org.jdesktop.jdnc.table
Class TableModelExtAdapter

java.lang.Object
  extended by org.jdesktop.binding.AbstractDataModel
      extended by org.jdesktop.jdnc.table.TableModelExtAdapter
All Implemented Interfaces:
DataModel, MetaDataProvider

public class TableModelExtAdapter
extends AbstractDataModel

Adapts a DefaultTableModelExt object to the DataModel interface so that user-interface components other than a table can easily be bound to columns in the model.

Version:
1.0
Author:
Amy Fowler

Field Summary
 
Fields inherited from class org.jdesktop.binding.AbstractDataModel
validators
 
Constructor Summary
TableModelExtAdapter(DefaultTableModelExt model)
           
 
Method Summary
 int getFieldCount()
           
 java.lang.String[] getFieldNames()
          Note: if the type for id is changed to Object type this will have to change to returning Object[].
 MetaData getMetaData(java.lang.String fieldName)
          Note: String will likely be converted to type Object for the ID
 int getRecordCount()
           
 int getRecordIndex()
           
 java.lang.Object getValue(java.lang.String fieldName)
           
 void setRecordIndex(int rowIndex)
          Sets the current record index such that the data field values in this value map represent the values contained at the specified row in the tabular data model.
protected  void setValueImpl(java.lang.String fieldName, java.lang.Object value)
           
 
Methods inherited from class org.jdesktop.binding.AbstractDataModel
addValidator, addValueChangeListener, fireValueChanged, getMetaData, getValidators, getValueChangeListeners, removeValidator, removeValueChangeListener, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableModelExtAdapter

public TableModelExtAdapter(DefaultTableModelExt model)
Method Detail

getFieldNames

public java.lang.String[] getFieldNames()
Description copied from interface: MetaDataProvider
Note: if the type for id is changed to Object type this will have to change to returning Object[].

Specified by:
getFieldNames in interface MetaDataProvider
Specified by:
getFieldNames in class AbstractDataModel
Returns:
array containing the names of all data fields in this map

getMetaData

public MetaData getMetaData(java.lang.String fieldName)
Description copied from interface: MetaDataProvider
Note: String will likely be converted to type Object for the ID

Specified by:
getMetaData in interface MetaDataProvider
Specified by:
getMetaData in class AbstractDataModel
Parameters:
fieldName - String containing the id of the data object
Returns:
MetaData object which describes properties, edit constraints and validation logic for a data object

getFieldCount

public int getFieldCount()
Returns:
integer containing the number of contained MetaData

getValue

public java.lang.Object getValue(java.lang.String fieldName)
Specified by:
getValue in interface DataModel
Specified by:
getValue in class AbstractDataModel
Parameters:
fieldName - String containing the name of the field
Returns:
Object containing the current value of the named field

setValueImpl

protected void setValueImpl(java.lang.String fieldName,
                            java.lang.Object value)
Specified by:
setValueImpl in class AbstractDataModel

setRecordIndex

public void setRecordIndex(int rowIndex)
Sets the current record index such that the data field values in this value map represent the values contained at the specified row in the tabular data model.

Parameters:
rowIndex - integer representing the current row index
Throws:
java.lang.IndexOutOfBoundsException - if index >= recordCount

getRecordIndex

public int getRecordIndex()
Returns:
integer representing the current row index

getRecordCount

public int getRecordCount()
Returns:
integer representing the number of rows currently in the tabular data model


Copyright © 2005 Sun Microsystems All Rights Reserved.