public class HistoryBrowser
extends java.lang.Object
| Modifier and Type | Class | Description |
|---|---|---|
static interface |
HistoryBrowser.CommandController |
Wrapps the command's execute, undo and redo methods.
|
static class |
HistoryBrowser.CommandNamesInfo |
Contains the info on the command name being executed, undone or redone and
last undoable and redoable command names.
|
static class |
HistoryBrowser.DocumentCommandController |
Lets the DOMViewerController wrap the commands.
|
static class |
HistoryBrowser.HistoryBrowserAdapter |
The adapter to provide the default behavior.
|
static class |
HistoryBrowser.HistoryBrowserEvent |
Event to pass to listener.
|
static interface |
HistoryBrowser.HistoryBrowserListener |
The HistoryBrowserListener.
|
| Modifier and Type | Field | Description |
|---|---|---|
protected HistoryBrowser.CommandController |
commandController |
Tells the history browser how to execute, undo and redo the commands.
|
protected int |
currentCommandIndex |
Current command pointer in history array.
|
protected javax.swing.event.EventListenerList |
eventListeners |
Listeners list.
|
static int |
EXECUTING |
The history browser is executing the command(s).
|
protected java.util.ArrayList |
history |
Command history.
|
protected int |
historySize |
History size.
|
static int |
IDLE |
The history browser is in idle state - no command is being executed,
undone or redone.
|
static int |
REDOING |
The history browser is redoing the command(s).
|
protected int |
state |
The current state of the history browser.
|
static int |
UNDOING |
The history browser is undoing the command(s).
|
| Constructor | Description |
|---|---|
HistoryBrowser(int historySize) |
Constructor.
|
HistoryBrowser(HistoryBrowser.CommandController commandController) |
Constructor.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
addCommand(UndoableCommand command) |
Adds the given command to history array and executes it.
|
void |
addListener(HistoryBrowser.HistoryBrowserListener listener) |
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 |
fireCompoundEditPerformed(HistoryBrowser.HistoryBrowserEvent event) |
Fires the compoundEditPerformed event.
|
void |
fireDoCompoundEdit(HistoryBrowser.HistoryBrowserEvent event) |
Fires the doCompoundEdit event.
|
void |
fireExecutePerformed(HistoryBrowser.HistoryBrowserEvent event) |
Fires the executePerformed event.
|
void |
fireHistoryReset(HistoryBrowser.HistoryBrowserEvent event) |
Fires the historyReset event.
|
void |
fireRedoPerformed(HistoryBrowser.HistoryBrowserEvent event) |
Fires the redoPerformed event.
|
void |
fireUndoPerformed(HistoryBrowser.HistoryBrowserEvent event) |
Fires the undoPerformed event.
|
java.lang.String |
getLastRedoableCommandName() |
Gets the last redoable command name.
|
java.lang.String |
getLastUndoableCommandName() |
Gets the last undoable command name.
|
int |
getState() |
Gets the state of this history browser.
|
void |
redo() |
Redoes the last 'undone' command.
|
void |
resetHistory() |
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.
|
public static final int EXECUTING
public static final int UNDOING
public static final int REDOING
public static final int IDLE
protected javax.swing.event.EventListenerList eventListeners
protected java.util.ArrayList history
protected int currentCommandIndex
protected int historySize
protected int state
protected HistoryBrowser.CommandController commandController
public HistoryBrowser(HistoryBrowser.CommandController commandController)
public HistoryBrowser(int historySize)
historySize - History sizeprotected void setHistorySize(int size)
size - New history sizepublic void setCommandController(HistoryBrowser.CommandController newCommandController)
newCommandController - The newCommandController to setpublic void addCommand(UndoableCommand command)
command - The given commandpublic void undo()
public void redo()
public void compoundUndo(int undoNumber)
undoNumber - The given number of undo actions to performpublic void compoundRedo(int redoNumber)
redoNumber - The given number of redo actions to performpublic java.lang.String getLastUndoableCommandName()
public java.lang.String getLastRedoableCommandName()
public void resetHistory()
public int getState()
public void addListener(HistoryBrowser.HistoryBrowserListener listener)
listener - The listener to addpublic void fireExecutePerformed(HistoryBrowser.HistoryBrowserEvent event)
event - The associated HistoryBrowserEvent eventpublic void fireUndoPerformed(HistoryBrowser.HistoryBrowserEvent event)
event - The associated HistoryBrowserEvent eventpublic void fireRedoPerformed(HistoryBrowser.HistoryBrowserEvent event)
event - The associated HistoryBrowserEvent eventpublic void fireHistoryReset(HistoryBrowser.HistoryBrowserEvent event)
event - The associated HistoryBrowserEvent eventpublic void fireDoCompoundEdit(HistoryBrowser.HistoryBrowserEvent event)
event - The associated HistoryBrowserEvent eventpublic void fireCompoundEditPerformed(HistoryBrowser.HistoryBrowserEvent event)
event - The associated HistoryBrowserEvent eventCopyright ? 2018 Apache Software Foundation. All Rights Reserved.