ptolemy.vergil.icon
Class UpdatedValueIcon
java.lang.Object
ptolemy.kernel.util.NamedObj
ptolemy.kernel.util.Attribute
ptolemy.vergil.icon.EditorIcon
ptolemy.vergil.icon.DynamicEditorIcon
ptolemy.vergil.icon.XMLIcon
ptolemy.vergil.icon.AttributeValueIcon
ptolemy.vergil.icon.UpdatedValueIcon
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable, ValueListener
public class UpdatedValueIcon
- extends AttributeValueIcon
An icon that displays the value of an attribute of the container,
updating it as the value of the value of the attribute is updated.
The attribute is assumed to be an instance of Settable, and its name
is given by the parameter attributeName. The width of the
display is fixed, and is given by the attribute displayWidth,
which is in "n" characters.
- Since:
- Ptolemy II 2.0
- Version:
- $Id: UpdatedValueIcon.java 57040 2010-01-27 20:52:32Z cxh $
- Author:
- Edward A. Lee
- See Also:
- Serialized Form
- Accepted Rating:
- Proposed Rating:
Fields inherited from class ptolemy.kernel.util.NamedObj |
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
Constructor Summary |
UpdatedValueIcon(NamedObj container,
java.lang.String name)
Create a new icon with the given name in the given container. |
Method Summary |
protected void |
_updateFigures()
Update the figures that were created by this icon to reflect the
new attribute value. |
void |
attributeChanged(Attribute attribute)
Override the base class to identify the named attribute in the
container and to attach a listener to it. |
java.lang.Object |
clone(Workspace workspace)
Clone the object into the specified workspace. |
Figure |
createBackgroundFigure()
Create a new background figure. |
void |
valueChanged(Settable settable)
React to the specified Settable has changing by requesting a
repaint of the most recently constructed figures. |
Methods inherited from class ptolemy.kernel.util.Attribute |
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setContainer, setName, updateContent |
Methods inherited from class ptolemy.kernel.util.NamedObj |
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, 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, propagateExistence, propagateValue, propagateValues, removeChangeListener, removeDebugListener, 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 |
_associatedAttribute
protected Settable _associatedAttribute
- The attribute whose value is being represented.
UpdatedValueIcon
public UpdatedValueIcon(NamedObj container,
java.lang.String name)
throws NameDuplicationException,
IllegalActionException
- Create a new icon with the given name in the given container.
The container is required to implement Settable, or an exception
will be thrown.
- Parameters:
container
- The container for this attribute.name
- The name of this attribute.
- Throws:
IllegalActionException
- If thrown by the parent
class or while setting an attribute.
NameDuplicationException
- If the name coincides with
an attribute already in the container.
attributeChanged
public void attributeChanged(Attribute attribute)
throws IllegalActionException
- Override the base class to identify the named attribute in the
container and to attach a listener to it.
- Overrides:
attributeChanged
in class NamedObj
- Parameters:
attribute
- The attribute that changed.
- Throws:
IllegalActionException
- Not thrown in this class.
clone
public java.lang.Object clone(Workspace workspace)
throws java.lang.CloneNotSupportedException
- Clone the object into the specified workspace. The new object is
not added to the directory of that workspace (you must do this
yourself if you want it there).
The result is an object with no container.
- Overrides:
clone
in class XMLIcon
- Parameters:
workspace
- The workspace for the cloned object.
- Returns:
- The new Attribute.
- Throws:
java.lang.CloneNotSupportedException
- Not thrown in this base class- See Also:
NamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
createBackgroundFigure
public Figure createBackgroundFigure()
- Create a new background figure. This overrides the base class
to draw a fixed-width box.
- Overrides:
createBackgroundFigure
in class XMLIcon
- Returns:
- A new figure.
valueChanged
public void valueChanged(Settable settable)
- React to the specified Settable has changing by requesting a
repaint of the most recently constructed figures.
- Specified by:
valueChanged
in interface ValueListener
- Overrides:
valueChanged
in class XMLIcon
- Parameters:
settable
- The object that has changed value.
_updateFigures
protected void _updateFigures()
- Update the figures that were created by this icon to reflect the
new attribute value. This method is called by this class in response
to notification that attributes have changed.