/** * Sets whether or not this component is enabled. Disabling this pane will * also disable its children. * * @param enabled <code>true<code> if this component and its children should * be enabled, <code>false<code> otherwise */ public void setEnabled(boolean enabled) { super.setEnabled(enabled); addButton.setEnabled(enabled); table.setEnabled(enabled); table.getTableHeader().setEnabled(enabled); if (enabled) { editButton.setEnabled(selectionModel.getSelectedValues().length == 1); removeButton.setEnabled(!selectionModel.isSelectionEmpty()); } else { table.clearSelection(); editButton.setEnabled(enabled); removeButton.setEnabled(enabled); } }
private Object[] selectedFields() { return rowSelectionModel.getSelectedValues(); }
private void rowSelectionChanged() { Object[] selection = rowSelectionModel.getSelectedValues(); boolean fieldSelected = (selection.length > 0); removeAction.setEnabled(fieldSelected); }
/** * Invoked when the user selects the Remove button. * * @param listSelectionModel The model containing the selected items */ public void removeSelectedItems(ObjectListSelectionModel listSelectionModel) { Collection sessions = CollectionTools.collection(listSelectionModel.getSelectedValues()); if (canRemoveSessions(sessions)) removeSessions(sessions); }