|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.bs.mdi.Action
org.bs.mdi.CompositeAction
A CompositeAction object consists of one or more single Action objects, and can be handled
like a single Action object. Use this class for grouping similar actions to logical units, which
the user should be able to undo/redo at once.
Think of a text editor for example. It usually won't let you undo a single keystroke, but rather just whole words or lines. The single keystrokes are somehow "glued together" to bigger units. You can use this class to simulate this behaviour.
| Constructor Summary | |
CompositeAction(ActionObservable observable)
Creates a new CompositeAction. |
|
CompositeAction(ActionObservable observable,
String overrideName)
Creates a new CompositeAction and overrides its name. |
|
| Method Summary | |
void |
add(Action action)
Add an action to this CompositeAction. |
void |
applyTo(Data data)
Applies this action to a Data object.
|
void |
applyTo(View view)
Applies this action to a View object.
|
boolean |
clustersWith(Action a)
Returns true if this action should be clustered together with the action given as the parameter. |
Action |
getFirstAction()
Returns the first action of this CompositeAction. |
Action |
getLastAction()
Returns the last action of this CompositeAction |
String |
getName()
Returns the name of the action type. |
boolean |
isUndoable()
Returns true if the action can be made undone. |
void |
remove(Action action)
Remove the given action from this CompositeAction. |
String |
toString()
Returns a string representation of this action. |
void |
undoFrom(Data data)
Undoes this Action from a Data object.
|
void |
undoFrom(View view)
Undoes this Action from a View object.
|
| Methods inherited from class org.bs.mdi.Action |
getSource, isRetarded, setRetarded |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public CompositeAction(ActionObservable observable)
add(org.bs.mdi.Action)) before this CompositeAction can be
considered fully functional.
observable - the source where this CompositeAction originated from
public CompositeAction(ActionObservable observable,
String overrideName)
observable - the source where this CompositeAction originated fromoverrideName - the name to override the default name with| Method Detail |
public void applyTo(Data data)
ActionData object.
Subclasses of Action should implement this method
to initiate a state change on the given data object.
applyTo in class Actiondata - the Data objectpublic void applyTo(View view)
ActionView object.
Subclasses of Action should implement this method
to initiate a state change on the given view object.
applyTo in class Actionview - the View objectpublic void undoFrom(Data data)
ActionData object.
Subclasses of Action should implement this method
to initiate a state change on the given data object.
undoFrom in class Actiondata - the Data objectpublic void undoFrom(View view)
ActionView object.
Subclasses of Action should implement this method
to initiate a state change on the given view object.
undoFrom in class Actionview - the View objectpublic void add(Action action)
action - the action to be addedpublic void remove(Action action)
action - the action to be removedpublic boolean clustersWith(Action a)
ActionCompositeAction.
The actual clustering is done by the RootData object.
The usual calling convention is: oldAction.clustersWith(newAction).
clustersWith in class Actiona - the Action to be tested whether it can be clustered or not
public Action getFirstAction()
public Action getLastAction()
public boolean isUndoable()
Action
isUndoable in class Actionpublic String getName()
Action
getName in class Actionpublic String toString()
Action
toString in class Action
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||