use of com.revolsys.swing.map.layer.record.LayerRecord in project com.revolsys.open by revolsys.
the class EditRecordGeometryOverlay method modePopupMenu.
private boolean modePopupMenu(final MouseEvent event) {
if (event.isPopupTrigger()) {
for (final CloseLocation location : getMouseOverLocations()) {
final LayerRecord record = location.getRecord();
if (record != null) {
final LayerRecordMenu menu = record.getMenu();
menu.showMenu(record, event);
}
return true;
}
}
return false;
}
use of com.revolsys.swing.map.layer.record.LayerRecord in project com.revolsys.open by revolsys.
the class EditRecordGeometryOverlay method setGeometry.
protected UndoableEdit setGeometry(final CloseLocation location, final Geometry newGeometry) {
if (isOverlayAction(ACTION_ADD_GEOMETRY) || isOverlayAction(ACTION_ADD_GEOMETRY_EDIT_VERTICES)) {
if (DataTypes.GEOMETRY.equals(newGeometry, this.addGeometryEditor)) {
return null;
} else {
// TODO
return null;
}
} else {
final LayerRecord record = location.getRecord();
final String geometryFieldName = record.getGeometryFieldName();
final Geometry oldValue = record.getGeometry();
if (newGeometry == oldValue || newGeometry != null && newGeometry.equalsExact(oldValue)) {
return null;
} else {
final AbstractRecordLayer layer = location.getLayer();
return layer.newSetFieldUndo(record, geometryFieldName, oldValue, newGeometry);
}
}
}
use of com.revolsys.swing.map.layer.record.LayerRecord in project com.revolsys.open by revolsys.
the class EditRecordGeometryOverlay method propertyChange.
@Override
public void propertyChange(final PropertyChangeEvent event) {
super.propertyChange(event);
final Object source = event.getSource();
final String propertyName = event.getPropertyName();
if ("preEditable".equals(propertyName)) {
if (isOverlayAction(ACTION_ADD_GEOMETRY)) {
if (this.addGeometryEditor.isValid()) {
try {
setXorGeometry(null);
if (this.addCompleteAction != null) {
final Geometry geometry = this.addGeometryEditor.newGeometry();
this.addCompleteAction.addComplete(this, geometry);
modeAddGeometryClear();
}
} finally {
clearMapCursor();
}
}
}
} else if ("editable".equals(propertyName)) {
repaint();
if (source == this.addLayer) {
// if (!isEditable(addLayer)) {
// setEditingObject(null, null);
// }
}
} else if (source instanceof LayerRecord) {
if (event.getNewValue() instanceof Geometry) {
// TODO update mouse over locations
// clearMouseOverLocations();
}
}
}
use of com.revolsys.swing.map.layer.record.LayerRecord in project com.revolsys.open by revolsys.
the class RecordLayerListSelectionModel method addSelectionInterval.
@Override
public void addSelectionInterval(final int index0, final int index1) {
final List<LayerRecord> records = getRecords(index0, index1);
final AbstractRecordLayer layer = this.model.getLayer();
layer.addSelectedRecords(records);
super.addSelectionInterval(index0, index1);
}
use of com.revolsys.swing.map.layer.record.LayerRecord in project com.revolsys.open by revolsys.
the class RecordLayerListSelectionModel method isSelectedIndex.
@Override
public boolean isSelectedIndex(final int index) {
final int rowIndex = convertRowIndexToModel(index);
final LayerRecord record = this.model.getRecord(rowIndex);
if (record != null) {
final AbstractRecordLayer layer = this.model.getLayer();
final boolean selected = layer.isSelected(record);
return selected;
}
return false;
}
Aggregations