|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.bs.mdi.Data
Represents a piece of information in a document.
Data objects can be nested, but there is only one
RootData object which is directly associated with
the document.
| Constructor Summary | |
protected |
Data()
Creates a new Data object which has no parent element and no associated Document object. |
protected |
Data(Document document)
Creates a new Data object which has no parent element. |
protected |
Data(Document document,
Data parent)
Creates a new Data object. |
| Method Summary | |
void |
actionPerformed(ActionObservable observable,
Action action)
Called from the ActionObservable when an action has been performed or redone. |
void |
actionUndone(ActionObservable observable,
Action action)
Called from the ActionObservable when an action has been undone. |
void |
addChild(Data child)
Adds a child element. |
void |
addObserver(ActionObserver observer)
Registers this observer so that it will receive notification messages. |
void |
applyAction(Action action)
Applies an action or perform a redo. |
protected Action |
coalesceAction(Action a)
Glues similar consecutive Actions together. |
int |
countChildren()
Counts all child elements. |
int |
countObservers()
Counts all registered observers. |
Data |
getChild(int index)
Gets the child element at the specified index. |
Document |
getDocument()
Returns the document associated with this Data object. |
Data |
getParentData()
Gets the parent Data object, or null if there is no parent object (i.e. this is probably a RootData object). |
boolean |
isObserver(ActionObserver observer)
Determines if the given observer is currently observing this object. |
void |
notifyObservers(Action action,
boolean undo)
Notifies the observers about an action which has been recently performed. |
void |
removeChild(Data child)
Removes a child element. |
void |
removeObserver(ActionObserver observer)
Un-registers this observer so that it will not receive notifications any longer. |
void |
setDocument(Document document)
Associates this Data object with the given document. |
void |
undoAction(Action action)
Perform an undo. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
protected Data()
protected Data(Document document)
document - the Document which this Data object belongs to
protected Data(Document document,
Data parent)
parent.addChild(this) if parent
is not null.
document - the Document which this Data object belongs toparent - the parent element of this Data object| Method Detail |
public Document getDocument()
public void setDocument(Document document)
UndoManager.
document - the documentpublic Data getParentData()
RootData object).
public void addChild(Data child)
child - the child elementpublic void removeChild(Data child)
child - the child elementpublic int countChildren()
public Data getChild(int index)
index - the index
public void addObserver(ActionObserver observer)
ActionObservable
addObserver in interface ActionObservableobserver - the observer to be registeredpublic void removeObserver(ActionObserver observer)
ActionObservable
removeObserver in interface ActionObservableobserver - the observer to be un-registeredpublic int countObservers()
ActionObservable
countObservers in interface ActionObservablepublic boolean isObserver(ActionObserver observer)
ActionObservable
isObserver in interface ActionObservableobserver - the observer
public void notifyObservers(Action action,
boolean undo)
ActionObservable
notifyObservers in interface ActionObservableaction - the action which has been performedundo - true if the action has been undone, false otherwise
public void actionPerformed(ActionObservable observable,
Action action)
ActionObserverActionObservable when an action has been performed or redone.
actionPerformed in interface ActionObserverobservable - the observable which this notification originated fromaction - the action which has been performed
public void actionUndone(ActionObservable observable,
Action action)
ActionObserverActionObservable when an action has been undone.
actionUndone in interface ActionObserverobservable - the observable which this notification originated fromaction - the action which has been undonepublic void applyAction(Action action)
ActionProcessor
applyAction in interface ActionProcessoraction - the action to be applied or redonepublic void undoAction(Action action)
ActionProcessor
undoAction in interface ActionProcessoraction - the action to be undoneprotected Action coalesceAction(Action a)
a - the recently occurred action
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||