use of com.revolsys.swing.map.layer.record.AbstractRecordLayer 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.AbstractRecordLayer 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.AbstractRecordLayer 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;
}
use of com.revolsys.swing.map.layer.record.AbstractRecordLayer in project com.revolsys.open by revolsys.
the class RecordLayerListSelectionModel method removeSelectionInterval.
@Override
public void removeSelectionInterval(final int index0, final int index1) {
final List<LayerRecord> records = getRecords(index0, index1);
final AbstractRecordLayer layer = this.model.getLayer();
layer.unSelectRecords(records);
super.removeSelectionInterval(index0, index1);
}
use of com.revolsys.swing.map.layer.record.AbstractRecordLayer in project com.revolsys.open by revolsys.
the class ModifiedFieldPredicate method isHighlighted.
@Override
public boolean isHighlighted(final Component renderer, final ComponentAdapter adapter) {
String toolTip = null;
boolean highlighted = false;
try {
final int rowIndex = adapter.convertRowIndexToModel(adapter.row);
final Record record = this.model.getRecord(rowIndex);
if (record instanceof LayerRecord) {
final LayerRecord layerRecord = (LayerRecord) record;
final AbstractRecordLayer layer = layerRecord.getLayer();
if (layer.isDeleted(layerRecord)) {
highlighted = false;
} else {
final int columnIndex = adapter.convertColumnIndexToModel(adapter.column);
final String fieldName = this.model.getColumnFieldName(columnIndex);
highlighted = layerRecord.isModified(fieldName);
if (highlighted) {
final RecordDefinition recordDefinition = layerRecord.getRecordDefinition();
final Object originalValue = layerRecord.getOriginalValue(fieldName);
final CodeTable codeTable = recordDefinition.getCodeTableByFieldName(fieldName);
String text;
if (originalValue == null) {
text = "-";
} else if (codeTable == null) {
text = DataTypes.toString(originalValue);
} else {
text = codeTable.getValue(Identifier.newIdentifier(originalValue));
if (text == null) {
text = "-";
}
}
toolTip = text;
}
if (columnIndex < this.model.getColumnFieldsOffset()) {
highlighted = false;
}
}
}
} catch (final IndexOutOfBoundsException e) {
highlighted = false;
}
final JComponent component = (JComponent) renderer;
if (toolTip != null && toolTip.length() > 100) {
toolTip = toolTip.substring(0, 100) + "...";
}
component.setToolTipText(toolTip);
return highlighted;
}
Aggregations