org.zkoss.zkplus.databind
Class SelectedItemConverter

java.lang.Object
  extended by org.zkoss.zkplus.databind.SelectedItemConverter
All Implemented Interfaces:
java.io.Serializable, TypeConverter

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

Convert selected item to bean and vice versa.

Before ZK version 3.6.2(included), when use data binding with selectedItem attribute of Listbox and/or Combobox, data binder will fire "onSelect" event automatically when the page is first loaded or model is changed. This is not consistent with ZK specification: only user action shall trigger component event. So since version 3.6.3, no longer the "onSelect" event will be fired(refer to Bug 2728704). However, some already implemented application might count on such "side effects". User can specify in application's WEB-INF/zk.xml following library-property to true to make it backward compatible (i.e. still fire the "onSelect" event when page is first loaded or model is changed)

    
        
                org.zkoss.zkplus.databind.onSelectWhenLoad
                true
        
 

Author:
Henri Chen
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.zkoss.zkplus.databind.TypeConverter
IGNORE
 
Constructor Summary
SelectedItemConverter()
           
 
Method Summary
 java.lang.Object coerceToBean(java.lang.Object val, Component comp)
          Convert an value object to bean property type.
 java.lang.Object coerceToUi(java.lang.Object val, Component comp)
          Convert an value object to UI component attribute type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SelectedItemConverter

public SelectedItemConverter()
Method Detail

coerceToUi

public java.lang.Object coerceToUi(java.lang.Object val,
                                   Component comp)
Description copied from interface: TypeConverter
Convert an value object to UI component attribute type.

Specified by:
coerceToUi in interface TypeConverter
Parameters:
val - the object to be corece to UI component attribute type.
comp - associated component
Returns:
the converted value suitable for assigning into UI compoenent attribute; or TypeConverter.IGNORE if you want DataBinder to ignore the assignment.

coerceToBean

public java.lang.Object coerceToBean(java.lang.Object val,
                                     Component comp)
Description copied from interface: TypeConverter
Convert an value object to bean property type.

Specified by:
coerceToBean in interface TypeConverter
Parameters:
val - the object to be corece to backend bean property type.
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