You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Wong, Emmanuel (Sam)" <Wo...@SEC.GOV> on 2006/12/08 21:32:39 UTC

Display tobago selectable tree

Hi:
	Is there a way you could able to display back what you have
saved in the database by indicate a checkmark on the Tobago tree?  I
have set the selectable="multiLeafOnly".  When user selected the leafs
that would like to save it in the database, then user retrieve back the
selected leafs and display with a check mark as indicated the leafs was
what he saved last time. Later user could de-selected the check box for
removing the existing leaf?  Htanks.


<tc:tree value="#{Controller.Tree}"
		state="#{Controller.selectedTrees}"
		id="Tree" idReference="userObject.id"
		nameReference="userObject.name" showIcons="true"
						showJunctions="true"
showRootJunction="true" showRoot="true"
	
selectable="multiLeafOnly"
						mutable="false">
					</tc:tree>



RE: Display tobago selectable tree

Posted by "Wong, Emmanuel (Sam)" <Wo...@SEC.GOV>.
Hi Volker:
	I put it in action command or action method and it did pick up
the unchecked leafs.  Thank you very much.

-----Original Message-----
From: Volker Weber [mailto:weber.volker@googlemail.com] 
Sent: Wednesday, December 20, 2006 8:25 AM
To: MyFaces Discussion
Subject: Re: Display tobago selectable tree

the getter of the TreeState is imho the wrong place to capture the
selection.

this should be done in the action method werd the result is stored.

the way you do this is ok, but you will get the selection before
rendering, not the one after submitting the page.

2006/12/20, Wong, Emmanuel (Sam) <Wo...@sec.gov>:
> Now, it display the checkbox on the tree that was being selected, but
> when I unchecked one of the leafs or event try to resaving it.  The
> treestate never get never pick up the leafs that was being checked.
Am
> I doing something wrong?  This is how I tried to capture? Thanks.
>
>         /**
>          * @return the _selectedCategories
>          */
>         public TreeState getSelectedCategories() {
>                 Set<DefaultMutableTreeNode> selection =
> _selectedCategories
>                                 .getSelection();
>                 boolean empty = selection.isEmpty();
>                 if (!empty) {
>
>                         _categoriesSelection.addAll(selection);
>
>                 }
>                 return _selectedCategories;
>         }
>
>
> -----Original Message-----
> From: Volker Weber [mailto:weber.volker@googlemail.com]
> Sent: Wednesday, December 20, 2006 7:52 AM
> To: MyFaces Discussion
> Subject: Re: Display tobago selectable tree
>
> Hi,
>
> just add all nodes which should displayed as selected to the selected
> set in the treeState:
>
> selectedTrees.getSelection().add(node);
>
> Regards,
>
>   Volker
>
>
> 2006/12/8, Wong, Emmanuel (Sam) <Wo...@sec.gov>:
> > Hi:
> >         Is there a way you could able to display back what you have
> > saved in the database by indicate a checkmark on the Tobago tree?  I
> > have set the selectable="multiLeafOnly".  When user selected the
leafs
> > that would like to save it in the database, then user retrieve back
> the
> > selected leafs and display with a check mark as indicated the leafs
> was
> > what he saved last time. Later user could de-selected the check box
> for
> > removing the existing leaf?  Htanks.
> >
> >
> > <tc:tree value="#{Controller.Tree}"
> >                 state="#{Controller.selectedTrees}"
> >                 id="Tree" idReference="userObject.id"
> >                 nameReference="userObject.name" showIcons="true"
> >                                                 showJunctions="true"
> > showRootJunction="true" showRoot="true"
> >
> > selectable="multiLeafOnly"
> >                                                 mutable="false">
> >                                         </tc:tree>
> >
> >
> >
>

RE: Display tobago selectable tree

Posted by "Wong, Emmanuel (Sam)" <Wo...@SEC.GOV>.
Hi Volker:
	Where is a correct place to put?  Because I am having trouble
when the GUI display it and I tried to unchecked one of the leafs (as
trying to delete the one that I don't want it anymore) and resaving what
was being checked on leafs.  I was not able to pick up any selections at
all?  Thanks. 

-----Original Message-----
From: Volker Weber [mailto:weber.volker@googlemail.com] 
Sent: Wednesday, December 20, 2006 8:25 AM
To: MyFaces Discussion
Subject: Re: Display tobago selectable tree

the getter of the TreeState is imho the wrong place to capture the
selection.

this should be done in the action method werd the result is stored.

the way you do this is ok, but you will get the selection before
rendering, not the one after submitting the page.

2006/12/20, Wong, Emmanuel (Sam) <Wo...@sec.gov>:
> Now, it display the checkbox on the tree that was being selected, but
> when I unchecked one of the leafs or event try to resaving it.  The
> treestate never get never pick up the leafs that was being checked.
Am
> I doing something wrong?  This is how I tried to capture? Thanks.
>
>         /**
>          * @return the _selectedCategories
>          */
>         public TreeState getSelectedCategories() {
>                 Set<DefaultMutableTreeNode> selection =
> _selectedCategories
>                                 .getSelection();
>                 boolean empty = selection.isEmpty();
>                 if (!empty) {
>
>                         _categoriesSelection.addAll(selection);
>
>                 }
>                 return _selectedCategories;
>         }
>
>
> -----Original Message-----
> From: Volker Weber [mailto:weber.volker@googlemail.com]
> Sent: Wednesday, December 20, 2006 7:52 AM
> To: MyFaces Discussion
> Subject: Re: Display tobago selectable tree
>
> Hi,
>
> just add all nodes which should displayed as selected to the selected
> set in the treeState:
>
> selectedTrees.getSelection().add(node);
>
> Regards,
>
>   Volker
>
>
> 2006/12/8, Wong, Emmanuel (Sam) <Wo...@sec.gov>:
> > Hi:
> >         Is there a way you could able to display back what you have
> > saved in the database by indicate a checkmark on the Tobago tree?  I
> > have set the selectable="multiLeafOnly".  When user selected the
leafs
> > that would like to save it in the database, then user retrieve back
> the
> > selected leafs and display with a check mark as indicated the leafs
> was
> > what he saved last time. Later user could de-selected the check box
> for
> > removing the existing leaf?  Htanks.
> >
> >
> > <tc:tree value="#{Controller.Tree}"
> >                 state="#{Controller.selectedTrees}"
> >                 id="Tree" idReference="userObject.id"
> >                 nameReference="userObject.name" showIcons="true"
> >                                                 showJunctions="true"
> > showRootJunction="true" showRoot="true"
> >
> > selectable="multiLeafOnly"
> >                                                 mutable="false">
> >                                         </tc:tree>
> >
> >
> >
>

Re: Display tobago selectable tree

Posted by Volker Weber <we...@googlemail.com>.
the getter of the TreeState is imho the wrong place to capture the selection.

this should be done in the action method werd the result is stored.

the way you do this is ok, but you will get the selection before
rendering, not the one after submitting the page.

2006/12/20, Wong, Emmanuel (Sam) <Wo...@sec.gov>:
> Now, it display the checkbox on the tree that was being selected, but
> when I unchecked one of the leafs or event try to resaving it.  The
> treestate never get never pick up the leafs that was being checked.  Am
> I doing something wrong?  This is how I tried to capture? Thanks.
>
>         /**
>          * @return the _selectedCategories
>          */
>         public TreeState getSelectedCategories() {
>                 Set<DefaultMutableTreeNode> selection =
> _selectedCategories
>                                 .getSelection();
>                 boolean empty = selection.isEmpty();
>                 if (!empty) {
>
>                         _categoriesSelection.addAll(selection);
>
>                 }
>                 return _selectedCategories;
>         }
>
>
> -----Original Message-----
> From: Volker Weber [mailto:weber.volker@googlemail.com]
> Sent: Wednesday, December 20, 2006 7:52 AM
> To: MyFaces Discussion
> Subject: Re: Display tobago selectable tree
>
> Hi,
>
> just add all nodes which should displayed as selected to the selected
> set in the treeState:
>
> selectedTrees.getSelection().add(node);
>
> Regards,
>
>   Volker
>
>
> 2006/12/8, Wong, Emmanuel (Sam) <Wo...@sec.gov>:
> > Hi:
> >         Is there a way you could able to display back what you have
> > saved in the database by indicate a checkmark on the Tobago tree?  I
> > have set the selectable="multiLeafOnly".  When user selected the leafs
> > that would like to save it in the database, then user retrieve back
> the
> > selected leafs and display with a check mark as indicated the leafs
> was
> > what he saved last time. Later user could de-selected the check box
> for
> > removing the existing leaf?  Htanks.
> >
> >
> > <tc:tree value="#{Controller.Tree}"
> >                 state="#{Controller.selectedTrees}"
> >                 id="Tree" idReference="userObject.id"
> >                 nameReference="userObject.name" showIcons="true"
> >                                                 showJunctions="true"
> > showRootJunction="true" showRoot="true"
> >
> > selectable="multiLeafOnly"
> >                                                 mutable="false">
> >                                         </tc:tree>
> >
> >
> >
>

RE: Display tobago selectable tree

Posted by "Wong, Emmanuel (Sam)" <Wo...@SEC.GOV>.
Now, it display the checkbox on the tree that was being selected, but
when I unchecked one of the leafs or event try to resaving it.  The
treestate never get never pick up the leafs that was being checked.  Am
I doing something wrong?  This is how I tried to capture? Thanks.

	/**
	 * @return the _selectedCategories
	 */
	public TreeState getSelectedCategories() {
		Set<DefaultMutableTreeNode> selection =
_selectedCategories
				.getSelection();
		boolean empty = selection.isEmpty();
		if (!empty) {
			
			_categoriesSelection.addAll(selection);
			
		}
		return _selectedCategories;
	}


-----Original Message-----
From: Volker Weber [mailto:weber.volker@googlemail.com] 
Sent: Wednesday, December 20, 2006 7:52 AM
To: MyFaces Discussion
Subject: Re: Display tobago selectable tree

Hi,

just add all nodes which should displayed as selected to the selected
set in the treeState:

selectedTrees.getSelection().add(node);

Regards,

  Volker


2006/12/8, Wong, Emmanuel (Sam) <Wo...@sec.gov>:
> Hi:
>         Is there a way you could able to display back what you have
> saved in the database by indicate a checkmark on the Tobago tree?  I
> have set the selectable="multiLeafOnly".  When user selected the leafs
> that would like to save it in the database, then user retrieve back
the
> selected leafs and display with a check mark as indicated the leafs
was
> what he saved last time. Later user could de-selected the check box
for
> removing the existing leaf?  Htanks.
>
>
> <tc:tree value="#{Controller.Tree}"
>                 state="#{Controller.selectedTrees}"
>                 id="Tree" idReference="userObject.id"
>                 nameReference="userObject.name" showIcons="true"
>                                                 showJunctions="true"
> showRootJunction="true" showRoot="true"
>
> selectable="multiLeafOnly"
>                                                 mutable="false">
>                                         </tc:tree>
>
>
>

Re: Display tobago selectable tree

Posted by Volker Weber <we...@googlemail.com>.
Hi,

just add all nodes which should displayed as selected to the selected
set in the treeState:

selectedTrees.getSelection().add(node);

Regards,

  Volker


2006/12/8, Wong, Emmanuel (Sam) <Wo...@sec.gov>:
> Hi:
>         Is there a way you could able to display back what you have
> saved in the database by indicate a checkmark on the Tobago tree?  I
> have set the selectable="multiLeafOnly".  When user selected the leafs
> that would like to save it in the database, then user retrieve back the
> selected leafs and display with a check mark as indicated the leafs was
> what he saved last time. Later user could de-selected the check box for
> removing the existing leaf?  Htanks.
>
>
> <tc:tree value="#{Controller.Tree}"
>                 state="#{Controller.selectedTrees}"
>                 id="Tree" idReference="userObject.id"
>                 nameReference="userObject.name" showIcons="true"
>                                                 showJunctions="true"
> showRootJunction="true" showRoot="true"
>
> selectable="multiLeafOnly"
>                                                 mutable="false">
>                                         </tc:tree>
>
>
>