|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bbn.openmap.MapHandlerChild com.bbn.openmap.OMComponent com.bbn.openmap.event.UndoStack
public class UndoStack
Provides a stack of actions that can be undone/redone. The UndoEvent objects contain the information needed to implement the actions. The UndoStack is told to push UndoEvents on their source objects by UndoStackTriggers using a regular ActionListener/ActionEvent mechanism. The UndoStack is an ActionListener to the triggers (GUI buttons/menu items that say Undo or Redo).
Field Summary | |
---|---|
static java.lang.String |
ClearCmd
|
static java.lang.String |
ClearRedoCmd
|
static java.lang.String |
ClearUndoCmd
|
protected UndoEvent |
currentState
The notion of the current state is important. |
static int |
DEFAULT_MAX_SIZE
|
static java.lang.String |
RedoCmd
|
protected java.util.Stack<UndoEvent> |
redoStack
|
static int |
REMEMBER_ALL
|
protected int |
stackSize
|
protected UndoStackSupport |
triggers
|
static java.lang.String |
UndoCmd
|
protected java.util.Stack<UndoEvent> |
undoStack
|
Fields inherited from class com.bbn.openmap.OMComponent |
---|
i18n, propertyPrefix |
Fields inherited from class com.bbn.openmap.MapHandlerChild |
---|
beanContextChildSupport, isolated |
Fields inherited from interface com.bbn.openmap.PropertyConsumer |
---|
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty |
Constructor Summary | |
---|---|
UndoStack()
|
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent ae)
|
void |
addUndoStackTrigger(UndoStackTrigger trigger)
UndoStackTriggers should call this method to add themselves for stack notifications, and all will be well. |
void |
clearStacks(boolean clearUndoStack,
boolean clearRedoStack)
Clear out the chosen undo stacks and fire an event to update the triggers on stack status. |
void |
fireStackStatus()
|
protected UndoEvent |
getWhatWillHappenNextFromStack(java.util.Stack<UndoEvent> stack)
|
protected void |
redo()
Take a UndoEvent off the forwardStack, and push it on the backStack. |
protected void |
rememberLastThing(UndoEvent event)
Put a new UndoEvent on the backStack, to remember for later in case we need to back up. |
void |
removeUndoStackTrigger(UndoStackTrigger trigger)
UndoStackTriggers should call this method to remove themselves from stack notifications, and all will be well. |
void |
setTheWayThingsAre(UndoEvent event)
Sets the current state of some object on the stack. |
protected void |
undo()
Take a UndoEvent off the backStack, and push it on the forward stack, and invoke the new currentState so the source component gets modified. |
Methods inherited from class com.bbn.openmap.OMComponent |
---|
getProperties, getPropertyInfo, getPropertyPrefix, setProperties, setProperties, setPropertyPrefix |
Methods inherited from class com.bbn.openmap.MapHandlerChild |
---|
addPropertyChangeListener, addVetoableChangeListener, childrenAdded, childrenRemoved, findAndInit, findAndInit, findAndUndo, firePropertyChange, fireVetoableChange, getBeanContext, isIsolated, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext, setIsolated |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_MAX_SIZE
public static final int REMEMBER_ALL
protected transient UndoEvent currentState
protected int stackSize
public static final transient java.lang.String UndoCmd
public static final transient java.lang.String RedoCmd
public static final transient java.lang.String ClearUndoCmd
public static final transient java.lang.String ClearRedoCmd
public static final transient java.lang.String ClearCmd
protected final java.util.Stack<UndoEvent> undoStack
protected final java.util.Stack<UndoEvent> redoStack
protected final UndoStackSupport triggers
Constructor Detail |
---|
public UndoStack()
Method Detail |
---|
public void setTheWayThingsAre(UndoEvent event)
event
- public void actionPerformed(java.awt.event.ActionEvent ae)
actionPerformed
in interface java.awt.event.ActionListener
protected void rememberLastThing(UndoEvent event)
event
- UndoEvent.protected void undo()
protected void redo()
public void clearStacks(boolean clearUndoStack, boolean clearRedoStack)
clearUndoStack
- clear out the undo stack.clearRedoStack
- clear out the redo stack.public void fireStackStatus()
protected UndoEvent getWhatWillHappenNextFromStack(java.util.Stack<UndoEvent> stack)
public void addUndoStackTrigger(UndoStackTrigger trigger)
public void removeUndoStackTrigger(UndoStackTrigger trigger)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |