|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.iplanet.jato.model.BeanAdapterModel
A simple model that obtains its values from one or more JavaBeans, using reflection to read and write bean properties. This class can be used to directly bind local business objects or EJBs to a view.
Field Summary | |
static int |
UNDEFINED_ROW_INDEX
|
Constructor Summary | |
BeanAdapterModel()
Default constructor |
|
BeanAdapterModel(java.lang.Object bean)
Construct an instance using the target bean as the backing data store |
|
BeanAdapterModel(java.lang.Object[] beans)
Construct an instance using the set of target beans as the backing data store. |
Method Summary | |
void |
beforeFirst()
Moves the internal location iterator to a special position such that a call to next() will position the location at the first dataset (if
available). |
protected boolean |
checkIndex()
|
boolean |
first()
Moves the internal location iterator to the first available dataset. |
java.lang.Object |
getBean()
Returns the backing bean object |
java.lang.Object[] |
getBeans()
Returns the set of backing bean objects |
java.lang.Object |
getCurrentBean()
Returns the bean at the current dataset location |
protected int |
getIndex()
|
int |
getLocation()
Get the relative location of the current data within the dataset. |
int |
getLocationOffset()
Returns the offset of this dataset from some implementation- or context-dependent reference location. |
java.lang.String |
getName()
Returns the logical instance name of this model. |
protected java.beans.PropertyDescriptor |
getPropertyDescriptor(java.lang.Object bean,
java.lang.String property)
|
int |
getSize()
Return the number of available datasets. |
java.lang.Object |
getValue(java.lang.String name)
Returns a named value from this model |
java.lang.Object[] |
getValues(java.lang.String name)
Returns a named set of values from this model |
boolean |
last()
Moves the internal location iterator to the last available dataset. |
boolean |
next()
Moves the internal location iterator to the next available dataset |
boolean |
previous()
Moves the internal location iterator to the previous available dataset |
void |
setBean(java.lang.Object value)
Sets the backing bean object and resets the dataset location to the "before first" state. |
void |
setBeans(java.lang.Object[] value)
Sets the backing bean objects and resets the dataset location to the "before first" state. |
protected void |
setIndex(int value)
|
void |
setLocation(int location)
Set the relative location of the current dataset. |
void |
setName(java.lang.String value)
Sets the logical name of this model |
void |
setSize(int value)
Sets the number of available datasets. |
void |
setValue(java.lang.String name,
java.lang.Object value)
Sets a named value in this model. |
void |
setValues(java.lang.String name,
java.lang.Object[] value)
Sets a named set of values in this model |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int UNDEFINED_ROW_INDEX
Constructor Detail |
public BeanAdapterModel()
public BeanAdapterModel(java.lang.Object bean)
public BeanAdapterModel(java.lang.Object[] beans)
Method Detail |
public java.lang.String getName()
Model
ModelManager
may assign a name to a model based
on user request.getName
in interface Model
com.iplanet.jato.model.Model
public void setName(java.lang.String value)
Model
setName
in interface Model
com.iplanet.jato.model.Model
name
- The new name of this modelpublic java.lang.Object getBean()
public java.lang.Object[] getBeans()
public void setBean(java.lang.Object value)
value
- The new bean to wrap in this modelpublic void setBeans(java.lang.Object[] value)
value
- The new set of beans to wrap in this modelprotected java.beans.PropertyDescriptor getPropertyDescriptor(java.lang.Object bean, java.lang.String property) throws java.beans.IntrospectionException
public java.lang.Object getValue(java.lang.String name)
Model
getValue
in interface Model
com.iplanet.jato.model.Model
name
- The name of the value to returnpublic void setValue(java.lang.String name, java.lang.Object value)
Model
setValue
in interface Model
com.iplanet.jato.model.Model
name
- The name of the value to setvalue
- The value to set in this modelpublic java.lang.Object[] getValues(java.lang.String name)
Model
getValues
in interface Model
com.iplanet.jato.model.Model
name
- The name of the value set to returnpublic void setValues(java.lang.String name, java.lang.Object[] value)
Model
setValues
in interface Model
com.iplanet.jato.model.Model
name
- The name of the value set to set in the modelvalues
- The set of values to set in this modelpublic int getSize() throws ModelControlException
DatasetModel
getSize
in interface DatasetModel
com.iplanet.jato.model.DatasetModel
ModelControlException
- Thrown if an error occurrs determining the number of datasetspublic void setSize(int value) throws ModelControlException
DatasetModel
setSize
in interface DatasetModel
com.iplanet.jato.model.DatasetModel
ModelControlException
- Thrown if an error occurrs setting the number of datasets. Not all
model control implementations will allow the number of datasets to
be directly changed.public int getLocationOffset()
DatasetModel
first()
and
last()
locations--this information is informational only.getLocationOffset
in interface DatasetModel
com.iplanet.jato.model.DatasetModel
ModelControlException
- Thrown if an error occurrs determining the location offset, or if the
notion of location offset is not supported. However, if the latter is
the case, implementors are encouraged instead to return a value
indicating the situation, such as zero or negative one (0 or -1).public int getLocation() throws ModelControlException
DatasetModel
first()
method is called. In
addition, this method will typically return negative one (-1) after the
beforeFirst()
method is called.getLocation
in interface DatasetModel
com.iplanet.jato.model.DatasetModel
ModelControlException
- Thrown if an error occurrs determining the current location, or if
the current location is undefined. However, if the latter is
the case, implementors are encouraged instead to return a value
indicating this situation, like negative one (-1).public void setLocation(int location) throws ModelControlException
DatasetModel
first()
method. Normally, a call to this method with a parameter of negative one (-1)
should be equivalent to calling the beforeFirst()
method. However,
neither of these situations are guaranteed depending on the implementation.setLocation
in interface DatasetModel
com.iplanet.jato.model.DatasetModel
ModelControlException
- Thrown if an error occurrs setting the current location. Not all model
control implementations support setting the current location.protected int getIndex()
protected void setIndex(int value)
protected boolean checkIndex()
public java.lang.Object getCurrentBean()
public void beforeFirst() throws ModelControlException
DatasetModel
next()
will position the location at the first dataset (if
available). Normally, a call to getLocation()
after this method
is called should return negative one (-1).beforeFirst
in interface DatasetModel
com.iplanet.jato.model.DatasetModel
ModelControlException
- Thrown if an error occurrs setting the location to this special positionpublic boolean first() throws ModelControlException
DatasetModel
getLocation()
after this method is called should return zero
(0). The offset of this dataset from some implementation- or context-dependent
reference location is given by getLocationOffset()
. However, this
control object is under no obligation or burden to allow setting the location to
obtain datasets outside of the "window" defined by the boundaries of the
first()
and last()
locations.first
in interface DatasetModel
com.iplanet.jato.model.DatasetModel
ModelControlException
- Thrown if an error occurrs moving to the first datasetpublic boolean last() throws ModelControlException
DatasetModel
getLocation()
after this method is called should return
getSize()-1
.last
in interface DatasetModel
com.iplanet.jato.model.DatasetModel
ModelControlException
- Thrown if an error occurrs moving to the last datasetpublic boolean next() throws ModelControlException
DatasetModel
next
in interface DatasetModel
com.iplanet.jato.model.DatasetModel
ModelControlException
- Thrown if an error occurrs positioning at the next datasetpublic boolean previous() throws ModelControlException
DatasetModel
previous
in interface DatasetModel
com.iplanet.jato.model.DatasetModel
ModelControlException
- Thrown if an error occurrs positioning at the previous dataset
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |