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 interfaceWrapps the command's execute, undo and redo methods.static classContains the info on the command name being executed, undone or redone and last undoable and redoable command names.static classLets the DOMViewerController wrap the commands.static classThe adapter to provide the default behavior.static classEvent to pass to listener.static interfaceThe HistoryBrowserListener. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected HistoryBrowser.CommandControllerTells the history browser how to execute, undo and redo the commands.protected intCurrent command pointer in history array.protected EventListenerListListeners list.static final intThe history browser is executing the command(s).protected ArrayListCommand history.protected intHistory size.static final intThe history browser is in idle state - no command is being executed, undone or redone.static final intThe history browser is redoing the command(s).protected intThe current state of the history browser.static final intThe history browser is undoing the command(s). -
Constructor Summary
ConstructorsConstructorDescriptionHistoryBrowser(int historySize) Constructor.HistoryBrowser(HistoryBrowser.CommandController commandController) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCommand(UndoableCommand command) Adds the given command to history array and executes it.voidAdds the listener to the listener list.voidcompoundRedo(int redoNumber) Performs redo action the given number of times.voidcompoundUndo(int undoNumber) Performs undo action the given number of times.voidFires the compoundEditPerformed event.voidFires the doCompoundEdit event.voidFires the executePerformed event.voidFires the historyReset event.voidFires the redoPerformed event.voidFires the undoPerformed event.Gets the last redoable command name.Gets the last undoable command name.intgetState()Gets the state of this history browser.voidredo()Redoes the last 'undone' command.voidClears the history array.voidsetCommandController(HistoryBrowser.CommandController newCommandController) Sets the commandController.protected voidsetHistorySize(int size) Setter for the history size.voidundo()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
-