|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.tensegrity.graph.element.ElementPoolManager
Reads the geometry, style and rule XML files and creates the entries in the corresponding pools. This class only contains static methods. To use this PoolManager it is required to either provide a element.xml url, which point to an element.xml file which contains the LOCATIONS Tag, or specify all the locations separately. This way of using the ElementPoolManager would look like:
// specify class to which the files will be relative to.
ElementPoolManager.setLoadClass(MyApplication.class);
ElementPoolManager.setElementPath("resource/xml/element.xml");
ElementPoolManager.setGeometryPaths(new String[] { "basic-geometry.xml", "icon-geometry.xml"});
ElementPoolManager.setStylePaths(new String[] { "basic-style.xml", "icon-style.xml", "components-style.xml"});
ElementPoolManager.setRulePath("rules.xml");
// done. All locations specified, now load the files
ElementPoolManager.loadElements();
RuleRegistry registry = ElementPoolManager.getRuleRegistry();
// continue...
You may also benefit from the LOCATIONS Tag. Therefore add the LOCATIONS tag
to your element.xml file and specify all the locations relative to the
element.xml you are modifying. To load the elements.xml file then would look
like this:
ElementPoolManager.setElementPath("c:\\documents\\project1\\joe\\elements.xml");
Set names = ElementPoolManager.loadElementNames();
RuleRegistry registry = ElementPoolManager.getRuleRegistry();
for (Iterator i = names.iterator(); i.hasNext();)
{
// do something...
}
| Method Summary | |
static void |
enterKey(java.lang.Object key,
java.lang.String elementName)
Registers a key/value pair internally. |
static java.lang.String[] |
getGeometryURLs()
Returns the currently used filenames of all geometry files. |
static RuleRegistry |
getRuleRegistry()
Returns the previously read RuleRegistry. |
static java.lang.String[] |
getStyleURLs()
Returns the currently used filenames of all style files. |
static boolean |
hasLocations()
Checks whether the currently set elements.xml file has a location tag. |
static void |
load()
Loads the geometries from the path given by the foregoing call to the method #setGeometryPaths()
styles from the path given by the foregoing call to the method
#setStylePaths()
elements from the path given by the foregoing call to the method
#setElementPath()
rules from the path given by the foregoing call to the method
#setRulePath()
NOTICE:If there was no foregoing call to all of the methods
mentioned before or if the pathes passed to the methods are not valid,
this method might not work properly. |
static java.util.List |
loadElementNames()
Method loadElementNames loads the elements.xml file specified by the elementURL field. |
static VisualNode |
resolveVisualNodeElement(java.lang.Object key)
Resolves a visual-node element from the given key. |
static void |
setElementPath(java.lang.String path)
Sets the paths used for loading elements files. |
static void |
setGeometryPaths(java.lang.String[] paths)
Sets the paths used for loading geometry files. |
static void |
setLoadClass(java.lang.Class clazz)
Sets the class that is the reference for loading. |
static void |
setRulePaths(java.lang.String[] paths)
Sets the paths used for loading rule files. |
static void |
setStylePaths(java.lang.String[] paths)
Sets the paths used for loading style files. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static void load()
#setGeometryPaths()
#setStylePaths()
#setElementPath()
#setRulePath()
XMLParseException - thrown if the xml files are not well formed.public static void setGeometryPaths(java.lang.String[] paths)
paths - a string array of paths.public static void setStylePaths(java.lang.String[] paths)
paths - a string array of paths.public static void setElementPath(java.lang.String path)
public static void setRulePaths(java.lang.String[] paths)
paths - a string array of paths.public static void setLoadClass(java.lang.Class clazz)
clazz - the reference class for loading resources.public static boolean hasLocations()
public static final java.util.List loadElementNames()
public static VisualNode resolveVisualNodeElement(java.lang.Object key)
key - the key used for resolving.
VisualNode.
public static void enterKey(java.lang.Object key,
java.lang.String elementName)
key - the key that is submitted.elementName - the value submitted under the given key.public static RuleRegistry getRuleRegistry()
null.public static java.lang.String[] getGeometryURLs()
public static java.lang.String[] getStyleURLs()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||