|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcox.jmatt.java.MathTools.graphing.xml.RenderableXML
public class RenderableXML
This is the base class for all XML graphing components. It provides basic parameter-handling machinery along with the foundation required for its subclasses.
All XML tags should have an ID. While this class does not ID-tag its parameters, it does provide machinery for the other classes to contain their IDs. It
also maintains a 'name' and a 'type' field. The name field is set through the one-argument constructor and the type via the setType()
method.
Although this class maintains the parameter table, it is available to subclasses as a protected ArrayList. Likewise the 'myName,' 'myType,' and 'myID'
fields. Since these fields are very important to subclasses, their existence can be checked with the testCondition()
method. The GraphKeysXML
class contains constant condition Objects for verifying that these fields are not null.
Field Summary | |
---|---|
protected java.lang.String |
myID
All XML tags should have an 'id=' attribute. |
protected java.lang.String |
myName
This String is used to hold the name of the object being manipulated. |
protected java.util.Hashtable<java.lang.String,java.lang.String> |
myParams
The parameter table is automatically maintained and handled via the render() method. |
protected java.lang.String |
myType
This field holds the String-ed value of the setType() method. |
Constructor Summary | |
---|---|
RenderableXML()
This constructor provides a simple, blank instance. |
|
RenderableXML(java.lang.String pName)
This constructor is provided to set the 'myName' field upon creation. |
Method Summary | |
---|---|
java.lang.Object |
render(java.lang.Object pContext)
The base render() method simply produces <Param> tags. |
void |
setID(java.lang.String pID)
This is not a mandated Renderable method. |
boolean |
setParameter(java.lang.String pKey,
java.lang.Object pValue)
Set or clear a parameter. |
boolean |
setType(java.lang.Object pType)
Use this method to set or clear the 'myType' field. |
boolean |
testCondition(java.lang.Object pCondition,
java.lang.Object pValue)
Three conditions can be checked: name, type, and ID. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String myName
protected java.lang.String myID
setID()
method. It is protected to allow subclass access.
protected java.lang.String myType
setType()
method. Its default value is null.
protected java.util.Hashtable<java.lang.String,java.lang.String> myParams
render()
method. It is protected to allow subclasses access should they
need it.
Constructor Detail |
---|
public RenderableXML()
public RenderableXML(java.lang.String pName)
Method Detail |
---|
public void setID(java.lang.String pID)
Renderable
method. It is provided to allow the inclusion of an 'id=' attribute on any generated tag.
public boolean setType(java.lang.Object pType)
toString()
.
The return value is always true.
setType
in interface Renderable
pType
- The 'type' of Renderable being used.
public boolean testCondition(java.lang.Object pCondition, java.lang.Object pValue)
GraphKeysXML
constants to check whether or not the specified value is non-null.
The value argument is not used. The return value is true if the value is set, false if it is null or blank.
testCondition
in interface Renderable
pCondition
- The condition to test against the value.pValue
- The value against which the condition is to be checked.
public boolean setParameter(java.lang.String pKey, java.lang.Object pValue)
Set or clear a parameter. If the key is null or blank it is ignored and false is returned. If the key is valid and the value is not null, it is added to the parameter table and the return value is true. If the key is valid and the value is null, the value stored under that key is removed from the table. If the Object was successfully removed, the return is true. If the table held no mapping, the return is false.
NOTE: The value Object is converted to String before it is added! Use with care.
setParameter
in interface Renderable
pKey
- The name of the parameter being set. Must not be null or empty.pValue
- The value of the parameter to set.
public java.lang.Object render(java.lang.Object pContext)
render()
method simply produces <Param> tags. No individual ID is set. The key value for each parameter appears in a 'key='
attribute and the tag contains the XML-escaped value. No rendering context is required or used.
render
in interface Renderable
pContext
- The Context Object to be used for rendering.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |