001: /* Tree.java
002:
003: {{IS_NOTE
004: Purpose:
005:
006: Description:
007:
008: History:
009: 2007/08/16 18:10:17 , 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.BaseTree;
022: import org.zkoss.zk.ui.Component;
023:
024: /**
025: * Tree is a JSF component implementation for {@link org.zkoss.zul.Tree},
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 treeitem, so that, when page submit those value,
036: * tree will decode the request parameter and set back to your bean.
037: * <p/>
038: * You must assign a value on each treeitem, so that, after user select treeitem and submitting,
039: * tree will decode the request parameter and set back the submitted value to your bean.
040: *
041: * <p/>
042: * When listbox set multiple to false(single selection), then
043: * the default binding value of this component is {@link java.lang.String}.
044: * When listbox set multiple ot true(multiple selection, then
045: * the default binding value of this component is {@link java.lang.String} array.
046: *
047: * <p/>
048: * Example of use bidirection value binding:<br/>
049: * <pre>
050: * <z:tree name="role1" id="tree" f:value="#{SelectionTestBean.selection}">
051: * <z:treechildren>
052: * <z:treeitem value="1">
053: * <z:treerow><z:treecell label="Item 1" /></z:treerow>
054: * </z:treeitem>
055: * <z:treeitem value="2">
056: * <z:treerow>
057: * <z:treecell label="Item 2" />
058: * </z:treerow>
059: * <z:treechildren>
060: * <z:treeitem value="3">
061: * <z:treerow>
062: * <z:treecell label="Item 2.1" />
063: * </z:treerow>
064: * <z:treechildren>
065: * <z:treeitem value="4">
066: * <z:treerow>
067: * <z:treecell label="Item 2.1.1" />
068: * </z:treerow>
069: * </z:treeitem>
070: * </z:treechildren>
071: * </z:treeitem>
072: * </z:treechildren>
073: * </z:treeitem>
074: * </z:treechildren>
075: * </z:tree>
076: * </pre>
077: *
078: *
079: * <p/>
080: * Example of using immediate:<br/>
081: * <pre>
082: * <z:tree f:immediate="true" />
083: * </pre>
084: *
085: * <p/>
086: * Example of using required:<br/>
087: * <pre>
088: * <z:tree f:required="true" />
089: * </pre>
090: * <p/>
091: * Example of using converter:<br/>
092: * <pre>
093: * <z:tree f:converter="yourBean.convertMethod"/>
094: * or
095: * <z:tree >
096: * <f:converter converterId="yourConverterId"/>
097: * </z:tree>
098: * </pre>
099: * <p/>
100: * Example of using validator:<br/>
101: * <pre>
102: * <z:tree f:validator="yourBean.validateMethod"/>
103: * or
104: * <z:tree >
105: * <f:validator validatorId="yourValidatorId"/>
106: * </z:tree>
107: * </pre>
108: * <p/>
109: * Example of using converter:<br/>
110: * <pre>
111: * <z:tree >
112: * <f:valueChangeListener type="your.ValueChangeListener"/>
113: * </z:tree>
114: * </pre>
115: * <p/>
116: * In some application server which doesn't support attribute namespace you can use attribute prefix 'f_' to replace attribute namespace
117: * <br/>
118: * For example,
119: * <pre>
120: * <z:tree f_value="#{yourBean.value}" />
121: * </pre>
122: *
123: * <p/>
124: * This component should be declared nested under {@link org.zkoss.jsf.zul.Page}.
125: *
126: * <p/>To know more ZK component features you can refer to <a href="http://www.zkoss.org/">http://www.zkoss.org/</a>
127: *
128: * @author Dennis.Chen
129: * @see org.zkoss.zul.Tree
130: * @see javax.faces.component.EditableValueHolder
131: */
132: public class Tree extends BaseTree {
133:
134: }
|