|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.moml.UndoContext
public class UndoContext
Holds information about the current undo context. It is used while parsing an incremental model change to hold the following information:
At the end of an element, if the context is undoable, then the undo MoML is generated by taking the main undo MoML StringBuffer, appending the undo MoML for children in the reverse order to the order they were parsed, and finally appending any closing undo MoML that is present.
Red (cxh) |
Red (cxh) |
Field Summary | |
---|---|
private boolean |
_childrenUndoable
|
private java.lang.StringBuffer |
_closingUndoMoML
|
private boolean |
_undoable
|
private java.util.Stack |
_undoChildEntries
|
private java.lang.StringBuffer |
_undoMoML
|
Constructor Summary | |
---|---|
UndoContext(boolean undoableContext)
Create a new UndoContext which may or may not need undo MoML generated. |
Method Summary | |
---|---|
void |
appendClosingUndoMoML(java.lang.String undoMoML)
Append some MoML to be appended after the undo MoML for child nodes. |
void |
appendUndoMoML(java.lang.String undoMoML)
Append some MoML to the current buffer. |
void |
applyRename(java.lang.String newName)
Used to handle the "rename" element. |
java.lang.String |
generateUndoEntry()
Generate the undo entry by processing children entries and the closing undo MoML. |
java.lang.String |
getUndoMoML()
Get the undo MoML for this element as it currently stands. |
boolean |
hasUndoableChildren()
Return whether or not child nodes need to generate MoML. |
boolean |
hasUndoMoML()
Return whether or not this context has any undo MoML to be processed. |
boolean |
isUndoable()
Tells if the current context is undoable or not. |
static java.lang.String |
moveContextEnd(NamedObj context,
NamedObj containee)
Return the closing element corresponding to the starting element returned by moveContextStart(), or an empty string if none is needed. |
static java.lang.String |
moveContextStart(NamedObj context,
NamedObj containee)
Return the MoML start element to put us in the context of the immediate container of the containee, assuming the current context is as given by the context argument. |
void |
pushUndoEntry(java.lang.String entry)
Push the passed in MoML onto the stack of element undo entries. |
void |
setChildrenUndoable(boolean isUndoable)
Set whether or not the child contexts are undoable. |
void |
setUndoable(boolean isUndoable)
Set whether or not the current context is undoable. |
java.lang.String |
toString()
Return a string representation of this object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private boolean _childrenUndoable
private boolean _undoable
private java.lang.StringBuffer _undoMoML
private java.lang.StringBuffer _closingUndoMoML
private java.util.Stack _undoChildEntries
Constructor Detail |
---|
public UndoContext(boolean undoableContext)
undoableContext
- Whether or not undo MoML is required for this
contextMethod Detail |
---|
public void appendClosingUndoMoML(java.lang.String undoMoML)
undoMoML
- The MoMl to be appended after any child nodespublic void appendUndoMoML(java.lang.String undoMoML)
undoMoML
- The undo MoML to append to the current buffer.public void applyRename(java.lang.String newName) throws IllegalActionException
newName
- the value to give to the value of the name attribute.
IllegalActionException
- if there is currently no undo MoML at
this level, or if there is no name attribute present.public java.lang.String generateUndoEntry()
public java.lang.String getUndoMoML()
public boolean hasUndoMoML()
public boolean hasUndoableChildren()
public boolean isUndoable()
public static java.lang.String moveContextEnd(NamedObj context, NamedObj containee)
For example, if the containee is not already immediately contained, and the container is an entity, the </entity> is appended to the model.
context
- The current context.containee
- The containee whose immediate context we want.
moveContextStart(NamedObj, NamedObj)
public static java.lang.String moveContextStart(NamedObj context, NamedObj containee)
For example, if the context has full name ".top" and the containee has full name ".top.a.b.c.d", then MoML to move down the model such as the following is returned: <entity name="a.b.c" >
context
- The current context.containee
- The containee whose immediate context we want.
moveContextEnd(NamedObj, NamedObj)
public void pushUndoEntry(java.lang.String entry)
entry
- Description of Parameterpublic void setChildrenUndoable(boolean isUndoable)
isUndoable
- the new statetpublic void setUndoable(boolean isUndoable)
isUndoable
- the new statetpublic java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |