Search in sources :

Example 51 with AbstractRecordLayer

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

the class ModeChanged method activate.

@Override
public void activate() {
    final AbstractRecordLayer layer = getLayer();
    addListeners(Property.addListenerNewValueSource(layer, AbstractRecordLayer.RECORDS_INSERTED, // 
    this::addCachedRecords), // 
    newRecordsDeletedListener(layer), Property.addListenerNewValueSource(layer, AbstractRecordLayer.RECORD_CACHE_MODIFIED, // 
    this::addCachedRecord));
    super.activate();
}
Also used : AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer)

Example 52 with AbstractRecordLayer

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

the class ModeSelected method getRecordsForCache.

@Override
protected List<LayerRecord> getRecordsForCache() {
    final AbstractRecordLayer layer = getLayer();
    final List<LayerRecord> selectedRecords = layer.getSelectedRecords();
    return selectedRecords;
}
Also used : AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord)

Example 53 with AbstractRecordLayer

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

the class RecordLayerHighlightedListSelectionModel method addSelectionInterval.

@Override
public void addSelectionInterval(final int index0, final int index1) {
    super.addSelectionInterval(convertRowIndexToModel(index0), convertRowIndexToModel(index1));
    final List<LayerRecord> records = getObjects(index0, index1);
    final AbstractRecordLayer layer = this.model.getLayer();
    layer.addHighlightedRecords(records);
}
Also used : AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord)

Example 54 with AbstractRecordLayer

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

the class RecordLayerTableModel method getMenu.

@Override
public BaseJPopupMenu getMenu(final int rowIndex, final int columnIndex) {
    final LayerRecord record = getRecord(rowIndex);
    if (record != null) {
        final AbstractRecordLayer layer = getLayer();
        if (layer != null) {
            LayerRecordMenu.setEventRecord(record);
            if (isUseRecordMenu()) {
                final LayerRecordMenu menu = record.getMenu();
                final BaseJPopupMenu popupMenu = menu.newJPopupMenu();
                popupMenu.addSeparator();
                final RecordLayerTable table = getTable();
                final boolean cellEditable = isCellEditable(rowIndex, columnIndex);
                final Object value = getValueAt(rowIndex, columnIndex);
                final boolean canCopy = Property.hasValue(value);
                if (cellEditable) {
                    final JMenuItem cutMenu = RunnableAction.newMenuItem("Cut Field Value", "cut", table::cutFieldValue);
                    cutMenu.setEnabled(canCopy);
                    popupMenu.add(cutMenu);
                }
                final JMenuItem copyMenu = RunnableAction.newMenuItem("Copy Field Value", "page_copy", table::copyFieldValue);
                copyMenu.setEnabled(canCopy);
                popupMenu.add(copyMenu);
                if (cellEditable) {
                    popupMenu.add(RunnableAction.newMenuItem("Paste Field Value", "paste_plain", table::pasteFieldValue));
                }
                return popupMenu;
            } else {
                return super.getMenu().newJPopupMenu();
            }
        }
    }
    return null;
}
Also used : LayerRecordMenu(com.revolsys.swing.map.layer.record.LayerRecordMenu) BaseJPopupMenu(com.revolsys.swing.menu.BaseJPopupMenu) AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord) RecordLayerTable(com.revolsys.swing.map.layer.record.table.RecordLayerTable) JMenuItem(javax.swing.JMenuItem)

Example 55 with AbstractRecordLayer

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

the class RecordLayerTableModel method isCellEditable.

@Override
protected boolean isCellEditable(final int rowIndex, final int columnIndex, final Record record) {
    final AbstractRecordLayer layer = getLayer();
    final LayerRecord layerRecord = (LayerRecord) record;
    if (layer.isDeleted(layerRecord)) {
        return false;
    } else if (layer.isCanEditRecords() || layer.isNew(layerRecord) && layer.isCanAddRecords()) {
        return super.isCellEditable(rowIndex, columnIndex, record);
    } else {
        return false;
    }
}
Also used : AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord)

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