|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.kernel.util.NamedObj
ptolemy.kernel.util.Attribute
ptolemy.vergil.icon.EditorIcon
ptolemy.vergil.icon.SVGIcon
public class SVGIcon
This class is intended to eventually replace XMLIcon, however, the current version doesn't work very well, so it isn't used.
Red (johnr) |
Yellow (eal) |
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj |
---|
NamedObj.ContainedObjectsIterator |
Field Summary | |
---|---|
private ConfigurableAttribute |
_description
|
private ConfigurableAttribute |
_smallIconDescription
|
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 | |
---|---|
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 | |
---|---|
private void |
_bindToContainer(NamedObj container)
Establish this icon as a listener for changes in attributes named "_iconDescription" and "_smallIconDescription" in the specified container. |
private void |
_createAttribute(java.lang.String type,
java.util.Map attributes,
java.lang.String content)
Create a new attribute and insert it in this icon. |
private void |
_generateContents(XmlElement root)
Given the root of an XML tree, populate this icon with attributes for each graphical element. |
private static java.lang.String |
_getAttribute(java.util.Map map,
java.lang.String name,
java.lang.String defaultValue)
Extract the named attribute from the attribute map and return the value as a string. |
private static double |
_getDouble(java.util.Map map,
java.lang.String name,
double defaultValue)
Extract the named attribute from the attribute map and return the value as a double. |
private static void |
_processFilledShapeAttributeAttributes(FilledShapeAttribute attribute,
java.util.Map attributes)
Set the attributes of a FilledShapeAttribute from the specified map of SVG attribute values. |
private static void |
_processLocation(Attribute attribute,
java.util.Map attributes)
Set the location of an Attribute from the specified map of SVG attribute values. |
private static void |
_processShapeAttributeAttributes(ShapeAttribute attribute,
java.util.Map attributes)
Set the attributes of a ShapeAttribute from the specified map of SVG attribute values. |
private void |
_updateContents()
Update the contents of the icon based on the SVG data in the associated "_iconDescription" parameter, if there is one. |
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, _isPropertySet, _recreateFigure, createBackgroundFigure, createFigure, createIcon, getContainerOrContainerToBe |
Methods inherited from class ptolemy.kernel.util.Attribute |
---|
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private ConfigurableAttribute _description
private ConfigurableAttribute _smallIconDescription
Constructor Detail |
---|
public SVGIcon(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 SVGIcon(NamedObj container, java.lang.String name) throws NameDuplicationException, IllegalActionException
container
- The container for this attribute.name
- The name of this attribute.
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 |
---|
public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class EditorIcon
workspace
- The workspace for the cloned object.
java.lang.CloneNotSupportedException
- Not thrown in this base classNamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
public void setContainer(NamedObj container) throws IllegalActionException, NameDuplicationException
setContainer
in class Attribute
container
- The container to attach this attribute to..
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.Attribute.getContainer()
public void setContainerToBe(NamedObj container)
setContainerToBe
in class EditorIcon
container
- The container that will eventually be set.EditorIcon.getContainerOrContainerToBe()
public void valueChanged(Settable settable)
valueChanged
in interface ValueListener
settable
- The object that has changed value.private void _bindToContainer(NamedObj container)
private void _createAttribute(java.lang.String type, java.util.Map attributes, java.lang.String content)
private void _generateContents(XmlElement root)
private static java.lang.String _getAttribute(java.util.Map map, java.lang.String name, java.lang.String defaultValue)
map
- The attribute map.name
- The element name.defaultValue
- The default value.
private static double _getDouble(java.util.Map map, java.lang.String name, double defaultValue)
map
- The attribute map.name
- The element name.defaultValue
- The default value.
private static void _processFilledShapeAttributeAttributes(FilledShapeAttribute attribute, java.util.Map attributes)
private static void _processShapeAttributeAttributes(ShapeAttribute attribute, java.util.Map attributes)
private static void _processLocation(Attribute attribute, java.util.Map attributes)
private void _updateContents() throws java.lang.Exception
java.lang.Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |