use of com.revolsys.swing.table.record.model.RecordRowTableModel in project com.revolsys.open by revolsys.
the class RecordRowPredicateRowFilter method include.
@Override
public boolean include(final Entry<? extends RecordRowTableModel, ? extends Integer> entry) {
final RecordRowTableModel tableModel = entry.getModel();
final Integer rowIndex = entry.getIdentifier();
final Record record = tableModel.getRecord(rowIndex);
return this.filter.test(record);
}
use of com.revolsys.swing.table.record.model.RecordRowTableModel in project com.revolsys.open by revolsys.
the class RecordLayerTable method tableChangedDo.
@Override
protected void tableChangedDo(final TableModelEvent event) {
final RecordLayerTableModel model = getModel();
if (model.isSortable()) {
setSortable(true);
} else {
setSortable(false);
}
final RowFilter<RecordRowTableModel, Integer> rowFilter = model.getRowFilter();
final boolean filterChanged = getRowFilter() != rowFilter;
if (filterChanged) {
setRowFilter(null);
}
super.tableChangedDo(event);
if (filterChanged) {
setRowFilter(rowFilter);
}
repaint();
}
use of com.revolsys.swing.table.record.model.RecordRowTableModel in project com.revolsys.open by revolsys.
the class RecordLayerTable method cutFieldValue.
public void cutFieldValue() {
if (isEditingCurrentCell()) {
final RecordTableCellEditor tableCellEditor = getTableCellEditor();
final JComponent editorComponent = tableCellEditor.getEditorComponent();
SwingUtil.dndCut(editorComponent);
} else {
copyFieldValue();
final RecordRowTableModel model = getTableModel();
final int row = TablePanel.getEventRow();
final int column = TablePanel.getEventColumn();
model.setValueAt(null, row, column);
}
}
use of com.revolsys.swing.table.record.model.RecordRowTableModel in project com.revolsys.open by revolsys.
the class RecordLayerTable method pasteFieldValue.
public void pasteFieldValue() {
if (isEditingCurrentCell()) {
final RecordTableCellEditor tableCellEditor = getTableCellEditor();
final JComponent editorComponent = tableCellEditor.getEditorComponent();
SwingUtil.dndPaste(editorComponent);
} else {
try {
final Transferable clipboard = ClipboardUtil.getContents();
final Object value = clipboard.getTransferData(DataFlavor.stringFlavor);
final RecordRowTableModel model = getTableModel();
final int row = TablePanel.getEventRow();
final int column = TablePanel.getEventColumn();
model.setValueAt(value, row, column);
} catch (final Throwable e) {
}
}
}
use of com.revolsys.swing.table.record.model.RecordRowTableModel 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