List of usage examples for javax.swing ListSelectionModel isSelectionEmpty
boolean isSelectionEmpty();
From source file:gui.TwopointPWDPanel.java
private void processMarkerTableClick(ListSelectionEvent e) { // Reset the display areas while (phaseModel.getRowCount() > 0) { phaseModel.removeRow(0);//ww w .j a va 2 s.c o m } rfqChart.clearDataset(); lodChart.clearDataset(); // The selected marker... ListSelectionModel lsm = (ListSelectionModel) e.getSource(); CMarker selM = null; if (lsm.isSelectionEmpty() == false) { int selectedRow = lsm.getMinSelectionIndex(); selM = (CMarker) markerTable.getValueAt(selectedRow, 1); } if (selM != null) { // ...against all the other markers (in the correct order) if (AppFrame.tpmmode != AppFrame.TPMMODE_NONSNP) { order.freezeSafeNames(); } for (CMarker lnkM : order.getLinkageGroup().getMarkers()) { // Self against self -> add an empty row if (selM.marker == lnkM.marker) { phaseModel.addRow(new Object[] { "", selM, "", "" }); } else { int i = order.getLinkageGroup().getMarkerIndexBySafeName(selM.safeName); int j = order.getLinkageGroup().getMarkerIndexBySafeName(lnkM.safeName); int i2 = i, j2 = j; if (order.translateIndexes != null) { i2 = order.translatePPIndexes[i]; j2 = order.translatePPIndexes[j]; } if (order.getPhasePairArray()[i2][j2] != null) { appendMarker(lnkM, order.getPhasePairArray()[i2][j2]); } } } } m1Label.setText(""); m2Label.setText(""); }
From source file:gui.TwopointPWDPanelnonsnp.java
private void processMarkerTableClick(ListSelectionEvent e) { // Reset the display areas while (phaseModel.getRowCount() > 0) { phaseModel.removeRow(0);/*from w w w . ja va2 s.c o m*/ } rfqChart.clearDataset(); lodChart.clearDataset(); // The selected marker... ListSelectionModel lsm = (ListSelectionModel) e.getSource(); CMarker selM = null; if (lsm.isSelectionEmpty() == false) { int selectedRow = lsm.getMinSelectionIndex(); selM = (CMarker) markerTable.getValueAt(selectedRow, 1); } if (selM != null) { // ...against all the other markers (in the correct order) for (CMarker lnkM : order.getLinkageGroup().getMarkers()) { // Self against self -> add an empty row if (selM.marker == lnkM.marker) { phaseModel.addRow(new Object[] { "", selM, "", "" }); } else { int i = selM.getSafeNameSuffix() - 1; int j = lnkM.getSafeNameSuffix() - 1; /* changed getIndex() to getSafeNameSuffix()-1 */ appendMarker(lnkM, order.getPhasePairArray()[i][j]); } } } m1Label.setText(""); m2Label.setText(""); }
From source file:com.dbschools.quickquiz.client.giver.MainWindow.java
private void addListeners() { takerTableDisplay.addTableKeyListener(new KeyAdapter() { @Override// w w w.j a v a 2 s . co m public void keyPressed(KeyEvent e) { char keyChar = e.getKeyChar(); if (Character.isDigit(keyChar) && e.isControlDown()) { awardPoints(Integer.parseInt(Character.toString(keyChar))); } } }); final ListSelectionModel takerTableSelectionModel = takerTableDisplay.getSelectionModel(); takerTableSelectionModel.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { btnAwardPoints.setEnabled(!takerTableSelectionModel.isSelectionEmpty()); } }); countdownMeter.addCountdownFinishListener(new CountdownFinishListener() { public void countdownFinished() { SwingUtilities.invokeLater(new Runnable() { public void run() { btnSendQuestion.setEnabled(true); } }); } }); }
From source file:gda.gui.BatonPanel.java
/** * change the appearance of the give button depending if there is a selection or not {@inheritDoc} * /*from ww w . jav a 2s . c o m*/ * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent) */ @Override public void valueChanged(ListSelectionEvent e) { boolean enable = false; ListSelectionModel lsm = (ListSelectionModel) e.getSource(); if (!lsm.isSelectionEmpty() && btnRelease.isEnabled() && userClients.getModel().getRowCount() > 1) { int selectedRow = lsm.getMinSelectionIndex(); Integer selectedUser = (Integer) userClients.getValueAt(selectedRow, 0); enable = selectedUser != JythonServerFacade.getInstance().getClientID(); } final boolean fenable = enable; SwingUtilities.invokeLater(new Runnable() { @Override public void run() { btnGive.setEnabled(fenable); } }); }
From source file:com.aw.swing.mvp.binding.component.BndSJTable.java
/** * Register a selection listener to the JTable related to this class * * @param rowSelectionListener that will be called when the selection of the JTable changes *///from ww w . ja v a 2 s . c om public void registerRowSelectionListener(final RowSelectionListener rowSelectionListener) { ListSelectionModel rowSM = jTable.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel) e.getSource(); if (lsm.isSelectionEmpty()) { logger.debug("No rows are selected."); rowSelectionListener.onClearSelectedRow(); } else { int selectedRowIndex = lsm.getMinSelectionIndex(); logger.debug("Row " + selectedRowIndex + " is now selected."); Object selectedRow = getSelectedRow(); rowSelectionListener.onSelectedRow(selectedRowIndex, selectedRow); } } }); }
From source file:gdt.jgui.entity.query.JQueryPanel.java
/** * Get the context menu./*from w w w . ja va 2s . c o m*/ * @return the context menu. */ @Override public JMenu getContextMenu() { menu = new JMenu("Context"); menu.addMenuListener(new MenuListener() { @Override public void menuSelected(MenuEvent e) { menu.removeAll(); // System.out.println("BookmarksEditor:getConextMenu:menu selected"); JMenuItem selectItem = new JMenuItem("Select"); selectItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showHeader(); showContent(); } }); menu.add(selectItem); JMenuItem clearHeader = new JMenuItem("Clear all"); clearHeader.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { clearHeader(); showHeader(); showContent(); } }); menu.add(clearHeader); Entigrator entigrator = console.getEntigrator(entihome$); Sack query = entigrator.getEntityAtKey(entityKey$); if (query.getElementItem("parameter", "noreset") == null) { JMenuItem resetItem = new JMenuItem("Reset"); resetItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int response = JOptionPane.showConfirmDialog(console.getContentPanel(), "Reset source to default ?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (response == JOptionPane.YES_OPTION) reset(); } }); menu.add(resetItem); } JMenuItem folderItem = new JMenuItem("Open folder"); folderItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { File file = new File(entihome$ + "/" + entityKey$); Desktop.getDesktop().open(file); } catch (Exception ee) { Logger.getLogger(getClass().getName()).info(ee.toString()); } } }); menu.add(folderItem); menu.addSeparator(); JMenuItem addHeader = new JMenuItem("Add column"); addHeader.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { addHeader(); } }); menu.add(addHeader); JMenuItem removeColumn = new JMenuItem("Remove column "); removeColumn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { removeColumn(); } }); menu.add(removeColumn); ListSelectionModel lsm = table.getSelectionModel(); if (!lsm.isSelectionEmpty()) { JMenuItem excludeRows = new JMenuItem("Exclude rows "); excludeRows.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Entigrator entigrator = console.getEntigrator(entihome$); Sack query = entigrator.getEntityAtKey(entityKey$); if (!query.existsElement("exclude")) query.createElement("exclude"); //else // query.clearElement("exclude"); ListSelectionModel lsm = table.getSelectionModel(); int minIndex = lsm.getMinSelectionIndex(); int maxIndex = lsm.getMaxSelectionIndex(); for (int i = minIndex; i <= maxIndex; i++) { if (lsm.isSelectedIndex(i)) { System.out.println("JQueryPanel:exclude rows:label=" + table.getValueAt(i, 1)); query.putElementItem("exclude", new Core(null, (String) table.getValueAt(i, 1), null)); } } entigrator.save(query); showHeader(); showContent(); } }); menu.add(excludeRows); } } @Override public void menuDeselected(MenuEvent e) { } @Override public void menuCanceled(MenuEvent e) { } }); return menu; }
From source file:it.cnr.icar.eric.client.ui.swing.RegistryObjectsTable.java
/** * Class Constructor./*from w w w. j a v a2 s . co m*/ * * @param model * * @see */ public RegistryObjectsTable(TableModel model) { // Gives a TableColumnModel so that AutoCreateColumnsFromModel will be false. super(model, new DefaultTableColumnModel()); this.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); if (model instanceof RegistryObjectsTableModel) { tableModel = (RegistryObjectsTableModel) model; } else if (model instanceof TableSorter) { tableModel = (RegistryObjectsTableModel) (((TableSorter) model).getModel()); } else { Object[] unexpectedTableModelArgs = { model }; MessageFormat form = new MessageFormat(resourceBundle.getString("error.unexpectedTableModel")); throw new IllegalArgumentException(form.format(unexpectedTableModelArgs)); } setToolTipText(resourceBundle.getString("tip.registryObjectsTable")); setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); ListSelectionModel rowSM = getSelectionModel(); stdRowHeight = getRowHeight(); setRowHeight(stdRowHeight * 3); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { ListSelectionModel lsm = (ListSelectionModel) e.getSource(); if (!lsm.isSelectionEmpty()) { setSelectedRow(lsm.getMinSelectionIndex()); } else { setSelectedRow(-1); } } }); createPopup(); addRenderers(); // Add listener to self so that I can bring up popup menus on right mouse click popupListener = new PopupListener(); addMouseListener(popupListener); //add listener for 'authenticated' bound property RegistryBrowser.getInstance().addPropertyChangeListener(RegistryBrowser.PROPERTY_AUTHENTICATED, this); //add listener for 'locale' bound property RegistryBrowser.getInstance().addPropertyChangeListener(RegistryBrowser.PROPERTY_LOCALE, this); }
From source file:edu.ku.brc.af.ui.forms.TableViewObj.java
/** * Build the table now that we have all the information we need for the columns. *///from ww w .j a v a 2 s . co m protected void buildTable() { // Now Build the JTable model = new ColTableModel(); table = new JTable(model); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.setRowSelectionAllowed(true); table.setColumnSelectionAllowed(false); table.setFocusable(false); //table.setPreferredScrollableViewportSize(new Dimension(200,table.getRowHeight()*6)); configColumns(); //table.setCellSelectionEnabled(false); table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { ListSelectionModel lsm = (ListSelectionModel) e.getSource(); updateUI(!lsm.isSelectionEmpty()); } } }); table.addMouseListener(new java.awt.event.MouseAdapter() { @Override public void mouseClicked(java.awt.event.MouseEvent e) { if (e.getClickCount() == 2) { int index = table.getSelectedRow(); editRow(index, false); } } }); DefaultTableCellRenderer renderer = new DefaultTableCellRenderer(); renderer.setHorizontalAlignment(SwingConstants.CENTER); /* // This is BROKEN! table.setCellSelectionEnabled(true); for (int i=0;i<model.getColumnCount();i++) { TableColumn column = table.getColumn(model.getColumnName(i)); //log.info(model.getColumnName(i)); //column.setCellRenderer(renderer); ColumnInfo columnInfo = columnList.get(i); Component comp = columnInfo.getComp(); //column.setCellEditor(new DefaultCellEditor(new JTextField())); if (comp instanceof GetSetValueIFace) { column.setCellEditor(new MyTableCellEditor(columnInfo)); } else if (comp instanceof JTextField) { column.setCellEditor(new DefaultCellEditor((JTextField)comp)); } else { log.error("Couldn't figure out DefaultCellEditor for comp ["+comp.getClass().getSimpleName()+"]"); } } */ tableScroller = new JScrollPane(table, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); orderablePanel = new JPanel(new BorderLayout()); orderablePanel.add(tableScroller, BorderLayout.CENTER); mainComp.add(orderablePanel, BorderLayout.CENTER); initColumnSizes(table); }
From source file:op.care.nursingprocess.DlgNursingProcess.java
private void tblPlanungMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblPlanungMousePressed if (!SwingUtilities.isRightMouseButton(evt)) { return;//from w w w . j a v a 2 s . c o m } Point p = evt.getPoint(); ListSelectionModel lsm = tblPlanung.getSelectionModel(); int row = tblPlanung.rowAtPoint(p); if (lsm.isSelectionEmpty() || (lsm.getMinSelectionIndex() == lsm.getMaxSelectionIndex())) { lsm.setSelectionInterval(row, row); } menu = new JPopupMenu(); /*** * _ _ ____ ____ _ _ * (_) |_ ___ _ __ ___ | _ \ ___ _ __ _ _ _ __ | _ \ ___| | ___| |_ ___ * | | __/ _ \ '_ ` _ \| |_) / _ \| '_ \| | | | '_ \| | | |/ _ \ |/ _ \ __/ _ \ * | | || __/ | | | | | __/ (_) | |_) | |_| | |_) | |_| | __/ | __/ || __/ * |_|\__\___|_| |_| |_|_| \___/| .__/ \__,_| .__/|____/ \___|_|\___|\__\___| * |_| |_| */ JMenuItem itemPopupDelete = new JMenuItem(SYSTools.xx("misc.commands.delete"), SYSConst.icon22delete); itemPopupDelete.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { for (int row : tblPlanung.getSelectedRows()) { listInterventionSchedule2Remove .add(((TMPlan) tblPlanung.getModel()).getInterventionSchedule(row)); nursingProcess.getInterventionSchedule() .remove(((TMPlan) tblPlanung.getModel()).getInterventionSchedule(row)); } ((TMPlan) tblPlanung.getModel()).fireTableDataChanged(); } }); menu.add(itemPopupDelete); /*** * _ _ ____ ____ _ _ _ * (_) |_ ___ _ __ ___ | _ \ ___ _ __ _ _ _ __/ ___| ___| |__ ___ __| |_ _| | ___ * | | __/ _ \ '_ ` _ \| |_) / _ \| '_ \| | | | '_ \___ \ / __| '_ \ / _ \/ _` | | | | |/ _ \ * | | || __/ | | | | | __/ (_) | |_) | |_| | |_) |__) | (__| | | | __/ (_| | |_| | | __/ * |_|\__\___|_| |_| |_|_| \___/| .__/ \__,_| .__/____/ \___|_| |_|\___|\__,_|\__,_|_|\___| * |_| |_| */ final JMenuItem itemPopupSchedule = new JMenuItem(SYSTools.xx("misc.commands.editsheduling"), SYSConst.icon22clock); itemPopupSchedule.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { final JidePopup popup = new JidePopup(); /** * This routine uses the <b>first</b> element of the selection as the template for editing * the schedule. After the edit it clones this "template", removes the original * InterventionSchedules (copying the apropriate Intervention of every single * Schedule first) and finally creates new schedules and adds them to * the CareProcess in question. */ int row = tblPlanung.getSelectedRows()[0]; InterventionSchedule firstInterventionScheduleWillBeTemplate = ((TMPlan) tblPlanung.getModel()) .getInterventionSchedule(row); JPanel dlg = new PnlSchedule(firstInterventionScheduleWillBeTemplate, new Closure() { @Override public void execute(Object o) { if (o != null) { InterventionSchedule template = (InterventionSchedule) o; ArrayList<InterventionSchedule> listInterventionSchedule2Add = new ArrayList(); for (int row : tblPlanung.getSelectedRows()) { InterventionSchedule oldTermin = ((TMPlan) tblPlanung.getModel()) .getInterventionSchedule(row); InterventionSchedule newTermin = template.clone(); newTermin.setIntervention(oldTermin.getIntervention()); listInterventionSchedule2Remove.add(oldTermin); listInterventionSchedule2Add.add(newTermin); } nursingProcess.getInterventionSchedule().removeAll(listInterventionSchedule2Remove); nursingProcess.getInterventionSchedule().addAll(listInterventionSchedule2Add); popup.hidePopup(); Collections.sort(nursingProcess.getInterventionSchedule()); ((TMPlan) tblPlanung.getModel()).fireTableDataChanged(); } } }); popup.setMovable(false); popup.getContentPane().setLayout(new BoxLayout(popup.getContentPane(), BoxLayout.LINE_AXIS)); popup.getContentPane().add(dlg); popup.setOwner(jspPlanung); popup.removeExcludedComponent(jspPlanung); popup.setDefaultFocusComponent(dlg); GUITools.showPopup(popup, SwingConstants.SOUTH_WEST); } }); menu.add(itemPopupSchedule); menu.show(evt.getComponent(), (int) p.getX(), (int) p.getY()); }
From source file:org.freeplane.view.swing.features.time.mindmapmode.nodelist.NodeList.java
public void startup() { if (dialog != null) { dialog.toFront();//www .java 2 s . c om return; } NodeList.COLUMN_MODIFIED = TextUtils.getText(PLUGINS_TIME_LIST_XML_MODIFIED); NodeList.COLUMN_CREATED = TextUtils.getText(PLUGINS_TIME_LIST_XML_CREATED); NodeList.COLUMN_ICONS = TextUtils.getText(PLUGINS_TIME_LIST_XML_ICONS); NodeList.COLUMN_TEXT = TextUtils.getText(PLUGINS_TIME_LIST_XML_TEXT); NodeList.COLUMN_DETAILS = TextUtils.getText(PLUGINS_TIME_LIST_XML_DETAILS); NodeList.COLUMN_DATE = TextUtils.getText(PLUGINS_TIME_LIST_XML_DATE); NodeList.COLUMN_NOTES = TextUtils.getText(PLUGINS_TIME_LIST_XML_NOTES); dialog = new JDialog(Controller.getCurrentController().getViewController().getFrame(), modal /* modal */); String windowTitle; if (showAllNodes) { windowTitle = PLUGINS_TIME_MANAGEMENT_XML_WINDOW_TITLE_ALL_NODES; } else { windowTitle = PLUGINS_TIME_MANAGEMENT_XML_WINDOW_TITLE; } dialog.setTitle(TextUtils.getText(windowTitle)); dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); final WindowAdapter windowListener = new WindowAdapter() { @Override public void windowGainedFocus(WindowEvent e) { mFilterTextSearchField.getEditor().selectAll(); } @Override public void windowClosing(final WindowEvent event) { disposeDialog(); } }; dialog.addWindowListener(windowListener); dialog.addWindowFocusListener(windowListener); UITools.addEscapeActionToDialog(dialog, new AbstractAction() { /** * */ private static final long serialVersionUID = 1L; public void actionPerformed(final ActionEvent arg0) { disposeDialog(); } }); final Container contentPane = dialog.getContentPane(); final GridBagLayout gbl = new GridBagLayout(); contentPane.setLayout(gbl); final GridBagConstraints layoutConstraints = new GridBagConstraints(); layoutConstraints.gridx = 0; layoutConstraints.gridy = 0; layoutConstraints.gridwidth = 1; layoutConstraints.gridheight = 1; layoutConstraints.weightx = 0.0; layoutConstraints.weighty = 0.0; layoutConstraints.anchor = GridBagConstraints.WEST; layoutConstraints.fill = GridBagConstraints.HORIZONTAL; contentPane.add(new JLabel(TextUtils.getText(PLUGINS_TIME_MANAGEMENT_XML_FIND)), layoutConstraints); layoutConstraints.gridwidth = 1; layoutConstraints.gridx++; contentPane.add(Box.createHorizontalStrut(40), layoutConstraints); layoutConstraints.gridx++; contentPane.add(new JLabel(TextUtils.getText("filter_match_case")), layoutConstraints); layoutConstraints.gridx++; contentPane.add(matchCase, layoutConstraints); layoutConstraints.gridx++; contentPane.add(Box.createHorizontalStrut(40), layoutConstraints); layoutConstraints.gridx++; contentPane.add(new JLabel(TextUtils.getText("regular_expressions")), layoutConstraints); layoutConstraints.gridx++; contentPane.add(useRegexInFind, layoutConstraints); layoutConstraints.gridx = 0; layoutConstraints.weightx = 1.0; layoutConstraints.gridwidth = GridBagConstraints.REMAINDER; layoutConstraints.gridy++; contentPane.add(/* new JScrollPane */(mFilterTextSearchField), layoutConstraints); layoutConstraints.gridy++; layoutConstraints.weightx = 0.0; layoutConstraints.gridwidth = 1; contentPane.add(new JLabel(TextUtils.getText(PLUGINS_TIME_MANAGEMENT_XML_REPLACE)), layoutConstraints); layoutConstraints.gridx = 5; contentPane.add(new JLabel(TextUtils.getText("regular_expressions")), layoutConstraints); layoutConstraints.gridx++; contentPane.add(useRegexInReplace, layoutConstraints); layoutConstraints.gridx = 0; layoutConstraints.weightx = 1.0; layoutConstraints.gridwidth = GridBagConstraints.REMAINDER; layoutConstraints.gridy++; contentPane.add(/* new JScrollPane */(mFilterTextReplaceField), layoutConstraints); dateRenderer = new DateRenderer(); textRenderer = new TextRenderer(); iconsRenderer = new IconsRenderer(); tableView = new FlatNodeTable(); tableView.addKeyListener(new FlatNodeTableKeyListener()); tableView.addMouseListener(new FlatNodeTableMouseAdapter()); tableView.getTableHeader().setReorderingAllowed(false); tableModel = updateModel(); mFlatNodeTableFilterModel = new FlatNodeTableFilterModel(tableModel, new int[] { NodeList.NODE_TEXT_COLUMN, NodeList.NODE_DETAILS_COLUMN, NodeList.NODE_NOTES_COLUMN }); sorter = new TableSorter(mFlatNodeTableFilterModel); tableView.setModel(sorter); sorter.setTableHeader(tableView.getTableHeader()); sorter.setColumnComparator(Date.class, TableSorter.COMPARABLE_COMPARATOR); sorter.setColumnComparator(NodeModel.class, TableSorter.LEXICAL_COMPARATOR); sorter.setColumnComparator(IconsHolder.class, TableSorter.COMPARABLE_COMPARATOR); sorter.setSortingStatus(NodeList.DATE_COLUMN, TableSorter.ASCENDING); final JScrollPane pane = new JScrollPane(tableView); UITools.setScrollbarIncrement(pane); layoutConstraints.gridy++; GridBagConstraints tableConstraints = (GridBagConstraints) layoutConstraints.clone(); tableConstraints.weightx = 1; tableConstraints.weighty = 10; tableConstraints.fill = GridBagConstraints.BOTH; contentPane.add(pane, tableConstraints); mTreeLabel = new JLabel(); layoutConstraints.gridy++; GridBagConstraints treeConstraints = (GridBagConstraints) layoutConstraints.clone(); treeConstraints.fill = GridBagConstraints.BOTH; @SuppressWarnings("serial") JScrollPane scrollPane = new JScrollPane(mTreeLabel) { @Override public boolean isValidateRoot() { return false; } }; contentPane.add(scrollPane, treeConstraints); final AbstractAction exportAction = new AbstractAction( TextUtils.getText("plugins/TimeManagement.xml_Export")) { /** * */ private static final long serialVersionUID = 1L; public void actionPerformed(final ActionEvent arg0) { exportSelectedRowsAndClose(); } }; final JButton exportButton = new JButton(exportAction); final AbstractAction replaceAllAction = new AbstractAction( TextUtils.getText("plugins/TimeManagement.xml_Replace_All")) { /** * */ private static final long serialVersionUID = 1L; public void actionPerformed(final ActionEvent arg0) { replace(new HolderAccessor(false)); } }; final JButton replaceAllButton = new JButton(replaceAllAction); final AbstractAction replaceSelectedAction = new AbstractAction( TextUtils.getText("plugins/TimeManagement.xml_Replace_Selected")) { /** * */ private static final long serialVersionUID = 1L; public void actionPerformed(final ActionEvent arg0) { replace(new HolderAccessor(true)); } }; final JButton replaceSelectedButton = new JButton(replaceSelectedAction); final AbstractAction gotoAction = new AbstractAction(TextUtils.getText("plugins/TimeManagement.xml_Goto")) { /** * */ private static final long serialVersionUID = 1L; public void actionPerformed(final ActionEvent arg0) { selectSelectedRows(); } }; final JButton gotoButton = new JButton(gotoAction); final AbstractAction disposeAction = new AbstractAction( TextUtils.getText(PLUGINS_TIME_MANAGEMENT_XML_CLOSE)) { /** * */ private static final long serialVersionUID = 1L; public void actionPerformed(final ActionEvent arg0) { disposeDialog(); } }; final JButton cancelButton = new JButton(disposeAction); /* Initial State */ gotoAction.setEnabled(false); exportAction.setEnabled(false); replaceSelectedAction.setEnabled(false); final Box bar = Box.createHorizontalBox(); bar.add(Box.createHorizontalGlue()); bar.add(cancelButton); bar.add(exportButton); bar.add(replaceAllButton); bar.add(replaceSelectedButton); bar.add(gotoButton); bar.add(Box.createHorizontalGlue()); layoutConstraints.gridy++; contentPane.add(/* new JScrollPane */(bar), layoutConstraints); final JMenuBar menuBar = new JMenuBar(); final JMenu menu = new JMenu(TextUtils.getText("plugins/TimeManagement.xml_menu_actions")); final AbstractAction[] actionList = new AbstractAction[] { gotoAction, replaceSelectedAction, replaceAllAction, exportAction, disposeAction }; for (int i = 0; i < actionList.length; i++) { final AbstractAction action = actionList[i]; final JMenuItem item = menu.add(action); item.setIcon(new BlindIcon(UIBuilder.ICON_SIZE)); } menuBar.add(menu); dialog.setJMenuBar(menuBar); final ListSelectionModel rowSM = tableView.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(final ListSelectionEvent e) { if (e.getValueIsAdjusting()) { return; } final ListSelectionModel lsm = (ListSelectionModel) e.getSource(); final boolean enable = !(lsm.isSelectionEmpty()); replaceSelectedAction.setEnabled(enable); gotoAction.setEnabled(enable); exportAction.setEnabled(enable); } }); rowSM.addListSelectionListener(new ListSelectionListener() { String getNodeText(final NodeModel node) { return TextController.getController().getShortText(node) + ((node.isRoot()) ? "" : (" <- " + getNodeText(node.getParentNode()))); } public void valueChanged(final ListSelectionEvent e) { if (e.getValueIsAdjusting()) { return; } final ListSelectionModel lsm = (ListSelectionModel) e.getSource(); if (lsm.isSelectionEmpty()) { mTreeLabel.setText(""); return; } final int selectedRow = lsm.getLeadSelectionIndex(); final NodeModel mindMapNode = getMindMapNode(selectedRow); mTreeLabel.setText(getNodeText(mindMapNode)); } }); final String marshalled = ResourceController.getResourceController() .getProperty(NodeList.WINDOW_PREFERENCE_STORAGE_PROPERTY); final WindowConfigurationStorage result = TimeWindowConfigurationStorage.decorateDialog(marshalled, dialog); final WindowConfigurationStorage storage = result; if (storage != null) { tableView.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); int column = 0; for (final TimeWindowColumnSetting setting : ((TimeWindowConfigurationStorage) storage) .getListTimeWindowColumnSettingList()) { tableView.getColumnModel().getColumn(column).setPreferredWidth(setting.getColumnWidth()); sorter.setSortingStatus(column, setting.getColumnSorting()); column++; } } mFlatNodeTableFilterModel.setFilter((String) mFilterTextSearchField.getSelectedItem(), matchCase.isSelected(), useRegexInFind.isSelected()); dialog.setVisible(true); }