Class AttributeValueAttribute

    • Field Detail

      • attributeName

        public StringAttribute attributeName
        The name of the attribute of the container whose value to display.
      • displayWidth

        public Parameter displayWidth
        The number of characters to display. This is an integer, with default value 6.
      • useExpression

        public Parameter useExpression
        If true, display the expression rather than the value. This is a boolean that defaults to false.
      • _displayWidth

        protected int _displayWidth
        Most recent value of the rounding parameter.
      • _attribute

        protected Settable _attribute
        The associated attribute.
    • Constructor Detail

      • AttributeValueAttribute

        public AttributeValueAttribute​(NamedObj container,
                                       java.lang.String name)
                                throws IllegalActionException,
                                       NameDuplicationException
        Construct an attribute with the given name contained by the specified container. The container argument must not be null, or a NullPointerException will be thrown. This attribute will use the workspace of the container for synchronization and version counts. If the name argument is null, then the name is set to the empty string. Increment the version of the workspace.
        Parameters:
        container - The container.
        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

      • valueChanged

        public void valueChanged​(Settable settable)
        React to a change in the value of the associated attribute.
        Specified by:
        valueChanged in interface ValueListener
        Parameters:
        settable - The object that has changed value.
      • addValueListener

        public void addValueListener​(ValueListener listener)
        Add a listener to be notified when the value of this settable object changes. This implementation ignores the argument, so listeners to this object are not notified of changes in value.
        Specified by:
        addValueListener in interface Settable
        Parameters:
        listener - The listener to add.
        See Also:
        removeValueListener(ValueListener)
      • getDefaultExpression

        public java.lang.String getDefaultExpression()
        Return the default value of this attribute, if there is one, or null if there is none.
        Specified by:
        getDefaultExpression in interface Settable
        Returns:
        The default value of this attribute, or null if there is none.
      • getExpression

        public java.lang.String getExpression()
        Get the value of the attribute that has been set by setExpression(), or null if there is none.
        Specified by:
        getExpression in interface Settable
        Returns:
        The expression. This base class always returns the empty string "".
        See Also:
        setExpression(String)
      • getValueAsString

        public java.lang.String getValueAsString()
        Get the value of the attribute, which is the evaluated expression.
        Specified by:
        getValueAsString in interface Settable
        Returns:
        The same as getExpression().
        See Also:
        getExpression()
      • getVisibility

        public Settable.Visibility getVisibility()
        Get the visibility of this Settable, as set by setVisibility(). If setVisibility() has not been called, then implementations of this interface should return some default, not null, indicating user-level visibility. The returned value is one of the static instances of the Visibility inner class.
        Specified by:
        getVisibility in interface Settable
        Returns:
        The visibility of this Settable.
        See Also:
        setVisibility(Settable.Visibility)
      • removeValueListener

        public void removeValueListener​(ValueListener listener)
        Remove a listener from the list of listeners that are notified when the value of this variable changes. This implementation ignores the argument.
        Specified by:
        removeValueListener in interface Settable
        Parameters:
        listener - The listener to remove.
        See Also:
        addValueListener(ValueListener)
      • setExpression

        public void setExpression​(java.lang.String expression)
                           throws IllegalActionException
        Set the value of the attribute by giving some expression. In this implementation, the specified value is ignored.
        Specified by:
        setExpression in interface Settable
        Parameters:
        expression - The value of the attribute, which is ignored.
        Throws:
        IllegalActionException - If the expression is invalid.
        See Also:
        getExpression()
      • setVisibility

        public void setVisibility​(Settable.Visibility visibility)
        Set the visibility of this Settable. This call does nothing.
        Specified by:
        setVisibility in interface Settable
        Parameters:
        visibility - The visibility of this Settable.
        See Also:
        getVisibility()
      • validate

        public java.util.Collection validate()
                                      throws IllegalActionException
        Set the attribute name to match the current expression.
        Specified by:
        validate in interface Settable
        Returns:
        Null, indicating that no other instances of Settable are validated.
        Throws:
        IllegalActionException - If the expression is not valid, or its value is not acceptable to the container or the listeners.
      • _setAttributeName

        protected void _setAttributeName​(java.lang.String attributeName)
        Set the attribute name.
        Parameters:
        attributeName - The attribute name.
      • _getText

        protected java.lang.String _getText()
        Return a new string that contains the expression of the referred to attribute.
        Returns:
        A new shape.