|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.zkoss.zul.ListModels
public class ListModels
A utility for handling ListModel
.
Field Summary | |
---|---|
static java.util.Comparator |
MAP_COMPARATOR
A comparator for ListSubModel.getSubModel(java.lang.Object, int) to check if
a value retrieved from the model matches the user typed. |
static java.util.Comparator |
STRING_COMPARATOR
A comparator for ListSubModel.getSubModel(java.lang.Object, int) to check if
a value retrieved from the model matches the user typed. |
Method Summary | ||
---|---|---|
static
|
toListSubModel(ListModel<T> model)
Returns a proxy instance of the given model that implements ListSubModel and ListModel interface. |
|
static
|
toListSubModel(ListModel<T> model,
java.util.Comparator<T> comparator,
int nRows)
Returns a proxy instance of the given model that implements ListSubModel and ListModel interface. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.util.Comparator STRING_COMPARATOR
ListSubModel.getSubModel(java.lang.Object, int)
to check if
a value retrieved from the model matches the user typed.
To compare, it will convert them to String instances, and
return 0 (i.e., matched), when the value starts with
the user typed, and both of them are not empty.
public static final java.util.Comparator MAP_COMPARATOR
ListSubModel.getSubModel(java.lang.Object, int)
to check if
a value retrieved from the model matches the user typed.
It assumes the model is Map
, and the value is
Map.Entry.
To compare, it will convert them to String instances, and
return 0 when the value (Map.Entry's getValue())
starts with the user typed, and both of them are not empty.
Method Detail |
---|
public static <T> ListModel<T> toListSubModel(ListModel<T> model, java.util.Comparator<T> comparator, int nRows)
ListSubModel
and ListModel
interface.
model
- a modelcomparator
- used to compare the value typed by user and
the value from the model. The first argument is the value typed by user,
and the second argument is the value retrieved from the model.
It shall return 0 if they matched (i.e., shall be shown).nRows
- the maximal allowed number of matched items.public static <T> ListModel<T> toListSubModel(ListModel<T> model)
ListSubModel
and ListModel
interface.
The default comparator depends on the type of the model, if the
model is an instance of ListModelMap
, MAP_COMPARATOR
is used.
Otherwise, STRING_COMPARATOR
is used.
In additions, the maximal allowed number of matched items is 15.
If you want more control, use toListSubModel(ListModel, Comparator, int)
instead.
model
- a ListModel
toListSubModel(ListModel, Comparator, int)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |