public class SpecificationUndoManager extends GraphUndoManager
SpecificationUndoManager
is a special case of an UndoManager
where the manager can be told to accept incoming edit events or not.
The intent behind this is to switch off acceptance of edits when models relying on
the SpecificationUndoManager
need to publish a number of edits (for example, when
loading an existing file, or supplying a set of default elements on a graph) to the manager
that should not be undoable by the user.
The SpecificationUndoManager
is also responsible for ensuring the the editor's
undo and redo Actions (UndoAction
and RedoAction
respectively) are
appropriately enabled for the manager's current state.
Modifier and Type | Class and Description |
---|---|
class |
SpecificationUndoManager.SpecificationCompoundEdit |
Constructor and Description |
---|
SpecificationUndoManager(boolean acceptEdits)
Constructor that allows the caller to specify whether the
returned
SpecificationUndoManager initially accepts edits
or not. |
Modifier and Type | Method and Description |
---|---|
void |
acceptEdits(boolean acceptEdits)
Toggles whether incoming undoable edits should be
accepted by this manager.
|
void |
disableButtons() |
void |
discardAllEdits()
Discards all edits and
resets the enabled states of the
UndoAction and RedoAction singletons.
|
static SpecificationUndoManager |
getInstance() |
javax.swing.undo.UndoableEdit |
getLastEdit() |
boolean |
isDirty() |
void |
redo()
Redoes the next redoable edit and
resets the enabled states of the
UndoAction and RedoAction singletons.
|
void |
refreshButtons() |
void |
removeLastUndoableEdit() |
void |
setDirty(boolean newValue) |
void |
startCompoundingEdits() |
void |
startCompoundingEdits(NetGraphModel model)
Tells the undo mamager to take all edits received
until
stopCompoundingEdits() is called
and combine then into a single undoable edit. |
void |
stopCompoundingEdits()
Tells the undo mamager to post the currently
compounded edits received as a single undoable edit
and to stop compounding edits from now on.
|
void |
undo()
Undoes the next undoable edit and
refreshes the enabled states of the
UndoAction and RedoAction singletons.
|
void |
undoableEditHappened(javax.swing.event.UndoableEditEvent event)
Adds incoming undoable edit to the list of valid events
managed if we are currently accepting edits.
|
canRedo, canUndo, editToBeRedone, editToBeUndone, nextEditToBeRedone, nextEditToBeUndone, redo, undo
addEdit, canRedo, canUndo, canUndoOrRedo, editToBeRedone, editToBeUndone, end, getLimit, getRedoPresentationName, getUndoOrRedoPresentationName, getUndoPresentationName, redoTo, setLimit, toString, trimEdits, trimForLimit, undoOrRedo, undoTo
public SpecificationUndoManager(boolean acceptEdits)
SpecificationUndoManager
initially accepts edits
or not.acceptEdits
- whether to accept incoming editsacceptEdits(boolean)
public static SpecificationUndoManager getInstance()
public void acceptEdits(boolean acceptEdits)
acceptEdits
- whether to accept incoming editspublic void undoableEditHappened(javax.swing.event.UndoableEditEvent event)
undoableEditHappened
in interface javax.swing.event.UndoableEditListener
undoableEditHappened
in class javax.swing.undo.UndoManager
acceptEdits(boolean)
,
UndoableEditEvent
public void undo()
undo
in interface javax.swing.undo.UndoableEdit
undo
in class javax.swing.undo.UndoManager
UndoAction
,
RedoAction
public void redo()
redo
in interface javax.swing.undo.UndoableEdit
redo
in class javax.swing.undo.UndoManager
UndoAction
,
RedoAction
public void discardAllEdits()
discardAllEdits
in class javax.swing.undo.UndoManager
UndoAction
,
RedoAction
public void refreshButtons()
public void disableButtons()
public void startCompoundingEdits()
public void startCompoundingEdits(NetGraphModel model)
stopCompoundingEdits()
is called
and combine then into a single undoable edit.public void stopCompoundingEdits()
public javax.swing.undo.UndoableEdit getLastEdit()
public boolean isDirty()
public void setDirty(boolean newValue)
public void removeLastUndoableEdit()