Events from tree node selection
[Logo]
ICEsoft.org Forums: ICEfaces, ICEmobile, ICEpdf
[Search] Search   [Recent Topics] Recent Topics   [Groups] Home Page | www.icefaces.org  [Register] Register  [Login] Login 
Events from tree node selection  XML
Forum Index -> General Help
Author Message
spartacus

Joined: 18/11/2006 00:00:00
Messages: 9
Offline


Hello,

I'm using ICEfaces 1.5.3. By and large, it's working very well for our demanding project.

Ran into the following issue when using the tree component. We're displaying an organization hierarchy using a tree component, with icons displayed conditionally.


Code:
            <ice:panelGrid width="100%" cellpadding="0" cellspacing="0" columns="2">
                 <ice:graphicImage value="/images/common/dot.gif"/>
                 <ice:tree id="orgTree"
                           value="#{treeBean.model}"
                           var="node"
                           hideRootNode="false"
                           hideNavigation="false"
                           imageDir="#{facesContext.externalContext.request.contextPath}/images/common/tree/">
                     <ice:treeNode>
                         <f:facet name="icon">
                             <ice:panelGroup style="display: inline">
                                 [b]<ice:commandLink id="_#{node.userObject.id}" actionListener="#{controller.nodeSelected}">[/b]
                                     <ice:graphicImage
                                             value="/images/common/org.jpg"/>
                                 </ice:commandLink>
                                 <ice:outputLink value="#{facesContext.externalContext.request.contextPath}/com/ketera/web/organization/create/create-edit-org.iface"
                                         rendered="#{(displayEditBtn eq 'Y')>
                                     <ice:graphicImage value="/images/common/edit.gif" title="Edit Org"/>
                                     <f:param name="id" value="#{node.userObject.id}"/>
                                 </ice:outputLink>
                                 <ice:outputLink value="#{facesContext.externalContext.request.contextPath}/com/ketera/web/organization/view/view-org-profile.iface"
                                         rendered="#{(displayViewBtn eq 'Y')>
                                     <ice:graphicImage value="/images/common/view.gif" title="View Org"/>
                                     <f:param name="id" value="#{node.userObject.id}"/>
                                 </ice:outputLink>
                             </ice:panelGroup>
                         </f:facet>
                         <f:facet name="content">
                             <ice:panelGroup style="display: inline">
                                 [b]<ice:commandLink id="_#{node.userObject.id}" actionListener="#{controller.nodeSelected}">
 [/b]                                    <ice:outputText value="#{node.userObject.name}" style="font-style: italic"/>
                                 </ice:commandLink>
                             </ice:panelGroup>
                         </f:facet>
                     </ice:treeNode>
                 </ice:tree>
             </ice:panelGrid>
 


ActionListener:
Code:
   public void nodeSelected(javax.faces.event.ActionEvent actionEvent)
   {
       logger.debug("parentOrgSelected: selected org id [" + actionEvent.getComponent().getId() + "]");
   }
 


The id value is logged as "_". That is, the value of Code:
#{node.userObject.id}
is either not being resolved, or it's incorrectly initialized.

Any idea why this is happening?

In some other pages, I'm using a similar commandLink -> actionListener without any issues. However, in that case, the command link is inside a panelGrid, not a tree component.

Thanks in advance.


adnan.durrani


Joined: 19/01/2006 00:00:00
Messages: 437
Offline


Hi Spartacus,

The "id" can be generated dynamically only if facelets being used, without facelets the id attribute can not have a value binding. So just wondering if you are using facelets?


Thanks,
-- Adnan Durrani --
[Email]
rmayhew


Joined: 11/04/2006 00:00:00
Messages: 100
Offline


Instead of passing the ID via the component, you could pass it via f:param

Code:
 <ice:commandLink 
                                 actionListener="#{tree.nodeClicked}">
                              <f:param name="clickedId"
                             value="#{item.userObject.id}"/>
                             <ice:outputText
                                     value="#{item.userObject.id}"/>
                         </ice:commandLink>
 

Rob Mayhew
http://snappy.sensemaker.net

[Email]
Baleyba

Joined: 16/11/2006 00:00:00
Messages: 110
Offline


Hi,

please could you tell me how to get parameter "clickedId" into the backingbean?


thanks
regards
Bal.

JBoss 4.2.3 | Java 1.6.0_16 | IceFaces 1.8.2
Baleyba

Joined: 16/11/2006 00:00:00
Messages: 110
Offline


OK I found. But We can't pass objects? just String with f:param :(

FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("clickedId"); 

JBoss 4.2.3 | Java 1.6.0_16 | IceFaces 1.8.2
express

Joined: 18/02/2009 00:00:00
Messages: 31
Offline


I'm trying to use a commandLink with actionListener arround my graphicImage in the treeNode.

But it never goes to the actionListener.

Code:
 In the xhtml:
 <ice:tree var="treeNode" hideRootNode="false" hideNavigation="false"
      value="#{bean.tree.model}" 
     imageDir="./xmlhttp/css/xp/css-images/" >
   <ice:treeNode>
     <f:facet name="icon">
       <ice:panelGroup style="display: inline">
         <ice:commandLink actionListener="#{bean.klikTest}">
           <h:graphicImage value="#{treeNode.userObject.icon}"/>
 	</ice:commandLink>
       </ice:panelGroup>
     </f:facet>
     <f:facet name="content">
       <ice:panelGroup style="display: inline" >
         <ice:commandLink 
             actionListener="#{treeNode.userObject.nodeClicked}" 
             value="#{treeNode.userObject.text}"
 	    title="#{treeNode.userObject.text}"
 	    action=".../>
       </ice:panelGroup>
     </f:facet>
   </ice:treeNode>
 </ice:tree>
 
 In the bean:
 public void klikTest(ActionEvent e) {
   System.out.println("!!!!! klik");
 }
 
 


I'm using version 1.8.1.

What am I doing wrong?

Thx,
Kevin
 
Forum Index -> General Help
Go to:   
Powered by JForum 2.1.7ice © JForum Team