Search in sources :

Example 6 with RecordRowTableModel

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);
}
Also used : RecordRowTableModel(com.revolsys.swing.table.record.model.RecordRowTableModel) Record(com.revolsys.record.Record)

Example 7 with RecordRowTableModel

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();
}
Also used : RecordLayerTableModel(com.revolsys.swing.map.layer.record.table.model.RecordLayerTableModel) RecordRowTableModel(com.revolsys.swing.table.record.model.RecordRowTableModel)

Example 8 with RecordRowTableModel

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);
    }
}
Also used : JComponent(javax.swing.JComponent) RecordRowTableModel(com.revolsys.swing.table.record.model.RecordRowTableModel) RecordTableCellEditor(com.revolsys.swing.table.record.editor.RecordTableCellEditor)

Example 9 with RecordRowTableModel

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) {
        }
    }
}
Also used : JComponent(javax.swing.JComponent) Transferable(java.awt.datatransfer.Transferable) RecordRowTableModel(com.revolsys.swing.table.record.model.RecordRowTableModel) EventObject(java.util.EventObject) RecordTableCellEditor(com.revolsys.swing.table.record.editor.RecordTableCellEditor)

Example 10 with RecordRowTableModel

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);
        }
    });
}
Also used : ListSelectionModel(javax.swing.ListSelectionModel) RecordRowTableModel(com.revolsys.swing.table.record.model.RecordRowTableModel) RecordLayerTable(com.revolsys.swing.map.layer.record.table.RecordLayerTable)

Aggregations

RecordRowTableModel (com.revolsys.swing.table.record.model.RecordRowTableModel)14 RecordTableCellEditor (com.revolsys.swing.table.record.editor.RecordTableCellEditor)3 JComponent (javax.swing.JComponent)3 Geometry (com.revolsys.geometry.model.Geometry)2 Record (com.revolsys.record.Record)2 EventObject (java.util.EventObject)2 FieldDefinition (com.revolsys.record.schema.FieldDefinition)1 RecordLayerTable (com.revolsys.swing.map.layer.record.table.RecordLayerTable)1 RecordLayerTableModel (com.revolsys.swing.map.layer.record.table.model.RecordLayerTableModel)1 BaseJTable (com.revolsys.swing.table.BaseJTable)1 ColorHighlighter (com.revolsys.swing.table.highlighter.ColorHighlighter)1 Color (java.awt.Color)1 StringSelection (java.awt.datatransfer.StringSelection)1 Transferable (java.awt.datatransfer.Transferable)1 ListSelectionModel (javax.swing.ListSelectionModel)1 SortOrder (javax.swing.SortOrder)1 TableColumn (javax.swing.table.TableColumn)1 TableColumnModel (javax.swing.table.TableColumnModel)1 ColorHighlighter (org.jdesktop.swingx.decorator.ColorHighlighter)1 Highlighter (org.jdesktop.swingx.decorator.Highlighter)1