| java.lang.Object com.jgraph.editor.JGraphEditorSettings
JGraphEditorSettings | public class JGraphEditorSettings (Code) | | Manages configuration files for a JGraph editor, namely XML documents and
properties files and holds references to configured objects.
|
Inner Class :public interface ShutdownHook | |
Method Summary | |
public void | add(String name, Document doc) Adds the document under the specified name or merges doc
into an existing document for name . | public void | add(String name, Properties props) Registers the specified properties under the specified name. | public void | add(String name, InputStream s) Adds the properties under a specified name from an input stream. | public void | addShutdownHook(ShutdownHook hook) Adds a shutdown hook which is called from
JGraphEditorSettings.shutdown() normally
when the program terminates. | public static String | getAttributeValue(Node node, String attributeName) Returns the textual representation of the attribute in node
whos name is attributeName or null if no
such attribute exists.
Parameters: node - The node whos attribute should be returned. Parameters: attributeName - The name of the attribute whos value should be returned. | public Document | getDocument(String name) Returns the document for the specified name or null if no
such document exists.
Parameters: name - The name of the document to be returned. | public static String | getKeyAttributeValue(Node node) Returns the textual representation of the attribute in node
whos name is equal to
JGraphEditorSettings.ATTRIBUTENAME_KEY or null
if no such node exists.
Parameters: node - The node whos attribute should be returned. | public static Node | getNodeByAttribute(NodeList nodeList, String attributeName, String value) Returns the node in nodeList whos attribute named
attributeName equals value or
null if no such node exists.
Parameters: nodeList - The nodes to scan for the attribute value. Parameters: attributeName - The name of the attribute to scan for. Parameters: value - The value of the attribute to scan for. | public Node | getNodeByName(String documentName, String name) Returns the first node for name in the document registered
under documentName .
Parameters: documentName - The string that identifies the document to be used. Parameters: name - The name of the node to be returned. | public static Node | getNodeByName(NodeList nodeList, String name) Returns the first node in nodeList whos name equals
name or null if no such node exists.
Parameters: nodeList - The list of nodes to scan for the name. Parameters: name - The name of the node to search for. | public Object | getObject(String key) Returns the object for the specified key.
Parameters: key - The key to return the object for. | public Properties | getProperties(String name) Returns the properties registered under the specified name or
null if no such properties exist.
Parameters: name - The name of the properties to return. | public Rectangle | getRectangleProperty(String name, String key) Gets the rectangle made up by 4 entries for the key
-property from the properties called name .
Parameters: name - The name of the properties to get the rectangle from. Parameters: key - The key to retrieve the rectangle values. | protected void | merge(Document document, Node parent, NodeList children, boolean useNames) Recursively replaces or appends children in
parent for equal keys (
JGraphEditorSettings.ATTRIBUTENAME_KEY or node
names, depending on useNames . | public static Document | parse(InputStream in) Constructs a document object for an XML input stream using the
JGraphEditorSettings.documentBuilderFactory .
Parameters: in - The input stream that represents the XML data. | public void | pushListEntryProperty(String name, String key, String value, int maxCount) Pushes a new entry into the list for key in the properties
called name with value , making sure the
list has no more than maxCount entries. | public void | putObject(String key, Object obj) Adds the specified object under key . | public void | putRectangleProperty(String name, String key, Rectangle rect) Puts the rectangle as 4 entries for the key -property plus
a suffix of .x, .y, .width and .height into the properties called
name . | public void | restoreSplitPane(String name, String key) Restores the divider location for the split pane found in objects under
key from the integer stored in the properties registered
under name for the key property. | public void | restoreWindow(String name, String key) Restores the window bounds for the window found in objects under
key from the rectangle stored in the properties registered
under name for the key property. | public void | shutdown() Invokes all hooks that have previously been added using addShutdownHook
in reverse order (last added first). | public void | storeSplitPane(String name, String key) Stores the dividerlocation of the splitpane found in objects under
key in the properties called name as a int
property under key . | public void | storeWindow(String name, String key) Stores the bounds of the window found in objects under key
in the properties called name as a rectangle property
under key . |
ATTRIBUTENAME_BEFORE | final public static String ATTRIBUTENAME_BEFORE(Code) | | XML attribute name for the before attribute.
|
ATTRIBUTENAME_KEY | final public static String ATTRIBUTENAME_KEY(Code) | | XML attribute name for the key attribute.
|
documentspropertiesobjects | protected Map documentspropertiesobjects(Code) | | Holds maps of (document, name), (properties, name) and (key, Object)
pairs respectively.
|
shutdownHooks | protected List shutdownHooks(Code) | | List of hooks that are to be called on shutdown.
|
JGraphEditorSettings | public JGraphEditorSettings()(Code) | | Constructs new settings using an empty object map.
|
JGraphEditorSettings | public JGraphEditorSettings(Map objects)(Code) | | Constructs new settings using the passed-in object map.
Parameters: objects - The map to use as the initial objects map. |
add | public void add(String name, Document doc)(Code) | | Adds the document under the specified name or merges doc
into an existing document for name .
Parameters: name - The name under which the document should be added. Parameters: doc - The document to add. |
add | public void add(String name, Properties props)(Code) | | Registers the specified properties under the specified name.
Parameters: name - The name to register the properties under. Parameters: props - The properties to register. |
addShutdownHook | public void addShutdownHook(ShutdownHook hook)(Code) | | Adds a shutdown hook which is called from
JGraphEditorSettings.shutdown() normally
when the program terminates.
Parameters: hook - The shutdown hook to be added. |
getAttributeValue | public static String getAttributeValue(Node node, String attributeName)(Code) | | Returns the textual representation of the attribute in node
whos name is attributeName or null if no
such attribute exists.
Parameters: node - The node whos attribute should be returned. Parameters: attributeName - The name of the attribute whos value should be returned. Returns the value of attributeName innode . See Also: Node.getAttributes See Also: NamedNodeMap.getNamedItem(java.lang.String) See Also: Node.getNodeValue |
getDocument | public Document getDocument(String name)(Code) | | Returns the document for the specified name or null if no
such document exists.
Parameters: name - The name of the document to be returned. Returns the backing document. |
getNodeByAttribute | public static Node getNodeByAttribute(NodeList nodeList, String attributeName, String value)(Code) | | Returns the node in nodeList whos attribute named
attributeName equals value or
null if no such node exists.
Parameters: nodeList - The nodes to scan for the attribute value. Parameters: attributeName - The name of the attribute to scan for. Parameters: value - The value of the attribute to scan for. Returns the first node that matches the search criteria. See Also: JGraphEditorSettings.getAttributeValue(Node,String) |
getNodeByName | public Node getNodeByName(String documentName, String name)(Code) | | Returns the first node for name in the document registered
under documentName .
Parameters: documentName - The string that identifies the document to be used. Parameters: name - The name of the node to be returned. Returns the first node for name indocumentName . |
getNodeByName | public static Node getNodeByName(NodeList nodeList, String name)(Code) | | Returns the first node in nodeList whos name equals
name or null if no such node exists.
Parameters: nodeList - The list of nodes to scan for the name. Parameters: name - The name of the node to search for. Returns the first node for name in nodeList . See Also: Node.getNodeName |
getObject | public Object getObject(String key)(Code) | | Returns the object for the specified key.
Parameters: key - The key to return the object for. Returns the object for key . |
getProperties | public Properties getProperties(String name)(Code) | | Returns the properties registered under the specified name or
null if no such properties exist.
Parameters: name - The name of the properties to return. Returns the properties for name . |
merge | protected void merge(Document document, Node parent, NodeList children, boolean useNames)(Code) | | Recursively replaces or appends children in
parent for equal keys (
JGraphEditorSettings.ATTRIBUTENAME_KEY or node
names, depending on useNames . If the node to be added
provides a before attribute and the node for the specified key exists in
the parent's node list then the new node is inserted before the
referenced node.
Parameters: document - The document to import the nodes into. Parameters: parent - The parent node to replace or add ports. Parameters: children - The children to add or replace. Parameters: useNames - If names or keys should be used to check for node equality. |
pushListEntryProperty | public void pushListEntryProperty(String name, String key, String value, int maxCount)(Code) | | Pushes a new entry into the list for key in the properties
called name with value , making sure the
list has no more than maxCount entries. If the list is
longer than maxCount , then the oldest entry will be
removed.
Parameters: name - The name of the properties to store the list. Parameters: key - The name of the key to store the list entries. Parameters: value - The value of the new list entry. Parameters: maxCount - The maximum number of elemnts in the list. |
putObject | public void putObject(String key, Object obj)(Code) | | Adds the specified object under key .
Parameters: key - The key to register the object under. Parameters: obj - The object to register. |
putRectangleProperty | public void putRectangleProperty(String name, String key, Rectangle rect)(Code) | | Puts the rectangle as 4 entries for the key -property plus
a suffix of .x, .y, .width and .height into the properties called
name .
Parameters: name - The name of the properties to store the rectangle. Parameters: key - The name of the key to store the rectangle size and location. Parameters: rect - The rectangle to put into the properties. |
restoreSplitPane | public void restoreSplitPane(String name, String key)(Code) | | Restores the divider location for the split pane found in objects under
key from the integer stored in the properties registered
under name for the key property.
Parameters: name - The name of the properties to use. Parameters: key - The key of the object and integer property. See Also: JGraphEditorSettings.getRectangleProperty(String,String) |
restoreWindow | public void restoreWindow(String name, String key)(Code) | | Restores the window bounds for the window found in objects under
key from the rectangle stored in the properties registered
under name for the key property. This
implementation assumes that the key property is a
rectangle, ie. consists of 4 entries in the file.
Parameters: name - The name of the properties to use. Parameters: key - The key of the object and rectangle property. See Also: JGraphEditorSettings.getRectangleProperty(String,String) |
shutdown | public void shutdown()(Code) | | Invokes all hooks that have previously been added using addShutdownHook
in reverse order (last added first).
|
storeSplitPane | public void storeSplitPane(String name, String key)(Code) | | Stores the dividerlocation of the splitpane found in objects under
key in the properties called name as a int
property under key .
Parameters: name - The name of the properties to store the divider location. Parameters: key - The name of the key to store the divider location. |
storeWindow | public void storeWindow(String name, String key)(Code) | | Stores the bounds of the window found in objects under key
in the properties called name as a rectangle property
under key .
Parameters: name - The name of the properties to store the bounds. Parameters: key - The name of the key to store the rectangle property. |
|
|