|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.formaria.aria.data.DataModel
org.formaria.aria.data.BaseModel
org.formaria.aria.data.table.TableModel
org.formaria.data.collection.CollectionTableModel
public class CollectionTableModel
A wrapper for a database table allowing it to integrate with the DataModel
The table model consists of a set of RowModel 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 Project |
currentProject
|
protected java.lang.String |
modelId
|
| Fields inherited from class org.formaria.aria.data.BaseModel |
|---|
addByDefault, appendByDefault, attributeNames, attributeValues, ID_ATTRIBUTE, NUM_FIXED_ATTRIBUTE, VALUE_ATTRIBUTE, values |
| Fields inherited from class org.formaria.aria.data.DataModel |
|---|
parentModel, tagName |
| Constructor Summary | |
|---|---|
CollectionTableModel(Project 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 DataModel 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 |
DataModel |
get(int i)
Get the DataModel 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 CollectionTableModel |
getTable(Project 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. |
DataModel |
getValue(int i)
Get a child value/node (a RowModel) 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 DataModel 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 DataModel 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 org.formaria.aria.data.BaseModel |
|---|
append, appendAttribute, 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 org.formaria.aria.data.DataModel |
|---|
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 Project currentProject
| Constructor Detail |
|---|
public CollectionTableModel(Project 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 BaseModelpublic void setReadOnly(boolean b)
b - true for a read-only table.public java.lang.Object get(java.lang.String element)
get in class BaseModelelement - The path to the DataModel we require
public void set(java.lang.String elementName,
java.lang.String attribName,
java.lang.Object newObject)
elementName - The path to the DataModel 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 BaseModelattribName - The path to the DataModel in the format 'base/foonewObject - The new value of the DataModelpublic DataModel get(int i)
get in class BaseModeli - The index of the values array
public java.lang.Object get()
get in class BaseModelpublic java.lang.Object append(java.lang.String id)
append in class BaseModelid - the node id
public void set(java.lang.Object s)
set in class BaseModels - the new valuepublic java.lang.Object getAttribValue(int i)
getAttribValue in class BaseModeli - The index of the attributeValues array whose value we want
public java.lang.String getAttribValueAsString(int i)
getAttribValueAsString in class TableModeli - The index of the attributeValues array whose value we want
public double getAttribValueAsDouble(int i)
getAttribValueAsDouble in class BaseModeli - The index of the attributeValues array whose value we want
public int getAttribValueAsInt(int i)
getAttribValueAsInt in class BaseModeli - The index of the attributeValues array whose value we want
public int getAttribute(java.lang.String attribName)
getAttribute in class BaseModelattribName - The name of the attribute we are trying to locate
public void sync()
TableModel
sync in class TableModelpublic void retrieve()
retrieve in class TableModelpublic void first()
public void last()
public boolean next()
public boolean hasMoreRows()
public boolean previous()
public java.lang.String getValue()
public DataModel getValue(int i)
i - The index into the values array
public java.lang.String getFieldValue(int colIdx)
getFieldValue in class TableModelcolIdx - the column of field index
public java.lang.String getFieldValue(int rowIdx,
int colIdx)
getFieldValue in class TableModelrowIdx - the row indexcolIdx - the column of field index
public void setFieldValue(int colIdx,
java.lang.String newValue)
setFieldValue in class TableModelcolIdx - the field index, zero basednewValue - the new field value
public void setFieldValue(int rowIdx,
int colIdx,
java.lang.String newValue)
setFieldValue in class TableModelrowIdx - the row index, zero basedcolIdx - the field index, zero basednewValue - the new field valuepublic double getValueAsDouble(java.lang.String elementName)
getValueAsDouble in class BaseModelelementName - the field/column name
public int getValueAsInt(java.lang.String elementName)
getValueAsInt in class BaseModelelementName - the field name
public java.lang.String getAttribName(int i)
getAttribName in class BaseModeli - The index of the attributeNames array whose value we want
public java.lang.String getId()
getId in class BaseModel
public void setAttribValue(int i,
java.lang.Object value)
setAttribValue in class BaseModeli - The index of the attributeValues array whose value we wantvalue - the value objectpublic int getNumChildren()
getNumChildren in class BaseModelpublic int getNumAttributes()
getNumAttributes in class BaseModelpublic java.lang.String getTagName()
getTagName in class DataModel
public static CollectionTableModel getTable(Project 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 RowSelectorsourceData - the new row selection index (zero based)public int getSelectedRow()
getSelectedRow in interface RowSelector
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||