You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Kamran Kashanian <ka...@gmail.com> on 2008/08/21 22:17:01 UTC

[Trinidad] [Proposal] Tree "Expand All" handling

There is some code in the Trinidad UIXTree which is intended to prevent the
user from doing an unbounded "Expand All" on large trees (see
UIXTree.broadcast() method. Specifically
HierarchyUtils.__handleBroadcast()).

The code counts the number of newly expanded nodes and if it is > 100 then
it counts the total number of nodes in the tree and if the total is also >
100, it prevents an expand all and only expands two levels.

There are several issues with this:

1) This code is executed on every expand/collapse event and can be
expensive. Counting 100 nodes in the RowKeySet and in the tree (see
TableUtils._getSizeOfTree()) can force the model to do additional data
fetches beyond what is currently displayed in the view port. Also the number
100 is completely arbitary.

2) There is no way to for this code to know if the user did an "Expand All"
or just did something to cause 100 nodes to expand. For example "Expand All
Below", or just select 100 nodes and do "Expand" from a menu. In these cases
the user will get unexpcted results (only two levels will expand)

3) Preventing the user from doing an Expand All should really be part of
application logic and has no place in the framework. Normally the
application would display a warning and ask the user if they really want to
do an expand all in response to a user action


[Proposal]

I would like to propose that this code be removed from UIXTree. I will
submit a patch if there are no strong objections.  This *is* a change in the
Trinidad tree functionality, and I am not sure how it impacts current users.


Thanks
Kamran

Re: [Trinidad] [Proposal] Tree "Expand All" handling

Posted by venkata guddanti <ve...@gmail.com>.
+1.

Hard coding the bound to 100 is arbitrary and not right. This should not be
part of the framework, especially since this code effects every node
expansion/collapse.

Venkata

On Thu, Aug 21, 2008 at 2:17 PM, Kamran Kashanian <kamrankashanian@gmail.com
> wrote:

> There is some code in the Trinidad UIXTree which is intended to prevent the
> user from doing an unbounded "Expand All" on large trees (see
> UIXTree.broadcast() method. Specifically
> HierarchyUtils.__handleBroadcast()).
>
> The code counts the number of newly expanded nodes and if it is > 100 then
> it counts the total number of nodes in the tree and if the total is also >
> 100, it prevents an expand all and only expands two levels.
>
> There are several issues with this:
>
> 1) This code is executed on every expand/collapse event and can be
> expensive. Counting 100 nodes in the RowKeySet and in the tree (see
> TableUtils._getSizeOfTree()) can force the model to do additional data
> fetches beyond what is currently displayed in the view port. Also the number
> 100 is completely arbitary.
>
> 2) There is no way to for this code to know if the user did an "Expand All"
> or just did something to cause 100 nodes to expand. For example "Expand All
> Below", or just select 100 nodes and do "Expand" from a menu. In these cases
> the user will get unexpcted results (only two levels will expand)
>
> 3) Preventing the user from doing an Expand All should really be part of
> application logic and has no place in the framework. Normally the
> application would display a warning and ask the user if they really want to
> do an expand all in response to a user action
>
>
> [Proposal]
>
> I would like to propose that this code be removed from UIXTree. I will
> submit a patch if there are no strong objections.  This *is* a change in the
> Trinidad tree functionality, and I am not sure how it impacts current users.
>
>
> Thanks
> Kamran
>
>