コード例 #1
0
  /**
   * 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);
    }
  }
コード例 #2
0
 private Object[] selectedFields() {
   return rowSelectionModel.getSelectedValues();
 }
コード例 #3
0
 private void rowSelectionChanged() {
   Object[] selection = rowSelectionModel.getSelectedValues();
   boolean fieldSelected = (selection.length > 0);
   removeAction.setEnabled(fieldSelected);
 }
コード例 #4
0
    /**
     * 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);
    }