public void install() { configureButton(); loadButton.setAction(this); if (selectedRow == -1) { selectionModel.clearSelection(); } else { selectionModel.setSelectionInterval(selectedRow, selectedRow); } selectionModel.addListSelectionListener(this); showCompanion(false); sheetSupport.install(); }
@Override public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting()) { return; } selectedRow = selectionModel.getMinSelectionIndex(); configureButton(); showCompanion(false); }
private void initComponents() { setTitle(LanguageBundle.getString("in_companionSelectRace")); // $NON-NLS-1$ setLayout(new BorderLayout()); Container container = getContentPane(); { final ListSelectionModel selectionModel = raceTable.getSelectionModel(); selectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); selectionModel.addListSelectionListener( new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { selectButton.setEnabled(!selectionModel.isSelectionEmpty()); } } }); } SearchFilterPanel searchBar = new SearchFilterPanel(); container.add(searchBar, BorderLayout.NORTH); raceTable.setDisplayableFilter(searchBar); raceTable.addActionListener(this); raceTable.setTreeViewModel(this); container.add(new JScrollPane(raceTable), BorderLayout.CENTER); JPanel buttonPane = new JPanel(new FlowLayout()); selectButton.addActionListener(this); selectButton.setEnabled(false); selectButton.setActionCommand("SELECT"); buttonPane.add(selectButton); JButton cancelButton = new JButton(LanguageBundle.getString("in_cancel")); cancelButton.addActionListener(this); cancelButton.setActionCommand("CANCEL"); buttonPane.add(cancelButton); container.add(buttonPane, BorderLayout.SOUTH); Utility.installEscapeCloseOperation(this); }
public void uninstall() { selectionModel.removeListSelectionListener(this); sheetSupport.uninstall(); }