use of javax.swing.ListSelectionModel in project TauP by crotwell.
the class PhaseDialog method addPhaseActionPerformed.
// GEN-LAST:event_phaseListKeyTyped
private void addPhaseActionPerformed(java.awt.event.ActionEvent evt) {
// GEN-FIRST:event_addPhaseActionPerformed
// Add your handling code here:
phaseListModel.addElement(evt.getActionCommand());
ListSelectionModel sel = phaseList.getSelectionModel();
sel.addSelectionInterval(phaseListModel.getSize() - 1, phaseListModel.getSize() - 1);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
phaseList.ensureIndexIsVisible(phaseListModel.getSize() - 1);
}
});
}
use of javax.swing.ListSelectionModel in project TauP by crotwell.
the class PhaseDialog method setPhases.
public void setPhases(String[] phases) {
phaseListModel.removeAllElements();
for (int i = 0; i < phases.length; i++) {
phaseListModel.addElement(phases[i]);
}
ListSelectionModel sel = phaseList.getSelectionModel();
sel.addSelectionInterval(0, phaseListModel.getSize() - 1);
}
use of javax.swing.ListSelectionModel in project com.revolsys.open by revolsys.
the class MergedRecordsTableModel method valueChanged.
@Override
public void valueChanged(final ListSelectionEvent event) {
final RecordRowTable table = getTable();
final ListSelectionModel selectionModel = table.getSelectionModel();
final int rowCount = super.getRowCount();
final boolean mergedSelected = selectionModel.isSelectedIndex(rowCount);
for (int rowIndex = 0; rowIndex < rowCount; rowIndex++) {
final Record record = getRecord(rowIndex);
if (record != null) {
if (mergedSelected || selectionModel.isSelectedIndex(rowIndex)) {
this.layer.addHighlightedRecords((LayerRecord) record);
} else {
this.layer.unHighlightRecords((LayerRecord) record);
}
}
}
this.layer.zoomToHighlighted();
}
use of javax.swing.ListSelectionModel in project com.revolsys.open by revolsys.
the class RecordLayerTableModel method setTable.
@Override
public void setTable(final BaseJTable table) {
super.setTable(table);
final ListSelectionModel selectionModel = getSelectionModel();
table.setSelectionModel(selectionModel);
}
use of javax.swing.ListSelectionModel in project com.revolsys.open by revolsys.
the class RecordLayerTableModel method setTableRecordsMode.
public void setTableRecordsMode(final TableRecordsMode tableRecordsMode) {
Invoke.later(() -> {
final TableRecordsMode oldMode = this.tableRecordsMode;
final RecordLayerTable table = getTable();
if (table != null && tableRecordsMode != null && tableRecordsMode != oldMode) {
if (oldMode != null) {
oldMode.deactivate();
}
final String oldGeometryFilterMode = getGeometryFilterMode();
this.tableRecordsMode = MODE_EMPTY;
fireTableDataChanged();
table.setSortable(false);
table.setSelectionModel(null);
table.setRowFilter(null);
tableRecordsMode.activate();
final ListSelectionModel selectionModel = tableRecordsMode.getSelectionModel();
table.setSelectionModel(selectionModel);
final boolean sortable = tableRecordsMode.isSortable();
table.setSortable(sortable);
final RowFilter<RecordRowTableModel, Integer> rowFilter = getRowFilter();
table.setRowFilter(rowFilter);
final boolean filterByBoundingBoxSupported = tableRecordsMode.isFilterByBoundingBoxSupported();
if (!filterByBoundingBoxSupported) {
this.filterByBoundingBox = false;
}
this.tableRecordsMode = tableRecordsMode;
refresh();
firePropertyChange("tableRecordsMode", oldMode, this.tableRecordsMode);
firePropertyChange("geometryFilterMode", oldGeometryFilterMode, getGeometryFilterMode());
firePropertyChange("filterByBoundingBox", !this.filterByBoundingBox, this.filterByBoundingBox);
firePropertyChange("filterByBoundingBoxSupported", !filterByBoundingBoxSupported, filterByBoundingBoxSupported);
}
});
}
Aggregations