Class WindowPropertiesAttribute

  • All Implemented Interfaces:
    java.awt.event.ComponentListener, java.lang.Cloneable, java.util.EventListener, HasTypeConstraints, Typeable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable, Settable, ValueListener

    public class WindowPropertiesAttribute
    extends Parameter
    implements java.awt.event.ComponentListener
    This attribute stores properties of a window, including the width, height, and location. The token in this attribute is a RecordToken containing a field "bounds" with a 4-element integer array. There is also a field that indicates whether the window is maximized. By default, this attribute has visibility NONE, so the user will not see it in parameter editing dialogs.
    Since:
    Ptolemy II 2.1
    Version:
    $Id$
    Author:
    Edward A. Lee, Contributors: Jason E. Smith, Christopher Brooks
    Pt.AcceptedRating:
    Red (johnr)
    Pt.ProposedRating:
    Red (eal)
    • Constructor Detail

      • WindowPropertiesAttribute

        public WindowPropertiesAttribute​(NamedObj container,
                                         java.lang.String name)
                                  throws IllegalActionException,
                                         NameDuplicationException
        Construct an attribute with the given name contained by the specified entity. 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

      • clone

        public java.lang.Object clone​(Workspace workspace)
                               throws java.lang.CloneNotSupportedException
        Clone the attribute into the specified workspace. This calls the base class and then sets the attribute public members to refer to the attributes of the new attribute
        Overrides:
        clone in class Parameter
        Parameters:
        workspace - The workspace for the new attribute
        Returns:
        A new director.
        Throws:
        java.lang.CloneNotSupportedException - If a derived class contains an attribute that cannot be cloned.
        See Also:
        Object.clone()
      • componentHidden

        public void componentHidden​(java.awt.event.ComponentEvent event)
        Do nothing. This method is invoked when the component has been made invisible.
        Specified by:
        componentHidden in interface java.awt.event.ComponentListener
        Parameters:
        event - The component event.
      • componentMoved

        public void componentMoved​(java.awt.event.ComponentEvent event)
        Record the new position. This method is invoked when the component's position changes.
        Specified by:
        componentMoved in interface java.awt.event.ComponentListener
        Parameters:
        event - The component event.
      • componentResized

        public void componentResized​(java.awt.event.ComponentEvent event)
        Record the new size. This method is invoked when the component's size changes.
        Specified by:
        componentResized in interface java.awt.event.ComponentListener
        Parameters:
        event - The component event.
      • componentShown

        public void componentShown​(java.awt.event.ComponentEvent event)
        Do nothing. This method is invoked when the component has been made visible.
        Specified by:
        componentShown in interface java.awt.event.ComponentListener
        Parameters:
        event - The component event.
      • recordProperties

        public void recordProperties​(java.awt.Frame frame)
        Set the value of the attribute to match those of the specified frame.
        Parameters:
        frame - The frame whose properties are to be recorded.
      • setProperties

        public boolean setProperties​(java.awt.Frame frame)
        Set the properties of the specified frame to match the current value of the attribute. If the value of the attribute has not been set, then do nothing and return true. If the value of this attribute is malformed in any way, then just return false.

        If the x or y position is less than 0 pixels or greater than (width - 10 pixels) or (height - 10) pixels of the screen, then offset the position by 30 pixels so the user can drag the window.

        Parameters:
        frame - The frame whose properties are to be set.
        Returns:
        True if successful.