Package ptolemy.kernel.util
Class DecoratorAttributes
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.util.Attribute
-
- ptolemy.kernel.util.DecoratorAttributes
-
- All Implemented Interfaces:
java.lang.Cloneable
,Changeable
,Debuggable
,DebugListener
,Derivable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
- Direct Known Subclasses:
ConstraintMonitor.ConstraintMonitorAttributes
,ExecutionAttributes
,GiottoAttributes
,MapAttributes
,MirrorDecoratorAttributes
,StaticSchedulingDirectorAttributes
,ThrottleAttributes
public class DecoratorAttributes extends Attribute
A container for attributes created by a decorator. This is an attribute that will be contained by a target object that is decorated by a decorator. The parameters that the decorator creates will be contained by an instance of this object. These attributes can be retrieved by usingNamedObj.getDecoratorAttribute(Decorator,String)
orNamedObj.getDecoratorAttributes(Decorator)
.- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Bert Rodiers, Edward A. Lee
- Pt.AcceptedRating:
- Red (rodiers)
- Pt.ProposedRating:
- Yellow (eal)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description protected Decorator
_decorator
The decorator.StringAttribute
decoratorName
The name of the decorator relative to the top-level of the model, to be stored in a MoML file to re-establish the connection with a decorator after saving and re-parsing the file.-
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
-
-
Constructor Summary
Constructors Constructor Description DecoratorAttributes(NamedObj container, java.lang.String name)
Construct a DecoratorAttributes instance with the given name and container.DecoratorAttributes(NamedObj container, Decorator decorator)
Construct a DecoratorAttributes instance to contain the decorator parameter for the specified container provided by the specified decorator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
attributeChanged(Attribute attribute)
Override the base class to establish a link to the decorator if the argument is decoratorName.java.lang.Object
clone(Workspace workspace)
Clone the object into the specified workspace.void
exportMoML(java.io.Writer output, int depth, java.lang.String name)
Override the base class to first set the decoratorName attribute to the current name of the associated decorator, and then export using the superclass.Decorator
getDecorator()
Return the decorator that is responsible for this DecoratorAttributes instance.-
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setContainer, setName, updateContent
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _description, _executeChangeRequests, _exportMoMLContents, _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, 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
-
-
-
-
Field Detail
-
decoratorName
public StringAttribute decoratorName
The name of the decorator relative to the top-level of the model, to be stored in a MoML file to re-establish the connection with a decorator after saving and re-parsing the file. The name is relative to the top-level, rather than the full name, so that SaveAs works (where the name of the toplevel changes). FIXME: However, if you save a submodel, then this will not work! This is a string that is not visible to the user.
-
_decorator
protected Decorator _decorator
The decorator.
-
-
Constructor Detail
-
DecoratorAttributes
public DecoratorAttributes(NamedObj container, Decorator decorator) throws IllegalActionException, NameDuplicationException
Construct a DecoratorAttributes instance to contain the decorator parameter for the specified container provided by the specified decorator. This constructor is used when retrieving decorator parameters from a target NamedObj that does not yet have the decorator parameters.- Parameters:
container
- The target for the decorator.decorator
- The decorator.- Throws:
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. This should not occur.
-
DecoratorAttributes
public DecoratorAttributes(NamedObj container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Construct a DecoratorAttributes instance with the given name and container. This constructor is used when parsing MoML files, where it is assumed that the decorator is specified by name as the value of thedecoratorName
parameter.- Parameters:
container
- The container of this object.name
- The name of this attribute.- Throws:
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.
-
-
Method Detail
-
attributeChanged
public void attributeChanged(Attribute attribute) throws IllegalActionException
Override the base class to establish a link to the decorator if the argument is decoratorName.- Overrides:
attributeChanged
in classNamedObj
- Parameters:
attribute
- The attribute that changed.- Throws:
IllegalActionException
- If the change is not acceptable to this container (not thrown in this base class).
-
clone
public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
Clone the object into the specified workspace.- Overrides:
clone
in classAttribute
- Parameters:
workspace
- The workspace for the cloned object.- Returns:
- The new Attribute.
- Throws:
java.lang.CloneNotSupportedException
- Not thrown in this base class- See Also:
NamedObj.exportMoML(Writer, int, String)
,NamedObj.setDeferringChangeRequests(boolean)
-
exportMoML
public void exportMoML(java.io.Writer output, int depth, java.lang.String name) throws java.io.IOException
Override the base class to first set the decoratorName attribute to the current name of the associated decorator, and then export using the superclass.- Specified by:
exportMoML
in interfaceMoMLExportable
- Overrides:
exportMoML
in classNamedObj
- Parameters:
output
- The output stream to write to.depth
- The depth in the hierarchy, to determine indenting.name
- The name of we use when exporting the description.- Throws:
java.io.IOException
- If an I/O error occurs.- See Also:
NamedObj.exportMoML(Writer, int)
-
getDecorator
public Decorator getDecorator() throws IllegalActionException
Return the decorator that is responsible for this DecoratorAttributes instance.- Returns:
- The decorator, or null if there is none.
- Throws:
IllegalActionException
- If the decorator cannot be determined (e.g., a parameter cannot be evaluated).
-
-