Example usage for javax.swing ListSelectionModel getLeadSelectionIndex

List of usage examples for javax.swing ListSelectionModel getLeadSelectionIndex

Introduction

In this page you can find the example usage for javax.swing ListSelectionModel getLeadSelectionIndex.

Prototype

int getLeadSelectionIndex();

Source Link

Document

Return the second index argument from the most recent call to setSelectionInterval(), addSelectionInterval() or removeSelectionInterval().

Usage

From source file:op.tools.DlgListSelector.java

private void btnApplyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnApplyActionPerformed
    ListModel lm = lstSelect.getModel();
    ListSelectionModel lsm = lstSelect.getSelectionModel();
    result = lm.getElementAt(lsm.getLeadSelectionIndex());
    dispose();//  w ww . j  a  va2s  .  c  o  m

}

From source file:org.freeplane.view.swing.features.time.mindmapmode.nodelist.NodeList.java

public void startup() {
    if (dialog != null) {
        dialog.toFront();/*ww w  .  ja  va  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);
}

From source file:org.freeplane.view.swing.features.time.mindmapmode.NodeList.java

public void startup() {
    if (dialog != null) {
        dialog.toFront();/*from  w  w  w  . ja  v a 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_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();
    nodeRenderer = new NodeRenderer();
    notesRenderer = new NotesRenderer();
    iconsRenderer = new IconsRenderer();
    timeTable = new FlatNodeTable();
    timeTable.addKeyListener(new FlatNodeTableKeyListener());
    timeTable.addMouseListener(new FlatNodeTableMouseAdapter());
    timeTable.getTableHeader().setReorderingAllowed(false);
    timeTableModel = updateModel();
    mFlatNodeTableFilterModel = new FlatNodeTableFilterModel(timeTableModel, NodeList.NODE_TEXT_COLUMN);
    sorter = new TableSorter(mFlatNodeTableFilterModel);
    timeTable.setModel(sorter);
    sorter.setTableHeader(timeTable.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(timeTable);
    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 ReplaceAllInfo());
        }
    };
    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 ReplaceSelectedInfo());
        }
    };
    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 = timeTable.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) {
        timeTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
        int column = 0;
        for (final TimeWindowColumnSetting setting : ((TimeWindowConfigurationStorage) storage)
                .getListTimeWindowColumnSettingList()) {
            timeTable.getColumnModel().getColumn(column).setPreferredWidth(setting.getColumnWidth());
            sorter.setSortingStatus(column, setting.getColumnSorting());
            column++;
        }
    }
    mFlatNodeTableFilterModel.setFilter((String) mFilterTextSearchField.getSelectedItem(),
            matchCase.isSelected(), useRegexInFind.isSelected());
    dialog.setVisible(true);
}

From source file:org.nuclos.client.ui.collect.result.ResultController.java

private ListSelectionListener newListSelectionListener(final JTable tblResult) {
    return new ListSelectionListener() {
        @Override// ww  w .j a  v  a  2s  .c  om
        public void valueChanged(ListSelectionEvent ev) {
            try {
                final ListSelectionModel lsm = (ListSelectionModel) ev.getSource();

                final CollectStateModel<?> clctstatemodel = clctctl.getCollectStateModel();
                if (clctstatemodel.getOuterState() == CollectState.OUTERSTATE_RESULT) {
                    final int iResultMode = CollectStateModel.getResultModeFromSelectionModel(lsm);
                    if (iResultMode != clctctl.getCollectStateModel().getResultMode()) {
                        clctctl.setCollectState(CollectState.OUTERSTATE_RESULT, iResultMode);
                    }
                }

                if (!ev.getValueIsAdjusting()) {
                    // Autoscroll selection. It's okay to do that here rather than in the CollectStateListener.
                    if (!lsm.isSelectionEmpty() && tblResult.getAutoscrolls()) {
                        // ensure that the last selected row is visible:
                        final int iRowIndex = lsm.getLeadSelectionIndex();
                        final int iColIndex = tblResult.getSelectedColumn();
                        final Rectangle rectCell = tblResult.getCellRect(iRowIndex,
                                iColIndex != -1 ? iColIndex : 0, true);
                        if (rectCell != null) {
                            tblResult.scrollRectToVisible(rectCell);
                        }
                    }
                }
            } catch (CommonBusinessException ex) {
                Errors.getInstance().showExceptionDialog(clctctl.getTab(), ex);
            }
        } // valueChanged
    };
}