|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.kernel.util.ChangeRequest
ptolemy.moml.MoMLChangeRequest
public class MoMLChangeRequest
A mutation request specified in MoML. This class provides the preferred mechanism for implementing mutations on a model while it is executing. To use it, create an instance of this class, specifying MoML code as an argument to the constructor. Then queue the instance of this class with a composite entity by calling its requestChange() method.
If a context is given to the constructor, then the MoML will be executed in that context. If that context has other objects that defer their MoML definitions to it (i.e., it is a class definition and there are instances of the class), then the MoML will also be executed in the context of those objects that defer to it. Thus, the change to a class will propagate to instances. If the context is (deeply) contained by another object that has objects that defer their MoML definitions to it, then the changes are also propagated to those objects. Thus, even when class definitions are nested within class definitions, a change within a class definition will propagate to all instances of the class(es).
The parser used to implement the change will be the parser contained by a ParserAttribute of the top-level element of the context. If no context is given, or there is no ParserAttribute in its top level, then a new parser is created, and a new ParserAttribute is placed in the top level.
Note that if a context is specified that is above a class definition, and a change within the class definition is made by referencing the contents of the class definition using dotted names, then the change will not propagate. Thus, changes should be made in the most specific context (lowest level in the hierarchy) possible.
Red (neuendor) |
Yellow (eal) |
Field Summary | |
---|---|
private java.net.URL |
_base
|
private NamedObj |
_context
|
private static boolean |
_DEBUG
|
private boolean |
_mergeWithPreviousUndo
|
private MoMLParser |
_parser
|
private boolean |
_reportToHandler
|
private boolean |
_undoable
|
Constructor Summary | |
---|---|
MoMLChangeRequest(java.lang.Object originator,
NamedObj context,
java.lang.String request)
Construct a mutation request to be executed in the specified context. |
|
MoMLChangeRequest(java.lang.Object originator,
NamedObj context,
java.lang.String request,
java.net.URL base)
Construct a mutation request to be executed in the specified context. |
|
MoMLChangeRequest(java.lang.Object originator,
java.lang.String request)
Construct a mutation request. |
Method Summary | |
---|---|
protected void |
_execute()
Execute the change by evaluating the request and propagating the request if appropriate. |
protected void |
_postParse(MoMLParser parser)
Do nothing. |
protected void |
_preParse(MoMLParser parser)
Do nothing. |
NamedObj |
getContext()
Return the context specified in the constructor, or null if none was specified. |
static NamedObj |
getDeferredToParent(NamedObj object)
Deprecated. No longer needed; just use the specified object as a context. |
void |
setMergeWithPreviousUndo(boolean mergeWithPrevious)
Set whether or not the undo from this change should be merged with the previous undoable change. |
void |
setReportErrorsToHandler(boolean report)
Specify whether or not to report errors via the handler that is registered with the parser. |
void |
setUndoable(boolean undoable)
Set whether or not this change is undoable. |
Methods inherited from class ptolemy.kernel.util.ChangeRequest |
---|
addChangeListener, execute, getDescription, getLocality, getSource, isErrorReported, isPersistent, isStructuralChange, removeChangeListener, setDescription, setErrorReported, setListeners, setPersistent, waitForCompletion |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.net.URL _base
private NamedObj _context
private static boolean _DEBUG
private boolean _mergeWithPreviousUndo
private MoMLParser _parser
private boolean _reportToHandler
private boolean _undoable
Constructor Detail |
---|
public MoMLChangeRequest(java.lang.Object originator, java.lang.String request)
originator
- The originator of the change request.request
- The mutation request in MoML.public MoMLChangeRequest(java.lang.Object originator, NamedObj context, java.lang.String request)
originator
- The originator of the change request.context
- The context in which to execute the MoML.request
- The mutation request in MoML.public MoMLChangeRequest(java.lang.Object originator, NamedObj context, java.lang.String request, java.net.URL base)
originator
- The originator of the change request.context
- The context in which to execute the MoML.request
- The mutation request in MoML.base
- The URL relative to which external references should
be resolved.Method Detail |
---|
public NamedObj getContext()
public static NamedObj getDeferredToParent(NamedObj object)
object
- The NamedObj to which other objects defer their MoML
definitions.
public void setUndoable(boolean undoable)
undoable
- whether or not this change should be treated
as an incremental change that is undoablepublic void setMergeWithPreviousUndo(boolean mergeWithPrevious)
mergeWithPrevious
- whether or not this change should be mergedpublic void setReportErrorsToHandler(boolean report)
report
- False to disable error reporting.ErrorHandler
protected void _execute() throws java.lang.Exception
_execute
in class ChangeRequest
java.lang.Exception
- If an exception is thrown
while evaluating the request.protected void _postParse(MoMLParser parser)
parser
- The parserprotected void _preParse(MoMLParser parser)
parser
- The parser
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |