Myfaces t:tree2 component

Hi
Is there any way to get the all the nodes to a selected leaf?
Like instead of ((TreeNode)node).getDescription() returns the leaf. Is there a way to return the full path to that leaf?
Thank you in advance.

SenkaTatsujin: Have you figured this out?
If you have could you please share what you did.
Thanks,
--Todd                                                                                                                                                                                                                       

Similar Messages

  • Myfaces tree2 component

    For the first time im using myfaces plugin in RAD 6.0..I wanna use the tree2 component.I have included the tomahawk jar file and other jars in the classpath.But all i wanna know is how to get a tree structure of say a datatable as a node under the tree? Is it possible??If so could you please explain..

    SenkaTatsujin: Have you figured this out?
    If you have could you please share what you did.
    Thanks,
    --Todd                                                                                                                                                                                                                       

  • JSF Tree construction - My Faces Tree2 Component development

    Hi
    I am planning to recommend JSF and MyFaces for the development of the application.
    like Navigation Tree on the left side, header, footer and body ..
    1) Can any one share a piece of code to develop Dynamic Navigation Tree(like ServerSideToggling ..I will get the data from backend based on the I will build the Tree with leafs, when we click on leafs we need to call action to redirect to other jsps ) we can achieve this using MyFaces Tree2 Component,Just wondering if anybody know some information, any info is appreciated.
    Parent1
    |
    --Child1__
    |--sub child 1
    --Child2
    --Child3
    Parent2
    |
    --Child1__
    |--sub child 1
    --Child2
    --Child3
    Conditions:
    1) Need to construct the Tree based on backend data.
    2) All the Parents and Children should be links, like when I click on any link, I need to call an action and forward it some other page.
    For testing I hardcoded and built one tree, which look similar...but the dynamic tree needs server side toggling..which requires...handling of backend data...constructing a tree...If you could share a sample, I will be appreciated...mean while I will try to do this...
    thanks
    jish

    HI jish,
    A couple suggestions.
    While the MyFaces (tomahawk) components may be very useful, I would encourage you to make sure you're using JSF from the Mojarra project. It is more stable and better supported: https://javaserverfaces.dev.java.net
    Also, I would encourage you NOT to use JSPs. JSF 2.0 will favor a facelets-style syntax, so you should consider using Facelets or JSFTemplating instead. JSP is also slower and more cumbersome to work with. Try: https://jsftemplating.dev.java.net or https://facelets.dev.java.net . Either one of these projects replace JSP and provide "templating" support (which doesn't exist when using JSP) as well as many other features to help you (like JSFTemplating's factories for creating dynamic trees).
    I don't use MyFaces Tree2 component (I use Woodstock's Tree component), however, I think the concepts should be the same. Here's some a link to a very complicated example (GlassFish Admin Console Tree code which is generated from several backend sources + updated via Ajax):
    https://glassfish.dev.java.net/source/browse/glassfish/admin-gui/src/docroot/peTree.jsf?rev=1.12&view=markup
    A more simple example:
    <sun:tree text="Tree Example" clientSide="false" url="http://www.google.com">
        <sun:treeNode text="Static Tree Node" actionExpression="#{some.thing}">
            <dynamicTreeNode treeAdaptorClass="com.sun.enterprise.tools.admingui.tree.MBeanTreeAdaptor"
                objectName="com.sun.appserv:type=applications,category=config"
                methodName="getAllDeployedJ2EEApplications"
                text="Dynamic Tree Node"
                url="/applications/enterpriseApplications.jsf"
                attributeName="name"
                childURL="applications/enterpriseApplicationsEdit.jsf?appName=#{$this{valueBinding}.text}" />
        </sun:treeNode>
    </sun:tree>Another place to look is the scales project. The lead developer on that project is actively developing a Tree component that will have a very clean interface to interacting with dynamic trees.
    Good luck!
    Ken Paulsen
    https://jsftemplating.dev.java.net

  • Tomahawk tree2 component using css

    hi,
    Is there any way to set new style (css) to Tomahawk tree2 component ?? Can you give me an example ?
    best regards,

    This question is apparently about JSF. This forum is not about JSF.
    To find the correct forum here you have to know that "JSF" is an acronym for [JavaServer Faces|http://forums.sun.com/forum.jspa?forumID=427].

  • MyFaces'  JspTilesViewHandlerImpl   &   dynamic component rendering

    Hi,
    First -- if you're on the myfaces user list, this is a repeat post. Skip!
    Second, I don't mean to offend the RI dev guys with this myfaces post!
    Has anyone dynamically rendered JSF components while using myfaces� JspTilesViewHandlerImpl view handler?
    I have a WebGalileoFaces tabbed panel component. Its listener attaches sub-tabs to it dynamically. The rendering works without using the view handler above. Yet, when I use the myfaces handler, I get an NPE. My listener impl is below.
    The view handler appears to cut off access to the actual UIViewRoot so the form cannot be found. I�ve tried a couple calls directly to the handler using context.getApplication().getViewHandler() yet, none of the methods gave me access to it (well, that I could figure out).
    Ideas anyone?
    Thanks
    Lorinda
        public void processTabSelected(TabSelectedEvent event)
                throws AbortProcessingException {
            context = FacesContext.getCurrentInstance();
            // who sent the event?
            FacesTabbedPanel eventSource = (FacesTabbedPanel) event.getSource();
            UIComponent tabbedPanel = event.getComponent();
            String tabName = tabbedPanel.getId();
            String formId = tabbedPanel.getParent().getId();
            LOG.info("Tab selected:   " + tabName);
            LOG.info("Parent form:   " + formId);
         UIForm form = (UIForm) context.getViewRoot().findComponent(formId);             
    NPE HERE ----  UIPanel panel =  (UIPanel) form.findComponent("childTabsGrid");
    // NOTE:  the childTabsGrid must be used to attach children.
            if (panel == null) {
                LOG.error("PanelGrid   'childTabsGrid'   could not be found.  ");
            } else {
    //  ATTACH SUB TABS
                // clear the childTabsGrid to prevent stacking child tabs      
                panel.getChildren().clear();
              ListSelectionModel selectionModel = eventSource.getListSelectionModel();
               UIComponent newTabbedPanel = createSubTabbedPanel(selectionModel);
               panel.getChildren().add(newTabbedPanel);
            }

    Yes, i have created a complete portal page using a custom portal tab and JspTilesViewHandlerImpl with all components dynamically rendered and inserted by tiles: dynamic partal tabs, i18n implementation for mesages and SelectItems, dynamically change company layout with its own look-and-feel if a requested information belongs to a company (division, department, branch office, etc). There is some abnormality and how i go around to get the solution up and running. I will post the details in myfaces dev list in the next couple days.
    In essence, the navigation page dispatched by JspTilesViewHandlerImpl works properly with all Jsf UI components. However, within this tile definition and its own layout, any fragment inserted by tiles such as portlets in the left/right columns and the display fragment does not have jsf <h:commandButton> and <h:commandLink> correctly picked up the action while <h:outputLink> properly linked to the intended page.
    I temporarily solve the issue to get the portal up and running. However, this is only a temporary solution since it will severly limit a complete integration of Jsf+Tiles. A complete solution needs to be addressed, which i thing myfaces developers can quickly patch it.
    BaTien
    DBGROUPS

  • MyFaces Tomahawk more than one tree2

    Hi everybody, I'm new with JSP and I'll appreciate some help with this:
    I have a JSP app implementing MyFaces Tomahawk tree2 with TreeBacker class modified, the component renders pretty well, but I need to show another tree completely different, I made a new class almost equal than TreeBacker but the name and the new tree structure, but at runtime the tree doesn't renders.
    In the running tree2:
    <t:tree2 id="clientTree" value="#{treeBacker.treeData}" var="node" varNodeToggler="t" clientSideToggle="true">Additionaly, why if I change treeBacker.treeData to TreeBacker.treeData the tree2 doesn't renders ??
    In the rebel tree2:
    <t:tree2 id="clientTree" value="#{treeBacker2.treeData}" var="node" varNodeToggler="t" clientSideToggle="true">this tree2 doesn't work....
    What I'm doing wrong ?

    I don't understand very good who works the repeater that you put there. And in the dataprovider I have to know how many trees I will have? Because I don't know how many trees I will have(in one moment 1, later 4, later 2... I could put a variable but I don't understand very good how can I do the repeater and..).
    I get create a dinamic Vbox with X tress, but putting all the xml in one, something like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <Cuentas>
        <Cuenta id="cuenta1" label="cuenta1">
        <node label="INBOX">
            <node label="Nombre">
        </node>
        </node>
        </Cuenta>
        <Cuenta id="cuenta2" label="cuenta2">
        <node label="INBOX">
            <node label="Apellido">
        </node>
        </node>
        </Cuenta>
    </Cuentas>
    With my treeLoad code I create 2 tress in one Vbox, if the xml document have 3 diferents Cuenta I will create 3 trees. But now I have different xml and I don't how can I do the same.

  • MyFaces Tree Component Rendering

    Hi all,
    I am adding myfaces client tree Component to my panel.Its not rendering and its throwing exception.
    anyhelp would be appriciated
    Thanks
    Sudha

    Hi,
    I am trying to render myfaces client tree on faces portlet using RAD 6.0. As RAD does not support JSF 1.1, I have commented DOCTYPE from faces-config.xml in tomahawk.jar file.
    Root of the tree is getting displayed without "+" sign. And when I click on it,
    javascript error "Object Expected" occurs.
    I am not able to figure out the problem from last 2 days. So, Please help me out if you can.
    Thanks in anticipation.
    ~Madhura

  • Tree2 in Tomahawk  and JSF Tiles Implementation

    hi All,
    right now i mfacing one problem. which arise due to tiles implementation in JSF with Tree2 component of Tomahawk. i had created one tree menu using Tree2.
    its working fine, but i was not able to highlight selected child node of tree menu as i m using tiles implementation so all pages gets reloaded on every click on jsp. thus color of that selected node becomes as it is.
    please note that i m using myfaces implementation.
    what i have written is as below:
    <t:tree2 id="wrapTree" value="#{frontPage.catTree}" var="node" clientSideToggle="true"
                             showRootNode="false" varNodeToggler="t">
                                  <f:facet name="parent-one">
                                  <h:panelGrid id="parentOne" columns="1" cellpadding="0" cellspacing="0" border="0">
                                            <h:commandLink styleClass="textorg" immediate="true" action="#{categoryListBean.showCategoryDetail}">
                                  <h:outputText escape="false" value="#{node.description} "/>
                                       <f:param name="categoreId" value="#{node.identifier}"/>
                             </h:commandLink>
                                  </h:panelGrid>
                   </f:facet>
                   <f:facet name="top-parent">
                   <h:panelGrid id="topParent" columns="1" cellpadding="2" cellspacing="0" border="0" align="left">
                   <h:commandLink styleClass="txtbold" immediate="true" action="#{categoryListBean.showCategoryDetail}">
                   <h:outputText escape="false" value="#{node.description} "/>
                   <f:param name="categoreId" value="#{node.identifier}"/>
                   </h:commandLink>
                   </h:panelGrid>
                   </f:facet>
                   <f:facet name="child">
                   <h:panelGroup id="Child">
                             <h:commandLink styleClass="#{t.nodeSelected ? 'headerRedText':'txt1'}" actionListener="#{t.setNodeSelected}" immediate="true">
                   <h:outputText value="#{node.description}"/>
                        <f:param name="categoreId" value="#{node.identifier}"/>
                   </h:commandLink>
                   </h:panelGroup>
                   </f:facet>
                             </t:tree2>
    please help me if u have solution of this problem.
    thank you.

    hi,
    in MyFaces there is an example using JSF and Tiles.
    MyFaces provides a custom ViewHandler faciltity.
    see http://sourceforge.net/projects/myfaces
    hope that helps.
    Regards,
    Matthias

  • Problem using Tomahawk tree2 with JSF RI 1.1

    Hello,
    When I try to run Tomahawk tree2 component on JSF RI 1.1 I am getting the following exception.
    java.lang.IllegalStateException: Duplicate component ID 'billsearch:billSearchForm:NewTabadvanceSearch:subTabOne:clientTree:t2c' found in view.
         at com.sun.faces.application.StateManagerImpl.removeTransientChildrenAndFacets(StateManagerImpl.java:191)
         at com.sun.faces.application.StateManagerImpl.removeTransientChildrenAndFacets(StateManagerImpl.java:199)
         at com.sun.faces.application.StateManagerImpl.removeTransientChildrenAndFacets(StateManagerImpl.java:181)
         at com.sun.faces.application.StateManagerImpl.removeTransientChildrenAndFacets(StateManagerImpl.java:181)
         at com.sun.faces.application.StateManagerImpl.removeTransientChildrenAndFacets(StateManagerImpl.java:181)
         at com.sun.faces.application.StateManagerImpl.removeTransientChildrenAndFacets(StateManagerImpl.java:181)
         at com.sun.faces.application.StateManagerImpl.removeTransientChildrenAndFacets(StateManagerImpl.java:181)
         at com.sun.faces.application.StateManagerImpl.removeTransientChildrenAndFacets(StateManagerImpl.java:181)
         at com.sun.faces.application.StateManagerImpl.removeTransientChildrenAndFacets(StateManagerImpl.java:181)
         at com.sun.faces.application.StateManagerImpl.saveSerializedView(StateManagerImpl.java:85)
         at org.ajax4jsf.framework.ajax.AjaxStateManager.saveSerializedView(AjaxStateManager.java:90)
         at com.sun.faces.taglib.jsf_core.ViewTag.doAfterBody(ViewTag.java:169)
         at jsp_servlet._pages.__billsearchinit._jspService(__billsearchinit.java:156)
         at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:223)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
         at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:500)
         at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:245)
         at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
         at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
         at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
         at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:229)
         at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
         at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:223)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
         at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:501)
         at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:245)
         at weblogic.servlet.jsp.PageContextImpl.forward(PageContextImpl.java:148)
         at jsp_servlet.__index._jspService(__index.java:101)
         at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:223)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3243)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2003)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1909)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1359)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)Any help would be highly appreciated. I have tried setting my own id's to each and every component. But this throws me a different error and it doesn't let me set the id's manually. The error message is:
    Error 500--Internal Server Error
    java.lang.IllegalArgumentException: 1
         at javax.faces.component.UIComponentBase.validateId(UIComponentBase.java:462)
         at javax.faces.component.UIComponentBase.setId(UIComponentBase.java:279)
         at javax.faces.webapp.UIComponentTag.createComponent(UIComponentTag.java:1016)
         at javax.faces.webapp.UIComponentTag.createFacet(UIComponentTag.java:1059)
         at javax.faces.webapp.UIComponentTag.findComponent(UIComponentTag.java:740)
         at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:429)
    Any help or hint on solving this problem is highly appreciated.
    Thanks in adv.
    ~SirG

    Richfaces is compatible with JSF 1.1 and 1.2 and also with great ui part
    but it may conflict with the other tomahawk component and filters

  • Expanding tree2 child nodeHello Friends,

    Hello Friends,
    I am new to myfaces tree2 component. I am trying to implement the an example
    given at
    http://www.jroller.com/plainoldweblog/entry/use_tomahawk_tree2_and_ajax4jsf
    I am not able to expand the child node in the given example. Can somebody help
    me, I need to recursively expand the child node. I have given the source below.
    Thank you.
    Sudheer
    treeBean.java
    =============
    public class TreeBean implements Serializable {
         private TreeModel treeModel;
         public TreeModel getTreeModel() {
              if(treeModel == null) {
                   //you don't really have to initialize the treeModel here
                   TreeNode root = new TreeNodeBase("folder", "root", "1", false);
         List<TreeNode> rootChildList = root.getChildren();     
         //constructs real folder tree
         TreeNode documents = new TreeNodeBase("folder", "Documents", "10", false);     
         List<TreeNode> childList = documents.getChildren();     
         TreeNode home = new TreeNodeBase("folder", "User Home", "101", false);
         home.getChildren().add(new TreeNodeBase("folder", "user", "1011", false));
         TreeNode tmp = new TreeNodeBase("folder", "Temporary", "102", false);
         tmp.getChildren().add(new TreeNodeBase("folder", "junks", "1021", false));     
         childList.add(home);
         childList.add(tmp);
         rootChildList.add(documents);
              treeModel = new TreeModelBase(root);                         
              return treeModel;
         * set folder tree model
         * @param p_treeModel
         public void setTreeModel(TreeModel p_treeModel) {
              treeModel = p_treeModel;
    * This method listens to expand and collapse folder events.
    * @param p_event
    public void processToggle(ActionEvent p_event) {
    UIComponent component = (UIComponent) p_event.getSource();
    while (!(component != null && component instanceof HtmlTree)) {
         component = component.getParent();
    if (component != null) {
         HtmlTree tree = (HtmlTree) component;
         TreeNode node = tree.getNode();
         if (!tree.isNodeExpanded()) {
              loadChildren(node);
         } else {
              //unloadChildren(node);
    * when tree node is expanded, this method will load its children
    * @param p_parentNode
    public void loadChildren(TreeNode p_parentNode) {
              List<TreeNode> childList = p_parentNode.getChildren();
              //This is where you need to load the actual child nodes
              childList.add(new TreeNodeBase(p_parentNode.getType(),
                        "folder"+System.currentTimeMillis(),
                        p_parentNode.getIdentifier()+1, false));
    tree.xhtml
    ==========
    <h:form id="ajaxform">
         <h:panelGroup id="treePanel">
              <t:tree2 id="tree" value="#{treeBacker.treeModel}"
                        var="node" varNodeToggler="t"
                        clientSideToggle="false"
                        showRootNode="false" showNav="false"
                        showLines="false">
                   <f:facet name="folder">
                        <h:panelGroup id="folderPanelGroup">
                             <!-- expand collapse -->
                             <a4j:commandLink id="expandCollapseLink" immediate="true"
                                       styleClass="treeNode"
                                       reRender="treePanel"
                                       action="#{t.toggleExpanded}"
                                       actionListener="#{treeBacker.processToggle}">
                                  <t:graphicImage style="border:0px" url="#{t.nodeExpanded ? '/images/yellow-folder-open.png' : '/images/yellow-folder-closed.png' }" />
                             </a4j:commandLink>
                             <!-- load folder content -->
                             <h:outputText value="#{node.description}" />
                        </h:panelGroup>
                   </f:facet>
              </t:tree2>
         </h:panelGroup>
    </h:form>
    ...........

    The config looks OK for this Gen 1 VM, except the odd memory configuration.
    Can you look up the Hyper-V logs on the host:
    particularly hypervisor/operational and VMMS/admin?
    You can use Powershell to collect the logs if you like.
    Here's a sample script. After running the script to load the function you can run:
    Get-HVEventLog -Computername MyHVHost-Days 7
    Sam Boutros, Senior Consultant, Software Logic, KOP, PA http://superwidgets.wordpress.com (Please take a moment to Vote as Helpful and/or Mark as Answer, where applicable) _________________________________________________________________________________
    Powershell: Learn it before it's an emergency http://technet.microsoft.com/en-us/scriptcenter/powershell.aspx http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx
    Sam,
    i corrected the memory settings & assigned static memory as 1024 MB.
    there was two blocks of scripts in that website, i don't which of them i must run.
    i verified my event viewer as i had done earlier, i the following are the only events which are are logged in all hyper-v related notes:
    hyper-v-hyperVisor node:
    Hyper-V successfully created a new partition (partition 3).
    Hyper-v-synthnic node:
    'test4' Network Adapter (7F8B9901-BBF5-4541-B586-33A5EE906B49) started successfully. (Virtual Machine ID D3589B09-C269-46CE-9BD1-51A3C95C04BF)
    'test4' Network Adapter (d3589b09-c269-46ce-9bd1-51a3c95c04bf--7f8b9901-bbf5-4541-b586-33a5ee906b49) Disconnected from virtual network. (Virtual Machine ID D3589B09-C269-46CE-9BD1-51A3C95C04BF)
    Hyper-v-worker node:
    'test4' started successfully. (Virtual machine ID D3589B09-C269-46CE-9BD1-51A3C95C04BF)
    and also in Custom node\ Administrative events, an error is logged continuously ---->
     Microsoft-Windows-Kernel-EventTracing/Admin :
    Session "" failed to start with the following error: 0xC000000D (event ID 2)

  • Tree2 leaf selection

    I am trying implement myfaces tree2 component. Here the tree list files in filesystem and what i am trying to do is on selection of a leaf in the tree, set the InputText tag fileName.
    How do i do this ?
    This is how my jsf code action class look
    file.jsp
              <h:inputText id="fileName" value="#{fileAction.fileName}" />
              <t:tree2 id="clientTree2" value="#{fileAction.fileList}"
                   var="node" varNodeToggler="t" showRootNode="false" clientSideToggle="false">
                   <f:facet name="document">
                        <h:panelGroup>
                             <h:commandLink immediate="true"
                                  styleClass="#{t.nodeSelected ? 'documentSelected':'document'}"
                                  action="#{fileAction.doSetFileName}">
                                  <t:graphicImage value="images/document.png" border="0" />
                                  <h:outputText value="#{node.description}" />
                                  <f:param name="fileName" value="#{node.description}" />
                             </h:commandLink>
                        </h:panelGroup>
                   </f:facet>
              </t:tree2>
    public class FileAction {
         private String fileName;
    }

    Hi
    I think what you're going to need to do is to put a
    valueChangeListener in your outputText node
    <h:outputText value="#{node.description}"
    valueChangeListener="#{<YOURBean>.processValueChange}
    onclick="submit()" />
    you will need the onclick as well otherwise you don't
    get the event firing until the node has lost
    focus/page submit
    In you bean code you will need to have a method -
    along the lines of
    public void processValueChange(ValueChangeEvent
    event) throws
    AbortProcessingException {
    UIComponent component = event.getComponent();
    UIOutput outPutText = (UIOutput)component;
    FacesContext fC =
    = FacesContext.getCurrentInstance();
    UIViewRoot root = fC.getViewRoot();
    UIComponent c = root.findComponent("fileName"); //
    // the id of your
    inputText field
    if(c != null){
    UIInput fileName = (UIInput)c;
    fileName.setValue((String)outPutText.getValue());
    //     Now update GUI
    fC.renderResponse();
    NOTEs
    the above code is for example purposes only - you
    will need to tailor it for safe operation within your
    app
    You may NOT need the renderresponse call - this
    causes an immediate screen re-darw and the screen
    does NOT necessarily scroll to where you left it<h:outputText value="#{node.description}"
    valueChangeListener="#{<YOURBean>.processValueChange}"
    onclick="submit()" />
    I am doubt of this. can outputText attribute be valueChangeListener?

  • A tree component

    Hello,
    I'm presently looking for a JSF tree component. I need one which not only would allow me to display a little icon next to my leaves names, but which would allow me to display a checkbox too.
    I've tried the Apache MyFaces tree, in the Tomahawk sub-project. But it looks like I won't manage to add a checkbox without changing its code.
    A clue, anyone ? With MyFaces or anything else ?
    AlienQueen

    below is my code from my project
    perhaps it is useful for your problem
    * Copyright 2005 The Apache Software Foundation.
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
    * http://www.apache.org/licenses/LICENSE-2.0
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    * See the License for the specific language governing permissions and
    * limitations under the License.
    package com.itlt.clb.action;
    import org.apache.myfaces.custom.tree2.HtmlTree;
    import org.apache.myfaces.custom.tree2.TreeNode;
    import org.apache.myfaces.custom.tree2.TreeNodeBase;
    import org.apache.myfaces.custom.tree2.TreeModel;
    import org.apache.myfaces.custom.tree2.TreeModelBase;
    import com.itlt.clb.entity.Agency;
    import com.itlt.clb.util.HibDb;
    import com.itlt.clb.util.Loginer;
    import com.itlt.clb.util.constant.ConstParas;
    import javax.faces.context.FacesContext;
    import javax.faces.application.FacesMessage;
    import javax.faces.component.UIComponent;
    import javax.faces.validator.ValidatorException;
    import javax.faces.event.ActionEvent;
    import java.io.Serializable;
    import java.util.List;
    * Backer bean for use in example. Basically makes a TreeNode available.
    * @author Sean Schofield
    * @version $Revision: 1.9 $ $Date: 2007-05-31 09:17:44 $
    public class TreeBacker implements Serializable
    private TreeModelBase _treeModel;
    private HtmlTree _tree;
    private boolean select;
    public boolean isSelect() {
              return select;
         public void setSelect(boolean select) {
              this.select = select;
         public TreeNode getTreeData()
              String formatFolder = "foo-folder";
              int agencyCodeLen = 5;//&#20195;&#29702;&#32534;&#30721;&#38271;&#24230;
              long agencyId = Loginer.getCurLogin().getUserclerk().getAgency().getId();
              TreeNode treeData = null;
              //&#39318;&#20808;&#24471;&#21040;&#20013;&#28207;&#36890;&#30340;&#25968;&#25454;.
              List chinaLinkList = HibDb.queryHQL("from Agency a where a.id ='"+agencyId+"' and a.status = '"+ConstParas.common3Status.ACTIVE.getStatus()+"'", 0, 0);
              Agency chinaLinkAgency = null;
              if(chinaLinkList != null && chinaLinkList.size() > 0){
                        chinaLinkAgency = (Agency)chinaLinkList.get(0);
                        if(chinaLinkAgency.getCode().length()==agencyCodeLen)
                             formatFolder = "foo-folder";
                        else
                             formatFolder = "bar-folder";
                        treeData = new TreeNodeBase(formatFolder, "<input type='checkbox' id='agency_"+chinaLinkAgency.getId()+"' value='"+chinaLinkAgency.getId()+"' onclick='getSelectAgency(this)'>"+chinaLinkAgency.getName()+"", false);
              // construct a set of fake data (normally your data would come from a database)
              List list = HibDb.queryHQL("from Agency a where a.agency.id='"+chinaLinkAgency.getId()+"' and a.status = 'A'", 0, 0);
              Agency agency = null;
              Agency subAgency = null;
              Agency subAgencyPoint = null;
              TreeNodeBase personNode = null;
              TreeNodeBase folderNode = null;
              TreeNodeBase folderNodePoint = null;
              for(int i=0;i<list.size();i++){
                   agency = (Agency)list.get(i);
                   if(agency.getAgency() != null){
                        if(agency.getCode().length()==agencyCodeLen)
                                       formatFolder = "foo-folder";
                                  else
                                       formatFolder = "bar-folder";
                        personNode= new TreeNodeBase(formatFolder, "<input type='checkbox' id='agency_"+chinaLinkAgency.getId()+"_"+agency.getId()+"' value='"+agency.getId()+"'onclick='getSelectAgency(this)'>"+agency.getName()+"", false);
                        //&#21435;&#25214;&#21040;&#25152;&#26377;&#23646;&#20110;&#23427;&#30340;&#38144;&#21806;&#28857;
                        //System.out.println(" agency.getId() = "+agency.getId());
                             List subList = HibDb.queryHQL("from Agency a where a.agency.id = '"+agency.getId()+"'and a.status ='"+ConstParas.common3Status.ACTIVE.getStatus()+"'", 0, 0);
                             for(int k=0;k<subList.size();k++){
                                  subAgency = (Agency)subList.get(k);
                                  if(subAgency.getCode().length()==agencyCodeLen)
                                            formatFolder = "foo-folder";
                                       else
                                            formatFolder = "bar-folder";
                                  folderNode = new TreeNodeBase(formatFolder, "<input type='checkbox' id='agency_"+chinaLinkAgency.getId()+"_"+agency.getId()+"_"+subAgency.getId()+"' value='"+subAgency.getId()+"'onclick='getSelectAgency(this)'>"+subAgency.getName()+"", false);
    //                              folderNode.getChildren().add(new TreeNodeBase("document", "X050001", true));
    //                              personNode.getChildren().add(folderNode);
                                  List subListPoint = HibDb.queryHQL("from Agency a where a.agency.id = '"+subAgency.getId()+"' and a.status = '"+ConstParas.common3Status.ACTIVE.getStatus()+"'", 0, 0);
                                  for(int l=0;l<subListPoint.size();l++){
                                       subAgencyPoint = (Agency)subListPoint.get(l);
                                       if(subAgencyPoint.getCode().length()==agencyCodeLen)
                                                 formatFolder = "foo-folder";
                                            else
                                                 formatFolder = "bar-folder";
                                       folderNodePoint = new TreeNodeBase(formatFolder, "<input type='checkbox' id='agency_"+chinaLinkAgency.getId()+"_"+agency.getId()+"_"+subAgency.getId()+"_"+subAgencyPoint.getId()+"' value='"+subAgencyPoint.getId()+"'onclick='getSelectAgency(this)'>"+subAgencyPoint.getName()+"", true);
                                       folderNode.getChildren().add(folderNodePoint);
    //                                        personNode.getChildren().add(folderNode);
                                  personNode.getChildren().add(folderNode);
                        treeData.getChildren().add(personNode);
    return treeData;
    * NOTE: This is just to show an alternative way of supplying tree data. You can supply either a
    * TreeModel or TreeNode.
    * @return TreeModel
    public TreeModel getExpandedTreeData()
    return new TreeModelBase(getTreeData());
    public void setTree(HtmlTree tree)
    _tree = tree;
    public HtmlTree getTree()
    return _tree;
    public String expandAll()
    _tree.expandAll();
    return null;
    private String _nodePath;
    public void setNodePath(String nodePath)
    _nodePath = nodePath;
    public String getNodePath()
    return _nodePath;
    public void checkPath(FacesContext context, UIComponent component, java.lang.Object value)
    // make sure path is valid (leaves cannot be expanded or renderer will complain)
    FacesMessage message = null;
    String[] path = _tree.getPathInformation(value.toString());
    for (int i = 0; i < path.length; i++)
    String nodeId = path;
    try
    _tree.setNodeId(nodeId);
    catch (Exception e)
    throw new ValidatorException(message, e);
    if (_tree.getNode().isLeaf())
    message = new FacesMessage(FacesMessage.SEVERITY_ERROR,
    "Invalid node path (cannot expand a leaf): " + nodeId,
    "Invalid node path (cannot expand a leaf): " + nodeId);
    throw new ValidatorException(message);
    public void expandPath(ActionEvent event)
    tree.expandPath(tree.getPathInformation(_nodePath));
    it support your checkboxi
    Message was edited by:
    lysmart

  • Tree2

    I am trying to use the tree2 component that ships with MyFaces Tomahawk but I keep running into issues. I've been trying to debug this for two days now.
    I have gotten the tree2.jsp example up and running but it breaks when i try to customize it. It keeps giving me the error
    Encountered a node [0:0:1] + with an illogical state.  Node is expanded but it is also considered a leaf (a leaf cannot be considered expanded.The code works fine if I my TreeBacker.getTreeData() looks like this:
    public TreeNode getTreeData()
         TreeNode treeData = new TreeNodeBase("foo-folder", "Inbox", false);
         TreeNodeBase personNode = new TreeNodeBase("foo-folder", "Frank Foo", false);
         personNode.getChildren().add(new TreeNodeBase("document", "C050003", true));
         treeData.getChildren().add(personNode);
            return treeData;
        }However if I add one more node beneath that (which is explicitly marked as a leaf) it bombs out on me with the error mentioned above:
    public TreeNode getTreeData()
         TreeNode treeData = new TreeNodeBase("foo-folder", "Inbox", false);
         TreeNodeBase personNode = new TreeNodeBase("foo-folder", "Frank Foo", false);
         personNode.getChildren().add(new TreeNodeBase("document", "C050003", true));
         personNode.getChildren().add(new TreeNodeBase("document", "22C050003", true));
         treeData.getChildren().add(personNode);
            return treeData;
        }

    My best guess would be that the nodes that have not been expanded don't actually exist in the HTML. So they cannot send data back to the server. You may want to implement server-side logic to handle this case.

  • About af:tree component

    ......... I use JDeveloper 11g TP4 .............
    I use tree component to desplay a recursion relationship as the relation between Employee and Manager in HR schema (Manager is an Employee)
    I want the tree to desplay manager and it's employee as Children and Children(a manager to another employee) may have a subchildren and so on.
    I make a tree and it desplay the data correctly but I want when I press to any node I show the data of its child in a table. the problem when I press to any node it return the id of the first node (root) I want when I press a child it return its Id not The root Id.
    tree code:
    <af:tree value="#{bindings.EmployeesView1.treeModel}" var="node"
    selectionListener="#{bindings.EmployeesView1.treeModel.makeCurrent}"
    rowSelection="single" binding="#{backing_untitled1.tree1}"
    id="tree1">
    <f:facet name="nodeStamp">
    <af:outputText value="#{node}"
    binding="#{backing_untitled1.outputText1}"
    id="outputText1"/>
    </f:facet>
    </af:tree>
    I construct it from wizerd I did not write any code.....
    Thank You

    I have the same problem in the <t:tree2> component. If any clues, please let us know.

  • Tomahawk tree2 not rendered properly in mobile browser

    Hi,
    I was trying to use tomahawk tree2 component. It was able to render properly on the desktop browser.
    I tried to open the same application on the PDA IE browser. There is a gap between the nodes.
    It was not looking good.
    How can i apply my own styles to overcome the problem.
    Thanks in Advance
    Sur

    Report this issue at the mailinglist/issuetracker of Tomahawk. You see, you're here at a Sun forum, not at an Apache forum.

Maybe you are looking for