public class MoMLModelAttribute extends Attribute implements Configurable
configure(URL, String, String)
,
or by including the MoML within <configure> tags in a MoML file.
The MoML is returned by the getConfigureText()
method.
The getContainedModel()
method returns the model specified
by the MoML.
When an instance of this attribute is exported to MoML, the MoML description above will be included in the exported MoML within <configure> tags.
An instance of this attribute may wish to override the default "Look Inside" behavior by including an instance of ptolemy.vergil.toolbox.MoMLModelAttributeControllerFactory as an attribute contained by this instance. Instead of having an explicit compile-time dependency between this class and MoMLModelAttributeControllerFactory, derived classes should use MoML to set up the containment relationship. For example,
<property name="MyAttribute" class="ptolemy.moml.MoMLModelAttribute"> <property name="_controllerFactory" class="ptolemy.vergil.toolbox.MoMLModelAttributeControllerFactory"> </property> <configure> ... my MoML text here ... </configure> </property>
Red (tfeng) |
Red (tfeng) |
NamedObj.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
protected NamedObj |
_model
The contained model.
|
FileParameter |
modelURL
URL from which to get the model.
|
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
Constructor and Description |
---|
MoMLModelAttribute(NamedObj container,
java.lang.String name)
Create a model attribute with the specified container and name.
|
Modifier and Type | Method and Description |
---|---|
protected void |
_exportMoMLContents(java.io.Writer output,
int depth)
Write a MoML description this object, which includes a
MoML description of the contained model within the <configure> tag.
|
void |
attributeChanged(Attribute attribute)
React to a change in an attribute.
|
java.lang.Object |
clone(Workspace workspace)
Return a clone of this model attribute.
|
void |
configure(java.net.URL base,
java.lang.String source,
java.lang.String text)
Construct and configure the contained model with the specified source and
text.
|
java.lang.String |
getConfigureSource()
Return the input source that was specified the last time the configure
method was called.
|
java.lang.String |
getConfigureText()
Return the MoML description of the model, if there is one, and
null otherwise.
|
NamedObj |
getContainedModel()
Return the contained model.
|
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setContainer, setName, updateContent
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _description, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
public FileParameter modelURL
$CLASSPATH/{relative URL}
.protected NamedObj _model
public MoMLModelAttribute(NamedObj container, java.lang.String name) throws NameDuplicationException, IllegalActionException
container
- The specified container.name
- The specified name.IllegalActionException
- If the attribute is not of an
acceptable class for the container, or if the name contains a period.NameDuplicationException
- If the name coincides with an
attribute already in the container.public void attributeChanged(Attribute attribute) throws IllegalActionException
attributeChanged
in class NamedObj
attribute
- The attribute that changed.IllegalActionException
- Thrown if the URL string contained in the
modelURL attribute is not valid.public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class Attribute
workspace
- The workspace for the cloned object.java.lang.CloneNotSupportedException
- Thrown if an error occurs while
cloning the attribute or the contained model.NamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
public void configure(java.net.URL base, java.lang.String source, java.lang.String text) throws java.lang.Exception
configure
in interface Configurable
base
- The base URL for relative references, or null if not known.source
- The URI of a document providing source, which if specified,
will be used to obtain the text. In that case, the text argument will be
ignored.text
- The MoML description.java.lang.Exception
- If the parsing fails.public java.lang.String getConfigureSource()
getConfigureSource
in interface Configurable
public java.lang.String getConfigureText()
getConfigureText
in interface Configurable
public NamedObj getContainedModel()
protected void _exportMoMLContents(java.io.Writer output, int depth) throws java.io.IOException
_exportMoMLContents
in class NamedObj
output
- The output stream to write to.depth
- The depth in the hierarchy, to determine indenting.java.io.IOException
- If an I/O error occurs.NamedObj.exportMoML(Writer, int)