You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Nikita Koselev <ko...@gmail.com> on 2008/08/31 00:24:19 UTC

radio buttons in tomahawk tree - how to do it?

Dear friends,

Here goes the problem.

I've built a tree from database.
Lets say that it specifies types of equipment.
I want manager to have possibility to add new equipment, according to
equipment type, which he should
select from the tree (at least our analyst thinks so).

I've managed to generate and render tree from database, using tomahawk
tree2 tag.
What I need now is a possibility to select any of the nodes or leafs
with a radio button,  which
will send equipment_type_id further to the command bean.

The problem is that when I put code like this to the tree2:
---
<t:tree2 value="#{equipmentController.treeData}" var="node"
		varNodeToggler="t">
		<f:facet name="equipment type">
			<h:panelGroup>
				<h:selectOneRadio>
					<f:selectItem itemValue="#{node.identifier}"
itemLabel="#{node.description}" />
				</h:selectOneRadio>
			</h:panelGroup>
		</f:facet>
</t:tree2>
---
I get separate set of selectOneRadio sets for each leaf/node.
However it must be possible to select only one leaf/node by clicking
radio button.

Any ideas, how to do it?

Sincerely,
Nikita Koselev

Re: radio buttons in tomahawk tree - how to do it?

Posted by Nikita Koselev <ko...@gmail.com>.
Hmmm.... I understand your idea. It should work, but then we'll have
"select equipment type" near every equipment type.
We also have inputText field on this page for equipment name input. So
if I use radio buttons, I'll have standard "fill the fields and click
ok/cancel" application. Otherwise user won't have "right for mistake".

2008/9/2 Jim the Standing Bear <st...@gmail.com>:
> Hmm... maybe I am a bit slow, but I still don't see why you had to use
> the radio button for equipment types...  why not just use a
> commandlink for each equipment type node, and whenever a user clicks
> on it, your backing bean would select the corresponding equipment
> type?
>
>
>
> On Tue, Sep 2, 2008 at 1:18 PM, Nikita Koselev <ko...@gmail.com> wrote:
>> The whole idea of this tree of equipment types is to select the type
>> needed from the tree, add some description, like "toyota" to it in
>> database and save it to equipment_id, equipment_type,
>> equipment_description TABLE.
>>
>> I tried to wrap the whole tree into h:selectOneRadio but it doesn't work.
>> The problem is that there is only t:treeCheckbox Tomahawk tag (which
>> is used for creation of checkboxes in the tree).
>> I think the easiest way is to create my own component, like treeRadioButton .
>>
>> Thanks for help.
>>
>> 2008/9/2 Jim the Standing Bear <st...@gmail.com>:
>>> By enclosing the <h:selectOneRadio> tag inside of the facet, you were
>>> literally creating a different group of radio buttons for each node,
>>> and your results verified that also.
>>>
>>> You may want to try moving the <h:selectOneRadio> tags outside of the
>>> <t:tree2> tag, or outside of the <f:facet name="equipmentType"> tag.
>>> I haven't tried this, so it may or may not work.
>>>
>>> But why bother with the radio button anyways?  Since the tree only
>>> allows you to select one node at a time, the mutual-exclusiveness is
>>> already there.  Having the radioButtons will just be redundant.  Is it
>>> possible to shift the logic behind the radioButton click to the
>>> treeNode click?  HTH
>>>
>>> -- Jim
>>>
>>>
>>> On Sat, Aug 30, 2008 at 6:24 PM, Nikita Koselev <ko...@gmail.com> wrote:
>>>> Dear friends,
>>>>
>>>> Here goes the problem.
>>>>
>>>> I've built a tree from database.
>>>> Lets say that it specifies types of equipment.
>>>> I want manager to have possibility to add new equipment, according to
>>>> equipment type, which he should
>>>> select from the tree (at least our analyst thinks so).
>>>>
>>>> I've managed to generate and render tree from database, using tomahawk
>>>> tree2 tag.
>>>> What I need now is a possibility to select any of the nodes or leafs
>>>> with a radio button,  which
>>>> will send equipment_type_id further to the command bean.
>>>>
>>>> The problem is that when I put code like this to the tree2:
>>>> ---
>>>> <t:tree2 value="#{equipmentController.treeData}" var="node"
>>>>                varNodeToggler="t">
>>>>                <f:facet name="equipment type">
>>>>                        <h:panelGroup>
>>>>                                <h:selectOneRadio>
>>>>                                        <f:selectItem itemValue="#{node.identifier}"
>>>> itemLabel="#{node.description}" />
>>>>                                </h:selectOneRadio>
>>>>                        </h:panelGroup>
>>>>                </f:facet>
>>>> </t:tree2>
>>>> ---
>>>> I get separate set of selectOneRadio sets for each leaf/node.
>>>> However it must be possible to select only one leaf/node by clicking
>>>> radio button.
>>>>
>>>> Any ideas, how to do it?
>>>>
>>>> Sincerely,
>>>> Nikita Koselev
>>>>
>>>
>>>
>>>
>>> --
>>> --------------------------------------
>>> Standing Bear Has Spoken
>>> --------------------------------------
>>>
>>
>>
>>
>> --
>> Nikita Koselev
>>
>
>
>
> --
> --------------------------------------
> Standing Bear Has Spoken
> --------------------------------------
>



-- 
Nikita Koselev

Re: radio buttons in tomahawk tree - how to do it?

Posted by Jim the Standing Bear <st...@gmail.com>.
Hmm... maybe I am a bit slow, but I still don't see why you had to use
the radio button for equipment types...  why not just use a
commandlink for each equipment type node, and whenever a user clicks
on it, your backing bean would select the corresponding equipment
type?



On Tue, Sep 2, 2008 at 1:18 PM, Nikita Koselev <ko...@gmail.com> wrote:
> The whole idea of this tree of equipment types is to select the type
> needed from the tree, add some description, like "toyota" to it in
> database and save it to equipment_id, equipment_type,
> equipment_description TABLE.
>
> I tried to wrap the whole tree into h:selectOneRadio but it doesn't work.
> The problem is that there is only t:treeCheckbox Tomahawk tag (which
> is used for creation of checkboxes in the tree).
> I think the easiest way is to create my own component, like treeRadioButton .
>
> Thanks for help.
>
> 2008/9/2 Jim the Standing Bear <st...@gmail.com>:
>> By enclosing the <h:selectOneRadio> tag inside of the facet, you were
>> literally creating a different group of radio buttons for each node,
>> and your results verified that also.
>>
>> You may want to try moving the <h:selectOneRadio> tags outside of the
>> <t:tree2> tag, or outside of the <f:facet name="equipmentType"> tag.
>> I haven't tried this, so it may or may not work.
>>
>> But why bother with the radio button anyways?  Since the tree only
>> allows you to select one node at a time, the mutual-exclusiveness is
>> already there.  Having the radioButtons will just be redundant.  Is it
>> possible to shift the logic behind the radioButton click to the
>> treeNode click?  HTH
>>
>> -- Jim
>>
>>
>> On Sat, Aug 30, 2008 at 6:24 PM, Nikita Koselev <ko...@gmail.com> wrote:
>>> Dear friends,
>>>
>>> Here goes the problem.
>>>
>>> I've built a tree from database.
>>> Lets say that it specifies types of equipment.
>>> I want manager to have possibility to add new equipment, according to
>>> equipment type, which he should
>>> select from the tree (at least our analyst thinks so).
>>>
>>> I've managed to generate and render tree from database, using tomahawk
>>> tree2 tag.
>>> What I need now is a possibility to select any of the nodes or leafs
>>> with a radio button,  which
>>> will send equipment_type_id further to the command bean.
>>>
>>> The problem is that when I put code like this to the tree2:
>>> ---
>>> <t:tree2 value="#{equipmentController.treeData}" var="node"
>>>                varNodeToggler="t">
>>>                <f:facet name="equipment type">
>>>                        <h:panelGroup>
>>>                                <h:selectOneRadio>
>>>                                        <f:selectItem itemValue="#{node.identifier}"
>>> itemLabel="#{node.description}" />
>>>                                </h:selectOneRadio>
>>>                        </h:panelGroup>
>>>                </f:facet>
>>> </t:tree2>
>>> ---
>>> I get separate set of selectOneRadio sets for each leaf/node.
>>> However it must be possible to select only one leaf/node by clicking
>>> radio button.
>>>
>>> Any ideas, how to do it?
>>>
>>> Sincerely,
>>> Nikita Koselev
>>>
>>
>>
>>
>> --
>> --------------------------------------
>> Standing Bear Has Spoken
>> --------------------------------------
>>
>
>
>
> --
> Nikita Koselev
>



-- 
--------------------------------------
Standing Bear Has Spoken
--------------------------------------

Re: radio buttons in tomahawk tree - how to do it?

Posted by Nikita Koselev <ko...@gmail.com>.
The whole idea of this tree of equipment types is to select the type
needed from the tree, add some description, like "toyota" to it in
database and save it to equipment_id, equipment_type,
equipment_description TABLE.

I tried to wrap the whole tree into h:selectOneRadio but it doesn't work.
The problem is that there is only t:treeCheckbox Tomahawk tag (which
is used for creation of checkboxes in the tree).
I think the easiest way is to create my own component, like treeRadioButton .

Thanks for help.

2008/9/2 Jim the Standing Bear <st...@gmail.com>:
> By enclosing the <h:selectOneRadio> tag inside of the facet, you were
> literally creating a different group of radio buttons for each node,
> and your results verified that also.
>
> You may want to try moving the <h:selectOneRadio> tags outside of the
> <t:tree2> tag, or outside of the <f:facet name="equipmentType"> tag.
> I haven't tried this, so it may or may not work.
>
> But why bother with the radio button anyways?  Since the tree only
> allows you to select one node at a time, the mutual-exclusiveness is
> already there.  Having the radioButtons will just be redundant.  Is it
> possible to shift the logic behind the radioButton click to the
> treeNode click?  HTH
>
> -- Jim
>
>
> On Sat, Aug 30, 2008 at 6:24 PM, Nikita Koselev <ko...@gmail.com> wrote:
>> Dear friends,
>>
>> Here goes the problem.
>>
>> I've built a tree from database.
>> Lets say that it specifies types of equipment.
>> I want manager to have possibility to add new equipment, according to
>> equipment type, which he should
>> select from the tree (at least our analyst thinks so).
>>
>> I've managed to generate and render tree from database, using tomahawk
>> tree2 tag.
>> What I need now is a possibility to select any of the nodes or leafs
>> with a radio button,  which
>> will send equipment_type_id further to the command bean.
>>
>> The problem is that when I put code like this to the tree2:
>> ---
>> <t:tree2 value="#{equipmentController.treeData}" var="node"
>>                varNodeToggler="t">
>>                <f:facet name="equipment type">
>>                        <h:panelGroup>
>>                                <h:selectOneRadio>
>>                                        <f:selectItem itemValue="#{node.identifier}"
>> itemLabel="#{node.description}" />
>>                                </h:selectOneRadio>
>>                        </h:panelGroup>
>>                </f:facet>
>> </t:tree2>
>> ---
>> I get separate set of selectOneRadio sets for each leaf/node.
>> However it must be possible to select only one leaf/node by clicking
>> radio button.
>>
>> Any ideas, how to do it?
>>
>> Sincerely,
>> Nikita Koselev
>>
>
>
>
> --
> --------------------------------------
> Standing Bear Has Spoken
> --------------------------------------
>



-- 
Nikita Koselev

Re: radio buttons in tomahawk tree - how to do it?

Posted by Jim the Standing Bear <st...@gmail.com>.
By enclosing the <h:selectOneRadio> tag inside of the facet, you were
literally creating a different group of radio buttons for each node,
and your results verified that also.

You may want to try moving the <h:selectOneRadio> tags outside of the
<t:tree2> tag, or outside of the <f:facet name="equipmentType"> tag.
I haven't tried this, so it may or may not work.

But why bother with the radio button anyways?  Since the tree only
allows you to select one node at a time, the mutual-exclusiveness is
already there.  Having the radioButtons will just be redundant.  Is it
possible to shift the logic behind the radioButton click to the
treeNode click?  HTH

-- Jim


On Sat, Aug 30, 2008 at 6:24 PM, Nikita Koselev <ko...@gmail.com> wrote:
> Dear friends,
>
> Here goes the problem.
>
> I've built a tree from database.
> Lets say that it specifies types of equipment.
> I want manager to have possibility to add new equipment, according to
> equipment type, which he should
> select from the tree (at least our analyst thinks so).
>
> I've managed to generate and render tree from database, using tomahawk
> tree2 tag.
> What I need now is a possibility to select any of the nodes or leafs
> with a radio button,  which
> will send equipment_type_id further to the command bean.
>
> The problem is that when I put code like this to the tree2:
> ---
> <t:tree2 value="#{equipmentController.treeData}" var="node"
>                varNodeToggler="t">
>                <f:facet name="equipment type">
>                        <h:panelGroup>
>                                <h:selectOneRadio>
>                                        <f:selectItem itemValue="#{node.identifier}"
> itemLabel="#{node.description}" />
>                                </h:selectOneRadio>
>                        </h:panelGroup>
>                </f:facet>
> </t:tree2>
> ---
> I get separate set of selectOneRadio sets for each leaf/node.
> However it must be possible to select only one leaf/node by clicking
> radio button.
>
> Any ideas, how to do it?
>
> Sincerely,
> Nikita Koselev
>



-- 
--------------------------------------
Standing Bear Has Spoken
--------------------------------------