/** * Initializes the currentEdit field if the model is deserialized. */ private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { ois.defaultReadObject(); currentEdit = createUndoableEdit(); }
/** * Initializes the currentEdit field if the model is deserialized. */ private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { ois.defaultReadObject(); currentEdit = createUndoableEdit(); }
/** * Constructs a new graph model. If no root is specified * then a new root mxCell with a default layer is created. * * @param root Cell that represents the root cell. */ public mxGraphModel(Object root) { currentEdit = createUndoableEdit(); if (root != null) { setRoot(root); } else { clear(); } }
/** * Constructs a new graph model. If no root is specified * then a new root mxCell with a default layer is created. * * @param root Cell that represents the root cell. */ public mxGraphModel(Object root) { currentEdit = createUndoableEdit(); if (root != null) { setRoot(root); } else { clear(); } }
public void endUpdate() { updateLevel--; if (!endingUpdate) { endingUpdate = updateLevel == 0; fireEvent(new mxEventObject(mxEvent.END_UPDATE, "edit", currentEdit)); try { if (endingUpdate && !currentEdit.isEmpty()) { fireEvent(new mxEventObject(mxEvent.BEFORE_UNDO, "edit", currentEdit)); mxUndoableEdit tmp = currentEdit; currentEdit = createUndoableEdit(); tmp.dispatch(); fireEvent(new mxEventObject(mxEvent.UNDO, "edit", tmp)); } } finally { endingUpdate = false; } } }
public void endUpdate() { updateLevel--; if (!endingUpdate) { endingUpdate = updateLevel == 0; fireEvent(new mxEventObject(mxEvent.END_UPDATE, "edit", currentEdit)); try { if (endingUpdate && !currentEdit.isEmpty()) { fireEvent(new mxEventObject(mxEvent.BEFORE_UNDO, "edit", currentEdit)); mxUndoableEdit tmp = currentEdit; currentEdit = createUndoableEdit(); tmp.dispatch(); fireEvent(new mxEventObject(mxEvent.UNDO, "edit", tmp)); } } finally { endingUpdate = false; } } }