## org.autoplot.state.UndoRedoSupport

UndoRedoSupport keeps track of a series of application states, providing "undo" and "redo" operations.

## UndoRedoSupport( org.autoplot.ApplicationModel applicationModel )

Creates a new instance of UndoRedoSupport

## PROP_REDOLABEL

## PROP_SIZE_LIMIT

name of the property containing the number of states kept

## PROP_DEPTH

property name of the current depth

## PROP_SAVE_STATE_DEPTH

the number of states to keep in the states folder. Presently this is only implemented so that 0 disables the feature.

addPropertyChangeListener( String propertyName, java.beans.PropertyChangeListener listener ) → void [view source]
addPropertyChangeListener( java.beans.PropertyChangeListener listener ) → void [view source]

## getDepth

getDepth( ) → int

get the current depth, where depth can be lower than the number of states held, when redos can be done.

### Returns:

the current depth.
[search for examples] [view on GitHub] [view on old javadoc]

## getLongUndoDescription

getLongUndoDescription( int i ) → String

used for feedback.

### Parameters

i - an int

### Returns:

a String
[search for examples] [view on GitHub] [view on old javadoc]

## getRedoAction

getRedoAction( ) → javax.swing.Action

get the action to trigger redo.

### Returns:

action that can be attached to button.
[search for examples] [view on GitHub] [view on old javadoc]

## getRedoDescription

getRedoDescription( ) → String

get the longer description for the action, intended to be used for the tooltip.

### Returns:

a String
[search for examples] [view on GitHub] [view on old javadoc]

## getRedoLabel

getRedoLabel( ) → String

returns a label describing the redo operation, or null if the operation doesn't exist.

### Returns:

the label
[search for examples] [view on GitHub] [view on old javadoc]

## getSaveStateDepth

getSaveStateDepth( ) → int

get the current number of persistent states stored in autoplot_data/state

### Returns:

an int
[search for examples] [view on GitHub] [view on old javadoc]

## getSizeLimit

getSizeLimit( ) → int

get the number of states which will be kept

### Returns:

size
[search for examples] [view on GitHub] [view on old javadoc]

## getUndoAction

getUndoAction( ) → javax.swing.Action

get the action to trigger undo.

### Returns:

action that can be attached to button.
[search for examples] [view on GitHub] [view on old javadoc]

## getUndoDescription

getUndoDescription( ) → String

get the longer description for the action, intended to be used for the tooltip.

### Returns:

a human-readable description
[search for examples] [view on GitHub] [view on old javadoc]

## getUndoLabel

getUndoLabel( ) → String

returns a label describing the undo operation, or null if the operation doesn't exist.

### Returns:

the label
[search for examples] [view on GitHub] [view on old javadoc]

## isIgnoringUpdates

isIgnoringUpdates( ) → boolean

Getter for property ignoringUpdates.

### Returns:

Value of property ignoringUpdates.
[search for examples] [view on GitHub] [view on old javadoc]

## peekAt

peekAt( int pos ) → org.autoplot.state.UndoRedoSupport.StateStackElement

allow scripts to peek into undo/redo stack for debugging.

### Parameters

pos - an int

### Returns:

an org.autoplot.state.UndoRedoSupport.StateStackElement
[search for examples] [view on GitHub] [view on old javadoc]

## pushState

pushState( java.beans.PropertyChangeEvent ev ) → void

request that a state be pushed onto the state stack.

### Parameters

ev - a PropertyChangeEvent

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc]

## pushState

pushState( java.beans.PropertyChangeEvent ev, String label ) → void

push the current state of the application onto the stack.

### Parameters

ev - a PropertyChangeEvent
label - a String

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc]

## redo

redo( ) → void

redo the state change that was undone, popping up the state stack one position.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc]

## refreshUndoMultipleMenu

refreshUndoMultipleMenu( javax.swing.JMenu undoMultipleMenu ) → void

create all the menu items for a JMenu offering undo targets.

### Parameters

undoMultipleMenu - the menu

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc]
removePropertyChangeListener( String propertyName, java.beans.PropertyChangeListener listener ) → void [view source]
removePropertyChangeListener( java.beans.PropertyChangeListener listener ) → void [view source]

## resetHistory

resetHistory( ) → void

reset the history, for example after a vap file is loaded.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc]

## setIgnoringUpdates

setIgnoringUpdates( boolean ignoringUpdates ) → void

Setter for property ignoringUpdates.

### Parameters

ignoringUpdates - New value of property ignoringUpdates.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc]

## setSaveStateDepth

setSaveStateDepth( int depth ) → void

set the number of persistent states to keep, or 0 will disable the feature.

### Parameters

depth - zero or the number of states to keep.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc]

## setSizeLimit

setSizeLimit( int size ) → void

set the number of states which will be kept

### Parameters

size - an int

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc]

## undo

undo( ) → void

undo the last state change.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc]

## undo

undo( int level ) → void

reset the application to an old state from the state stack.

### Parameters

level - the number of states to undo (1 is jump to the last state).

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc]