You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Sean Schofield <se...@gmail.com> on 2005/03/02 14:39:27 UTC

Re: How to access selected/current row/node in Tree TABLE

David/Bryan,

Have either of you guys had a chance to look at tree2 yet?  I started
thinking about some of the issues involved.

One issue that comes to mind is the connecting lines that connect each
of the nodes.  If you put them inside a table that has a border
between cells (or any kind of padding) then these lines won't connect.
 David, I noticed in the example you sent me the lines do not connect.
 Maybe we could not support the connecting lines to make it easier? 
Bryan, in yours you do seem to have the connecting lines except for
the root node.  How do you feel about all of this.

sean


On Sat, 26 Feb 2005 06:52:24 -0800 (PST), David Le Strat
<dl...@yahoo.com> wrote:
> Sean,
> 
> <x:treeColumn> drives the column where the tree should
> display. I haven't had a chance to look at your code
> but will try to do so when I get a little time.
> 
> Regards,
> 
> David Le Strat.
> 
> --- Sean Schofield <se...@gmail.com> wrote:
> 
> > David,
> >
> > I took a look at your document.  I think we can
> > probably pull
> > something like this off.  Perhaps you can help me
> > modify the tree2 to
> > do this?
> >
> > It looks like you have an entire tree as the basis
> > for the tree with
> > various aspects of the node for the columns.  In the
> > second column you
> > have chosen to display the actual tree.  I suppose
> > when you click on
> > the nodes you also expand/collapse the rows in the
> > table.  Is this
> > right?
> >
> > Personally, I can't imagine a use for this type of
> > display, but as you
> > point out, there are a lot users using it ;-)  I
> > will do my best to
> > support it but as I said, it would be nice if you
> > could take a look at
> > what I've done so far and maybe give me some help in
> > doing it.
> >
> > sean
> >
> >
> > On Thu, 24 Feb 2005 04:05:28 -0800 (PST), David Le
> > Strat
> > <dl...@yahoo.com> wrote:
> > > Sean,
> > >
> > > I have not had a chance to look at your new
> > component,
> > > but if you are going to drop the old component,
> > can
> > > you make sure that the new one supports the
> > > functionality described in the enclosed document.
> > I
> > > implemented that functionality and it seems that
> > quite
> > > a few users have found usage for such an extension
> > of
> > > the tree component.
> > >
> > > Regards,
> > >
> > > David Le Strat.
> > >
> > > --- Sean Schofield <se...@gmail.com>
> > wrote:
> > >
> > > > Bryan,
> > > >
> > > > I don't know much about TreeTable but there are
> > > > plans to eventually
> > > > drop support for the old tree component in favor
> > of
> > > > a new one that has
> > > > been developed.  My advice to you is to check
> > out
> > > > the new tree2 in the
> > > > CVS.  Also, you can download a WAR file with a
> > built
> > > > in example if you
> > > > search this list you will find Matthias' post of
> > > > that.
> > > >
> > > > If you find that the new tree component cannot
> > do
> > > > something that you
> > > > need, then please let us know so we can address
> > > > that.
> > > >
> > > > sean
> > > >
> > > >
> > > > On Wed, 23 Feb 2005 15:17:13 -0700, Bryan Dickey
> > > > <bD...@youngliving.com> wrote:
> > > > > I found a solution to my problem... I was
> > almost
> > > > there.
> > > > >
> > > > > *In my jsp I have something similar to:
> > > > >
> > > > > ....
> > > > > <h:column>
> > > > > <h:commandLink
> > > > action="#{action.viewDetailedUserInfo}">
> > > > > <h:graphicImage
> > > > value="images/detailed_user_info.gif"
> > border="0"/>
> > > > > <f:param name="selectedid"
> > > > value="#{userObject.ID}"/>
> > > > > </h:commandLink>
> > > > > </h:column>
> > > > > ....
> > > > >
> > > > > *And the action method:
> > > > >
> > > > > public String viewDetailedUserInfo() {
> > > > >
> > > > > String selectedID = (String)
> > > >
> > >
> >
> app.createValueBinding("#{param.selectedid}").getValue(facesContext);
> > > > >
> > > > > //do something with selected id
> > > > >
> > > > >  return "viewDetailedUserInfo";
> > > > >  }
> > > > >
> > > > > In viewDetailedUserInfo() I could have instead
> > > > retrieved the param using
> > > >
> > >
> >
> FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().
> > > > >
> > > > > I still would like to know why the two
> > approaches
> > > > described in my first email don't work... if
> > anyone
> > > > cares to comment.
> > > > >
> > > > > Thanks,
> > > > > Bryan
> > > > >
> > > > > >>> Bryan Dickey 02/23/05 01:10PM >>>
> > > > > How can I access the selected/current row/node
> > in
> > > > an action method using the Tree TABLE component?
> > > > >
> > > > > *I've tried the following with no success:
> > > > >
> > > >
> > >
> >
> ______________________________________________________________________________________
> > > > >
> > > > > <h:form>
> > > > > <x:tree var="userObject" ... >
> > > > > <x:treeColumn><h:outputText
> > > > value="#{userObject.name}"/></x:treeColumn>
> > > > > <h:column><h:outputText
> > > > value="#{userObject.ID}"/></h:column>
> > > > > <h:column><h:commandButton
> > > > image="images/detailed_user_info.gif"
> > > >
> > action="#{action.viewDetailedUserInfo}"/></h:column>
> > > > > <x:treeSelectionListener
> > > > type="backing.ActionBean"/>
> > > > > </x:tree>
> > > > > </h:form>
> > > > >
> > > > >
> > > >
> > >
> >
> ....................................................................................................................................
> > > > >
> > > > > public class ActionBean implements
> > > > TreeSelectionListener {
> > > > > ....
> > > > > public void valueChanged(TreeSelectionEvent
> > event)
> > > > {
> > > > > DefaultMutableTreeNode selectedNode =
> > > > (DefaultMutableTreeNode)
> > > >
> > event.getNewSelectionPath().getLastPathComponent();
> > > > > }
> > > > > }
> > > > >
> > > >
> > >
> >
> ______________________________________________________________________________________
> > > > >
> > > > > In this case, method "valueChanged" never
> > seems to
> > > > be called when the commandButton is clicked.
> > > > >
> > > > > *I also tried the standard approach used with
> > > > datatables (with no success):
> > > > >
> > > >
> > >
> >
> ______________________________________________________________________________________
> > > > >
> > > > > public class ActionBean {
> > > > > ....
> > > > > public String viewDetailedUserInfo() {
> > > > > FacesContext facesContext =
> > > > FacesContext.getCurrentInstance();
> > > > > Application app =
> > facesContext.getApplication();
> > > > >
> > > > > Integer selectedID = (Integer)
> > > >
> > >
> >
> app.createValueBinding("#{userObject.ID}")..getValue(facesContext);
> >
> === message truncated ===
> 
> 
> __________________________________
> Do you Yahoo!?
> Read only the mail you want - Yahoo! Mail SpamGuard.
> http://promotions.yahoo.com/new_mail
>