| |
|
| java.lang.Object net.xoetrope.xui.data.XModel
All known Subclasses: net.xoetrope.optional.data.sql.DatabaseRowModel, net.xoetrope.optional.service.XServiceModelNode, net.xoetrope.optional.data.sql.DatabaseFieldModel, net.xoetrope.xui.data.XBaseModel,
XModel | abstract public class XModel (Code) | | The XModel is designed to support an MVC like structure. The model allows data
to be maintained separately from UI code and separately from the control logic.
The model supports an XPath like way of naming nodes and accessing data. The model
is hierarchical and therefore a variety of data can be stored including simple
scalar values to vectors and arrays. The model can be supplemented by adding
custom node types and by using adapters and bindings.
The XModel is one of the main ideas behind XUI and central to providing the
clean separation of the data. The XUI UI components can be abstractly bound
to the model as instances of XModel although the actual nodes may be
implemented by a range of classes representing tables or lists of even more
complex nodes. All the UI component need know the path to the node in the model.
In some cases an adapter is used to simplify access to the data and perhaps
maintain additional information needed by the UI component (e.g. the selected
value in a list).
Copyright (c) Xoetrope Ltd., 1998-2003
License: see license.txt
version: $Revision: 1.30 $ |
addModelListener | public void addModelListener(XModelListener listener, String name)(Code) | | Add a new listener to this model node
Parameters: listener - the listener object Parameters: name - the name of the metod to be invoked |
append | abstract public void append(XModel childNode)(Code) | | Append a node
Parameters: childNode - the child node |
append | abstract 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 |
clear | public void clear()(Code) | | Return this node to its initial state by removing its children and attributes
|
fireModelUpdated | public void fireModelUpdated()(Code) | | Notify the listeners that this model node has changed
|
get | public Object get(String element)(Code) | | Get the value of the element located at the path in the element parameter
If the attribName parameter is not null we get the value of the
attributeValues
Parameters: element - The path to the XModel we require The value of the XModel or the attribute |
get | abstract 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 | abstract public Object get()(Code) | | gets the value attribute
the value of the model |
getAttribName | abstract 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 | abstract public Object getAttribValue(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 |
getAttribValueAsDouble | abstract 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 | abstract public int getAttribValueAsInt(int i)(Code) | | Parameters: i - The index of the attributeValues array whose value we want The int value of the attributeValues array at position i |
getAttribValueAsString | abstract 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 | abstract 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 |
getId | abstract public String getId()(Code) | | Gets the value of the ID attribute
the ID attribute |
getInstance | public static XModel getInstance()(Code) | | Get the root instance of the model. This class now delegates to the project manager.
the root XModel instance.'deprecated since 1.0.3 |
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 |
getTagName | public String getTagName()(Code) | | Gets the model element tag name, e.g. 'Component' from the XML fragment
|
getValueAsDouble | abstract public double getValueAsDouble(String elementName)(Code) | | Gets the value attribute as a Double value
Parameters: elementName - the value as a double |
getValueAsInt | abstract 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 | abstract 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 boolean hasAutoId()(Code) | | true if there was no name for the element in the DataSource, anexample of this is the annonymouse nodes used to represent the record ofa table e.g. | ... | ... |
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 |
hashCode | abstract public int hashCode()(Code) | | Get a hash code for the node.
the node's hash code |
prefixOutputPath | public static String prefixOutputPath(String path)(Code) | | Prefix the output path if the prefix is not already present
Parameters: path - |
removeChildren | public void removeChildren()(Code) | | Remove the children of this node
|
reset | public XModel reset()(Code) | | Reset the whole model, giving a new root node and a new hierarchy
'deprecated since 1.0.3
|
resetAttributes | public void resetAttributes()(Code) | | Reset the attributes of this node
|
set | abstract public void set(String attribName, Object newObject)(Code) | | Set the named attribute value of this XModel node. If the attribName is
null then this node's value is updated.
Parameters: elementName - The path to the XModel in the format 'base/foo Parameters: newObject - The new value of the XModel |
set | abstract public void set(Object s)(Code) | | Sets the model value
Parameters: s - the new value |
setAttribValue | abstract public void setAttribValue(int i, Object value)(Code) | | Sets the attribute value
Parameters: i - The index of the attributeValues array whose value we want Parameters: value - the value object |
setAttribValue | abstract public void setAttribValue(int i, String attribName, Object value)(Code) | | Sets the attribute name and value
Parameters: i - 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 newId)(Code) | | Sets the ID attribute
Parameters: newId - 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 |
setTagName | public void setTagName(String name)(Code) | | Sets the model element tag name, e.g. 'Component' from the XML fragment
Parameters: name - |
|
|
|