Search in sources :

Example 6 with RecordLayerTableModel

use of com.revolsys.swing.map.layer.record.table.model.RecordLayerTableModel 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 7 with RecordLayerTableModel

use of com.revolsys.swing.map.layer.record.table.model.RecordLayerTableModel in project com.revolsys.open by revolsys.

the class RecordLayerTableRowSorter method isSortable.

@Override
public boolean isSortable(final int columnIndex) {
    final RecordLayerTableModel model = (RecordLayerTableModel) getModel();
    final FieldDefinition fieldDefinition = model.getColumnFieldDefinition(columnIndex);
    if (fieldDefinition == null) {
        return true;
    } else {
        final Class<?> fieldClass = fieldDefinition.getTypeClass();
        return !Geometry.class.isAssignableFrom(fieldClass);
    }
}
Also used : RecordLayerTableModel(com.revolsys.swing.map.layer.record.table.model.RecordLayerTableModel) Geometry(com.revolsys.geometry.model.Geometry) FieldDefinition(com.revolsys.record.schema.FieldDefinition)

Example 8 with RecordLayerTableModel

use of com.revolsys.swing.map.layer.record.table.model.RecordLayerTableModel in project com.revolsys.open by revolsys.

the class RecordLayerTableRowSorter method getComparator.

@Override
public Comparator<?> getComparator(final int columnIndex) {
    final RecordLayerTableModel model = (RecordLayerTableModel) getModel();
    final String fieldName = model.getColumnFieldName(columnIndex);
    final RecordDefinition recordDefinition = this.layer.getRecordDefinition();
    final CodeTable codeTable = recordDefinition.getCodeTableByFieldName(fieldName);
    if (codeTable == null) {
        final Comparator<?> comparator = super.getComparator(columnIndex);
        if (comparator == null) {
            return this.layer.getComparator(fieldName);
        } else {
            return comparator;
        }
    } else {
        return codeTable;
    }
}
Also used : RecordLayerTableModel(com.revolsys.swing.map.layer.record.table.model.RecordLayerTableModel) CodeTable(com.revolsys.record.code.CodeTable) RecordDefinition(com.revolsys.record.schema.RecordDefinition)

Aggregations

RecordLayerTableModel (com.revolsys.swing.map.layer.record.table.model.RecordLayerTableModel)8 Geometry (com.revolsys.geometry.model.Geometry)4 RecordRowTableModel (com.revolsys.swing.table.record.model.RecordRowTableModel)4 ListSelectionModel (javax.swing.ListSelectionModel)4 WebColors (com.revolsys.awt.WebColors)3 SwingUtil (com.revolsys.swing.SwingUtil)3 ClipboardUtil (com.revolsys.swing.dnd.ClipboardUtil)3 AbstractRecordLayer (com.revolsys.swing.map.layer.record.AbstractRecordLayer)3 LayerRecord (com.revolsys.swing.map.layer.record.LayerRecord)3 LayerRecordMenu (com.revolsys.swing.map.layer.record.LayerRecordMenu)3 TablePanel (com.revolsys.swing.table.TablePanel)3 ColorHighlighter (com.revolsys.swing.table.highlighter.ColorHighlighter)3 RecordRowTable (com.revolsys.swing.table.record.RecordRowTable)3 RecordTableCellEditor (com.revolsys.swing.table.record.editor.RecordTableCellEditor)3 Color (java.awt.Color)3 Font (java.awt.Font)3 DataFlavor (java.awt.datatransfer.DataFlavor)3 StringSelection (java.awt.datatransfer.StringSelection)3 Transferable (java.awt.datatransfer.Transferable)3 TextAttribute (java.awt.font.TextAttribute)3