List of usage examples for com.jgoodies.forms.layout CellConstraints xywh
public CellConstraints xywh(int col, int row, int colSpan, int rowSpan)
Examples:
cc.xywh(1, 3, 2, 1); cc.xywh(1, 3, 7, 3);
From source file:ca.phon.app.query.EditQueryPanel.java
License:Open Source License
private void init() { final FormLayout layout = new FormLayout("right:pref, 3dlu, fill:pref:grow", "pref, 3dlu, pref, 3dlu, pref, 3dlu, pref, fill:pref:grow"); final CellConstraints cc = new CellConstraints(); setLayout(layout);//from w w w . java2 s . c o m starBox = new StarBox(IconSize.SMALL); starBox.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { if (getQuery() != null) { getQuery().setStarred(starBox.isSelected()); } } }); queryNameField = new JTextField(); queryNameField.selectAll(); queryNameField.requestFocusInWindow(); queryNameField.getDocument().addDocumentListener(new DocumentListener() { @Override public void removeUpdate(DocumentEvent e) { updateName(); } @Override public void insertUpdate(DocumentEvent e) { updateName(); } @Override public void changedUpdate(DocumentEvent e) { } private void updateName() { if (getQuery() != null) getQuery().setName(queryNameField.getText()); } }); queryCommentsArea = new JTextArea(); queryCommentsArea.setRows(5); queryCommentsArea.getDocument().addDocumentListener(new DocumentListener() { @Override public void removeUpdate(DocumentEvent e) { updateComments(); } @Override public void insertUpdate(DocumentEvent e) { updateComments(); } @Override public void changedUpdate(DocumentEvent e) { } private void updateComments() { if (getQuery() != null) getQuery().setComments(queryCommentsArea.getText()); } }); uuidLabel = new JLabel(); dateLabel = new JLabel(); add(starBox, cc.xy(1, 1)); add(queryNameField, cc.xy(3, 1)); add(new JLabel("UUID:"), cc.xy(1, 3)); add(uuidLabel, cc.xy(3, 3)); add(new JLabel("Date:"), cc.xy(1, 5)); add(dateLabel, cc.xy(3, 5)); add(new JLabel("Comments:"), cc.xy(1, 7)); add(new JScrollPane(queryCommentsArea), cc.xywh(3, 7, 1, 2)); }
From source file:ca.phon.app.query.QueryInfoPanel.java
License:Open Source License
private void init() { setLayout(new BorderLayout()); starBox = new StarBox(IconSize.SMALL); starBox.addActionListener(new ActionListener() { @Override//ww w .ja v a 2s . c o m public void actionPerformed(ActionEvent e) { toggleStarred(); } }); // query name nameLabel = new JXLabel(); Font nameFont = nameLabel.getFont().deriveFont(Font.BOLD, 14.0f); nameLabel.setFont(nameFont); final ImageIcon searchIcon = IconManager.getInstance().getIcon("actions/system-search", IconSize.SMALL); final PhonUIAction openAction = new PhonUIAction(this, "onOpenQuery"); openAction.putValue(PhonUIAction.NAME, "Open Query"); openAction.putValue(PhonUIAction.SMALL_ICON, searchIcon); openAction.putValue(PhonUIAction.SHORT_DESCRIPTION, "Open query in editor"); openButton = new JButton(openAction); nameField = new JTextField(); nameField.setFont(nameFont); uuidLabel = new JLabel(); dateLabel = new JLabel(); commentsArea = new JTextArea(); commentsArea.setRows(5); commentsArea.setLineWrap(true); commentsArea.setEditable(false); commentsArea.setFont(Font.getFont("dialog")); final JScrollPane commentsLabelScroller = new JScrollPane(commentsArea); // layout form components final FormLayout layout = new FormLayout("right:pref, 3dlu, fill:pref:grow, right:pref", "pref, 3dlu, pref, 3dlu, pref, 3dlu, top:pref, fill:pref:grow"); final CellConstraints cc = new CellConstraints(); infoSection = new JPanel(layout); infoSection.setBorder(BorderFactory.createTitledBorder("Information")); infoSection.add(starBox, cc.xy(1, 1)); infoSection.add(nameLabel, cc.xy(3, 1)); infoSection.add(openButton, cc.xy(4, 1)); infoSection.add(new JLabel("UUID:"), cc.xy(1, 3)); infoSection.add(uuidLabel, cc.xyw(3, 3, 2)); infoSection.add(new JLabel("Date:"), cc.xy(1, 5)); infoSection.add(dateLabel, cc.xyw(3, 5, 2)); infoSection.add(new JLabel("Comments:"), cc.xy(1, 7)); infoSection.add(commentsLabelScroller, cc.xywh(3, 7, 2, 2)); resultsModel = new ResultSetTableModel(project, null); resultsModel.addPropertyChangeListener(bgTaskPropertyListener); resultsTable = new JXTable(resultsModel); resultsTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); resultsTable.addMouseListener(resultsMouseListener); resultsRowSorter = new TableRowSorter<ResultSetTableModel>(resultsModel); resultsRowSorter.setSortsOnUpdates(true); final RowSorter.SortKey sortKey = new RowSorter.SortKey(ResultSetTableModel.Columns.ID.ordinal(), SortOrder.ASCENDING); resultsRowSorter.setSortKeys(Collections.singletonList(sortKey)); resultsTable.setRowSorter(resultsRowSorter); resultsTable.setColumnControlVisible(true); resultsTable.addHighlighter(HighlighterFactory.createSimpleStriping()); resultsTable.setVisibleRowCount(10); // remove selection column resultsTable.getColumnModel().removeColumn(resultsTable.getColumn(0)); JScrollPane resultsScroller = new JScrollPane(resultsTable); final ImageIcon reportIcon = IconManager.getInstance().getIcon("mimetypes/x-office-spreadsheet", IconSize.SMALL); final PhonUIAction reportAction = new PhonUIAction(this, "onReport"); reportAction.putValue(PhonUIAction.NAME, "Report"); reportAction.putValue(PhonUIAction.SHORT_DESCRIPTION, "Create report"); reportAction.putValue(PhonUIAction.SMALL_ICON, reportIcon); reportButton = new JButton(reportAction); busyLabel = new JXBusyLabel(new Dimension(16, 16)); busyLabel.setBusy(false); hideResultsBox = new JCheckBox("Hide empty result sets"); hideResultsBox.setSelected(false); hideResultsBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { toggleRowFilter(); } }); // system preference openEditorBox = new JCheckBox("Open session with result set"); openEditorBox.setSelected(true); resultsSection = new JPanel(new BorderLayout()); resultsSection.setBorder(BorderFactory.createTitledBorder("Results")); final FormLayout topLayout = new FormLayout("pref, left:pref, left:pref, fill:pref:grow, right:pref", "pref"); final JPanel topResultsPanel = new JPanel(); topResultsPanel.setLayout(topLayout); topResultsPanel.add(busyLabel, cc.xy(1, 1)); topResultsPanel.add(hideResultsBox, cc.xy(2, 1)); topResultsPanel.add(openEditorBox, cc.xy(3, 1)); topResultsPanel.add(reportButton, cc.xy(5, 1)); resultsSection.add(topResultsPanel, BorderLayout.NORTH); resultsSection.add(resultsScroller, BorderLayout.CENTER); openButton.setEnabled(false); reportButton.setEnabled(false); add(infoSection, BorderLayout.NORTH); add(resultsSection, BorderLayout.CENTER); }
From source file:ca.phon.app.query.report.ResultListingSectionPanel.java
License:Open Source License
private void init() { // get absolute locations of icons String addImgRelPath = "data" + File.separator + "icons" + File.separator + "16x16" + File.separator + "actions" + File.separator + "list-add.png"; File addImgFile = new File(addImgRelPath); String addImgURI = addImgFile.toURI().toASCIIString(); String removeImgRelPath = "data" + File.separator + "icons" + File.separator + "16x16" + File.separator + "actions" + File.separator + "list-remove.png"; File remImgFile = new File(removeImgRelPath); String remImgURI = remImgFile.toURI().toASCIIString(); String infoTxt = INFO_TEXT.replaceAll("\\$\\{field_add_img\\}", addImgURI) .replaceAll("\\$\\{field_remove_img\\}", remImgURI); super.setInformationText(getClass().getName() + ".info", infoTxt); // list panel FormLayout listLayout = new FormLayout("fill:pref:grow, pref", "pref, fill:pref:grow"); JPanel listPanel = new JPanel(listLayout); CellConstraints cc = new CellConstraints(); ResultListing resList = getSection(); fieldList = new JXList(resList.getField().toArray(new ResultListingField[0])); fieldList.setCellRenderer(new FieldListCellRenderer()); fieldList.addListSelectionListener(new FieldListSelectionListener()); fieldList.setMinimumSize(new Dimension(200, 0)); ActionMap fieldActionMap = fieldList.getActionMap(); InputMap fieldInputMap = fieldList.getInputMap(JComponent.WHEN_FOCUSED); PhonUIAction showListAction = new PhonUIAction(this, "onShowPopup"); ImageIcon addIcn = IconManager.getInstance().getIcon("actions/list-add", IconSize.XSMALL); showListAction.putValue(PhonUIAction.SMALL_ICON, addIcn); showListAction.putValue(PhonUIAction.SHORT_DESCRIPTION, "Add field..."); addFieldButton = new JButton(showListAction); PhonUIAction removeFieldAction = new PhonUIAction(this, "onDelField"); ImageIcon delIcn = IconManager.getInstance().getIcon("actions/list-remove", IconSize.XSMALL); removeFieldAction.putValue(PhonUIAction.SMALL_ICON, delIcn); removeFieldAction.putValue(PhonUIAction.SHORT_DESCRIPTION, "Remove selected field"); delFieldButton = new JButton(removeFieldAction); String delActID = "_remove_field_"; fieldActionMap.put(delActID, removeFieldAction); KeyStroke delKs1 = KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0); KeyStroke delKs2 = KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0); fieldInputMap.put(delKs1, delActID); fieldInputMap.put(delKs2, delActID); PhonUIAction moveFieldUpAction = new PhonUIAction(this, "onMoveFieldUp"); ImageIcon upIcn = IconManager.getInstance().getIcon("actions/go-up", IconSize.XSMALL); moveFieldUpAction.putValue(PhonUIAction.SMALL_ICON, upIcn); moveFieldUpAction.putValue(PhonUIAction.SHORT_DESCRIPTION, "Move selected field up"); upFieldButton = new JButton(moveFieldUpAction); PhonUIAction moveFieldDownAction = new PhonUIAction(this, "onMoveFieldDown"); ImageIcon downIcn = IconManager.getInstance().getIcon("actions/go-down", IconSize.XSMALL); moveFieldDownAction.putValue(PhonUIAction.SMALL_ICON, downIcn); moveFieldDownAction.putValue(PhonUIAction.SHORT_DESCRIPTION, "Move selected field down"); downFieldButton = new JButton(moveFieldDownAction); FormLayout topBtnLayout = new FormLayout( "fill:pref:grow, right:pref, right:pref, " + (upFieldButton.getPreferredSize().width) + "px", "pref"); JPanel topBtnPanel = new JPanel(topBtnLayout); FormLayout sideBtnLayout = new FormLayout("pref", "pref, 3dlu, pref, fill:pref:grow"); JPanel sideBtnPanel = new JPanel(sideBtnLayout); JScrollPane listScroller = new JScrollPane(fieldList); topBtnPanel.add(addFieldButton, cc.xy(2, 1)); topBtnPanel.add(delFieldButton, cc.xy(3, 1)); sideBtnPanel.add(upFieldButton, cc.xy(1, 1)); sideBtnPanel.add(downFieldButton, cc.xy(1, 3)); listPanel.add(topBtnPanel, cc.xyw(1, 1, 2)); listPanel.add(sideBtnPanel, cc.xywh(2, 2, 1, 1)); listPanel.add(listScroller, cc.xy(1, 2)); // field form fieldOptionsPanel = new JPanel(new BorderLayout()); fieldOptionsPanel.setBorder(BorderFactory.createTitledBorder("Options")); namePanel = new JPanel(new FormLayout("left:pref, 3dlu, fill:pref:grow", "pref")); nameField = new JTextField(); nameField.getDocument().addDocumentListener(new NameFieldListener()); namePanel.add(new JLabel("Field name:"), cc.xy(1, 1)); namePanel.add(nameField, cc.xy(3, 1)); fieldOptionsPanel.add(namePanel, BorderLayout.NORTH); // format selection tableOptBox = new JRadioButton("Table"); listOptBox = new JRadioButton("List"); ButtonGroup btnGroup = new ButtonGroup(); FormatHandler formatHandler = new FormatHandler(); tableOptBox.setSelected(resList.getFormat() == ResultListingFormatType.TABLE); tableOptBox.addActionListener(formatHandler); listOptBox.setSelected(!tableOptBox.isSelected()); listOptBox.addActionListener(formatHandler); includeExcludedBox = new JCheckBox("Include excluded results"); includeExcludedBox.setSelected(getSection().isIncludeExcluded()); includeExcludedBox.addActionListener(new ActionListener() { @Override/*from w w w. j a va 2s. c o m*/ public void actionPerformed(ActionEvent arg0) { getSection().setIncludeExcluded(includeExcludedBox.isSelected()); } }); btnGroup.add(tableOptBox); btnGroup.add(listOptBox); FormLayout splitLayout = new FormLayout("200px:nogrow, fill:default:grow", "fill:default:grow"); fieldPanel = new JPanel(splitLayout); fieldPanel.add(listPanel, cc.xy(1, 1)); fieldPanel.add(fieldOptionsPanel, cc.xy(2, 1)); fieldPanel.setBorder(BorderFactory.createTitledBorder("Field Outline")); JPanel formatPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); formatPanel.add(new JLabel("Display data as:")); formatPanel.add(tableOptBox); formatPanel.add(listOptBox); formatPanel.add(includeExcludedBox); formatPanel.setBorder(BorderFactory.createTitledBorder("Options")); JPanel cPanel = new JPanel(new BorderLayout()); cPanel.add(formatPanel, BorderLayout.NORTH); cPanel.add(fieldPanel, BorderLayout.CENTER); add(cPanel, BorderLayout.CENTER); nameField.setEnabled(false); }
From source file:ca.phon.app.session.editor.view.session_information.SessionInfoEditorView.java
License:Open Source License
private void init() { setLayout(new BorderLayout()); contentPanel = new TierDataLayoutPanel(); dateField = createDateField();// ww w . j a va 2 s .c o m dateField.getTextField().setColumns(10); dateField.setBackground(Color.white); mediaLocationField = new MediaSelectionField(getEditor().getProject()); mediaLocationField.setEditor(getEditor()); mediaLocationField.getTextField().setColumns(10); mediaLocationField.addPropertyChangeListener(FileSelectionField.FILE_PROP, mediaLocationListener); participantTable = new JXTable(); participantTable.setVisibleRowCount(3); ComponentInputMap participantTableInputMap = new ComponentInputMap(participantTable); ActionMap participantTableActionMap = new ActionMap(); ImageIcon deleteIcon = IconManager.getInstance().getIcon("actions/delete_user", IconSize.SMALL); final PhonUIAction deleteAction = new PhonUIAction(this, "deleteParticipant"); deleteAction.putValue(PhonUIAction.SHORT_DESCRIPTION, "Delete selected participant"); deleteAction.putValue(PhonUIAction.SMALL_ICON, deleteIcon); participantTableActionMap.put("DELETE_PARTICIPANT", deleteAction); participantTableInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "DELETE_PARTICIPANT"); participantTableInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0), "DELETE_PARTICIPANT"); removeParticipantButton = new JButton(deleteAction); participantTable.setInputMap(WHEN_FOCUSED, participantTableInputMap); participantTable.setActionMap(participantTableActionMap); addParticipantButton = new JButton(new NewParticipantAction(getEditor(), this)); addParticipantButton.setFocusable(false); ImageIcon editIcon = IconManager.getInstance().getIcon("actions/edit_user", IconSize.SMALL); final PhonUIAction editParticipantAct = new PhonUIAction(this, "editParticipant"); editParticipantAct.putValue(PhonUIAction.NAME, "Edit participant..."); editParticipantAct.putValue(PhonUIAction.SHORT_DESCRIPTION, "Edit selected participant..."); editParticipantAct.putValue(PhonUIAction.SMALL_ICON, editIcon); editParticipantButton = new JButton(editParticipantAct); editParticipantButton.setFocusable(false); final CellConstraints cc = new CellConstraints(); FormLayout participantLayout = new FormLayout("fill:pref:grow, pref, pref, pref", "pref, pref, pref:grow"); JPanel participantPanel = new JPanel(participantLayout); participantPanel.setBackground(Color.white); participantPanel.add(new JScrollPane(participantTable), cc.xywh(1, 2, 3, 2)); participantPanel.add(addParticipantButton, cc.xy(2, 1)); participantPanel.add(editParticipantButton, cc.xy(3, 1)); participantPanel.add(removeParticipantButton, cc.xy(4, 2)); participantTable.addMouseListener(new MouseInputAdapter() { @Override public void mouseClicked(MouseEvent arg0) { if (arg0.getClickCount() == 2 && arg0.getButton() == MouseEvent.BUTTON1) { editParticipantAct.actionPerformed(new ActionEvent(arg0.getSource(), arg0.getID(), "edit")); } } }); languageField = new LanguageField(); languageField.getDocument().addDocumentListener(languageFieldListener); int rowIdx = 0; final JLabel dateLbl = new JLabel("Session Date"); dateLbl.setHorizontalAlignment(SwingConstants.RIGHT); contentPanel.add(dateLbl, new TierDataConstraint(TierDataConstraint.TIER_LABEL_COLUMN, rowIdx)); contentPanel.add(dateField, new TierDataConstraint(TierDataConstraint.FLAT_TIER_COLUMN, rowIdx++)); final JLabel mediaLbl = new JLabel("Media"); mediaLbl.setHorizontalAlignment(SwingConstants.RIGHT); contentPanel.add(mediaLbl, new TierDataConstraint(TierDataConstraint.TIER_LABEL_COLUMN, rowIdx)); contentPanel.add(mediaLocationField, new TierDataConstraint(TierDataConstraint.FLAT_TIER_COLUMN, rowIdx++)); final JLabel partLbl = new JLabel("Participants"); partLbl.setHorizontalAlignment(SwingConstants.RIGHT); contentPanel.add(partLbl, new TierDataConstraint(TierDataConstraint.TIER_LABEL_COLUMN, rowIdx)); contentPanel.add(participantPanel, new TierDataConstraint(TierDataConstraint.FLAT_TIER_COLUMN, rowIdx++)); final JLabel langLbl = new JLabel("Language"); langLbl.setHorizontalAlignment(SwingConstants.RIGHT); contentPanel.add(langLbl, new TierDataConstraint(TierDataConstraint.TIER_LABEL_COLUMN, rowIdx)); contentPanel.add(languageField, new TierDataConstraint(TierDataConstraint.FLAT_TIER_COLUMN, rowIdx++)); add(new JScrollPane(contentPanel), BorderLayout.CENTER); update(); }
From source file:ca.phon.app.session.editor.view.tier_management.TierOrderingEditorView.java
License:Open Source License
private void init() { final SessionEditor sessionEditor = getEditor(); final Session session = sessionEditor.getSession(); final TierOrderingTableModel tableModel = new TierOrderingTableModel(session, getCurrentOrder()) { private static final long serialVersionUID = 1L; @Override//from w w w.ja v a2s . c o m public void setValueAt(Object aValue, int rowIndex, int columnIndex) { super.setValueAt(aValue, rowIndex, columnIndex); if (columnIndex == TierOrderingTableModel.TierOrderingTableColumn.SHOW_TIER.ordinal()) { toggleTierVisible(rowIndex); } else if (columnIndex == TierOrderingTableModel.TierOrderingTableColumn.LOCK_TIER.ordinal()) { toggleTierLocked(rowIndex); } } }; tierOrderingTable = new JXTable(tableModel); // tierOrderingTable = new JXTable(new TierOrderingTableModel(getModel().getSession(), tierOrder)); tierOrderingTable.setSortable(false); tierOrderingTable.setVisibleRowCount(5); tierOrderingTable.addMouseListener(new TierContextMenuListener()); tierOrderingTable.getColumn(TierOrderingTableModel.TierOrderingTableColumn.GROUP_TIER.ordinal()) .setCellRenderer(new DefaultTableCellRenderer() { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JLabel retVal = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); Boolean val = (Boolean) value; if (val) retVal.setText("Yes"); else retVal.setText("No"); return retVal; } }); // setup tier odering table action map ActionMap tierOrderActionMap = new ActionMap(); ComponentInputMap tableInputMap = new ComponentInputMap(tierOrderingTable); final PhonUIAction deleteAction = new PhonUIAction(this, "onDeleteTier"); deleteAction.putValue(PhonUIAction.SHORT_DESCRIPTION, "Delete the currently selected tier."); deleteAction.putValue(PhonUIAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0)); tierOrderActionMap.put("DELETE_TIER", deleteAction); tableInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "DELETE_TIER"); tableInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0), "DELETE_TIER"); tierOrderingTable.setActionMap(tierOrderActionMap); tierOrderingTable.setInputMap(WHEN_FOCUSED, tableInputMap); final NewTierAction addAction = new NewTierAction(getEditor(), this); newTierButton = new JButton(addAction); newTierButton.setFocusable(false); final ImageIcon removeIcon = IconManager.getInstance().getIcon("actions/list-remove", IconSize.XSMALL); deleteAction.putValue(PhonUIAction.SMALL_ICON, removeIcon); deleteTierButton = new JButton(deleteAction); deleteTierButton.setFocusable(false); final ImageIcon upIcon = IconManager.getInstance().getIcon("actions/go-up", IconSize.SMALL); final PhonUIAction upAction = new PhonUIAction(this, "moveUp"); upAction.putValue(PhonUIAction.SHORT_DESCRIPTION, "Move tier up"); upAction.putValue(PhonUIAction.SMALL_ICON, upIcon); moveUpButton = new JButton(upAction); moveUpButton.setFocusable(false); final ImageIcon downIcon = IconManager.getInstance().getIcon("actions/go-down", IconSize.SMALL); final PhonUIAction downAction = new PhonUIAction(this, "moveDown"); downAction.putValue(PhonUIAction.SHORT_DESCRIPTION, "Move tier down"); downAction.putValue(PhonUIAction.SMALL_ICON, downIcon); moveDownButton = new JButton(downAction); moveDownButton.setFocusable(false); final ImageIcon fontIcon = IconManager.getInstance().getIcon("actions/edit", IconSize.SMALL); final PhonUIAction fontAction = new PhonUIAction(this, "onEditTier"); fontAction.putValue(PhonUIAction.NAME, "Edit tier..."); fontAction.putValue(PhonUIAction.SHORT_DESCRIPTION, "Edit tier..."); fontAction.putValue(PhonUIAction.SMALL_ICON, fontIcon); editButton = new JButton(fontAction); editButton.setFocusable(false); final ToggleLockAllTiersAction lockAllAction = new ToggleLockAllTiersAction(getEditor(), this); final JButton lockAllButton = new JButton(lockAllAction); final ToggleHideAllTiersAction hideAllAction = new ToggleHideAllTiersAction(getEditor(), this); final JButton hideAllButton = new JButton(hideAllAction); FormLayout layout = new FormLayout("pref, pref, fill:pref:grow, pref, pref, pref", "pref, pref, pref, pref, fill:pref:grow"); CellConstraints cc = new CellConstraints(); setLayout(layout); add(new JScrollPane(tierOrderingTable), cc.xywh(1, 2, 5, 4)); add(moveUpButton, cc.xy(6, 2)); add(moveDownButton, cc.xy(6, 3)); add(editButton, cc.xy(5, 1)); add(newTierButton, cc.xy(4, 1)); add(lockAllButton, cc.xy(1, 1)); add(hideAllButton, cc.xy(2, 1)); }
From source file:ca.phon.app.workspace.ProjectButton.java
License:Open Source License
private void refreshComponents() { String colLayout = "fill:pref:grow"; for (int i = 0; i < buttonActions.size(); i++) { colLayout += ", pref" + (i == buttonActions.size() - 1 ? "" : ", 2dlu"); }/*from w w w . j a v a2s.c om*/ String rowLayout = "top:pref, pref"; setLayout(new FormLayout(colLayout, rowLayout)); CellConstraints cc = new CellConstraints(); updateLabels(); add(projPathLabel, cc.xy(1, 1)); add(projDetailsLabel, cc.xy(1, 2)); int colIdx = 2; for (Action act : buttonActions) { add(getActionButton(act), cc.xywh(colIdx++, 1, 1, 1)); colIdx++; } }
From source file:ca.phon.csv2phon.wizard.ParticipantsStep.java
License:Open Source License
private void init() { setLayout(new BorderLayout()); header = new DialogHeader("CSV Import", "Set up participants."); add(header, BorderLayout.NORTH); FormLayout participantLayout = new FormLayout("fill:pref:grow, 1dlu, pref", "pref, 3dlu, pref, 3dlu, pref, fill:pref:grow"); CellConstraints cc = new CellConstraints(); JPanel participantPanel = new JPanel(participantLayout); participantPanel.setBorder(BorderFactory.createTitledBorder("Participants")); JLabel infoLabel = new JLabel( "<html><body><p>(Optional) Set up participants which will be added to each imported session.</p></body></html>"); participantTable = new JXTable(); ImageIcon addIcon = IconManager.getInstance().getIcon("actions/list-add", IconSize.XSMALL); addParticipantButton = new JButton(addIcon); addParticipantButton.setFocusable(false); addParticipantButton.setToolTipText("Add participant"); addParticipantButton.addActionListener(new ActionListener() { @Override//from w w w . j a va 2 s . co m public void actionPerformed(ActionEvent e) { newParticipant(); } }); ImageIcon editIcon = IconManager.getInstance().getIcon("actions/edit", IconSize.XSMALL); editParticipantButton = new JButton(editIcon); editParticipantButton.setFocusable(false); editParticipantButton.setToolTipText("Edit participant"); editParticipantButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { editParticipant(); } }); Action deleteParticipantAction = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { deleteParticipant(); } }; ActionMap participantActionMap = participantTable.getActionMap(); participantActionMap.put("DELETE_PARTICIPANT", deleteParticipantAction); InputMap participantInputMap = participantTable.getInputMap(); participantInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0), "DELETE_PARTICIPANT"); participantInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "DELETE_PARTICIPANT"); participantTable.setActionMap(participantActionMap); participantTable.setInputMap(JComponent.WHEN_FOCUSED, participantInputMap); participantPanel.add(infoLabel, cc.xy(1, 1)); participantPanel.add(new JScrollPane(participantTable), cc.xywh(1, 3, 1, 4)); participantPanel.add(addParticipantButton, cc.xy(3, 3)); participantPanel.add(editParticipantButton, cc.xy(3, 5)); add(participantPanel, BorderLayout.CENTER); }
From source file:ca.phon.phon2csv.wizard.CSVColumnsStep.java
License:Open Source License
private void init() { setLayout(new BorderLayout()); JPanel centerPanel = new JPanel(); FormLayout centerLayout = new FormLayout("250px, fill:pref:grow, pref", "pref, pref, pref, pref, fill:pref:grow, pref"); CellConstraints cc = new CellConstraints(); centerPanel.setLayout(centerLayout); docPane = new JTextPane(); docPane.setEditorKit(new HTMLEditorKit()); docPane.setText(columnDocString);//from w ww. j av a 2 s . co m centerPanel.add(new JScrollPane(docPane), cc.xywh(1, 1, 1, 6)); reportColumnModel = new DefaultListModel(); for (CSVExportColumn rc : getInitialColumnList()) reportColumnModel.addElement(rc); columnList = new JXList(reportColumnModel); columnList.setCellRenderer(new ReportColumnCellRenderer()); centerPanel.add(new JScrollPane(columnList), cc.xywh(2, 2, 1, 5)); columnEntryField = new JTextField(); columnEntryField.addActionListener(addColumnListener); centerPanel.add(columnEntryField, cc.xy(2, 1)); ImageIcon addIcon = IconManager.getInstance().getIcon("actions/list-add", IconSize.SMALL); ImageIcon removeIcon = IconManager.getInstance().getIcon("actions/list-remove", IconSize.SMALL); ImageIcon upIcon = IconManager.getInstance().getIcon("actions/go-up", IconSize.SMALL); ImageIcon downIcon = IconManager.getInstance().getIcon("actions/go-down", IconSize.SMALL); ImageIcon resetIcon = IconManager.getInstance().getIcon("actions/reload", IconSize.SMALL); addColumnBtn = new JButton(addIcon); addColumnBtn.setToolTipText("Add column"); addColumnBtn.addActionListener(addColumnListener); centerPanel.add(addColumnBtn, cc.xy(3, 1)); upColumnBtn = new JButton(upIcon); upColumnBtn.setToolTipText("Move column up"); upColumnBtn.addActionListener(upColumnListener); centerPanel.add(upColumnBtn, cc.xy(3, 3)); downColumnBtn = new JButton(downIcon); downColumnBtn.setToolTipText("Move column down"); downColumnBtn.addActionListener(downColumnListener); centerPanel.add(downColumnBtn, cc.xy(3, 4)); removeColumnBtn = new JButton(removeIcon); removeColumnBtn.setToolTipText("Remove column"); removeColumnBtn.addActionListener(deleteColumnListener); centerPanel.add(removeColumnBtn, cc.xy(3, 2)); resetDefaultBtn = new JButton(resetIcon); resetDefaultBtn.setToolTipText("Reset to default"); resetDefaultBtn.addActionListener(resetColumnsListener); centerPanel.add(resetDefaultBtn, cc.xy(3, 6)); header = new DialogHeader("Set up Columns", "Set up columns for csv export"); add(header, BorderLayout.NORTH); add(centerPanel, BorderLayout.CENTER); }
From source file:ca.sqlpower.architect.swingui.enterprise.ServerProjectsManagerPanel.java
License:Open Source License
public ServerProjectsManagerPanel(SPServerInfo serverInfo, ArchitectSwingSession session, ArchitectSessionContext context, Component dialogOwner, Action closeAction) { this.serverInfo = serverInfo; this.dialogOwner = dialogOwner; this.session = session; this.context = context; this.closeAction = closeAction; ArchitectClientSideSession.getCookieStore().clear(); DefaultFormBuilder builder = new DefaultFormBuilder( new FormLayout("pref:grow, 5dlu, pref", "pref, pref, pref")); servers = null;//from www. j a va 2 s.c o m projects = new JList(new DefaultListModel()); projects.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { refreshPanel(); if (e.getClickCount() == 2 && SwingUtilities.isLeftMouseButton(e)) { openAction.actionPerformed(null); } } }); JScrollPane projectsPane = new JScrollPane(projects); projectsPane.setPreferredSize(new Dimension(250, 300)); JButton securityButton = new JButton(openSecurityManagerPanelAction); refreshInfoList(); CellConstraints cc = new CellConstraints(); builder.add(new JLabel(serverInfo.getName() + "'s projects:"), cc.xyw(1, 1, 2)); builder.nextLine(); builder.add(projectsPane, cc.xywh(1, 2, 1, 2)); DefaultFormBuilder buttonBarBuilder = new DefaultFormBuilder(new FormLayout("pref")); buttonBarBuilder.append(new JButton(refreshAction)); buttonBarBuilder.append(securityButton); buttonBarBuilder.append(new JButton(newAction)); buttonBarBuilder.append(new JButton(openAction)); buttonBarBuilder.append(new JButton(deleteAction)); buttonBarBuilder.append(new JButton(closeAction)); builder.add(buttonBarBuilder.getPanel(), cc.xy(3, 2)); builder.setDefaultDialogBorder(); panel = builder.getPanel(); }
From source file:ca.sqlpower.architect.swingui.enterprise.ServerProjectsManagerPanel.java
License:Open Source License
public ServerProjectsManagerPanel(ArchitectSwingSession session, ArchitectSessionContext context, Component dialogOwner, Action closeAction) { this.session = session; this.dialogOwner = dialogOwner; this.context = context; this.closeAction = closeAction; ArchitectClientSideSession.getCookieStore().clear(); DefaultFormBuilder builder = new DefaultFormBuilder( new FormLayout("pref:grow, 5dlu, pref:grow, 5dlu, pref", "pref, pref, pref")); servers = new JList(new DefaultListModel()); servers.addMouseListener(new MouseAdapter() { @Override//from ww w .j ava 2s. c o m public void mouseReleased(MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e)) { refreshInfoList(); } } }); DefaultListModel serversModel = (DefaultListModel) servers.getModel(); serversModel.removeAllElements(); if (context.getServerManager().getServers(false).size() > 0) { for (SPServerInfo serverInfo : context.getServerManager().getServers(false)) { serversModel.addElement(serverInfo); } } else { serversModel.addElement("No Servers"); servers.setEnabled(false); } projects = new JList(new DefaultListModel()); projects.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { refreshPanel(); if (e.getClickCount() == 2 && SwingUtilities.isLeftMouseButton(e)) { openAction.actionPerformed(null); } } }); JScrollPane projectsPane = new JScrollPane(projects); projectsPane.setPreferredSize(new Dimension(250, 300)); JScrollPane serverPane = new JScrollPane(servers); serverPane.setPreferredSize(new Dimension(250, 300)); JButton securityButton = new JButton(openSecurityManagerPanelAction); refreshInfoList(); CellConstraints cc = new CellConstraints(); builder.add(new JLabel("Servers:"), cc.xyw(1, 1, 2)); builder.add(new JLabel("Projects:"), cc.xyw(3, 1, 2)); builder.nextLine(); builder.add(serverPane, cc.xywh(1, 2, 1, 2)); builder.add(projectsPane, cc.xywh(3, 2, 1, 2)); DefaultFormBuilder buttonBarBuilder = new DefaultFormBuilder(new FormLayout("pref")); buttonBarBuilder.append(new JButton(refreshAction)); buttonBarBuilder.append(securityButton); buttonBarBuilder.append(new JButton(newAction)); buttonBarBuilder.append(new JButton(openAction)); buttonBarBuilder.append(new JButton(uploadAction)); buttonBarBuilder.append(new JButton(deleteAction)); buttonBarBuilder.append(new JButton(closeAction)); builder.add(buttonBarBuilder.getPanel(), cc.xy(5, 2)); builder.setDefaultDialogBorder(); panel = builder.getPanel(); }