public abstract class NodeHandler
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
VCSTATE_ATTR |
Constructor and Description |
---|
NodeHandler() |
Modifier and Type | Method and Description |
---|---|
abstract VPTNode |
createNode(org.xml.sax.Attributes attrs,
VPTProject project)
Instantiates a VPTNode based on the information given in the attribute
list.
|
protected java.lang.String |
fixPath(java.lang.String src)
Translates the directory separators read from the XML according
the file system.
|
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 void |
writeAttr(java.lang.String name,
java.lang.String value,
java.io.Writer out)
Writes an attribute to the writer.
|
protected static final java.lang.String VCSTATE_ATTR
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 fixPath(java.lang.String src)