You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by Apache Wiki <wi...@apache.org> on 2006/11/02 13:21:00 UTC
[Myfaces Wiki] Update of "Tree2" by ArashRajaeeyan
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Myfaces Wiki" for change notification.
The following page has been changed by ArashRajaeeyan:
http://wiki.apache.org/myfaces/Tree2
------------------------------------------------------------------------------
= <t:tree2/> =
+ == Description ==
+ A component that provides an HTML-based tree from data supplied by a backing bean. The tree is highly customizable and allows for fine-grained control over the appearance of each of the nodes depending on their type. Almost any type of JSF component (text, image, checkbox, etc.) can be rendered inside the nodes and there is an option for client-side or server-side toggling of the expand/collapse state.
+
+ == Screen Shot ==
+ e.g. Not a Visual Component
+
+ == API ==
+
+ e.g.
+ || component-family || org.apache.myfaces.HtmlTree ||
+ || renderer-type || org.apache.myfaces.Tree ||
+ || component-class || org.apache.myfaces.custom.tree2.HtmlTree ||
+ || renderer-class || org.apache.myfaces.custom.tree2.HtmlTreeRenderer ||
+ || tag-class || org.apache.myfaces.custom.tree2.TreeTag ||
+
+ == Links to javadoc and tlddoc ==
+ http://myfaces.apache.org/tomahawk/tree2.html
+
+ == Usage ==
+
+
+ == Syntax ==
+ {{{
+ <t:tree2
+ [tomahawk_tree2_attributes]
+ [alt_location_attributes]
+ [ui_component_attributes] >
+ <f:facet name="...">
+ ... nested tags...
+ <f:facet name="...">
+ <f:facet>
+ ... nested tags...
+ </f:facet>
+ ...
+ </t:tree2>
+ }}}
+
+ == Instructions ==
The '''Tree2''' component renders a tree representation of your data with a HTML table. The tree is dynamic: nodes are expanded or collapsed when the user clicks them. The component supports both client side interaction through JavaScript, and server side interaction. In the latter case, each user click results in a request/response cycle, which re-renders the tree in the new view state.
Note that in the latter case only the visible (expanded) data is sent to the client. In the first case (client side tree), the entire tree is sent to the browser with every HTML response. Each node of the tree carries a sizable amount of HTML code with it (think 200 characters on average, depending on the amount of information you want to show in for a node), and this information is sent to the browser also for nodes that are not visible to the end user when the page is rendered, because one of their ancestor nodes is collapsed. If you have a tree, e.g., 4 levels deep, with 10 children on average for each node, you will transmit 10 + 10^2^ + 10^3^ + 10^4^ = 11 110 nodes of 200 characters, or 2 222 000 characters, or roughly 2MB of data. This example should make clear that, although the client side tree gives a very good user experience, you could grow a bandwith problem very rapidly, so be aware. This tree is fit for small trees, or medium sized trees on an intranet or over
a broadband connection. For large trees, or when you need to take into account low-bandwidth connections, you should use the server side tree.
You can choose between client-side or server-side interaction with the {{{clientSideToggle}}} attribute. {{{<t:tree2 clientSideToggle="false" ...}}} gives you the servers-side interaction. {{{true}}} (client-side interaction) is the default for this attribute.
- == Use ==
+ == Attributes ==
+ || '''name''' || '''required''' || '''description''' ||
+ || value || true || ||
+ || var || false || ||
+ || varNodeToggler || false || ||
+ || showNav || false || Show the "plus" and "minus" navigation icons (default is true.) Value is ignored if clientSideToggle is true. ||
+ || showLines || false || Show the connecting lines (default is true.) ||
+ || clientSideToggle || false || Perform client-side toggling of expand/collapse state via javascript (default is true.) ||
+ || showRootNode || false || Include the root node when rendering the tree (default is true.) ||
+ || preserveToggle || false || Preserve changes in client-side toggle information between requests (default is true.) ||
+
+
+ == Configuration ==
+ Don't need any extra configuration.
+
+ == Notes and Known issues ==
+ Some known issues like incompatibility to other frameworks/component libs
+
+ == Examples ==
+ Link to irian and additional notes.
+
+ == FAQ ==
+ * how should I store the tree in my model?
+ * (how) can I use tree2 in portlets?
+ * (how) can I use tree2 like tree for [Tree Table]?
+ * (how) can I use tree2 in facelets?
+ * what is the different between server side and client side?
+ * how can I lazy load the nodes of tree? (nodes only load when I click on their parent)?
+ * is lazy load ajax enabled?
+ * How can I controll which nodes are expanded from the backing bean?
+ * How can I Show the same tree in different pages?
+ * How can I user Tree2 for navigation?
+
+ == Additional Information ==
+ * Invalid Bit Mask
+
=== Backing Bean ===
The tree2 component needs a {{{TreeModel}}} from a backing bean to operate. Usually, you give the {{{TreeModel}}} to the component using a value binding, like this:
{{{