Class MonitorReceiverAttribute

  • All Implemented Interfaces:
    java.lang.Cloneable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable, Settable, Singleton

    public class MonitorReceiverAttribute
    extends SingletonAttribute
    implements Settable
    This parameter, when inserted into a port, causes the port to display data available for the actor to read. It assumes that the port is an input port. Otherwise, it returns an empty string. It is a singleton, and it's name is always _showInfo, regardless of what name argument is specified to the constructor. Note that the display is not automatically updated. Use an instance of RepaintController in your model to cause the display to be updated, or use MonitorReceiverContents.
    Since:
    Ptolemy II 8.0
    Version:
    $Id$
    Author:
    Edward A. Lee
    See Also:
    MonitorReceiverContents
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Yellow (eal)
    • Method Detail

      • addValueListener

        public 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.
        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 expression currently used by this variable. The expression is either the value set by setExpression(), or a string representation of the value set by setToken(), or an empty string if no value has been set.
        Specified by:
        getExpression in interface Settable
        Returns:
        The expression used by this variable.
        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 value.
        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. If no such listener exists, do nothing.
        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 some implementations, the listeners and the container will be notified immediately. However, some implementations may defer notification until validate() is called.
        Specified by:
        setExpression in interface Settable
        Parameters:
        expression - The value of the attribute.
        Throws:
        IllegalActionException - If the expression is invalid.
        See Also:
        getExpression()
      • setVisibility

        public 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.
        Specified by:
        setVisibility in interface Settable
        Parameters:
        visibility - The visibility of this Settable.
        See Also:
        getVisibility()
      • validate

        public 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.
        Specified by:
        validate in interface 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.