List of usage examples for javax.swing.event RowSorterEvent getType
public Type getType()
From source file:de.mendelson.comm.as2.client.AS2Gui.java
/** * Makes this a RowSorterListener, workaround for the bug that the selected * row will change to a random one after the sort process */// ww w.j a v a2 s .c o m @Override public void sorterChanged(RowSorterEvent e) { if (e.getType().equals(RowSorterEvent.Type.SORTED)) { this.jTableMessageOverview.getSelectionModel().clearSelection(); this.setButtonState(); } }
From source file:com.osparking.attendant.AttListForm.java
/** * Creates new form AttListForm/*w w w .java 2s . c o m*/ */ public AttListForm(IMainGUI mainGUI, String loginID, String loginPW, boolean isManager) { // Mark the first row as selected in default this.mainGUI = mainGUI; try { initComponents(); setLocation(0, 0); setIconImages(OSPiconList); // Reset search column combobox items searchCriteriaComboBox.removeAllItems(); searchCriteriaComboBox.addItem(new ConvComboBoxItem(LOGIN_ID_LABEL, LOGIN_ID_LABEL.getContent())); searchCriteriaComboBox.addItem(new ConvComboBoxItem(NAME_LABEL, NAME_LABEL.getContent())); // Make last 8 digits of the user ID visible on the user password label. String id = loginID; if (loginID.length() > 8) { id = ".." + loginID.substring(loginID.length() - 8); } userPWLabel.setText(id + " " + MY_PW_LABEL.getContent()); this.loginID = loginID; this.loginPW = loginPW; this.isManager = isManager; initComponentsUser(); // limit maximun allowed length of user IDa userIDText.setDocument(new JTextFieldLimit(20)); ListSelectionModel model = usersTable.getSelectionModel(); model.addListSelectionListener(new AttendantRowSelectionListener()); setFormMode(FormMode.NormalMode); loadAttendantTable(""); int selectIndex = searchRow(loginID); if (rowHidden(usersTable, selectIndex)) { usersTable.changeSelection(selectIndex, 0, false, false); } else { usersTable.setRowSelectionInterval(selectIndex, selectIndex); } usersTable.requestFocus(); usersTable.getRowSorter().addRowSorterListener(new RowSorterListener() { @Override public void sorterChanged(final RowSorterEvent e) { SwingUtilities.invokeLater(new Runnable() { public void run() { if (e.getType() == RowSorterEvent.Type.SORTED) { if (usersTable.getSelectedRow() != -1) { usersTable.scrollRectToVisible( usersTable.getCellRect(usersTable.getSelectedRow(), 0, false)); } } } }); } }); } catch (Exception ex) { logParkingException(Level.SEVERE, ex, "(AttListForm Constructor ID: " + loginID + ")"); } JComponent pane = (JComponent) this.getContentPane(); pane.getInputMap().put(null, MUTEX_DEBUG_SEQ_VALUE); addWindowListener(new WindowAdapter() { public void windowOpened(WindowEvent e) { searchText.requestFocus(); } }); attachEnterHandler(searchText); adminAuth2CheckBox.setSelected(isManager); KeyStroke controlF = KeyStroke.getKeyStroke("control F"); JRootPane rootPane = getRootPane(); rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(controlF, "myAction"); rootPane.getActionMap().put("myAction", new Ctrl_F_Action(searchText)); }