You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@click.apache.org by Demetrios Kyriakis <de...@gmail.com> on 2008/11/18 16:17:54 UTC

Improved CheckboxTree instead of MultiSelect?

Hi,

In many applications a Select with "multiple" option is used, plus
"spacing" and unselectable items to "simulate" the concept of a hierarchy .
This approach however is very user unfriendly (at least for simple users).
I know that in Click there's the PickList component, but it has the same 
"hierarchy" problem.

One solution might be to use the CheckboxTree, but it looks like it's 
missing a set of features:
- the possibility to force the tree to remain expanded (e.g. boolean 
forceExpanded). In this case the + and - should simply dissapear from 
parent nodes.
- the root to render nicely like other tree components do it (right now 
it has an ugly "- leaf line".
- TreeNode to have a "title" (hint).
- TreeListener to have a "mouseOver" event too.

Are the above already possible (I couldn't find the API) to achieve them.

Thank you,

Demetrios.


Re: Improved CheckboxTree instead of MultiSelect?

Posted by Bob Schellink <sa...@gmail.com>.
Demetrios Kyriakis wrote:
> Any plans to include those options into the official Component itself?
> (I mean "nodeTitle" and "forceExpanded")


Sure I don't see any problems with that.

bob

Re: Improved CheckboxTree instead of MultiSelect?

Posted by Demetrios Kyriakis <de...@gmail.com>.
> CheckboxTree does not have the features you mentioned however its 
> rendering is fine grained so you could override the methods you need and 
> render appropriately. 
Thank you.
Any plans to include those options into the official Component itself?
(I mean "nodeTitle" and "forceExpanded")

> One thing which won't work is "mouseOver" on 
> TreeListener. TreeListener fires server side events and mouseOver is 
> more of a client side need.
Yes. Sorry (dealing to much with GWT lately :) ).

> That said if the component you need does not collapse and is always 
> expanded why not use an HTML list instead:
> 
> <ul>
>   <li>checkbox</li>
>   <ul>
>     <li>checkbox</li>
>   </ul>
> </ul>
> 
> Seems much simpler than coercing Tree into a mutli select.
Well, the tree seems a more natural choice to me:
- CheckboxTree is a component already (and does most of the job).
- the "helper lines" that create the impression of a tree are better 
than spaced indent.

Thank you,

Demetrios.


Re: Improved CheckboxTree instead of MultiSelect?

Posted by Bob Schellink <sa...@gmail.com>.
CheckboxTree does not have the features you mentioned however its 
rendering is fine grained so you could override the methods you need 
and render appropriately. One thing which won't work is "mouseOver" on 
TreeListener. TreeListener fires server side events and mouseOver is 
more of a client side need.

That said if the component you need does not collapse and is always 
expanded why not use an HTML list instead:

<ul>
   <li>checkbox</li>
   <ul>
     <li>checkbox</li>
   </ul>
</ul>

Seems much simpler than coercing Tree into a mutli select.

Using a JS library such as JQuery you could easily register mouseOver 
events to any part of the tree:

$(document).ready(function() {
   // iterate all <li> elements and register mouseOver event
   $("#multiselect").find("li").each(function(i) {
     $(this).mouseover(function(){
       $(this).attr("style", "background:yellow");
     }).mouseout(function() {
       $(this).attr("style", "background:none");
     });
   });
});

regards

bob

Demetrios Kyriakis wrote:
> Hi,
> 
> In many applications a Select with "multiple" option is used, plus
> "spacing" and unselectable items to "simulate" the concept of a hierarchy .
> This approach however is very user unfriendly (at least for simple users).
> I know that in Click there's the PickList component, but it has the same 
> "hierarchy" problem.
> 
> One solution might be to use the CheckboxTree, but it looks like it's 
> missing a set of features:
> - the possibility to force the tree to remain expanded (e.g. boolean 
> forceExpanded). In this case the + and - should simply dissapear from 
> parent nodes.
> - the root to render nicely like other tree components do it (right now 
> it has an ugly "- leaf line".
> - TreeNode to have a "title" (hint).
> - TreeListener to have a "mouseOver" event too.
> 
> Are the above already possible (I couldn't find the API) to achieve them.
> 
> Thank you,
> 
> Demetrios.
> 
>