|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.moml.MoMLUndoEntry
public class MoMLUndoEntry
This is an undo action on the undo/redo stack. The undo/redo stack is stored in an instance of UndoInfoAttribute associated with the top-level of a model. If undo/redo is enabled, a MoMLParser will create entries automatically and put them on the stack whenever it parses MoML. So the easiest mechanism to perform undoable actions is to specify those actions in MoML and issue a MoMLChangeRequest to execute them. An alternative, however, is to create an instance of this class with no MoML, using the single argument constructor, and to override execute() to directly perform the undo.
MoMLParser
,
UndoStackAttribute
,
MoMLChangeRequest
Red (cxh) |
Yellow (eal) |
Field Summary | |
---|---|
private NamedObj |
_context
|
private java.lang.Exception |
_exception
|
private java.lang.String |
_undoMoML
|
Constructor Summary | |
---|---|
MoMLUndoEntry(NamedObj context,
java.lang.String undoMoML)
Create an undo entry comprised of the specified MoML code. |
Method Summary | |
---|---|
void |
changeExecuted(ChangeRequest change)
Do nothing. |
void |
changeFailed(ChangeRequest change,
java.lang.Exception exception)
Record the exception so that execute() can throw it. |
void |
execute()
Parse the MoML specified in the constructor call in the context specified in the constructor call using the parser associated with the context (as determined by ParserAttribute.getParser()). |
java.lang.String |
toString()
Return the MoML of the undo action. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private NamedObj _context
private java.lang.Exception _exception
private java.lang.String _undoMoML
Constructor Detail |
---|
public MoMLUndoEntry(NamedObj context, java.lang.String undoMoML)
context
- The context in which to execute the undo.undoMoML
- The MoML specification of the undo action.Method Detail |
---|
public void changeExecuted(ChangeRequest change)
changeExecuted
in interface ChangeListener
change
- The change that was successfully executed.public void changeFailed(ChangeRequest change, java.lang.Exception exception)
changeFailed
in interface ChangeListener
change
- The change that failed.exception
- The exception that occurred.execute()
public void execute() throws java.lang.Exception
execute
in interface UndoAction
java.lang.Exception
- If something goes wrong.ParserAttribute.getParser(NamedObj)
public 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 |