myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rob Decker" <...@objectsource.org>
Subject Re: more about tree2 node selection
Date Thu, 31 Mar 2005 22:45:46 GMT
Well, nesting jstl's tags with jsf is a no-no. Anyone know another way to accomplish 
this?

--
Rob

@objectsource.org


---------- Original Message -----------
From: "Rob Decker" <rob@objectsource.org>
To: "my-faces-user" <myfaces-user@incubator.apache.org>
Sent: Thu, 31 Mar 2005 17:40:05 -0500
Subject: more about tree2 node selection

> I'm reading earlier posts on the selection listener and trying figure out what 
> exactly is happening with it. I'm looking at
> 
>     <f:facet name="document">
>      <h:panelGroup>
>        <h:commandLink immediate="true" styleClass="document"
>           actionListener="#{t.setNodeSelected}" rendered="#{!t.nodeSelected}">
>          <h:graphicImage value="/images/document.png" border="0"/>
>          <h:outputText value="#{node.description}"/>
>          <f:param name="docNum" value="#{node.identifier}"/>
>        </h:commandLink>
>        <h:commandLink immediate="true" styleClass="documentSelected"
>           actionListener="#{t.setNodeSelected}" rendered="#{t.nodeSelected}">
>          <h:graphicImage value="/images/document.png" border="0"/>
>          <h:outputText value="#{node.description}"/>
>          <f:param name="docNum" value="#{node.identifier}"/>
>        </h:commandLink>
>      </h:panelGroup>
>    </f:facet>
> 
> This what I see is happening:
> 
> When someone clicks the first command link, the 't' is just internally setting 
> a variable so t.nodeSelected returns true. When page re-rendered the second 
> link is displayed, which has a style that does something to indicate the node 
> is selected.
> 
> I'd like to continue being a lazy programmer and not have to type the content 
> of my command link twice. Is there a way the above can be refactored so it 
> only needs one command link? For instance in jstl I'd do:
> 
>   <c:if test="${t.nodeSelected}">
>     <h:commandLink immediate="true" styleClass="documentSelected"
>           actionListener="#{t.setNodeSelected}" rendered="#{t.nodeSelected}">
>   </c:if>
>   <c:if test="${!t.nodeSelected}">
>     <h:commandLink immediate="true" styleClass="document"
>           actionListener="#{t.setNodeSelected}" rendered="#{!t.nodeSelected}">
>   </c:if>
>     <h:graphicImage value="/images/document.png" border="0"/>
>          <h:outputText value="#{node.description}"/>
>          <f:param name="docNum" value="#{node.identifier}"/>
>     </h:commandLink>
> 
> I'm not clear on mixing jstl and jsf. Is this something works or is there a 
> "JSF" way to do this?
> 
> And what is the current tree way in
> 
> "Of course you
> can always configure it to behave exactly the same as the current tree
> if that is your wish "
> 
> of doing selection?
> 
> --
> Rob
> 
> @objectsource.org
------- End of Original Message -------


Mime
View raw message