Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /* ListboxListmodelConverter.java
 
 	Purpose:
 		
 	Description:
 		
 	History:
 		2012/3/8 Created by Dennis Chen
 
Copyright (C) 2011 Potix Corporation. All Rights Reserved.
*/
package org.zkoss.zkplus.databind;
The TypeConverter implementation for converting collection to ListModel of a listbox

Deprecated:
As of release 7.0.0, replace with new ZK binding.
Author(s):
dennis
Since:
6.0.1
	private static final long serialVersionUID = 1L;
	protected ListModel<?> getComponentModel(Component comp){
		return ((Listbox)comp).getModel();
	}
	protected BindingListModel<?> handleWrappedNonListModel(Component compBindingListModel<?> wrappedModel){
		final Listbox listbox = (Listbox)comp;
		if(wrappedModel instanceof Selectable){
			if(((Selectable<?>)wrappedModel).isMultiple() != listbox.isMultiple());
			//since the model was wrapped. I should respect the setting on the component
			//user might set the multiple on the listbox by <listbox multiple="true" 
			//or <listbox multiple="@bind(true)" or <listbox multiple="@bind(vm.multiple)"
			((Selectable<?>)wrappedModel).setMultiple(listbox.isMultiple());
		}
		return wrappedModel;
	}
New to GrepCode? Check out our FAQ X