|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectprojectviewer.persist.NodeHandler
A node handler is a class that takes care of loading an saving nodes to/from the configuration file.
Constructor Summary | |
NodeHandler()
|
Method Summary | |
abstract VPTNode |
createNode(org.xml.sax.Attributes attrs,
VPTProject project)
Instantiates a VPTNode based on the information given in the attribute list. |
abstract java.lang.Class |
getNodeClass()
Returns the class of the nodes that should be delegated to this handler when saving node data to the config file. |
abstract java.lang.String |
getNodeName()
Returns the name of the tag representing nodes handled by this handler when loading the project's XML file. |
abstract boolean |
hasChildren()
Returns whether the node(s) handled by this handler are expected to have children or not. |
abstract boolean |
isChild()
Returns whether the node is a child of some other node or not. |
abstract void |
saveNode(VPTNode node,
java.io.Writer out)
Saves a node to the given Writer. |
protected void |
startElement(java.lang.String name,
java.io.Writer out)
Writes the start of an element to the given writer, using the given string as the node name. |
protected void |
startElement(java.io.Writer out)
Writes the start of an element to the given writer. |
protected java.lang.String |
translatePath(java.lang.String src)
Translates any "\" found in the string to "/". |
protected void |
writeAttr(java.lang.String name,
java.lang.String value,
java.io.Writer out)
Writes an attribute to the writer. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public NodeHandler()
Method Detail |
public abstract java.lang.String getNodeName()
public abstract java.lang.Class getNodeClass()
public abstract boolean isChild()
This controls whether the node will be added to the parent node read from the XML file after instantiation.
public abstract boolean hasChildren()
public abstract VPTNode createNode(org.xml.sax.Attributes attrs, VPTProject project)
attrs
- The attributes read from the config file.project
- The project that holds this node.public abstract void saveNode(VPTNode node, java.io.Writer out) throws java.io.IOException
getNodeClass()
method.
This method should create the tag, but it shouldn't close it, even
if it's an empty tag. Closing tags is done by the PersistenceManager
based on the value returned by hasChildren()
.
The config file format does not support text elements inside other
elements, so don't use them when saving nodes or you won't be able
to read them later.
java.io.IOException
protected void startElement(java.io.Writer out) throws java.io.IOException
java.io.IOException
protected void startElement(java.lang.String name, java.io.Writer out) throws java.io.IOException
java.io.IOException
protected void writeAttr(java.lang.String name, java.lang.String value, java.io.Writer out) throws java.io.IOException
java.io.IOException
protected final java.lang.String translatePath(java.lang.String src)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |