org.jdesktop.swing.data
Class JavaBeanDataModel
java.lang.Object
org.jdesktop.swing.data.AbstractDataModel
org.jdesktop.swing.data.DefaultDataModel
org.jdesktop.swing.data.JavaBeanDataModel
- All Implemented Interfaces:
- DataModel
- public class JavaBeanDataModel
- extends DefaultDataModel
A class that creates a collection of MetaData based BeanInfo
PropertyDescriptors. To use this class:
- Construct the model using the Bean class you wish to model
- use
setJavaBean to set the current object of this class.
- Updates made to the form will update the property values of the bean.
TODO: Using JavaBeans as a data source should be generalized and not
constrained to FormModels.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JavaBeanDataModel
public JavaBeanDataModel(Class beanClass)
throws IntrospectionException
JavaBeanDataModel
public JavaBeanDataModel(Class beanClass,
Object bean)
throws IntrospectionException
- Constructs a JavaBeanDataModel by introspecting on the class and using the data from
the object as the current bean
- Parameters:
beanClass - the class to use to introspect propertiesbean - the object where the current values will be retrieved and stored.
setJavaBean
public void setJavaBean(Object bean)
- Set the JavaBean instance that this model will use.
getJavaBean
public Object getJavaBean()
- Get the JavaBean instance that this model uses.
getValue
public Object getValue(String fieldName)
- Specified by:
getValue in interface DataModel- Overrides:
getValue in class DefaultDataModel
setValueImpl
protected void setValueImpl(String fieldName,
Object value)
- Overrides:
setValueImpl in class DefaultDataModel
Copyright 2004 by Sun Microsystems, Inc. All Rights Reserved.