|
Version: 1.1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.biomoby.service.dashboard.data.DataTypeNode
public class DataTypeNode
A node in a tree representing a Biomoby data type. These nodes are used and managed by DataTypeModel which is then used by DataTypeTreeTable to display and to edit Biomoby input data.
Each DataTypeNode represents a MobyDataType instance and it knows how to create sub-nodes that contain member types of this MobyDataType. It also contains id, namespace, and (for primitive types) a value.
It also provides a table cell renderer and editor - they are used if this DataTypeNode represents a Biomoby primitive type for rendering and editing its value. The renderer and editor are here because they can differ from line to line (they are not the same for the whole table column as it is usual).
If this node represents a Biomoby String primitive type, it provides a boolean cell renderer and editor for a column where a user can specify that - in the resulting XML - the string value should be normally escaped, or wrapped in a CDATA section. Also the user an indicate that the String value can have more lines - in such case a special text area appears to allow it.
Finally, for nodes representing HAS relationship, there are several buttons allowing to add, clone or remove its HAS sibling.
Method Summary | |
---|---|
static DataTypeNode |
createNode(MobyDataType dataType,
String memberName,
int memberRel,
DataTypeNode parent,
HashMap dtTable,
DataTypeModel model)
A factory for a node. |
Object |
fixValue(Object value)
If the given value does not correspond with the type of this node (which happens for empty values) change it to more appropriate value. |
TableCellEditor |
getButtonEditor(int column)
Return a cell editor for given column, assuming that this column is one of those displaying buttons for adding, cloning and removing HAS siblings. |
TableCellRenderer |
getButtonRenderer(int column)
Return a cell renderer for given column, assuming that this column is one of those displaying buttons for adding, cloning and removing HAS siblings. |
TableCellEditor |
getCDATAEditor(JTable table)
Return a boolean cell editor for given table. |
Object |
getCDATAFlag()
Get flag indicating whether to use a CDATA wrapper for values of String primitive types. |
TableCellRenderer |
getCDATARenderer(JTable table)
Return a boolean cell renderer for given table. |
Object |
getChild(int i)
Return an i-th child of this node. |
int |
getChildCount()
How many children this node has. |
DataTypeNode[] |
getChildren()
Return children nodes of this node (after loading them if not yet done). |
MobyDataType |
getDataType()
Return a Biomoby data type represented by this node. |
String |
getId()
Return an ID assigned to this node. |
String |
getMemberName()
Return a member name (article name) assigned to this node. |
String |
getNamespace()
Return a namespace assigned to this node. |
DataTypeNode |
getParentNode()
Return a parent node. |
Object |
getValue()
Return a value stored in this node (makes sense only for Biomoby primitive types). |
TableCellEditor |
getValueEditor(JTable table)
Return a cell editor (of column containing the value) for given table. |
TableCellRenderer |
getValueRenderer(JTable table,
Object value)
Return a cell renderer for given table and for given value. |
boolean |
isHAS()
Return true if this node has HAS relationship to its parents. |
boolean |
isLeaf()
Return true if this node represents a leaf in a data type tree. |
boolean |
isPrimitive()
Return true if this node represents a primitive data type. |
boolean |
isString()
Return true if this node represents a String Biomoby primitive type. |
void |
setCDATAFlag(Object value)
Set flag indicating whether to use a CDATA wrapper for values of String primitive types. |
void |
setId(String newValue)
Assign an ID to this node. |
void |
setNamespace(String newValue)
Assign a namespace to this node. |
void |
setValue(Object newValue)
Assign a new value to this node (makes sense only for Biomoby primitive types). |
String |
toString()
|
org.jdom.Element |
toXML()
Create an XML element representing this node. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public String toString()
toString
in class Object
public org.jdom.Element toXML()
public boolean isLeaf()
public boolean isPrimitive()
public boolean isString()
public boolean isHAS()
public DataTypeNode getParentNode()
public MobyDataType getDataType()
public String getId()
public void setId(String newValue)
public String getNamespace()
public void setNamespace(String newValue)
public String getMemberName()
public Object getValue()
public void setValue(Object newValue)
public TableCellRenderer getValueRenderer(JTable table, Object value)
public TableCellEditor getValueEditor(JTable table)
public Object fixValue(Object value)
public void setCDATAFlag(Object value)
public Object getCDATAFlag()
public TableCellRenderer getCDATARenderer(JTable table)
public TableCellEditor getCDATAEditor(JTable table)
public TableCellRenderer getButtonRenderer(int column)
public TableCellEditor getButtonEditor(int column)
public static DataTypeNode createNode(MobyDataType dataType, String memberName, int memberRel, DataTypeNode parent, HashMap dtTable, DataTypeModel model)
dataType
- represented by this nodememberName
- how this data type is named (article name) in
its parentmemberRel
- how this node is related to its parent (should
be Central.iHAS
or Central.iHASA
or -1 (if it does not have
any parent)parent
- data typedtTable
- contains all other data types (so we can find
our children)model
- that drives the tree-table where this node sits inpublic int getChildCount()
public Object getChild(int i)
public DataTypeNode[] getChildren()
|
Version: 1.1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |