ptolemy.vergil.icon
Class CopyCatIcon

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.CopyCatIcon
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable, ValueListener

public class CopyCatIcon
extends XMLIcon

This is an icon that copies the icon of the last entity contained by the same container, if there is one, and behaves like the base class if not.

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

Nested Class Summary
 
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
 
Field Summary
private static int _MARGIN
          Margin around the inside icon.
private  java.lang.String _originalDescription
          Original description of the icon.
 ColorAttribute echoBoxColor
          Color of the echo boxes.
 Parameter echos
          The number of echos of the bounding box to draw.
 Parameter includeName
          If true, include the name of the copied actor in the icon if the name is included normally in its icon.
 
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
CopyCatIcon(NamedObj container, java.lang.String name)
          Create a new icon with the given name in the given container.
 
Method Summary
 java.lang.Object clone(Workspace workspace)
          Clone the object into the specified workspace.
 Figure createBackgroundFigure()
          Create a new background figure.
 
Methods inherited from class ptolemy.vergil.icon.XMLIcon
_description, _recreateFigure, 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, createFigure, 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

echoBoxColor

public ColorAttribute echoBoxColor
Color of the echo boxes. This defaults to white.


echos

public Parameter echos
The number of echos of the bounding box to draw. This is an int that defaults to 2.


includeName

public Parameter includeName
If true, include the name of the copied actor in the icon if the name is included normally in its icon. NOTE: This will not include the name if the inside actor does not have an icon attribute, but only has an _iconDescription, so it's far from perfect. This is a boolean that defaults to false.


_originalDescription

private java.lang.String _originalDescription
Original description of the icon.


_MARGIN

private static int _MARGIN
Margin around the inside icon.

Constructor Detail

CopyCatIcon

public CopyCatIcon(NamedObj container,
                   java.lang.String name)
            throws IllegalActionException,
                   NameDuplicationException
Create a new icon with the given name in the given container.

Parameters:
container - The container.
name - The name of the attribute.
Throws:
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.
Method Detail

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 method looks for entities contained by the same container, and if there are any, copies the icon of the last such entity. If there are none, then it behaves like the base class.

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