Search in sources :

Example 6 with AbstractRecordLayer

use of com.revolsys.swing.map.layer.record.AbstractRecordLayer in project com.revolsys.open by revolsys.

the class LayerRecordForm method getTitle.

public static String getTitle(final LayerRecord record) {
    final AbstractRecordLayer layer = record.getLayer();
    final Identifier id = record.getIdentifier();
    String title;
    final String layerName = layer.getName();
    if (record.getState() == RecordState.NEW) {
        title = "Add New " + layerName;
    } else if (layer.isCanEditRecords()) {
        title = "Edit " + layerName;
        if (id != null) {
            title += " #" + id;
        }
    } else {
        title = "View " + layerName;
        if (id != null) {
            title += " #" + id;
        }
    }
    return title;
}
Also used : Identifier(com.revolsys.identifier.Identifier) AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer)

Example 7 with AbstractRecordLayer

use of com.revolsys.swing.map.layer.record.AbstractRecordLayer in project com.revolsys.open by revolsys.

the class RecordLayerTable method addModifiedRecordHighlighter.

@Override
protected void addModifiedRecordHighlighter() {
    final RecordLayerTableModel model = getModel();
    final HighlightPredicate predicate = (renderer, adapter) -> {
        try {
            final int rowIndex = adapter.convertRowIndexToModel(adapter.row);
            final LayerRecord record = model.getRecord(rowIndex);
            final AbstractRecordLayer layer = model.getLayer();
            return layer.isModified(record);
        } catch (final Throwable e) {
            return false;
        }
    };
    addHighlighter(new ColorHighlighter(new AndHighlightPredicate(predicate, HighlightPredicate.EVEN), WebColors.newAlpha(WebColors.LimeGreen, 127), WebColors.Black, WebColors.newAlpha(WebColors.DarkGreen, 191), Color.WHITE));
    addHighlighter(new ColorHighlighter(new AndHighlightPredicate(predicate, HighlightPredicate.ODD), WebColors.LimeGreen, WebColors.Black, WebColors.DarkGreen, Color.WHITE));
}
Also used : RecordLayerTableModel(com.revolsys.swing.map.layer.record.table.model.RecordLayerTableModel) Color(java.awt.Color) ListSelectionModel(javax.swing.ListSelectionModel) DataFlavor(java.awt.datatransfer.DataFlavor) TextAttribute(java.awt.font.TextAttribute) SwingUtil(com.revolsys.swing.SwingUtil) Transferable(java.awt.datatransfer.Transferable) LayerRecordMenu(com.revolsys.swing.map.layer.record.LayerRecordMenu) RowFilter(javax.swing.RowFilter) JTableHeader(javax.swing.table.JTableHeader) TableColumnExt(org.jdesktop.swingx.table.TableColumnExt) EventObject(java.util.EventObject) RecordLayerTableModel(com.revolsys.swing.map.layer.record.table.model.RecordLayerTableModel) WebColors(com.revolsys.awt.WebColors) ClipboardUtil(com.revolsys.swing.dnd.ClipboardUtil) Map(java.util.Map) StringSelection(java.awt.datatransfer.StringSelection) TableColumnModelEvent(javax.swing.event.TableColumnModelEvent) RowSorter(javax.swing.RowSorter) ListSelectionEvent(javax.swing.event.ListSelectionEvent) RecordRowTableModel(com.revolsys.swing.table.record.model.RecordRowTableModel) PropertyChangeEvent(java.beans.PropertyChangeEvent) TableModel(javax.swing.table.TableModel) JComponent(javax.swing.JComponent) ChangeEvent(javax.swing.event.ChangeEvent) AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) TableColumnModelExtListener(org.jdesktop.swingx.event.TableColumnModelExtListener) TableModelEvent(javax.swing.event.TableModelEvent) HighlightPredicate(org.jdesktop.swingx.decorator.HighlightPredicate) FontHighlighter(org.jdesktop.swingx.decorator.FontHighlighter) TablePanel(com.revolsys.swing.table.TablePanel) Font(java.awt.Font) TableColumn(javax.swing.table.TableColumn) TableColumnModelExt(org.jdesktop.swingx.table.TableColumnModelExt) RecordRowTable(com.revolsys.swing.table.record.RecordRowTable) AndHighlightPredicate(org.jdesktop.swingx.decorator.HighlightPredicate.AndHighlightPredicate) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord) ColorHighlighter(com.revolsys.swing.table.highlighter.ColorHighlighter) Geometry(com.revolsys.geometry.model.Geometry) RecordTableCellEditor(com.revolsys.swing.table.record.editor.RecordTableCellEditor) ColorHighlighter(com.revolsys.swing.table.highlighter.ColorHighlighter) AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) HighlightPredicate(org.jdesktop.swingx.decorator.HighlightPredicate) AndHighlightPredicate(org.jdesktop.swingx.decorator.HighlightPredicate.AndHighlightPredicate) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord) AndHighlightPredicate(org.jdesktop.swingx.decorator.HighlightPredicate.AndHighlightPredicate)

Example 8 with AbstractRecordLayer

use of com.revolsys.swing.map.layer.record.AbstractRecordLayer in project com.revolsys.open by revolsys.

the class RecordLayerTable method addNewRecordHighlighter.

@Override
protected void addNewRecordHighlighter() {
    final RecordLayerTableModel model = getModel();
    final HighlightPredicate predicate = (renderer, adapter) -> {
        try {
            final int rowIndex = adapter.convertRowIndexToModel(adapter.row);
            final LayerRecord record = model.getRecord(rowIndex);
            final AbstractRecordLayer layer = model.getLayer();
            return layer.isNew(record);
        } catch (final Throwable e) {
            return false;
        }
    };
    addHighlighter(new ColorHighlighter(new AndHighlightPredicate(predicate, HighlightPredicate.EVEN), WebColors.newAlpha(WebColors.LightSkyBlue, 127), WebColors.Black, WebColors.newAlpha(WebColors.RoyalBlue, 191), Color.WHITE));
    addHighlighter(new ColorHighlighter(new AndHighlightPredicate(predicate, HighlightPredicate.ODD), WebColors.LightSkyBlue, WebColors.Black, WebColors.RoyalBlue, Color.WHITE));
}
Also used : RecordLayerTableModel(com.revolsys.swing.map.layer.record.table.model.RecordLayerTableModel) Color(java.awt.Color) ListSelectionModel(javax.swing.ListSelectionModel) DataFlavor(java.awt.datatransfer.DataFlavor) TextAttribute(java.awt.font.TextAttribute) SwingUtil(com.revolsys.swing.SwingUtil) Transferable(java.awt.datatransfer.Transferable) LayerRecordMenu(com.revolsys.swing.map.layer.record.LayerRecordMenu) RowFilter(javax.swing.RowFilter) JTableHeader(javax.swing.table.JTableHeader) TableColumnExt(org.jdesktop.swingx.table.TableColumnExt) EventObject(java.util.EventObject) RecordLayerTableModel(com.revolsys.swing.map.layer.record.table.model.RecordLayerTableModel) WebColors(com.revolsys.awt.WebColors) ClipboardUtil(com.revolsys.swing.dnd.ClipboardUtil) Map(java.util.Map) StringSelection(java.awt.datatransfer.StringSelection) TableColumnModelEvent(javax.swing.event.TableColumnModelEvent) RowSorter(javax.swing.RowSorter) ListSelectionEvent(javax.swing.event.ListSelectionEvent) RecordRowTableModel(com.revolsys.swing.table.record.model.RecordRowTableModel) PropertyChangeEvent(java.beans.PropertyChangeEvent) TableModel(javax.swing.table.TableModel) JComponent(javax.swing.JComponent) ChangeEvent(javax.swing.event.ChangeEvent) AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) TableColumnModelExtListener(org.jdesktop.swingx.event.TableColumnModelExtListener) TableModelEvent(javax.swing.event.TableModelEvent) HighlightPredicate(org.jdesktop.swingx.decorator.HighlightPredicate) FontHighlighter(org.jdesktop.swingx.decorator.FontHighlighter) TablePanel(com.revolsys.swing.table.TablePanel) Font(java.awt.Font) TableColumn(javax.swing.table.TableColumn) TableColumnModelExt(org.jdesktop.swingx.table.TableColumnModelExt) RecordRowTable(com.revolsys.swing.table.record.RecordRowTable) AndHighlightPredicate(org.jdesktop.swingx.decorator.HighlightPredicate.AndHighlightPredicate) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord) ColorHighlighter(com.revolsys.swing.table.highlighter.ColorHighlighter) Geometry(com.revolsys.geometry.model.Geometry) RecordTableCellEditor(com.revolsys.swing.table.record.editor.RecordTableCellEditor) ColorHighlighter(com.revolsys.swing.table.highlighter.ColorHighlighter) AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) HighlightPredicate(org.jdesktop.swingx.decorator.HighlightPredicate) AndHighlightPredicate(org.jdesktop.swingx.decorator.HighlightPredicate.AndHighlightPredicate) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord) AndHighlightPredicate(org.jdesktop.swingx.decorator.HighlightPredicate.AndHighlightPredicate)

Example 9 with AbstractRecordLayer

use of com.revolsys.swing.map.layer.record.AbstractRecordLayer in project com.revolsys.open by revolsys.

the class RecordLayerTablePanel method actionShowFieldSetsMenu.

private void actionShowFieldSetsMenu() {
    final JPopupMenu menu = new JPopupMenu();
    final JMenuItem editMenuItem = RunnableAction.newMenuItem("Edit Field Sets", "fields_filter_edit", () -> {
        final String fieldNamesSetName = FieldNamesSetPanel.showDialog(this.layer);
        if (Property.hasValue(fieldNamesSetName)) {
            this.tableModel.setFieldNamesSetName(fieldNamesSetName);
        }
    });
    menu.add(editMenuItem);
    menu.addSeparator();
    final AbstractRecordLayer layer = getLayer();
    final String selectedFieldSetName = layer.getFieldNamesSetName();
    for (final String fieldSetName : layer.getFieldNamesSetNames()) {
        final JCheckBoxMenuItem menuItem = RunnableAction.newCheckBoxMenuItem(fieldSetName, () -> this.tableModel.setFieldNamesSetName(fieldSetName));
        if (fieldSetName.equalsIgnoreCase(selectedFieldSetName)) {
            menuItem.setSelected(true);
        }
        menu.add(menuItem);
    }
    MenuFactory.showMenu(menu, this.fieldSetsButton, 10, 10);
}
Also used : AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) JMenuItem(javax.swing.JMenuItem) BaseJPopupMenu(com.revolsys.swing.menu.BaseJPopupMenu) JPopupMenu(javax.swing.JPopupMenu) JCheckBoxMenuItem(javax.swing.JCheckBoxMenuItem)

Example 10 with AbstractRecordLayer

use of com.revolsys.swing.map.layer.record.AbstractRecordLayer in project com.revolsys.open by revolsys.

the class ModeSelected method deactivate.

@Override
public void deactivate() {
    super.deactivate();
    final AbstractRecordLayer layer = getLayer();
    layer.clearHighlightedRecords();
}
Also used : AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer)

Aggregations

AbstractRecordLayer (com.revolsys.swing.map.layer.record.AbstractRecordLayer)71 LayerRecord (com.revolsys.swing.map.layer.record.LayerRecord)35 Geometry (com.revolsys.geometry.model.Geometry)9 ArrayList (java.util.ArrayList)8 AbstractLayer (com.revolsys.swing.map.layer.AbstractLayer)7 Layer (com.revolsys.swing.map.layer.Layer)7 List (java.util.List)7 Record (com.revolsys.record.Record)6 Condition (com.revolsys.record.query.Condition)6 LayerGroup (com.revolsys.swing.map.layer.LayerGroup)6 CloseLocation (com.revolsys.swing.map.overlay.CloseLocation)4 Color (java.awt.Color)4 BoundingBox (com.revolsys.geometry.model.BoundingBox)3 Point (com.revolsys.geometry.model.Point)3 Field (com.revolsys.swing.field.Field)3 LayerRecordMenu (com.revolsys.swing.map.layer.record.LayerRecordMenu)3 WebColors (com.revolsys.awt.WebColors)2 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)2 Identifier (com.revolsys.identifier.Identifier)2 FieldDefinition (com.revolsys.record.schema.FieldDefinition)2