| |
|
| java.lang.Object net.xoetrope.xui.data.XModel net.xoetrope.xui.data.XBaseModel
All known Subclasses: net.xoetrope.optional.data.sql.DatabaseTableModel,
XBaseModel | public class XBaseModel extends XModel implements Cloneable(Code) | | The basic implementation of the XModel is handled by this class. Static data
is loaded from an XML file pointed to by the startup.properties file by
default using an XDataSource. The model is central to XUI and allows the UI
components to be separated from the data in an abstract fashion. This model
element is designed to support static data, text, list and tabular structures.
Copyright (c) Xoetrope Ltd., 1998-2003
License: see license.txt
version: $Revision: 1.27 $ |
ID_ATTRIBUTE | final public static int ID_ATTRIBUTE(Code) | | |
NUM_FIXED_ATTRIBUTE | final public static int NUM_FIXED_ATTRIBUTE(Code) | | |
VALUE_ATTRIBUTE | final public static int VALUE_ATTRIBUTE(Code) | | |
addByDefault | protected boolean addByDefault(Code) | | |
appendByDefault | protected static boolean appendByDefault(Code) | | |
XBaseModel | public XBaseModel(XModel parent)(Code) | | Constructs an instance of the model node.
|
XBaseModel | public XBaseModel()(Code) | | |
append | public Object append(String elementName)(Code) | | Append a new node with the specified name. This method does not replace any
existing nodes.
Parameters: element - The immediate path to the XModel required The value of the XModel or the attribute |
append | public void append(XModel childNode)(Code) | | Appends a node to the model. If a node of the same name is found it is
replaced. If there is insufficient space to store the new node then the
storage is automatically expanded.
The child nodes should be named uniquely
or not at all (i.e. they should be annonymous). If the new childNode has a
name then it is compared to the existing nodes and will replace a node of
the same name if one exists.
Parameters: childNode - the child node |
get | public Object get(String element)(Code) | | Get the value of the element located at the path in the element parameter.
The element name parameter can include an attribute name by appending
'@attributeName' to the path, where attributeName is the name of the
attribute.
Parameters: element - The path to the XModel required The value of the XModel or the attribute |
get | public XModel get(int i)(Code) | | Get the XModel at element i
Parameters: i - The index of the values array The XModel at location i |
get | public Object get()(Code) | | gets the value attribute
the value of the model |
getAddByDefault | public boolean getAddByDefault()(Code) | | Get the flags that determines if attributes are added when queried
true if an attribute is added if it is missing when queried, or false to return -1when querying a node attribute with "getAttribute( name )". |
getAppendByDefault | public static boolean getAppendByDefault()(Code) | | Get the flags that determines if attributes are added when queried
true if an attribute is added if it is missing when queried, or false to return -1when querying a node attribute with "getAttribute( name )". |
getAttribFromPath | protected String getAttribFromPath(String path)(Code) | | Get the attribute from a path e.g.
returns 'attrib' from 'a/b/c/@attrib'
returns null from 'a/b/c/'
Parameters: path - the path to split the attribute name |
getAttribName | public String getAttribName(int i)(Code) | | Parameters: i - The index of the attributeNames array whose value we want The string value of the attributeNames array at position i |
getAttribValue | public Object getAttribValue(int i)(Code) | | Parameters: i - The index of the attributeValues array whose value we want The (Object) value of the attributeValues array at position i |
getAttribValueAsDouble | public double getAttribValueAsDouble(int i)(Code) | | Parameters: i - The index of the attributeValues array whose value we want The double value of the attributeValues array at position i |
getAttribValueAsInt | public int getAttribValueAsInt(int index)(Code) | | Parameters: index - The index of the attributeValues array whose value we want The int value of the attributeValues array at position i |
getAttribValueAsString | public String getAttribValueAsString(int i)(Code) | | Parameters: i - The index of the attributeValues array whose value we want The string value of the attributeValues array at position i |
getAttribute | public int getAttribute(String attribName)(Code) | | returns the index of the attribiteNames array whose value is the same
as the attribName
Parameters: attribName - The name of the attribute we are trying to locate The index of the attributeNames array containg the name |
getBaseFromPath | protected String getBaseFromPath(String path)(Code) | | Get the base path from a path e.g.
returns 'a/b/c/' from 'a/b/c/@attrib'
returns 'a/b/c/' from 'a/b/c/'
returns null from 'a/b/c/@attrib'
Parameters: path - the path to split the path stripped of attributes |
getChildExists | public boolean getChildExists(String name)(Code) | | Check to see if the specified child node exists. Doing a get() creates the
named node by design, so it will always result in a value
Parameters: name - the name of the child we are looking for boolean indicating the existance of the child. |
getId | public String getId()(Code) | | Gets the name attribute
the name attribute |
getNumAttributes | public int getNumAttributes()(Code) | | Gets the number of attributes of this node
the number of attributes |
getNumChildren | public int getNumChildren()(Code) | | Gets the number of immediate children of this node
the number of child nodes |
getValueAsDouble | public double getValueAsDouble(String elementName)(Code) | | Gets the value attribute as a Double value
Parameters: elementName - the value as a double |
getValueAsInt | public int getValueAsInt(String elementName)(Code) | | Gets the value attribute of the specified node as an int.
Parameters: elementName - the value as an int |
getValueAsString | public String getValueAsString(String elementName)(Code) | | Gets the value attribute of the specified node as a string.
Parameters: elementName - the value as a string |
hasAutoId | public void hasAutoId(boolean b)(Code) | | Used for elements which need a name assigned temporarily because one doesn't
exist in the DataSource.
Parameters: b - true if there was no name in the DataSource |
hasAutoId | public boolean hasAutoId()(Code) | | true if there was no name for the element in the DataSource |
hashCode | public int hashCode()(Code) | | |
insertChildAt | public void insertChildAt(XModel newNode, int idx)(Code) | | Insert a node at a specified index in the list of children
Parameters: newNode - the new model node Parameters: idx - the index at which to insert |
remove | public void remove(XModel child)(Code) | | Remove a child node from this XModel instance. Squeeze the following
children so that they are contiguous.
Parameters: child - the child to be removed. |
removeAttributes | public void removeAttributes()(Code) | | Remove the nodes attributes and attribute names
|
removeChild | public void removeChild(String name)(Code) | | Remove a child node
Parameters: name - the ID or name of the node |
removeChild | public void removeChild(String name, String value)(Code) | | Remove a child node
Parameters: name - the ID or name of the node Parameters: value - the value of the matching node to remove |
removeChildren | public void removeChildren()(Code) | | Remove the children of this node
|
set | public void set(String elementName, Object newObject)(Code) | | Set the value of the element in the child XModel located at the elementName.
The child node matching the element is first retrieved and then the named
attribute is updated. The attributeName can be specified by appending
'@attributeName' to the path, where attributeName is the name of the
attribute (e.g. '/fonts/arial/@bold' where 'bold' is the attributeName.
If the attributeName is not specified the retreived node's value is updated.
To update this node's value use set( newObject )
Parameters: elementName - The path to the XModel in the format 'base/foo Parameters: newObject - The new value of the attribute |
set | public void set(Object s)(Code) | | Sets the model value of this node.
Parameters: s - the new value |
setAddByDefault | public void setAddByDefault(boolean state)(Code) | | Set the flags that determines if attributes are added when queried
Parameters: state - true to add an attribute if it is missing, false to return -1when querying a node attribute with "getAttribute( name )". |
setAppendByDefault | public static void setAppendByDefault(boolean state)(Code) | | Set the flags that determines if attributes are added when queried
Parameters: state - true to add an attribute if it is missing, false to return -1when querying a node attribute with "getAttribute( name )". |
setAttribValue | public void setAttribValue(int index, Object value)(Code) | | Sets the attribute value
Parameters: index - The index of the attributeValues array whose value we want Parameters: value - the value object |
setAttribValue | public void setAttribValue(int index, String attribName, Object value)(Code) | | Sets the attribute value
Parameters: index - The index of the attributeValues array whose value we want Parameters: attribName - the name of the attribute Parameters: value - the value object |
setId | public void setId(String newName)(Code) | | Sets the name attribute
Parameters: newName - the new name |
setNumAttributes | public void setNumAttributes(int num)(Code) | | Setup the attributeNames and attributeValues arrays. If not already
initialised set the size of each to 2 otherwise store them temporarily
and reassign to the increased size arrays.
Parameters: num - The new size of the array |
setNumChildren | public void setNumChildren(int num)(Code) | | Set the number of children of this node
Parameters: num - the new number of children |
|
|
|