Package org.zkoss.zul
Class ListModels
- java.lang.Object
-
- org.zkoss.zul.ListModels
-
public class ListModels extends java.lang.ObjectA utility for handlingListModel.- Since:
- 5.0.4
- Author:
- jumperchen
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.ComparatorMAP_COMPARATORA comparator forListSubModel.getSubModel(java.lang.Object, int)to check if a value retrieved from the model matches the user typed.static java.util.ComparatorMAP_CONTAINS_COMPARATORA comparator forListSubModel.getSubModel(java.lang.Object, int)to check if a value retrieved from the model matches the user typed.static java.util.ComparatorSTRING_COMPARATORA comparator forListSubModel.getSubModel(java.lang.Object, int)to check if a value retrieved from the model matches the user typed.static java.util.ComparatorSTRING_CONTAINS_COMPARATORA comparator forListSubModel.getSubModel(java.lang.Object, int)to check if a value retrieved from the model contains the user typed.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> ListModel<T>toListSubModel(ListModel<T> model)Returns a proxy instance of the given model that implementsListSubModelandListModelinterface.static <T> ListModel<T>toListSubModel(ListModel<T> model, int initRenderCount)Returns a proxy instance of the given model that implementsListSubModelandListModelinterface.static <T> ListModel<T>toListSubModel(ListModel<T> model, java.util.Comparator<T> comparator, int nRows)Returns a proxy instance of the given model that implementsListSubModelandListModelinterface.static <T> ListModel<T>toListSubModel(ListModel<T> model, java.util.Comparator<T> comparator, int nRows, int initRenderCount)Returns a proxy instance of the given model that implementsListSubModelandListModelinterface.
-
-
-
Field Detail
-
STRING_COMPARATOR
public static final java.util.Comparator STRING_COMPARATOR
A comparator forListSubModel.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.
-
STRING_CONTAINS_COMPARATOR
public static final java.util.Comparator STRING_CONTAINS_COMPARATOR
A comparator forListSubModel.getSubModel(java.lang.Object, int)to check if a value retrieved from the model contains the user typed. To compare, it will convert them to String instances, and return 0 (i.e., matched), when the value contains the user typed (case-insensitive), and both of them are not empty.- Since:
- 10.3.0
-
MAP_COMPARATOR
public static final java.util.Comparator MAP_COMPARATOR
A comparator forListSubModel.getSubModel(java.lang.Object, int)to check if a value retrieved from the model matches the user typed. It assumes the model isMap, 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.
-
MAP_CONTAINS_COMPARATOR
public static final java.util.Comparator MAP_CONTAINS_COMPARATOR
A comparator forListSubModel.getSubModel(java.lang.Object, int)to check if a value retrieved from the model matches the user typed. It assumes the model isMap, 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()) contains the user typed, and both of them are not empty.- Since:
- 10.3.0
-
-
Method Detail
-
toListSubModel
public static <T> ListModel<T> toListSubModel(ListModel<T> model, java.util.Comparator<T> comparator, int nRows)
Returns a proxy instance of the given model that implementsListSubModelandListModelinterface.- Parameters:
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.
-
toListSubModel
public static <T> ListModel<T> toListSubModel(ListModel<T> model, java.util.Comparator<T> comparator, int nRows, int initRenderCount)
Returns a proxy instance of the given model that implementsListSubModelandListModelinterface.- Parameters:
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.initRenderCount- the number of items to be rendered initially when the input is empty (Support for Chosenbox).- Since:
- 10.3.0
-
toListSubModel
public static <T> ListModel<T> toListSubModel(ListModel<T> model, int initRenderCount)
Returns a proxy instance of the given model that implementsListSubModelandListModelinterface.The default comparator depends on the type of the model, if the model is an instance of
ListModelMap,MAP_COMPARATORis used. Otherwise,STRING_COMPARATORis used.If you want more control, use
toListSubModel(ListModel, Comparator, int, int)instead.- Parameters:
model- aListModelinitRenderCount- the number of items to be rendered initially when the input is empty (Support for Chosenbox).- Since:
- 10.3.0
- See Also:
toListSubModel(ListModel, Comparator, int, int)
-
toListSubModel
public static <T> ListModel<T> toListSubModel(ListModel<T> model)
Returns a proxy instance of the given model that implementsListSubModelandListModelinterface.The default comparator depends on the type of the model, if the model is an instance of
ListModelMap,MAP_COMPARATORis used. Otherwise,STRING_COMPARATORis used.In additions, the maximal allowed number of matched items is 15.
If you want more control, use
toListSubModel(ListModel, Comparator, int)instead.- Parameters:
model- aListModel- See Also:
toListSubModel(ListModel, Comparator, int)
-
-