You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Christopher J. Bowerman" <bo...@dtpax2.ncifcrf.gov> on 2006/05/22 22:21:43 UTC

tree2 expand/collapse

Hi,

 

I'm using a tree2 component.  My problem seems to have to do with tree
state.  The tree works fine the first time I render it, but I have a "home"
button that starts the user input over again and builds a new tree.  When
the new tree is rendered the nodes that were expanded in the earlier tree
are expanded in this one as well.  I'd like the tree to be fully collapsed
whenever I've built a new tree.  Can anybody actually tell me how I can do
this?  I've seen other mention of it on previous posts, but they were almost
a year ago and no mention how to actually go about it.  Any help would be
greatly appreciated.

 

Thanks.

 

==================================

Christopher J. Bowerman

Internet Applications Developer

SAIC-Frederick

phone: 301.846.5275

email: christopher.j.bowerman@saic.com

 

 

 


Tree2 not rendering some js and components

Posted by Michal Glowacki <mg...@projektpro.internetdsl.pl>.
Hi

    I have already seen Tomahawk-1171 bug, but also saw that there is 
workaround - switching from sun ri to myfaces. Can anyone tell me how to do 
this? I'm using jboss 4.0.3 and unfortunatelly Creator IDE which binds me to 
some of sun's implementations (abstract page beans etc). My project includes 
only 3 files from sun library: webui.jar, jsfcl.jar and appbase.jar. I 
already included myfaces jar's and tomahawk library. It's very strange to me 
because before switchinh to tomahawk 1.1.2 everything was working fine. And 
now, the problem like in 1171 - no clear_<form_name> js function is rendered 
and no _link_hidden input component.

Thanks for any help in advance
Michal 


Re: tree2 expand/collapse

Posted by Adrien FOURES <af...@sigems.fr>.
Hi Chris,
I have the same problem, and i found a solution to pass over. i delete 
my myfaces tree : name "tree1", in the jsf tree component, and its works 
now fine.

                // delete component "tree1" directly in the jsf tree 
component
                
if(FacesContext.getCurrentInstance().getViewRoot().findComponent("tree1") 
!= null){
                    List listTmp = 
FacesContext.getCurrentInstance().getViewRoot().findComponent("tree1").getParent().getChildren();
                    if(listTmp!=null)   
                        
listTmp.remove(FacesContext.getCurrentInstance().getViewRoot().findComponent("tree1"));
                }
               
                treeData1 = ..... // load data
                treeModel1 = new TreeModelBase(treeData1); // load model
                treeHtml1 = new HtmlTree(); // create new instance for 
binding


    <t:tree2 id="tree1"
            value="#{TreeBean.treeModel1}"
            binding="#{TreeBean.treeHtml1}"
            var="node"
            varNodeToggler="t"
            clientSideToggle="true"
            preserveToggle="false">

    </tree2>


Adrien



Sean Schofield wrote:

> I think this is the issue:
>
> http://issues.apache.org/jira/browse/TOMAHAWK-437
>
> Its on my list of tree2 issues to address.  Right now we're sorting
> through some big picture tomahawk and core issues.
>
> Sean
>
>
> On 5/23/06, Chris Hane <ch...@itsolut.com> wrote:
>
>> This isn't going to help too much; but I started to run into the same
>> things when I was using tree2 and client side expand/collapse.
>>
>> What I tracked it down to was the expand/collapse state is stored in a
>> cookie that is relevant for a the tree2 component on a specific screen.
>> For me that meant when I had to the same screen open in two windows
>> (different records though), they "shared" the expand/collapse state.
>> This causes weird looking behavior (e.g., expand three node in one
>> screen, go to the second screen and expand a node and three are expanded
>> (the same three from the first screen)).
>>
>> At the time I wasn't setup to explore the tomahawk code so I found a
>> work around for my specific case (I expand all nodes all the time and
>> don't let the user collapse). I opened a JIRA on this issue - the
>> archives have the specific #.
>>
>> Having said that, I'm not an expert with tomahawk - actually just
>> starting so I might be doing something wrong...
>>
>> Chris....
>>
>> Christopher J. Bowerman wrote:
>> >
>> > Hi,
>> >
>> > I'm using a tree2 component. My problem seems to have to do with tree
>> > state. The tree works fine the first time I render it, but I have a
>> > "home" button that starts the user input over again and builds a new
>> > tree. When the new tree is rendered the nodes that were expanded in
>> > the earlier tree are expanded in this one as well. I'd like the tree
>> > to be fully collapsed whenever I've built a new tree. Can anybody
>> > actually tell me how I can do this? I've seen other mention of it on
>> > previous posts, but they were almost a year ago and no mention how to
>> > actually go about it. Any help would be greatly appreciated.
>> >
>> > Thanks.
>> >
>> > ==================================
>> >
>> > Christopher J. Bowerman
>> >
>> > Internet Applications Developer
>> >
>> > SAIC-Frederick
>> >
>> > phone: 301.846.5275
>> >
>> > email: christopher.j.bowerman@saic.com
>> > <ma...@saic.com>
>> >
>> > 
>> ------------------------------------------------------------------------
>> >
>> > No virus found in this incoming message.
>> > Checked by AVG Free Edition.
>> > Version: 7.1.392 / Virus Database: 268.7.0/345 - Release Date: 
>> 5/22/2006
>> >
>>
>>
>> -- 
>> No virus found in this outgoing message.
>> Checked by AVG Free Edition.
>> Version: 7.1.392 / Virus Database: 268.7.0/345 - Release Date: 5/22/2006
>>
>>
>
>

Re: tree2 expand/collapse

Posted by Sean Schofield <se...@gmail.com>.
I think this is the issue:

http://issues.apache.org/jira/browse/TOMAHAWK-437

Its on my list of tree2 issues to address.  Right now we're sorting
through some big picture tomahawk and core issues.

Sean


On 5/23/06, Chris Hane <ch...@itsolut.com> wrote:
> This isn't going to help too much; but I started to run into the same
> things when I was using tree2 and client side expand/collapse.
>
> What I tracked it down to was the expand/collapse state is stored in a
> cookie that is relevant for a the tree2 component on a specific screen.
> For me that meant when I had to the same screen open in two windows
> (different records though), they "shared" the expand/collapse state.
> This causes weird looking behavior (e.g., expand three node in one
> screen, go to the second screen and expand a node and three are expanded
> (the same three from the first screen)).
>
> At the time I wasn't setup to explore the tomahawk code so I found a
> work around for my specific case (I expand all nodes all the time and
> don't let the user collapse). I opened a JIRA on this issue - the
> archives have the specific #.
>
> Having said that, I'm not an expert with tomahawk - actually just
> starting so I might be doing something wrong...
>
> Chris....
>
> Christopher J. Bowerman wrote:
> >
> > Hi,
> >
> > I'm using a tree2 component. My problem seems to have to do with tree
> > state. The tree works fine the first time I render it, but I have a
> > "home" button that starts the user input over again and builds a new
> > tree. When the new tree is rendered the nodes that were expanded in
> > the earlier tree are expanded in this one as well. I'd like the tree
> > to be fully collapsed whenever I've built a new tree. Can anybody
> > actually tell me how I can do this? I've seen other mention of it on
> > previous posts, but they were almost a year ago and no mention how to
> > actually go about it. Any help would be greatly appreciated.
> >
> > Thanks.
> >
> > ==================================
> >
> > Christopher J. Bowerman
> >
> > Internet Applications Developer
> >
> > SAIC-Frederick
> >
> > phone: 301.846.5275
> >
> > email: christopher.j.bowerman@saic.com
> > <ma...@saic.com>
> >
> > ------------------------------------------------------------------------
> >
> > No virus found in this incoming message.
> > Checked by AVG Free Edition.
> > Version: 7.1.392 / Virus Database: 268.7.0/345 - Release Date: 5/22/2006
> >
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.1.392 / Virus Database: 268.7.0/345 - Release Date: 5/22/2006
>
>

Re: tree2 expand/collapse

Posted by Chris Hane <ch...@itsolut.com>.
Please keep this on the list....

I'm not at the machine with my source (so this is from memory).  
Basically I created my own tree state object that looks something like:

public class MyTreeState extends TreeStateBase {

   @Override
   public boolean isNodeExpanded(String node_id){
      return true;
   }

}

On the TreeModelBase, after you have added your nodes, call the setState 
method and pass it a new instance of this class.

The tree will be expanded (and the user will not have the option of 
collapsing any of the nodes).  In the GUI, I also removed the tree 
icons/lines so there isn't a visual clue that the tree can be 
expanded/collapsed.

For my specific use case, this works pretty well.

Chris....

Chrisi wrote:
> Hi Chris,
>
> you wrote:
>> ... work around for my specific case (I expand all nodes all the time 
>> and
>> don't let the user collapse).
>
> Can you please tell me how you did this.
> I tried something like this in my getTreeData method:
>
> HtmlTree _tree = (HtmlTree)
> FacesContext.getCurrentInstance().getViewRoot().findComponent("myTree");
> _tree.exandAll();
>
> I always get an outofMemory.....
>
> Thanks and Greetings
> Chrisi
>
>


-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.7.1/347 - Release Date: 5/24/2006


Re: tree2 expand/collapse

Posted by Chris Hane <ch...@itsolut.com>.
This isn't going to help too much; but I started to run into the same 
things when I was using tree2 and client side expand/collapse.

What I tracked it down to was the expand/collapse state is stored in a 
cookie that is relevant for a the tree2 component on a specific screen. 
For me that meant when I had to the same screen open in two windows 
(different records though), they "shared" the expand/collapse state. 
This causes weird looking behavior (e.g., expand three node in one 
screen, go to the second screen and expand a node and three are expanded 
(the same three from the first screen)).

At the time I wasn't setup to explore the tomahawk code so I found a 
work around for my specific case (I expand all nodes all the time and 
don't let the user collapse). I opened a JIRA on this issue - the 
archives have the specific #.

Having said that, I'm not an expert with tomahawk - actually just 
starting so I might be doing something wrong...

Chris....

Christopher J. Bowerman wrote:
>
> Hi,
>
> I’m using a tree2 component. My problem seems to have to do with tree 
> state. The tree works fine the first time I render it, but I have a 
> “home” button that starts the user input over again and builds a new 
> tree. When the new tree is rendered the nodes that were expanded in 
> the earlier tree are expanded in this one as well. I’d like the tree 
> to be fully collapsed whenever I’ve built a new tree. Can anybody 
> actually tell me how I can do this? I’ve seen other mention of it on 
> previous posts, but they were almost a year ago and no mention how to 
> actually go about it. Any help would be greatly appreciated.
>
> Thanks.
>
> ==================================
>
> Christopher J. Bowerman
>
> Internet Applications Developer
>
> SAIC-Frederick
>
> phone: 301.846.5275
>
> email: christopher.j.bowerman@saic.com 
> <ma...@saic.com>
>
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.392 / Virus Database: 268.7.0/345 - Release Date: 5/22/2006
>   


-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.7.0/345 - Release Date: 5/22/2006