001: /* Listbox.java
002:
003: {{IS_NOTE
004: Purpose:
005:
006: Description:
007:
008: History:
009: Aug 8, 2007 5:48:27 PM 2007, Created by Dennis.Chen
010: }}IS_NOTE
011:
012: Copyright (C) 2007 Potix Corporation. All Rights Reserved.
013:
014: {{IS_RIGHT
015: This program is distributed under GPL Version 2.0 in the hope that
016: it will be useful, but WITHOUT ANY WARRANTY.
017: }}IS_RIGHT
018: */
019: package org.zkoss.jsf.zul;
020:
021: import org.zkoss.jsf.zul.impl.BaseListbox;
022: import org.zkoss.zk.ui.Component;
023:
024: /**
025: * Listbox is a JSF component implementation for {@link org.zkoss.zul.Listbox},
026: * This class also implements {@link javax.faces.component.EditableValueHolder}.
027: * That means you can use bidirection value binding, immediate, required, converter, validator, valueChangeListener features on this component.
028: * <br/>
029: * To use those features, you must decleare a namespace of "http://java.sun.com/jsf/core"
030: * with a prefix (say 'f' in below example), add attribute of those feature with this namespace
031: * (for example f:required="true")in you jsf page.
032: * For more detail of EditableValueHolder features of JSF, you can refer to <a href="http://java.sun.com/products/jsp/">http://java.sun.com/products/jsp/</a>
033: *
034: * <p/>
035: * You must assign a value on each listitem, so that, after user select listitem and submitting,
036: * listbox will decode the request parameter and set back the submitted value to your bean.
037: * <p/>
038: * When listbox set multiple to false(single selection), then
039: * the default binding value of this component is {@link java.lang.String}.
040: * When listbox set multiple ot true(multiple selection, then
041: * the default binding value of this component is {@link java.lang.String} array.
042: *
043: * <p/>
044: * Example of use bidirection value binding:<br/>
045: * <pre>
046: <z:listbox id="role1" f:value="#{yourBean.value}">
047: <z:listitem value="1" label="Determine need" />
048: <z:listitem value="2" label="Evaluate products/sesrvices" />
049: <z:listitem value="3" label="Recommend products/sesrvices" />
050: <z:listitem value="4" label="Implement products/sesrvices" />
051: <z:listitem value="5" label="Techinical decision maker" />
052: <z:listitem value="6" label="Financial decision maker" />
053: </z:listbox>
054: * </pre>
055: *
056: *
057: * <p/>
058: * Example of using immediate:<br/>
059: * <pre>
060: * <z:listbox f:immediate="true" />
061: * </pre>
062: *
063: * <p/>
064: * Example of using required:<br/>
065: * <pre>
066: * <z:listbox f:required="true" />
067: * </pre>
068: * <p/>
069: * Example of using converter:<br/>
070: * <pre>
071: * <z:listbox f:converter="yourBean.convertMethod"/>
072: * or
073: * <z:listbox >
074: * <f:converter converterId="yourConverterId"/>
075: * </z:listbox>
076: * </pre>
077: * <p/>
078: * Example of using validator:<br/>
079: * <pre>
080: * <z:listbox f:validator="yourBean.validateMethod"/>
081: * or
082: * <z:listbox >
083: * <f:validator validatorId="yourValidatorId"/>
084: * </z:listbox>
085: * </pre>
086: * <p/>
087: * Example of using converter:<br/>
088: * <pre>
089: * <z:listbox >
090: * <f:valueChangeListener type="your.ValueChangeListener"/>
091: * </z:listbox>
092: * </pre>
093: * <p/>
094: * In some application server which doesn't support attribute namespace you can use attribute prefix 'f_' to replace attribute namespace
095: * <br/>
096: * For example,
097: * <pre>
098: * <z:listbox f_value="#{yourBean.value}" />
099: * </pre>
100: *
101: * <p/>
102: * This component should be declared nested under {@link org.zkoss.jsf.zul.Page}.
103: *
104: * <p/>To know more ZK component features you can refer to <a href="http://www.zkoss.org/">http://www.zkoss.org/</a>
105: *
106: * @author Dennis.Chen
107: * @see org.zkoss.zul.Listbox
108: * @see javax.faces.component.EditableValueHolder
109: */
110: public class Listbox extends BaseListbox {
111:
112: }
|