Package org.apache.batik.apps.svgbrowser
Class HistoryBrowser
java.lang.Object
org.apache.batik.apps.svgbrowser.HistoryBrowser
History browser. Manages perform of execute, undo and redo actions.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Wrapps the command's execute, undo and redo methods.static class
Contains the info on the command name being executed, undone or redone and last undoable and redoable command names.static class
Lets the DOMViewerController wrap the commands.static class
The adapter to provide the default behavior.static class
Event to pass to listener.static interface
The HistoryBrowserListener. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected HistoryBrowser.CommandController
Tells the history browser how to execute, undo and redo the commands.protected int
Current command pointer in history array.protected EventListenerList
Listeners list.static final int
The history browser is executing the command(s).protected ArrayList
Command history.protected int
History size.static final int
The history browser is in idle state - no command is being executed, undone or redone.static final int
The history browser is redoing the command(s).protected int
The current state of the history browser.static final int
The history browser is undoing the command(s). -
Constructor Summary
ConstructorsConstructorDescriptionHistoryBrowser
(int historySize) Constructor.HistoryBrowser
(HistoryBrowser.CommandController commandController) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCommand
(UndoableCommand command) Adds the given command to history array and executes it.void
Adds the listener to the listener list.void
compoundRedo
(int redoNumber) Performs redo action the given number of times.void
compoundUndo
(int undoNumber) Performs undo action the given number of times.void
Fires the compoundEditPerformed event.void
Fires the doCompoundEdit event.void
Fires the executePerformed event.void
Fires the historyReset event.void
Fires the redoPerformed event.void
Fires the undoPerformed event.Gets the last redoable command name.Gets the last undoable command name.int
getState()
Gets the state of this history browser.void
redo()
Redoes the last 'undone' command.void
Clears the history array.void
setCommandController
(HistoryBrowser.CommandController newCommandController) Sets the commandController.protected void
setHistorySize
(int size) Setter for the history size.void
undo()
Undoes the last executed or 'redone' command.
-
Field Details
-
EXECUTING
public static final int EXECUTINGThe history browser is executing the command(s).- See Also:
-
UNDOING
public static final int UNDOINGThe history browser is undoing the command(s).- See Also:
-
REDOING
public static final int REDOINGThe history browser is redoing the command(s).- See Also:
-
IDLE
public static final int IDLEThe history browser is in idle state - no command is being executed, undone or redone.- See Also:
-
eventListeners
Listeners list. -
history
Command history. -
currentCommandIndex
protected int currentCommandIndexCurrent command pointer in history array. -
historySize
protected int historySizeHistory size. -
state
protected int stateThe current state of the history browser. -
commandController
Tells the history browser how to execute, undo and redo the commands. Wraps the execute, undo and redo methods
-
-
Constructor Details
-
HistoryBrowser
Constructor. -
HistoryBrowser
public HistoryBrowser(int historySize) Constructor.- Parameters:
historySize
- History size
-
-
Method Details
-
setHistorySize
protected void setHistorySize(int size) Setter for the history size.- Parameters:
size
- New history size
-
setCommandController
Sets the commandController.- Parameters:
newCommandController
- The newCommandController to set
-
addCommand
Adds the given command to history array and executes it.- Parameters:
command
- The given command
-
undo
public void undo()Undoes the last executed or 'redone' command. -
redo
public void redo()Redoes the last 'undone' command. -
compoundUndo
public void compoundUndo(int undoNumber) Performs undo action the given number of times.- Parameters:
undoNumber
- The given number of undo actions to perform
-
compoundRedo
public void compoundRedo(int redoNumber) Performs redo action the given number of times.- Parameters:
redoNumber
- The given number of redo actions to perform
-
getLastUndoableCommandName
Gets the last undoable command name.- Returns:
- String or "" if there's no any
-
getLastRedoableCommandName
Gets the last redoable command name.- Returns:
- String or "" if there's no any
-
resetHistory
public void resetHistory()Clears the history array. -
getState
public int getState()Gets the state of this history browser.- Returns:
- the state
-
addListener
Adds the listener to the listener list.- Parameters:
listener
- The listener to add
-
fireExecutePerformed
Fires the executePerformed event.- Parameters:
event
- The associated HistoryBrowserEvent event
-
fireUndoPerformed
Fires the undoPerformed event.- Parameters:
event
- The associated HistoryBrowserEvent event
-
fireRedoPerformed
Fires the redoPerformed event.- Parameters:
event
- The associated HistoryBrowserEvent event
-
fireHistoryReset
Fires the historyReset event.- Parameters:
event
- The associated HistoryBrowserEvent event
-
fireDoCompoundEdit
Fires the doCompoundEdit event.- Parameters:
event
- The associated HistoryBrowserEvent event
-
fireCompoundEditPerformed
Fires the compoundEditPerformed event.- Parameters:
event
- The associated HistoryBrowserEvent event
-