Package ptolemy.actor.gui
Class WindowPropertiesAttribute
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.util.Attribute
-
- ptolemy.kernel.util.AbstractSettableAttribute
-
- ptolemy.data.expr.Variable
-
- ptolemy.data.expr.Parameter
-
- ptolemy.actor.gui.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)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.data.expr.Variable
Variable.CircularDependencyError, Variable.VariableScope
-
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
-
Nested classes/interfaces inherited from interface ptolemy.kernel.util.Settable
Settable.Visibility
-
-
Field Summary
-
Fields inherited from class ptolemy.data.expr.Variable
_currentExpression, _needsEvaluation, _parserScope, _parseTreeValid, _suppressVariableSubstitution, _valueListeners
-
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
-
Fields inherited from interface ptolemy.kernel.util.Settable
EXPERT, FULL, NONE, NOT_EDITABLE
-
-
Constructor Summary
Constructors Constructor Description WindowPropertiesAttribute(NamedObj container, java.lang.String name)
Construct an attribute with the given name contained by the specified entity.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
clone(Workspace workspace)
Clone the attribute into the specified workspace.void
componentHidden(java.awt.event.ComponentEvent event)
Do nothing.void
componentMoved(java.awt.event.ComponentEvent event)
Record the new position.void
componentResized(java.awt.event.ComponentEvent event)
Record the new size.void
componentShown(java.awt.event.ComponentEvent event)
Do nothing.void
recordProperties(java.awt.Frame frame)
Set the value of the attribute to match those of the specified frame.boolean
setProperties(java.awt.Frame frame)
Set the properties of the specified frame to match the current value of the attribute.-
Methods inherited from class ptolemy.data.expr.Parameter
addChoice, exportMoML, getChoices, removeAllChoices, removeChoice
-
Methods inherited from class ptolemy.data.expr.Variable
_description, _evaluate, _getCurrentExpression, _notifyValueListeners, _parseIfNecessary, _propagate, _propagateToValueListeners, _propagateValue, _setToken, _setTokenAndNotify, addValueListener, attributeChanged, getDeclaredType, getExpression, getFreeIdentifiers, getParserScope, getScope, getScope, getToken, getType, getTypeTerm, getValueAsString, getVariable, getVisibility, invalidate, isKnown, isLazy, isStringMode, isSuppressVariableSubstitution, isTypeAcceptable, removeValueListener, reset, setContainer, setExpression, setLazy, setName, setParseTreeEvaluator, setStringMode, setSuppressVariableSubstitution, setToken, setToken, setTypeAtLeast, setTypeAtLeast, setTypeAtMost, setTypeEquals, setTypeSameAs, setUnknown, setValueListenerAsWeakDependency, setVisibility, stringRepresentation, toString, typeConstraintList, typeConstraints, validate, valueChanged
-
Methods inherited from class ptolemy.kernel.util.AbstractSettableAttribute
getDefaultExpression
-
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, updateContent
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, uniqueName, validateSettables, workspace
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getFullName, getName, getName
-
Methods inherited from interface ptolemy.kernel.util.Settable
getDisplayName
-
-
-
-
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
-
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 interfacejava.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 interfacejava.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 interfacejava.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 interfacejava.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.
-
-