ptolemy.vergil.icon
Class SVGIcon

java.lang.Object
  extended byptolemy.kernel.util.NamedObj
      extended byptolemy.kernel.util.Attribute
          extended byptolemy.vergil.icon.EditorIcon
              extended byptolemy.vergil.icon.SVGIcon
All Implemented Interfaces:
Changeable, java.lang.Cloneable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Nameable, java.io.Serializable, ValueListener

public class SVGIcon
extends EditorIcon
implements ValueListener

This class is intended to eventually replace XMLIcon, however, the current version doesn't work very well, so it isn't used.

Since:
Ptolemy II 4.0
Version:
$Id: SVGIcon.java,v 1.11.2.1 2004/06/18 00:49:30 cxh Exp $
Author:
Edward A. Lee
See Also:
Serialized Form
Accepted Rating:
Red (johnr)
Proposed Rating:
Yellow (eal)

Nested Class Summary
 
Nested classes inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
 
Field Summary
 
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, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 
Constructor Summary
SVGIcon(NamedObj container, java.lang.String name)
          Create a new icon with the given name in the given container.
SVGIcon(Workspace workspace, java.lang.String name)
          Construct an icon in the specified workspace and name.
 
Method Summary
 java.lang.Object clone(Workspace workspace)
          Clone the object into the specified workspace.
 void setContainer(NamedObj container)
          Override the base class to establish this as a listener to icon descriptions in the container.
 void setContainerToBe(NamedObj container)
          Indicate that the container of this icon will eventually be the specified object.
 void valueChanged(Settable settable)
          React to the fact that the value of an attribute named "_iconDescription" contained by the same container has changed value by redrawing the figure.
 
Methods inherited from class ptolemy.vergil.icon.EditorIcon
_createDefaultBackgroundFigure, _recreateFigure, createBackgroundFigure, createFigure, createIcon, exportMoML, getContainerOrContainerToBe
 
Methods inherited from class ptolemy.kernel.util.Attribute
_getContainedObject, _propagateExistence, getContainer, setName
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _description, _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, toString, uniqueName, validateSettables, workspace
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SVGIcon

public SVGIcon(Workspace workspace,
               java.lang.String name)
        throws IllegalActionException
Construct an icon in the specified workspace and name. This constructor is typically used in conjunction with setContainerToBe() and createFigure() to create an icon and generate a figure without having to have write access to the workspace. If the workspace argument is null, then use the default workspace. The object is added to the directory of the workspace.

Parameters:
workspace - The workspace that will list the attribute.
Throws:
IllegalActionException - If the specified name contains a period.
See Also:
Increment the version number of the workspace.

SVGIcon

public SVGIcon(NamedObj container,
               java.lang.String name)
        throws NameDuplicationException,
               IllegalActionException
Create a new icon with the given name in the given container. By default, the icon contains no graphic objects.

Parameters:
container - The container for this attribute.
name - The name of this attribute.
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 EditorIcon
Parameters:
workspace - The workspace for the cloned object.
Returns:
The new Attribute.
Throws:
java.lang.CloneNotSupportedException - Not thrown in this base class

setContainer

public void setContainer(NamedObj container)
                  throws IllegalActionException,
                         NameDuplicationException
Override the base class to establish this as a listener to icon descriptions in the container.

Overrides:
setContainer in class Attribute
Parameters:
container - The container to attach this attribute to..
Throws:
IllegalActionException - If this attribute is not of the expected class for the container, or it has no name, or the attribute and container are not in the same workspace, or the proposed container would result in recursive containment.
NameDuplicationException - If the container already has an attribute with the name of this attribute.

setContainerToBe

public void setContainerToBe(NamedObj container)
Indicate that the container of this icon will eventually be the specified object. This rather specialized method is used to create an icon and generate a figure without having to have write access to the workspace. To use it, use the constructor that takes a workspace and a name, then call this method to indicate what the container will be. You can then call createFigure() or createBackgroundFigure(), and the appropriate figure for the container specified here will be used. Then queue a ChangeRequest that sets the container to the same specified container. Once the container has been set by calling setContainer(), then the object specified to this method is no longer relevant.

Overrides:
setContainerToBe in class EditorIcon
Parameters:
container - The container that will eventually be set.
See Also:
EditorIcon.getContainerOrContainerToBe()

valueChanged

public void valueChanged(Settable settable)
React to the fact that the value of an attribute named "_iconDescription" contained by the same container has changed value by redrawing the figure.

Specified by:
valueChanged in interface ValueListener
Parameters:
settable - The object that has changed value.