org.zkoss.zkplus.databind
Class ListModelConverter

java.lang.Object
  extended by org.zkoss.zkplus.databind.ListModelConverter
All Implemented Interfaces:
java.io.Serializable, TypeConverter
Direct Known Subclasses:
CombboxListModelConverter, ListboxListModelConverter, SelectboxListModelConverter

public class ListModelConverter
extends java.lang.Object
implements TypeConverter, java.io.Serializable

The TypeConverter implementation for converting collection to ListModel and vice versa.

Since zk 6.0.1 This class doesn't handle setMultiple and Selectable, you should use corresponding new converter for different component if it has selection.

Author:
Henri Chen
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.zkoss.zkplus.databind.TypeConverter
IGNORE
 
Constructor Summary
ListModelConverter()
           
 
Method Summary
 java.lang.Object coerceToBean(java.lang.Object val, Component comp)
          Convert a BindingListModel to Set, Map, List, or BindingListModel (itself).
 java.lang.Object coerceToUi(java.lang.Object val, Component comp)
          Convert a Set, Map, List, Object[], Enum, or other kind of BindingListModel to associated BindingListModel.
protected  ListModel<?> getComponentModel(Component comp)
          Gets the model of the component, the sub-class should override this method
protected  BindingListModel<?> handleWrappedNonListModel(Component comp, BindingListModel<?> wrappedModel)
          Handles the wrapped non-list-model, by default it return the original one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListModelConverter

public ListModelConverter()
Method Detail

coerceToUi

public java.lang.Object coerceToUi(java.lang.Object val,
                                   Component comp)
Convert a Set, Map, List, Object[], Enum, or other kind of BindingListModel to associated BindingListModel.

Specified by:
coerceToUi in interface TypeConverter
Parameters:
val - must be instanceof Set, Map, List, Object[], Enum Class, or other kind of BindingListModel implementation.
comp - associated component
Returns:
the converted value suitable for assigning into UI component attribute; or TypeConverter.IGNORE if you want DataBinder to ignore the assignment.

getComponentModel

protected ListModel<?> getComponentModel(Component comp)
Gets the model of the component, the sub-class should override this method

Since:
6.0.1

handleWrappedNonListModel

protected BindingListModel<?> handleWrappedNonListModel(Component comp,
                                                        BindingListModel<?> wrappedModel)
Handles the wrapped non-list-model, by default it return the original one.

The sub-class could override this method if it needs to do some post process on the wrapped model.

Since:
6.0.1

coerceToBean

public java.lang.Object coerceToBean(java.lang.Object val,
                                     Component comp)
Convert a BindingListModel to Set, Map, List, or BindingListModel (itself).

Specified by:
coerceToBean in interface TypeConverter
Parameters:
val - must be BindingListModelSet, BindingListModelList, BindingListModelMap, or other kind of BindingListModel
comp - associated component
Returns:
the converted value suitable for assigning into backend bean property; or TypeConverter.IGNORE if you want DataBinder to ignore the assignment.


Copyright © 2005-2011 Potix Corporation. All Rights Reserved. SourceForge.net Logo