|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.tapestry.dojo.form.DefaultAutocompleteModel
public class DefaultAutocompleteModel
Default simple implementation of IAutocompleteModel. This class relies
on the java beans specification to resolve key fields of an incoming
List.
If you had an object type of User, with the primary/unique id of
each User object stored as a member with a name of id
you would pass something like this into the model(don't forget that javabeans syntax
requires a corresponding getId() for members):
IAutocompleteModel model = new DefaultAutocompleteModel(List users, "id", "name");
http://jakarta.apache.org/commons/beanutils/commons-beanutils-1.6.1/docs/api/org/apache/commons/beanutils/PropertyUtils.html}| Constructor Summary | |
|---|---|
DefaultAutocompleteModel(List values,
String keyField,
String labelField)
Create a new model using java beans syntax to access the key/label for the list using the specified bean expressions. |
|
| Method Summary | |
|---|---|
Map |
filterValues(String match)
Used to filter a potentially large list of objects. |
String |
getLabelFor(Object value)
For the given value, provide a user friendly label that will be presented in a drop down selection list in the browser ui. |
Object |
getPrimaryKey(Object value)
Returns the primary key of the given value. |
Object |
getValue(Object primaryKey)
Returns the value corresponding the given primary key. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultAutocompleteModel(List values,
String keyField,
String labelField)
values - The list of values to manage.keyField - The java beans expression for getting the primary key of each object
in the list. getPrimaryKey(Object).labelField - The java beans expression for getting the label of each object
in the list. getLabelFor(Object).| Method Detail |
|---|
public Map filterValues(String match)
filterValues in interface IAutocompleteModelmatch - The given partial string that should be matched against object
labels in the model being managed.
Map containing key/value pairs matching the given input label string.
The map should contain a key compatible with IPrimaryKeyConverter.getPrimaryKey(Object)
and value compatible with IAutocompleteModel.getLabelFor(Object).public String getLabelFor(Object value)
getLabelFor in interface IAutocompleteModelvalue - The object to retrieve a label for.
public Object getPrimaryKey(Object value)
getPrimaryKey in interface IPrimaryKeyConverterpublic Object getValue(Object primaryKey)
getValue in interface IPrimaryKeyConverter
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||