net.xoetrope.xui.data.table
Class XFieldModel

java.lang.Object
  extended by net.xoetrope.xui.data.XModel
      extended by net.xoetrope.xui.data.table.XFieldModel
Direct Known Subclasses:
DatabaseFieldModel

public class XFieldModel
extends XModel

Provides a model for table field. The field will have no children. As a Java object the fields and rows indices are zero based in contrast to the JDBC indexing setup.

The class is not intended to be used directly except in rare circumstances, instead most access will be via the model and bindings or via the XTableModel class

Copyright (c) Xoetrope Ltd. 2001-2003

$Revision: 2.2 $ License: see license.txt


Field Summary
protected  int fieldIdx
           
protected  int rowIdx
           
protected  XTableModel sourceData
           
 
Fields inherited from class net.xoetrope.xui.data.XModel
parentModel, tagName
 
Constructor Summary
XFieldModel()
          Create a new field model node
XFieldModel(XTableModel table, int row, int field)
          Create a new field model node
 
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 append(XModel newObject)
          This method is required by the XModel interface but in this case it is not implemented as it is inappropriate in the context of the class
 java.lang.Object get()
          Get the field value
 XModel get(int i)
          Not yet implemented - does nothing
 java.lang.String getAttribName(int i)
          This method is required by the XModel interface but in this case it is not implemented as it is inappropriate in the context of the class
 int getAttribute(java.lang.String attribName)
          This method is required by the XModel interface but in this case it is not implemented as it is inappropriate in the context of the class
 java.lang.Object getAttribValue(int i)
          This method is required by the XModel interface but in this case it is not implemented as it is inappropriate in the context of the class
 double getAttribValueAsDouble(int i)
          Deprecated. use getAttribValueAsDouble( i, decimalSeparator, groupingSeparator ) instead, if the locale is different from the locale used to write the values to the model, then the parsed value may be incorrect.
 double getAttribValueAsDouble(int i, char decimalSeparator, char groupingSeparator)
          Convert the attribute at the specified index to a double and return it
 int getAttribValueAsInt(int i)
          Gets the field value as an int
 java.lang.String getAttribValueAsString(int i)
          This method is required by the XModel interface but in this case it is not implemented as it is inappropriate in the context of the class
 int getFieldIndex()
          Get the index of this fiels
 java.lang.String getId()
          This method is required by the XModel interface but in this case it is not implemented as it is inappropriate in the context of the class
 XTableModel getTable()
          Get the referenced table model
 java.lang.String getTagName()
          Gets the model element tag name, e.g.
 java.lang.String getValue()
          Gets the value of the field
 double getValueAsDouble(java.lang.String elementName)
          This method is required by the XModel interface but in this case it is not implemented as it is inappropriate in the context of the class
 int getValueAsInt(java.lang.String elementName)
          This method is required by the XModel interface but in this case it is not implemented as it is inappropriate in the context of the class
 java.lang.String getValueAsString(java.lang.String elementName)
          Gets the value attribute of the specified node as a string.
 int hashCode()
          Returns a hashcode for this node
 void remove(XModel model)
          Not yet implemented - does nothing
 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 setAttribValue(int i, java.lang.Object value)
          Not yet implemented - does nothing
 void setAttribValue(int i, java.lang.String attribName, java.lang.Object value)
          Not yet implemented - does nothing
 void setCellReference(XTableModel table, int row, int field)
          Set the reference to the field to which this node will refer
 java.lang.String toString()
          Gets the value as a string
 
Methods inherited from class net.xoetrope.xui.data.XModel
addModelListener, clear, fireModelUpdated, get, getNumAttributes, getNumChildren, getParent, hasAutoId, hasAutoId, prefixOutputPath, removeChildren, reset, resetAttributes, setId, setNumAttributes, setNumChildren, setParent, setTagName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

rowIdx

protected int rowIdx

fieldIdx

protected int fieldIdx

sourceData

protected XTableModel sourceData
Constructor Detail

XFieldModel

public XFieldModel()
Create a new field model node


XFieldModel

public XFieldModel(XTableModel table,
                   int row,
                   int field)
Create a new field model node

Parameters:
table - the table model
row - the row index
field - the field index
Method Detail

getTable

public XTableModel getTable()
Get the referenced table model

Returns:
the referenced table

getFieldIndex

public int getFieldIndex()
Get the index of this fiels

Returns:
the index of the column

setCellReference

public void setCellReference(XTableModel table,
                             int row,
                             int field)
Set the reference to the field to which this node will refer

Parameters:
table - the table that contains the data
row - the row index
field - the field index

append

public void append(XModel newObject)

This method is required by the XModel interface but in this case it is not implemented as it is inappropriate in the context of the class

Specified by:
append in class XModel
Parameters:
newObject - ignored

getValueAsDouble

public double getValueAsDouble(java.lang.String elementName)

This method is required by the XModel interface but in this case it is not implemented as it is inappropriate in the context of the class

Specified by:
getValueAsDouble in class XModel
Parameters:
elementName - ignored
Returns:
nothing, instead the method throws an UnsupportedOperationException

getValue

public java.lang.String getValue()
Gets the value of the field

Returns:
the value

getAttribValue

public java.lang.Object getAttribValue(int i)

This method is required by the XModel interface but in this case it is not implemented as it is inappropriate in the context of the class

Specified by:
getAttribValue in class XModel
Parameters:
i - ignored
Returns:
nothing, instead the method throws an UnsupportedOperationException

getAttribValueAsString

public java.lang.String getAttribValueAsString(int i)

This method is required by the XModel interface but in this case it is not implemented as it is inappropriate in the context of the class

Specified by:
getAttribValueAsString in class XModel
Parameters:
i - ignored
Returns:
nothing, instead the method throws an UnsupportedOperationException

getValueAsString

public java.lang.String getValueAsString(java.lang.String elementName)
Gets the value attribute of the specified node as a string.

This method is required by the XModel interface but in this case it is not implemented as it is inappropriate in the context of the class

Specified by:
getValueAsString in class XModel
Parameters:
elementName - ignored
Returns:
nothing, instead the method throws an UnsupportedOperationException

getId

public java.lang.String getId()

This method is required by the XModel interface but in this case it is not implemented as it is inappropriate in the context of the class

Specified by:
getId in class XModel
Returns:
nothing, instead the method throws an UnsupportedOperationException

getAttribName

public java.lang.String getAttribName(int i)

This method is required by the XModel interface but in this case it is not implemented as it is inappropriate in the context of the class

Specified by:
getAttribName in class XModel
Parameters:
i - ignored
Returns:
nothing, instead the method throws an UnsupportedOperationException

getAttribute

public int getAttribute(java.lang.String attribName)

This method is required by the XModel interface but in this case it is not implemented as it is inappropriate in the context of the class

Specified by:
getAttribute in class XModel
Parameters:
attribName - ignored
Returns:
nothing, instead the method throws an UnsupportedOperationException

set

public void set(java.lang.String attribName,
                java.lang.Object newObject)
Set the value of the XModel located at the elementName

Specified by:
set in class XModel
Parameters:
attribName - The path to the XModel in the format 'base/foo
newObject - The new value of the XModel

set

public void set(java.lang.Object s)
Sets the model value

Specified by:
set in class XModel
Parameters:
s - the new value

remove

public void remove(XModel model)
Not yet implemented - does nothing

Parameters:
model - - ignored

get

public XModel get(int i)
Not yet implemented - does nothing

Specified by:
get in class XModel
Parameters:
i - - ignored
Returns:
null

append

public java.lang.Object append(java.lang.String id)
This method does not nothing it is provided merely as an implementation of the XModel interface. A child or attribute can be logically appended to a table node.

Specified by:
append in class XModel
Parameters:
id - the node id
Returns:
null as nothing is appended

getTagName

public java.lang.String getTagName()
Gets the model element tag name, e.g. 'Component' from the XML fragment
Overrides:
getTagName in class XModel
Returns:
the model element name

get

public java.lang.Object get()
Get the field value

Specified by:
get in class XModel
Returns:
the field value object

getValueAsInt

public int getValueAsInt(java.lang.String elementName)

This method is required by the XModel interface but in this case it is not implemented as it is inappropriate in the context of the class

Specified by:
getValueAsInt in class XModel
Parameters:
elementName - ignored
Returns:
nothing, instead the method throws an UnsupportedOperationException

setAttribValue

public void setAttribValue(int i,
                           java.lang.Object value)
Not yet implemented - does nothing

Specified by:
setAttribValue in class XModel
Parameters:
i - ignored
value - ignored

setAttribValue

public void setAttribValue(int i,
                           java.lang.String attribName,
                           java.lang.Object value)
Not yet implemented - does nothing

Specified by:
setAttribValue in class XModel
Parameters:
i - - ignored
attribName - - ignored
value - - ignored

hashCode

public int hashCode()
Returns a hashcode for this node

Specified by:
hashCode in class XModel
Returns:
the hash code

getAttribValueAsInt

public int getAttribValueAsInt(int i)
Gets the field value as an int

Specified by:
getAttribValueAsInt in class XModel
Parameters:
i - The index of the attributeValues array whose value we want
Returns:
The int value of the attributeValues array at position i

getAttribValueAsDouble

public double getAttribValueAsDouble(int i)
Deprecated. use getAttribValueAsDouble( i, decimalSeparator, groupingSeparator ) instead, if the locale is different from the locale used to write the values to the model, then the parsed value may be incorrect.

Gets the field value as a double

Specified by:
getAttribValueAsDouble in class XModel
Parameters:
i - The index of the attributeValues array whose value we want
Returns:
The int value of the attributeValues array at position i

getAttribValueAsDouble

public double getAttribValueAsDouble(int i,
                                     char decimalSeparator,
                                     char groupingSeparator)
Convert the attribute at the specified index to a double and return it

Specified by:
getAttribValueAsDouble in class XModel
Parameters:
i - The index of the attributeValues array whose value we want
decimalSeparator - the decimal separator
groupingSeparator - the grouping (thousands) separator
Returns:
The double value of the attributeValues array at position i

toString

public java.lang.String toString()
Gets the value as a string

Overrides:
toString in class java.lang.Object
Returns:
the value as a string