org.jdesktop.swing.data
Class TabularDataModelAdapter

java.lang.Object
  extended byorg.jdesktop.swing.data.AbstractDataModel
      extended byorg.jdesktop.swing.data.TabularDataModelAdapter
All Implemented Interfaces:
DataModel

public class TabularDataModelAdapter
extends AbstractDataModel

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


Field Summary
 
Fields inherited from class org.jdesktop.swing.data.AbstractDataModel
validators
 
Constructor Summary
TabularDataModelAdapter(TabularDataModel model)
           
 
Method Summary
 int getFieldCount()
           
 String[] getFieldNames()
           
 MetaData getMetaData(String fieldName)
           
 int getRecordCount()
           
 int getRecordIndex()
           
 Object getValue(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(String fieldName, Object value)
           
 
Methods inherited from class org.jdesktop.swing.data.AbstractDataModel
addValidator, addValueChangeListener, fireValueChanged, 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

TabularDataModelAdapter

public TabularDataModelAdapter(TabularDataModel model)
Method Detail

getFieldNames

public String[] getFieldNames()
Specified by:
getFieldNames in interface DataModel
Specified by:
getFieldNames in class AbstractDataModel

getMetaData

public MetaData getMetaData(String fieldName)
Specified by:
getMetaData in interface DataModel
Specified by:
getMetaData in class AbstractDataModel

getFieldCount

public int getFieldCount()
Returns:
integer containing the number of fields in this data model

getValue

public Object getValue(String fieldName)
Specified by:
getValue in interface DataModel
Specified by:
getValue in class AbstractDataModel

setValueImpl

protected void setValueImpl(String fieldName,
                            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:
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 2004 by Sun Microsystems, Inc. All Rights Reserved.