public class EditorIcon extends Attribute implements IconAttribute
The icon consists of a background figure, created by the createBackgroundFigure() method, and a decorated version, created by the createFigure() method. The decorated version has, in this base class, a label showing the name of the entity, unless the entity contains a parameter called "_hideName" with value true. The swing icon created by createIcon() does not include the decorations, but rather is only the background figure.
The decorated version can also optionally show parameter values below the icon. If the preference named "_showParameters" has value "All", then all parameters are shown. If it has value "Overridden parameters only", then it will show only overridden parameters. In either case, only parameters that are visible and settable (see the Settable interface) will be shown, regardless of whether they are overridden.
When the preference "_showParameters" has value "Overridden parameters only", then some parameter values may be suppressed even if they are overridden. In particular, if an attribute contains a parameter named "_hide" with value true, then that parameter is not shown even if requested. If the container of the attribute contains a parameter named "_hideAllParameters" with value true, then none of its parameters are shown. This is useful, for example, if the icon itself shows the parameter, as with decorative visual elements.
Derived classes may simply populate this attribute with other visible attributes (attributes that contain icons), or they can override the createBackgroundFigure() method. This will affect both the Diva Figure and the Swing Icon representations. Derived classes can also create the figure or the icon in a different way entirely (for example, starting with a Swing icon and creating the figure using a SwingWrapper) by overriding both createBackgroundFigure() and createIcon(). However, the icon editor provided by EditIconFrame and EditIconTableau will only show (and allow editing) of those icon components created by populating this attribute with other visible attributes.
This attribute contains another attribute that is an instance of EditIconTableau. This has the effect that an instance of Configuration, when it attempts to open an instance of this class, will use EditIconTableau, which in turn uses EditIconFrame to provide an icon editor.
EditIconFrame
,
EditIconTableau
,
Configuration
NamedObj.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
protected NamedObj |
_containerToBe
The container to be eventually the container for this icon.
|
protected javax.swing.Icon |
_iconCache
The cached Swing icon.
|
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
Constructor and Description |
---|
EditorIcon(NamedObj container,
java.lang.String name)
Create a new icon with the given name in the given container.
|
EditorIcon(Workspace workspace,
java.lang.String name)
Construct an icon in the specified workspace and name.
|
Modifier and Type | Method and Description |
---|---|
protected Figure |
_createDefaultBackgroundFigure()
Create a new default background figure, which is a white box.
|
protected boolean |
_isPropertySet(NamedObj object,
java.lang.String name)
Return true if the property of the specified name is set for
the specified object.
|
protected void |
_recreateFigure()
Recreate the figure.
|
java.lang.Object |
clone(Workspace workspace)
Clone the object into the specified workspace.
|
Figure |
createBackgroundFigure()
Create a new background figure.
|
Figure |
createFigure()
Create a new Diva figure that visually represents this icon.
|
javax.swing.Icon |
createIcon()
Create a new Swing icon.
|
Nameable |
getContainerOrContainerToBe()
Return the container of this object, if there is one, or
if not, the container specified by setContainerToBe(), if
there is one, or if not, null.
|
void |
setContainerToBe(NamedObj container)
Indicate that the container of this icon will eventually
be the specified object.
|
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setContainer, setName, updateContent
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _description, _executeChangeRequests, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, decorators, 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, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
protected NamedObj _containerToBe
protected javax.swing.Icon _iconCache
public EditorIcon(Workspace workspace, java.lang.String name) throws IllegalActionException
workspace
- The workspace that will list the attribute.name
- The name of this attribute.IllegalActionException
- If the specified name contains
a period.Increment the version number of the workspace.
public EditorIcon(NamedObj container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- The container.name
- The name of the attribute.IllegalActionException
- If the attribute is not of an
acceptable class for the container.NameDuplicationException
- If the name coincides with
an attribute already in the container.public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class Attribute
workspace
- The workspace for the cloned object.java.lang.CloneNotSupportedException
- Not thrown in this base classNamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
public Figure createBackgroundFigure()
public Figure createFigure()
public javax.swing.Icon createIcon()
public Nameable getContainerOrContainerToBe()
setContainerToBe(NamedObj)
public void setContainerToBe(NamedObj container)
container
- The container that will eventually be set.getContainerOrContainerToBe()
protected Figure _createDefaultBackgroundFigure()
protected boolean _isPropertySet(NamedObj object, java.lang.String name)
object
- The object.name
- The property name.protected void _recreateFigure()