Revision history [back]

click to hide/show revision 1
initial version

answered 2012-01-27 10:28:49 +0800

Matze2 gravatar image Matze2

In ZK6, the multiple flag of the llistbox may get overwritten by the multiple flag of the listmodel. These are the possibilities to circumvent it: - provide a "real" ListModel as model and set multiple=true there - with ZK6 binding you can bind selectedItems instead of selectedItem, then multiple=true is set automatically - use a converter like that on the model to fix that behavior:

/**
 * Fix multiple selection state.
 *  
 * @author matze
 */
public class MultiSelectionConverter extends ListModelConverter {
    private static final long serialVersionUID = 1L;

    @Override
    public Object coerceToUi(Object val, Component comp) {
        Object bean = super.coerceToUi(val, comp);
        AbstractListModel<?> model = (AbstractListModel<?>) bean;
        Listbox listbox = (Listbox) comp;

        if (listbox.isMultiple() && !model.isMultiple()) {
            model.setMultiple(true);
        }
        return bean;
    }
}
Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More