|
||||||||||
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");
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 | |
---|---|
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. |
List |
getValues(String match)
Expected to return a list of all possible values, filtering out values that match the specified String in the label representation of the value. |
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 List getValues(String match)
getValues
in interface IAutocompleteModel
match
- The string to use to filter the values based on the label representation of objects.
IPrimaryKeyConverter.getPrimaryKey(Object)
can be called on each returned value.public String getLabelFor(Object value)
getLabelFor
in interface IAutocompleteModel
value
- The object to retrieve a label for.
public Object getPrimaryKey(Object value)
getPrimaryKey
in interface IPrimaryKeyConverter
public Object getValue(Object primaryKey)
getValue
in interface IPrimaryKeyConverter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |