org.jdesktop.swing.data
Class DefaultDataModel
java.lang.Object
org.jdesktop.swing.data.AbstractDataModel
org.jdesktop.swing.data.DefaultDataModel
- All Implemented Interfaces:
- DataModel
- Direct Known Subclasses:
- JavaBeanDataModel
- public class DefaultDataModel
- extends AbstractDataModel
Default data model implementation designed to hold a single record of
field values. This class provides storage of the model's values and
may be used when there is no underlying data model.
- See Also:
TabularDataModelAdapter,
JavaBeanDataModel
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultDataModel
public DefaultDataModel()
DefaultDataModel
public DefaultDataModel(MetaData[] fieldMetaData)
addField
public void addField(MetaData fieldMetaData,
Object defaultValue)
addField
public void addField(MetaData fieldMetaData)
removeField
public void removeField(MetaData fieldMetaData)
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
getRecordCount
public int getRecordCount()
- Returns:
- integer containing the number of records accessible
from this data model
getRecordIndex
public int getRecordIndex()
- Returns:
- integer representing the current index into the underlying
data model's records
setRecordIndex
public void setRecordIndex(int index)
- Description copied from interface:
DataModel
- Sets the current record index such that the field values
in this data model represent the values contained at the specified index
in the underlying data model.
- Parameters:
index - integer representing the current index into the underlying
data model's records
Copyright 2004 by Sun Microsystems, Inc. All Rights Reserved.