use of com.revolsys.swing.map.layer.record.AbstractRecordLayer in project com.revolsys.open by revolsys.
the class ModeAllPaged method recordUpdated.
@Override
protected void recordUpdated(final LayerRecord record) {
Invoke.later(() -> {
final Condition filter = getFilter();
final AbstractRecordLayer layer = getLayer();
if (layer.isNew(record)) {
if (filter.test(record)) {
addCachedRecord(record);
} else {
removeCachedRecord(record);
}
} else if (!filter.isEmpty()) {
if (layer.isModified(record)) {
if (filterTestModified(filter, record)) {
addCachedRecord(record);
} else {
removeCachedRecord(record);
}
}
}
});
}
use of com.revolsys.swing.map.layer.record.AbstractRecordLayer in project com.revolsys.open by revolsys.
the class ModeAllPaged method exportRecords.
@Override
public void exportRecords(final Query query, final Object target) {
final AbstractRecordLayer layer = getLayer();
layer.exportRecords(query, target);
}
use of com.revolsys.swing.map.layer.record.AbstractRecordLayer in project com.revolsys.open by revolsys.
the class ModeAllPaged method getRecordCount.
@Override
public int getRecordCount() {
synchronized (this) {
if (this.persistedRecordCount < 0) {
if (this.recordCountWorker == null) {
final long refreshIndex = getRefreshIndexNext();
final AbstractRecordLayer layer = getLayer();
this.recordCountWorker = Invoke.background("Query row count " + layer.getName(), this::getRecordCountPersisted, (rowCount) -> {
if (canRefreshFinish(refreshIndex)) {
this.persistedRecordCount = rowCount;
this.recordCountWorker = null;
fireTableDataChanged();
}
});
}
return 0;
} else {
int count = super.getRecordCount();
count += this.persistedRecordCount;
return count;
}
}
}
use of com.revolsys.swing.map.layer.record.AbstractRecordLayer in project com.revolsys.open by revolsys.
the class EditRecordGeometryOverlay method addRecords.
private void addRecords(final List<LayerRecord> results, final LayerGroup group, final Geometry 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;
addRecords(results, childGroup, boundingBox);
} else if (layer instanceof AbstractRecordLayer) {
final AbstractRecordLayer recordLayer = (AbstractRecordLayer) layer;
if (recordLayer.isSelectable(scale)) {
final List<LayerRecord> selectedRecords = recordLayer.getSelectedRecords();
for (final LayerRecord selectedRecord : selectedRecords) {
final Geometry geometry = selectedRecord.getGeometry();
if (boundingBox.intersects(geometry)) {
results.add(selectedRecord);
}
}
}
}
}
}
use of com.revolsys.swing.map.layer.record.AbstractRecordLayer in project com.revolsys.open by revolsys.
the class EditRecordGeometryOverlay method modeEditGeometryVerticesMove.
protected boolean modeEditGeometryVerticesMove(final MouseEvent event) {
if (canOverrideOverlayAction(ACTION_EDIT_GEOMETRY_VERTICES) || isOverlayAction(ACTION_MOVE_GEOMETRY)) {
final double scale = getViewportScale();
final List<CloseLocation> closeLocations = new ArrayList<>();
final MapPanel map = getMap();
for (final CloseLocation location : map.getCloseSelectedLocations()) {
final AbstractRecordLayer layer = location.getLayer();
if (layer.isEditable(scale)) {
closeLocations.add(location);
}
}
if (closeLocations.isEmpty()) {
modeMoveGeometryClear();
modeEditGeometryVerticesClear();
} else if (event.isAltDown()) {
setOverlayAction(ACTION_MOVE_GEOMETRY);
} else {
setOverlayAction(ACTION_EDIT_GEOMETRY_VERTICES);
}
return setMouseOverLocations(closeLocations);
}
return false;
}
Aggregations