Interface Settable

    • Field Detail

      • NONE

        static final Settable.Visibility NONE
        Indicator that a user interface should not make an instance visible.
      • EXPERT

        static final Settable.Visibility EXPERT
        Indicator that a user interface should make an instance visible only to experts.
      • FULL

        static final Settable.Visibility FULL
        Indicator that a user interface should make an instance visible.
      • NOT_EDITABLE

        static final Settable.Visibility NOT_EDITABLE
        Indicator that a user interface should make an instance visible, but not allow editing of the variable.
    • Method Detail

      • addValueListener

        void addValueListener​(ValueListener listener)
        Add a listener to be notified when the value of this settable object changes. An implementation of this method should ignore the call if the specified listener is already on the list of listeners. In other words, it should not be possible for the same listener to be notified twice of a value update.
        Parameters:
        listener - The listener to add.
        See Also:
        removeValueListener(ValueListener)
      • getDefaultExpression

        java.lang.String getDefaultExpression()
        Return the default value of this attribute, if there is one, or null if there is none.
        Returns:
        The default value of this attribute, or null if there is none.
      • getDisplayName

        java.lang.String getDisplayName()
        Return a name to present to the user.
        Specified by:
        getDisplayName in interface Nameable
        Returns:
        A name to present to the user.
      • getExpression

        java.lang.String getExpression()
        Get the expression of the attribute that has been set by setExpression(), or null if there is none.
        Returns:
        The expression.
        See Also:
        setExpression(String)
      • getValueAsString

        java.lang.String getValueAsString()
        Get the value of the attribute, which is the evaluated expression.
        Returns:
        The value.
        See Also:
        getExpression()
      • getVisibility

        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.
        Returns:
        The visibility of this Settable.
        See Also:
        setVisibility(Settable.Visibility)
      • removeValueListener

        void removeValueListener​(ValueListener listener)
        Remove a listener from the list of listeners that are notified when the value of this variable changes. If no such listener exists, do nothing.
        Parameters:
        listener - The listener to remove.
        See Also:
        addValueListener(ValueListener)
      • setExpression

        void setExpression​(java.lang.String expression)
                    throws IllegalActionException
        Set the value of the attribute by giving some expression. In some implementations, the listeners and the container will be notified immediately. However, some implementations may defer notification until validate() is called.
        Parameters:
        expression - The value of the attribute.
        Throws:
        IllegalActionException - If the expression is invalid.
        See Also:
        getExpression()
      • setVisibility

        void setVisibility​(Settable.Visibility visibility)
        Set the visibility of this Settable. The argument should be one of the static public instances of the inner class Visibility. This is enforced by making it impossible to construct instances of this inner class outside this interface definition. If this method is not called, then implementations of this interface should return some default, not null.
        Parameters:
        visibility - The visibility of this Settable.
        See Also:
        getVisibility()
      • validate

        java.util.Collection validate()
                               throws IllegalActionException
        Check the validity of the expression set in setExpression(). Implementations of this method should notify the container by calling attributeChanged(), unless the container has already been notified in setExpression(). They should also notify any registered value listeners if they have not already been notified. If any other instances of Settable are validated as a side effect, then an implementation should return a Collection containing those instances. This can be used by the caller to avoid validating those again. The list may contain this instance of Settable.
        Returns:
        A collection of settables that are also validated as a side effect, or null if there are none.
        Throws:
        IllegalActionException - If the expression is not valid, or its value is not acceptable to the container or the listeners.