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;
}
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();
}
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;
}
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);
}
}
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);
}
}
}
}
Aggregations