private ObjectListSelectionModel buildRowSelectionModel() { ObjectListSelectionModel rowSelectionModel = new ObjectListSelectionModel(new ListModelAdapter(sortedFieldsAdapter)); rowSelectionModel.addListSelectionListener(this.buildRowSelectionListener()); rowSelectionModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); return rowSelectionModel; }
private ObjectListSelectionModel buildTableSelectionModel(ListValueModel preferencesHolder) { ObjectListSelectionModel tsm = new ObjectListSelectionModel(new ListModelAdapter(preferencesHolder)); tsm.addListSelectionListener(this.buildTableSelectionListener()); tsm.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); return tsm; }
/** * Adds a <code>ListSelectionListener</code> to the given selection model in order to keep the * enable state of the given remove button in sync with the selection. */ private void buildRemoveButtonEnabler() { selectionModel.addListSelectionListener( new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { removeButton.setEnabled(!selectionModel.isSelectionEmpty()); } } }); }
/** * Adds a <code>ListSelectionListener</code> to the given selection model in order to keep the * enable state of the given edit button in sync with the selection. */ private void buildEditButtonEnabler() { selectionModel.addListSelectionListener( new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { editButton.setEnabled(selectionModel.getSelectedValues().length == 1); } } }); }
private ObjectListSelectionModel buildPrimaryKeysSelectionModel() { ObjectListSelectionModel selectionModel = new ObjectListSelectionModel(this.primaryKeysModel); selectionModel.addListSelectionListener(this.buildSelectionListener()); return selectionModel; }