Class DecoratorAttributes

    • 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 the decoratorName 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 class NamedObj
        Parameters:
        attribute - The attribute that changed.
        Throws:
        IllegalActionException - If the change is not acceptable to this container (not thrown in this base class).
      • 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 interface MoMLExportable
        Overrides:
        exportMoML in class NamedObj
        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).