|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.tensegrity.composite.persistence.FormatIDMap
The FormatIDMap class pools all types of Format implementations. These are Paint-,
Stroke-, Font- and MarkerFormats. While the class
FormatPool helps to avoid multiple instation
of the same format, this class is meant as utility class while serializing
and building Primitives. When serializing primitives you obtain a id-string
from FormatIDMap by calling the getTypeId-method. When all primitives are
written to the attributelist, you can obtain the list of used formats
(getTypeList()) and add their attribute representation to the
attributelist. When building primitives from an xml file, you need to read
in all stored formats, add them to the FormatIDMap and then, while building
the primitive instances, obtain the stored format instance from this class.
| Field Summary | |
static java.lang.String |
idPrefixFont
Constant prefix strings for string id's. |
static java.lang.String |
idPrefixMarker
Constant prefix strings for string id's. |
static java.lang.String |
idPrefixPaint
Constant prefix strings for string id's. |
static java.lang.String |
idPrefixStroke
Constant prefix strings for string id's. |
| Method Summary | |
static void |
addFormat(Format format,
java.lang.String id)
Associates a format to a given id. |
static void |
addFormats(AttributeList list)
This method adds all previously stored format instances to the given AttributeList by writing out Attributes where the name is obtained from keyIterator() and the value created by
FormatUtilities.getAttributeSetFromFormat(Object). |
static void |
addIdFormat(java.lang.String id,
Format format)
Associates a id to a given format reference. |
static void |
clear()
Clears the internally used map instances. |
static Format |
getFormat(java.lang.String id)
Returns an instance of Format to a given id string. |
static java.lang.String |
getId(Format format)
Returns the string id associated with a format. |
static java.util.Iterator |
keyIterator()
Returns a set view of the keys contained in the FormatIDMap. |
static void |
readFormats(AttributeList list)
|
static void |
useThreadLocal()
A call to this method configures the FormatIDMap to make use
of the ThreadLocal class hence a map is created for each
Thread the FormatIDMap is used by.
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String idPrefixMarker
public static final java.lang.String idPrefixPaint
public static final java.lang.String idPrefixStroke
public static final java.lang.String idPrefixFont
| Method Detail |
public static final void useThreadLocal()
FormatIDMap to make use
of the ThreadLocal class hence a map is created for each
Thread the FormatIDMap is used by.
FormatIDMap is in use by any Thread.
ThreadLocal
public static final void addFormat(Format format,
java.lang.String id)
format - the format.id - the id associated to the format.
public static final void addIdFormat(java.lang.String id,
Format format)
id - the id to associate with the format.format - the format.public static final java.lang.String getId(Format format)
format - the format description.
public static final Format getFormat(java.lang.String id)
Format to a given id string. Use this
method to retrieve the Format instance while building Primitive instances
from XML-files.
id - the id string.
Format.public static final java.util.Iterator keyIterator()
FormatIDMap.
FormatIDMap.public static final void clear()
public static final void addFormats(AttributeList list)
throws AttributeException,
ConstraintViolationException,
SerializeException
keyIterator() and the value created by
FormatUtilities.getAttributeSetFromFormat(Object).
list - the AttributeList to add the serialized formats to.
AttributeException - thrown whenever the add of an attribute fails.
ConstraintViolationException - thrown whenever the add of an
attribute fails.
SerializeException - thrown if
FormatUtilities.getAttributeSetFromFormat(Object) fails.
public static final void readFormats(AttributeList list)
throws BuildException
BuildException
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||