ptolemy.vergil.icon
Class AttributeValueIcon
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
- All Implemented Interfaces:
- Changeable, java.lang.Cloneable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Nameable, java.io.Serializable, ValueListener
- Direct Known Subclasses:
- BoxedValueIcon, UpdatedValueIcon
- public class AttributeValueIcon
- extends XMLIcon
An icon that displays the value of an attribute of the container.
The attribute is assumed to be an instance of Settable, and its name
is given by the parameter attributeName. The display is not
automatically updated when the attribute value is updated.
- Since:
- Ptolemy II 2.0
- Version:
- $Id: AttributeValueIcon.java,v 1.28.2.1 2004/06/18 00:49:30 cxh Exp $
- 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, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
|
Constructor Summary |
AttributeValueIcon(NamedObj container,
java.lang.String name)
Create a new icon with the given name in the given container.
|
|
Method Summary |
protected java.lang.String |
_displayString()
Get the string to render in the icon. |
Figure |
createFigure()
Create a new Diva figure that visually represents this icon.
|
| Methods inherited from class ptolemy.kernel.util.NamedObj |
_addAttribute, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDerivedLevel, getDerivedList, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, message, propagateExistence, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setModelErrorHandler, setPersistent, setSource, toplevel, uniqueName, validateSettables, workspace |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
attributeName
public StringAttribute attributeName
- The name of the attribute of the container whose value to display.
displayWidth
public Parameter displayWidth
- The number of characters to display. This is an integer, with
default value 6.
_labelFont
protected static java.awt.Font _labelFont
- The font used.
AttributeValueIcon
public AttributeValueIcon(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.
createFigure
public Figure createFigure()
- Create a new Diva figure that visually represents this icon.
The figure will be an instance of LabelFigure that renders the
value of the specified attribute of the container.
- Overrides:
createFigure in class EditorIcon
- Returns:
- A new CompositeFigure consisting of the label.
_displayString
protected java.lang.String _displayString()
- Get the string to render in the icon. This string is the
expression giving the value of the attribute of the container
having the name attributeName, truncated so that it is
no longer than displayWidth characters. If it is truncated,
then the string has a trailing "...". If the string is empty,
then return a string with one space (diva fails on empty strings).
- Returns:
- The string to display, or null if none is found.