ptolemy.vergil.modal
Class StateIcon
java.lang.Object
ptolemy.kernel.util.NamedObj
ptolemy.kernel.util.Attribute
ptolemy.vergil.icon.EditorIcon
ptolemy.vergil.icon.NameIcon
ptolemy.vergil.modal.StateIcon
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable
- Direct Known Subclasses:
- EventIcon, FmvStateIcon, StateMatcherIcon
public class StateIcon
- extends NameIcon
An icon that displays the name of the container in an appropriately
sized rounded box. This is designed to be contained by an instance
of State, and if it is, and if the state is the initial state, then
the rounded box will be bold. If it is a final state, then it will
be double.
By default, the icon will be filled with color white,
unless the refinement name of the containing State is not empty,
in which case it returns a light green.
However, if this attribute contains a ColorParameter named "fill",
then the color of that color parameter is used instead.
If not, but if the container is a State and contains a
ColorAttribute named "fill", then that color is used..
- Since:
- Ptolemy II 8.0
- Version:
- $Id: StateIcon.java 59166 2010-09-21 17:05:27Z cxh $
- Author:
- Edward A. Lee
- See Also:
- Serialized Form
- Accepted Rating:
- Proposed Rating:
Field Summary |
private static java.awt.Color |
_REFINEMENT_COLOR
The fill color for states with refinements. |
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 |
StateIcon(NamedObj container,
java.lang.String name)
Create a new icon with the given name in the given container. |
Method Summary |
protected java.awt.Paint |
_getFill()
Return the paint to use to fill the icon. |
protected float |
_getLineWidth()
Return the line width to use in rendering the box. |
javax.swing.Icon |
createIcon()
Create an icon. |
Methods inherited from class ptolemy.kernel.util.Attribute |
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent |
Methods inherited from class ptolemy.kernel.util.NamedObj |
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _description, _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, toString, uniqueName, validateSettables, workspace |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
_REFINEMENT_COLOR
private static java.awt.Color _REFINEMENT_COLOR
- The fill color for states with refinements.
StateIcon
public StateIcon(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.
createIcon
public javax.swing.Icon createIcon()
- Create an icon.
- Overrides:
createIcon
in class EditorIcon
- Returns:
- The icon.
_getFill
protected java.awt.Paint _getFill()
- Return the paint to use to fill the icon.
By default, this class returns Color.white, unless the refinement name
is not empty, in which case it returns a light green.
However, if this attribute contains a ColorParameter named "fill",
then the color of that color parameter is returned instead.
In addition, if the container is a State and contains a
ColorAttribute named "fill", then that color is returned.
- Overrides:
_getFill
in class NameIcon
- Returns:
- The paint to use to fill the icon.
_getLineWidth
protected float _getLineWidth()
- Return the line width to use in rendering the box.
This returns 1.0f, unless the container is an instance of State
and its isInitialState parameter is set to true.
- Overrides:
_getLineWidth
in class NameIcon
- Returns:
- The line width to use in rendering the box.