Search in sources :

Example 1 with UndoManager

use of com.revolsys.swing.undo.UndoManager in project com.revolsys.open by revolsys.

the class FieldSupport method setValue.

public boolean setValue(final Object value) {
    final Object oldValue = this.value;
    if (DataType.equal(oldValue, value)) {
        return false;
    } else {
        this.value = value;
        this.field.firePropertyChange(this.name, oldValue, value);
        final UndoManager parent = this.undoManager.getParent();
        SetFieldValueUndoableEdit.newUndoableEdit(parent, this.field, oldValue, value);
        return true;
    }
}
Also used : UndoManager(com.revolsys.swing.undo.UndoManager) CascadingUndoManager(com.revolsys.swing.undo.CascadingUndoManager)

Example 2 with UndoManager

use of com.revolsys.swing.undo.UndoManager in project com.revolsys.open by revolsys.

the class GeometryCoordinatesTableModel method setGeometry.

public void setGeometry(final Geometry geometry) {
    final LayerRecordForm form = this.geometryCoordinatesPanel.getForm();
    final LayerRecord record = form.getRecord();
    final Geometry oldGeometry = record.getGeometry();
    if (oldGeometry != geometry) {
        final AbstractRecordLayer layer = record.getLayer();
        final String geometryFieldName = record.getGeometryFieldName();
        final UndoableEdit setGeometryUndo = layer.newSetFieldUndo(record, geometryFieldName, oldGeometry, geometry);
        final UndoManager undoManager = form.getUndoManager();
        undoManager.addEdit(setGeometryUndo);
    }
    if (this.geometry != geometry) {
        this.geometry = geometry;
        if (geometry == null) {
            this.geometryFactory = GeometryFactory.DEFAULT_3D;
            this.vertexIndexMap = Collections.emptyMap();
            this.vertexIndices = Collections.emptyList();
        } else {
            this.geometryFactory = geometry.getGeometryFactory();
            this.vertexIndexMap = getIndexOfVertices(geometry);
            this.vertexIndices = new ArrayList<>(this.vertexIndexMap.keySet());
        }
        this.axisCount = this.geometryFactory.getAxisCount();
        this.axisNames = new ArrayList<>();
        if (geometry.isGeometryCollection()) {
            this.axisNames.add("P");
        }
        if (geometry instanceof Polygonal) {
            this.axisNames.add("R");
        }
        this.vertexIndexColumn = this.axisNames.size();
        this.axisNames.add("#");
        this.segmentIndexColumn = this.axisNames.size();
        this.axisNames.add("S #");
        this.numIndexItems = this.axisNames.size();
        this.axisNames.add("X");
        this.axisNames.add("Y");
        if (this.axisCount > 2) {
            this.axisNames.add("Z");
        }
        if (this.axisCount > 3) {
            this.axisNames.add("M");
        }
        this.columnCount = this.axisNames.size();
        fireTableStructureChanged();
    }
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) LayerRecordForm(com.revolsys.swing.map.form.LayerRecordForm) UndoManager(com.revolsys.swing.undo.UndoManager) UndoableEdit(javax.swing.undo.UndoableEdit) Polygonal(com.revolsys.geometry.model.Polygonal) AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord)

Example 3 with UndoManager

use of com.revolsys.swing.undo.UndoManager in project com.revolsys.open by revolsys.

the class MergeRecordsDialog method showDialog.

public static void showDialog(final AbstractRecordLayer layer) {
    final UndoManager undoManager = layer.getMapPanel().getUndoManager();
    final MergeRecordsDialog dialog = new MergeRecordsDialog(undoManager, layer);
    dialog.showDialog();
}
Also used : UndoManager(com.revolsys.swing.undo.UndoManager)

Aggregations

UndoManager (com.revolsys.swing.undo.UndoManager)3 Geometry (com.revolsys.geometry.model.Geometry)1 Polygonal (com.revolsys.geometry.model.Polygonal)1 LayerRecordForm (com.revolsys.swing.map.form.LayerRecordForm)1 AbstractRecordLayer (com.revolsys.swing.map.layer.record.AbstractRecordLayer)1 LayerRecord (com.revolsys.swing.map.layer.record.LayerRecord)1 CascadingUndoManager (com.revolsys.swing.undo.CascadingUndoManager)1 UndoableEdit (javax.swing.undo.UndoableEdit)1