myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ludovic Aelbrecht" <ludovic.aelbre...@student.kuleuven.be>
Subject tree component
Date Thu, 28 Feb 2008 11:46:49 GMT
Hi,

We're trying to use a JSF tree which represents a project. A project's
name is the tree's root, and it contains tasks, which can possibly
contain subtasks (which, in turn, can also contain subtasks, and so
on).

Such a task displays different fields: the task's name, the name of
the employee assigned to the task (if any), the number of hours
required for the task, etc.
The tree should not only display this data, but it should also make it
possible to edit it. We're doing this by using the "rendered"
attribute, so we can display an outputText or inputText/selectOneMenu
depending on whether the task's "editable" property is true/false.
We also need to be able to select a task, and add a subtask to it.

We chose Tomahawk's tree component for this, but have been having
multiple problems, and are wondering whether maybe Trinidad's tree
would be better for this.

The problems we're experiencing with Tomahawk's treetable are the following:
- when another project is chosen (through a selectOneMenu), the
TaskTreeBean's "selectedProject" variable is changed to another
project (tr:tree uses TaskTreeBean's getTreeModel() for the "value"
attribute).
After this change, the tree is updated, but if the tree was expanded
and it showed e.g. 5 tasks, and the newly chosen project has only 4
tasks, we get an exception (the other way around (i.e. first 4 tasks
then 5) is not a problem).
We fixed this by binding the tree to an HtmlTree defined in
TaskTreeBean, on which we call collapseAll() (in
setSelectedProject(Project newlySelectedProject)).
While this does fix the exception, there's still another problem: the
tree's root node, which contains the project's name, still shows the
previous project's name, until it's expanded, after which it does
update itself.
Any way this can be fixed? IMHO using the collapseAll() method for
this feels a bit like a hack - isn't there another way which would
simply refresh the tree so that the root node's name is also changed
and it knows the number of subnodes has changed?

Another issue is editing. There's a treecolumn which contains an
"edit" link, which calls switchEditable() in our codebase and toggles
the task's isEditable variable. Thanks to the rendered attribute, the
task's data should be shown in inputTexts instead of outputTexts.
However, no matter which "edit" link we click, it always the last
display node which gets inputTexts instead of outputTexts. This seems
to be related to incorrect id's like in
http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=82&t=001599
(we're using Tomahawk 1.1.6, though, and according to the jira ticket
it's been fixed since 1.1.5)

So my questions are: how can I refresh the tomahawk tree? Is there
some documentation somewhere about editing a row of a treetable?

I'm also wondering whether Tomahawk's tree is the best solution for my
problem. Tobago's tree component doesn't seem to support treetables,
but Trinidad's definitely does. Would Trinidad be a better solution?
If so, is there any documentation/code relating to my problem which
would help me get started with Trinidad's tree component? I've looked
at the demo's source code, but I can't seem to really figure out how
it should work. I'm also not sure yet if using Trinidad is better than
using Tomahawk, as it appears that Tomahawk's treetable should be
suited for what I'm trying to do.

Any suggestions, links, ideas are highly appreciated, as we've been
working on this for more than a week, and can't get any tree component
to work completely.

TIA,

Ludo

Mime
View raw message