ptolemy.vergil.icon
Class BoxedValuesIcon

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.kernel.util.Attribute
          extended by ptolemy.vergil.icon.EditorIcon
              extended by ptolemy.vergil.icon.DynamicEditorIcon
                  extended by ptolemy.vergil.icon.XMLIcon
                      extended by ptolemy.vergil.icon.BoxedValuesIcon
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable, ValueListener

public class BoxedValuesIcon
extends XMLIcon

This icon displays the value of all visible attributes of class Settable contained by the container of this icon. Visible attributes are those whose visibility is Settable.FULL. The names and values of the attributes are displayed in a box that resizes as necessary. If any line is longer than displayWidth (in characters), then it is truncated.

Since:
Ptolemy II 4.0
Version:
$Id: BoxedValuesIcon.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Edward A. Lee
See Also:
Serialized Form
Accepted Rating:
Red (johnr)
Proposed Rating:
Yellow (eal)

Nested Class Summary
 
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
 
Field Summary
protected static java.awt.Font _labelFont
          The font used.
 Parameter displayWidth
          The number of characters to display.
 
Fields inherited from class ptolemy.vergil.icon.EditorIcon
_containerToBe, _iconCache
 
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
BoxedValuesIcon(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 createBackgroundFigure()
          Create a new background figure.
 Figure createFigure()
          Create a new Diva figure that visually represents this icon.
 
Methods inherited from class ptolemy.vergil.icon.XMLIcon
_description, _recreateFigure, clone, createIcon, getXMLIcon, getXMLIcon, paintedList, toString, valueChanged
 
Methods inherited from class ptolemy.vergil.icon.DynamicEditorIcon
_addLiveFigure, _liveFigureIterator, _trimLiveFigures
 
Methods inherited from class ptolemy.vergil.icon.EditorIcon
_createDefaultBackgroundFigure, _isPropertySet, getContainerOrContainerToBe, setContainerToBe
 
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, attributeChanged, 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
 

Field Detail

displayWidth

public Parameter displayWidth
The number of characters to display. This is an integer, with default value 80.


_labelFont

protected static final java.awt.Font _labelFont
The font used.

Constructor Detail

BoxedValuesIcon

public BoxedValuesIcon(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.
Method Detail

createBackgroundFigure

public Figure createBackgroundFigure()
Create a new background figure. This overrides the base class to draw a box around the value display, where the width of the box depends on the value.

Overrides:
createBackgroundFigure in class XMLIcon
Returns:
A new figure.

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 values of the attributes 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.