Search in sources :

Example 31 with AbstractRecordLayer

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

the class ModeAllPaged method isRecordPageQueryChanged.

/**
 * Has the record been changed such that
 * @param record
 * @return
 */
protected boolean isRecordPageQueryChanged(final LayerRecord record) {
    final AbstractRecordLayer layer = getLayer();
    if (layer.isModified(record)) {
        final Condition filter = getFilter();
        final RecordLayerTableModel model = getTableModel();
        final Comparator<Record> comparator = model.getOrderByComparatorIdentifier();
        if (comparator != null) {
            final Record orginialRecord = record.getOriginalRecord();
            final int compare = comparator.compare(record, orginialRecord);
            if (compare != 0) {
                return true;
            }
        }
        if (!filter.isEmpty()) {
            if (filter.test(record)) {
                final Record orginialRecord = record.getOriginalRecord();
                if (!filter.test(orginialRecord)) {
                    return true;
                }
            }
        }
    }
    return false;
}
Also used : Condition(com.revolsys.record.query.Condition) AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) Record(com.revolsys.record.Record) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord)

Example 32 with AbstractRecordLayer

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

the class ModeAllPaged method activate.

@Override
public void activate() {
    final AbstractRecordLayer layer = getLayer();
    addListeners(Property.addListenerNewValueSource(layer, AbstractRecordLayer.RECORDS_INSERTED, // 
    this::addCachedRecords), // 
    newRecordsDeletedListener(layer));
    final RecordLayerTableModel model = getTableModel();
    for (final String propertyName : new String[] { "filter", AbstractRecordLayer.RECORDS_CHANGED }) {
        addListeners(Property.addListenerRunnable(layer, propertyName, this::refresh));
    }
    addListeners(// 
    Property.addListenerRunnable(model, "filter", this::refresh));
    super.activate();
}
Also used : AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer)

Example 33 with AbstractRecordLayer

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

the class ModeAllPaged method getRecordsForCache.

@Override
protected List<LayerRecord> getRecordsForCache() {
    final AbstractRecordLayer layer = getLayer();
    final List<LayerRecord> records = layer.getRecordsNew();
    final Condition filter = getFilter();
    if (!filter.isEmpty()) {
        Predicates.retain(records, filter);
        for (final LayerRecord modifiedRecord : layer.getRecordsModified()) {
            if (filterTestModified(filter, modifiedRecord)) {
                records.add(modifiedRecord);
            }
        }
    }
    final RecordLayerTableModel model = getTableModel();
    final Comparator<Record> comparator = model.getOrderByComparatorIdentifier();
    if (comparator != null) {
        records.sort(comparator);
    }
    return records;
}
Also used : Condition(com.revolsys.record.query.Condition) AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) Record(com.revolsys.record.Record) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord)

Example 34 with AbstractRecordLayer

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

the class SetRecordValuesUndo method redoDo.

@Override
protected void redoDo() {
    if (this.record != null) {
        final AbstractRecordLayer layer = this.record.getLayer();
        layer.replaceValues(this.record, this.newValues);
    }
}
Also used : AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer)

Example 35 with AbstractRecordLayer

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

the class SelectRecordsOverlay method unSelectRecords.

private void unSelectRecords(final LayerGroup group, final BoundingBox boundingBox) {
    final double scale = getViewportScale();
    final List<Layer> layers = group.getLayers();
    Collections.reverse(layers);
    for (final Layer layer : layers) {
        if (layer instanceof LayerGroup) {
            final LayerGroup childGroup = (LayerGroup) layer;
            unSelectRecords(childGroup, boundingBox);
        } else if (layer instanceof AbstractRecordLayer) {
            final AbstractRecordLayer recordLayer = (AbstractRecordLayer) layer;
            if (recordLayer.isSelectable(scale)) {
                recordLayer.unSelectRecords(boundingBox);
            }
        }
    }
}
Also used : AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) LayerGroup(com.revolsys.swing.map.layer.LayerGroup) Layer(com.revolsys.swing.map.layer.Layer) AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) AbstractLayer(com.revolsys.swing.map.layer.AbstractLayer)

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