public class UndoRedoSupport
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
UndoRedoSupport.StateStackElement
A model containing a state, including a description of what changed and
a thumbnail.
|
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
PROP_DEPTH
property name of the current depth
|
static java.lang.String |
PROP_REDOLABEL |
static java.lang.String |
PROP_SAVE_STATE_DEPTH
the number of states to keep in the states folder.
|
static java.lang.String |
PROP_SIZE_LIMIT
name of the property containing the number of states kept
|
| Constructor and Description |
|---|
UndoRedoSupport(ApplicationModel applicationModel)
Creates a new instance of UndoRedoSupport
|
| Modifier and Type | Method and Description |
|---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener) |
void |
addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener) |
int |
getDepth()
get the current depth, where depth can be lower than the number of
states held, when redos can be done.
|
java.lang.String |
getLongUndoDescription(int i)
used for feedback.
|
javax.swing.Action |
getRedoAction()
get the action to trigger redo.
|
java.lang.String |
getRedoDescription()
get the longer description for the action, intended to be used for the tooltip.
|
java.lang.String |
getRedoLabel()
returns a label describing the redo operation, or null if the operation
doesn't exist.
|
int |
getSaveStateDepth()
get the current number of persistent states stored in autoplot_data/state
|
int |
getSizeLimit()
get the number of states which will be kept
|
javax.swing.Action |
getUndoAction()
get the action to trigger undo.
|
java.lang.String |
getUndoDescription()
get the longer description for the action, intended to be used for the tooltip.
|
java.lang.String |
getUndoLabel()
returns a label describing the undo operation, or null if the operation
doesn't exist.
|
boolean |
isIgnoringUpdates()
Getter for property ignoringUpdates.
|
UndoRedoSupport.StateStackElement |
peekAt(int pos)
allow scripts to peek into undo/redo stack for debugging.
|
void |
pushState(java.beans.PropertyChangeEvent ev)
request that a state be pushed onto the state stack.
|
void |
pushState(java.beans.PropertyChangeEvent ev,
java.lang.String label)
push the current state of the application onto the stack.
|
void |
redo()
redo the state change that was undone, popping up the state stack one position.
|
void |
refreshUndoMultipleMenu(javax.swing.JMenu undoMultipleMenu)
create all the menu items for a JMenu offering undo targets.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener) |
void |
removePropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener) |
void |
resetHistory()
reset the history, for example after a vap file is loaded.
|
void |
setIgnoringUpdates(boolean ignoringUpdates)
Setter for property ignoringUpdates.
|
void |
setSaveStateDepth(int depth)
set the number of persistent states to keep, or 0 will disable the feature.
|
void |
setSizeLimit(int size)
set the number of states which will be kept
|
void |
undo()
undo the last state change.
|
void |
undo(int level)
reset the application to an old state from the state stack.
|
public static final java.lang.String PROP_REDOLABEL
public static final java.lang.String PROP_SIZE_LIMIT
public static final java.lang.String PROP_DEPTH
public static final java.lang.String PROP_SAVE_STATE_DEPTH
public UndoRedoSupport(ApplicationModel applicationModel)
applicationModel - the model which contains basic information about any Autoplot application.public void refreshUndoMultipleMenu(javax.swing.JMenu undoMultipleMenu)
undoMultipleMenu - the menupublic void removePropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
public void addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
public javax.swing.Action getUndoAction()
public void undo()
public void undo(int level)
level - the number of states to undo (1 is jump to the last state).public javax.swing.Action getRedoAction()
public void redo()
public void pushState(java.beans.PropertyChangeEvent ev)
ev - public int getSizeLimit()
public void setSizeLimit(int size)
size - public void pushState(java.beans.PropertyChangeEvent ev,
java.lang.String label)
ev - label - public java.lang.String getUndoDescription()
public java.lang.String getUndoLabel()
public java.lang.String getRedoDescription()
public java.lang.String getRedoLabel()
public void resetHistory()
public boolean isIgnoringUpdates()
public void setIgnoringUpdates(boolean ignoringUpdates)
ignoringUpdates - New value of property ignoringUpdates.public int getDepth()
public int getSaveStateDepth()
public void setSaveStateDepth(int depth)
depth - zero or the number of states to keep.public UndoRedoSupport.StateStackElement peekAt(int pos)
pos - public java.lang.String getLongUndoDescription(int i)
i -