|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.xoetrope.xui.data.XModel
net.xoetrope.xui.data.XBaseModel
net.xoetrope.xui.data.table.XTableModel
net.xoetrope.optional.data.collection.XCollectionTableModel
public class XCollectionTableModel
A wrapper for a database table allowing it to integrate with the XModel
The table model consists of a set of XRowModel objects and these in turn consist of DatabaseFieldModel nodes. These objects all act as wrappers for the DatabaseTable object and do not themselves maintain data.
Copyright: Copyright (c) 2003
License: see license.txt
| Field Summary | |
|---|---|
protected XProject |
currentProject
|
protected java.lang.String |
modelId
|
| Fields inherited from class net.xoetrope.xui.data.XBaseModel |
|---|
addByDefault, appendByDefault, attributeNames, attributeValues, ID_ATTRIBUTE, NUM_FIXED_ATTRIBUTE, VALUE_ATTRIBUTE, values |
| Fields inherited from class net.xoetrope.xui.data.XModel |
|---|
parentModel, tagName |
| Constructor Summary | |
|---|---|
XCollectionTableModel(XProject project,
java.lang.String name,
java.util.List fieldNames,
java.util.List data)
Create a new model node for a database table |
|
| Method Summary | |
|---|---|
java.lang.Object |
append(java.lang.String id)
This method does not nothing it is provided merely as an implementation of the XModel interface. |
void |
dump(java.io.Writer w)
Write teh contents of this model node to a stream |
void |
first()
Moves the table's cursor to the first row |
java.lang.Object |
get()
gets the value attribute |
XModel |
get(int i)
Get the XModel at element i |
java.lang.Object |
get(java.lang.String element)
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 |
java.lang.String |
getAttribName(int i)
Gets the attribute name for field i. |
int |
getAttribute(java.lang.String attribName)
returns the index of the attribiteNames array whose value is the same as the attribName |
java.lang.Object |
getAttribValue(int i)
Get the value of an attribute (row) |
double |
getAttribValueAsDouble(int i)
Get an attribute as a double value |
int |
getAttribValueAsInt(int i)
Get an attribute as an int value |
java.lang.String |
getAttribValueAsString(int i)
Get an attribute as a String object |
java.lang.String |
getFieldValue(int colIdx)
Provides iterative access to the table values. |
java.lang.String |
getFieldValue(int rowIdx,
int colIdx)
Provides random access to the table values. |
java.lang.String |
getId()
Gets the name attribute, by default the table name |
int |
getNumAttributes()
Get the number of fields in this TableModel |
int |
getNumChildren()
Gets the number of rows for this table |
int |
getSelectedRow()
Get the row selection index |
static XCollectionTableModel |
getTable(XProject currentProject,
java.lang.String tableName)
Look up a table by name in the overall model. |
java.lang.String |
getTagName()
Gets the model element tag name, e.g. |
java.lang.String |
getValue()
Provides iterative access to the table values. |
XModel |
getValue(int i)
Get a child value/node (a XRowModel) at the specified index |
double |
getValueAsDouble(java.lang.String elementName)
Gets the value attribute as a double value from the current record |
int |
getValueAsInt(java.lang.String elementName)
Gets the value attribute of the specified node as an int. |
int |
hashCode()
Get the hashcode for this model node |
boolean |
hasMoreRows()
Has the table more records/rows? |
void |
last()
Moves the table's cursor to the last row |
boolean |
next()
Moves the table's cursor to the next row |
boolean |
previous()
Moves the table's cursor to the previous row |
void |
retrieve()
Get the table data. |
void |
set(java.lang.Object s)
Sets the model value |
void |
set(java.lang.String attribName,
java.lang.Object newObject)
Set the value of the XModel located at the elementName |
void |
set(java.lang.String elementName,
java.lang.String attribName,
java.lang.Object newObject)
Set the value of the attribute in the XModel located at the elementName |
static void |
setAllowNull(boolean allow)
Set a flag to determine how null values are treated. |
void |
setAttribValue(int i,
java.lang.Object value)
Sets the attribute value |
void |
setDirty(boolean isDirty)
Ensures that the query is recalled. |
void |
setFieldValue(int rowIdx,
int colIdx,
java.lang.String newValue)
Set a field value |
void |
setFieldValue(int colIdx,
java.lang.String newValue)
Set a field value |
void |
setName(java.lang.String newName)
Sets the name attribute and constructs a new table of that name |
void |
setReadOnly(boolean b)
Sets the read only flag indicating whether or not the underlying table is read-only |
void |
setSelectedRow(int sourceData)
Set the row selection index |
void |
sync()
Syncs the model with the service response is the xtable has been changed or if the node has timed out. |
| Methods inherited from class net.xoetrope.xui.data.XBaseModel |
|---|
append, getAddByDefault, getAppendByDefault, getAttribFromPath, getAttribValueAsDouble, getBaseFromPath, getChildExists, getModel, getValueAsString, hasAutoId, hasAutoId, insertChildAt, remove, removeAttributes, removeChild, removeChild, removeChildren, setAddByDefault, setAppendByDefault, setAttribValue, setId, setNumAttributes, setNumChildren, swapNodes |
| Methods inherited from class net.xoetrope.xui.data.XModel |
|---|
addModelListener, clear, fireModelUpdated, getParent, prefixOutputPath, reset, resetAttributes, setParent, setTagName |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String modelId
protected XProject currentProject
| Constructor Detail |
|---|
public XCollectionTableModel(XProject project,
java.lang.String name,
java.util.List fieldNames,
java.util.List data)
project - the owner projectname - the name of this model nodefieldNames - the name of the fieldsdata - the data| Method Detail |
|---|
public static void setAllowNull(boolean allow)
allow - if false then nulls are return as zero or an empty string, if
true the null is returned for string types and Double.NaN for doubles and
Integer.MIN_VALUE for int fields and so onpublic void setDirty(boolean isDirty)
isDirty - boolean to set the dirty flagpublic void setName(java.lang.String newName)
newName - the new namepublic int hashCode()
hashCode in class XBaseModelpublic void setReadOnly(boolean b)
b - true for a read-only table.public java.lang.Object get(java.lang.String element)
get in class XBaseModelelement - The path to the XModel we require
public void set(java.lang.String elementName,
java.lang.String attribName,
java.lang.Object newObject)
elementName - The path to the XModel in the format 'base/fooattribName - The name of the attribute whose value we requirenewObject - The new value of the attribute
public void set(java.lang.String attribName,
java.lang.Object newObject)
set in class XBaseModelattribName - The path to the XModel in the format 'base/foonewObject - The new value of the XModelpublic XModel get(int i)
get in class XBaseModeli - The index of the values array
public java.lang.Object get()
get in class XBaseModelpublic java.lang.Object append(java.lang.String id)
append in class XBaseModelid - the node id
public void set(java.lang.Object s)
set in class XBaseModels - the new valuepublic java.lang.Object getAttribValue(int i)
getAttribValue in class XBaseModeli - The index of the attributeValues array whose value we want
public java.lang.String getAttribValueAsString(int i)
getAttribValueAsString in class XTableModeli - The index of the attributeValues array whose value we want
public double getAttribValueAsDouble(int i)
getAttribValueAsDouble in class XBaseModeli - The index of the attributeValues array whose value we want
public int getAttribValueAsInt(int i)
getAttribValueAsInt in class XBaseModeli - The index of the attributeValues array whose value we want
public int getAttribute(java.lang.String attribName)
getAttribute in class XBaseModelattribName - The name of the attribute we are trying to locate
public void sync()
XTableModel
sync in class XTableModelpublic void retrieve()
retrieve in class XTableModelpublic void first()
public void last()
public boolean next()
public boolean hasMoreRows()
public boolean previous()
public java.lang.String getValue()
public XModel getValue(int i)
i - The index into the values array
public java.lang.String getFieldValue(int colIdx)
getFieldValue in class XTableModelcolIdx - the column of field index
public java.lang.String getFieldValue(int rowIdx,
int colIdx)
getFieldValue in class XTableModelrowIdx - the row indexcolIdx - the column of field index
public void setFieldValue(int colIdx,
java.lang.String newValue)
setFieldValue in class XTableModelcolIdx - the field index, zero basednewValue - the new field value
public void setFieldValue(int rowIdx,
int colIdx,
java.lang.String newValue)
setFieldValue in class XTableModelrowIdx - the row index, zero basedcolIdx - the field index, zero basednewValue - the new field valuepublic double getValueAsDouble(java.lang.String elementName)
getValueAsDouble in class XBaseModelelementName - the field/column name
public int getValueAsInt(java.lang.String elementName)
getValueAsInt in class XBaseModelelementName - the field name
public java.lang.String getAttribName(int i)
getAttribName in class XBaseModeli - The index of the attributeNames array whose value we want
public java.lang.String getId()
getId in class XBaseModel
public void setAttribValue(int i,
java.lang.Object value)
setAttribValue in class XBaseModeli - The index of the attributeValues array whose value we wantvalue - the value objectpublic int getNumChildren()
getNumChildren in class XBaseModelpublic int getNumAttributes()
getNumAttributes in class XBaseModelpublic java.lang.String getTagName()
getTagName in class XModel
public static XCollectionTableModel getTable(XProject currentProject,
java.lang.String tableName)
tableName - the table name
public void dump(java.io.Writer w)
dump in interface DumpWriterw - the write/streampublic void setSelectedRow(int sourceData)
setSelectedRow in interface XRowSelectorsourceData - the new row selection index (zero based)public int getSelectedRow()
getSelectedRow in interface XRowSelector
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||