You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Alberto Brosich <ab...@ogs.trieste.it> on 2011/11/16 14:32:00 UTC
Dealing with 3 choice components
I have a form with with 3 choice components:
A) DropDownChoice
B) DropDownChoice
C) ListMultipleChoice
The values of B depend on selected value of A.
The values of C depend on selected values of A and B
I override the wantOnSelectionChangedNotifications() and
onSelectionChanged() methods of A and B.
A#onSelectionChanged
@Override
protected void onSelectionChanged(IntegerSelectChoice newSelection) {
super.onSelectionChanged(newSelection);
SearchForm.this.getModelObject().setInstrument(null);
SearchForm.this.getModelObject().setParams(null);
}
B#onSelectionChanged
@Override
protected void onSelectionChanged(IntegerSelectChoice newSelection) {
super.onSelectionChanged(newSelection);
SearchForm.this.getModelObject().setParams(null);
}
In A I set to null the model value of both B and C.
In B I set to null the model value only of B.
This code works only on the startup of the form. When I change the value
in A the list of C become empty. I have to change the value of B to fill C.
How can I manage this?
A
--
Alberto Brosich
Istituto Nazionale di Oceanografia e di Geofisica Sperimentale - OGS
Dipartimento di Oceanografia - OGA
National Oceanographic Data Centre/IOC - NODC
Borgo Grotta Gigante 42/c, 34010 Sgonico, Trieste (ITALY)
Phone: +39 040 2140281
E-mail:abrosich@ogs.trieste.it
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Dealing with 3 choice components
Posted by Alberto <ab...@ogs.trieste.it>.
On 11/16/2011 10:38 PM, Andrea Del Bene wrote:
> Are you referring to the example from book "Apache-Wicket-Cookbook",
> page n°34? If so, how do you populate the list of C? Maybe you should
> not set to null B model when you change value in A.
> If you can try to give an example of values from A,B and C.
I solved using Ajax.
In onUpdate() of AjaxFormComponentUpdatingBehavior of A, I add both
components (B and C) to the target.
thanks for the help
A
>
>
> On 11/16/2011 07:33 PM, Alberto wrote:
>> On 11/16/2011 06:06 PM, Andrea Del Bene wrote:
>>> Hi,
>>>
>>> can you elaborate a little bit more what behavior you want to achieve?
>>> I mean, C becomes empty because A#onSelectionChanged sets its model
>>> to null. This should not be strange.
>> Yes, sounds obvious to me too. But I found an examples with 2
>> dropdownchoice where in onSelectionChanged() of the first one is set to
>> null the model of the second one.
>> For two choices works well.
>> Maybe is a wrong pattern, but I not found anything useful.
>> Do you have other solutions?
>>
>> A
>>
>>>> I have a form with with 3 choice components:
>>>>
>>>> A) DropDownChoice
>>>> B) DropDownChoice
>>>> C) ListMultipleChoice
>>>>
>>>> The values of B depend on selected value of A.
>>>> The values of C depend on selected values of A and B
>>>>
>>>> I override the wantOnSelectionChangedNotifications() and
>>>> onSelectionChanged() methods of A and B.
>>>>
>>>> A#onSelectionChanged
>>>> @Override
>>>> protected void onSelectionChanged(IntegerSelectChoice newSelection) {
>>>> super.onSelectionChanged(newSelection);
>>>> SearchForm.this.getModelObject().setInstrument(null);
>>>> SearchForm.this.getModelObject().setParams(null);
>>>> }
>>>>
>>>> B#onSelectionChanged
>>>> @Override
>>>> protected void onSelectionChanged(IntegerSelectChoice newSelection) {
>>>> super.onSelectionChanged(newSelection);
>>>> SearchForm.this.getModelObject().setParams(null);
>>>> }
>>>>
>>>> In A I set to null the model value of both B and C.
>>>> In B I set to null the model value only of B.
>>>>
>>>> This code works only on the startup of the form. When I change the
>>>> value in A the list of C become empty. I have to change the value of
>>>> B to fill C.
>>>> http://www.corriere.it/index.shtml?refresh_ce
>>>> How can I manage this?
>>>>
>>>> A
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Dealing with 3 choice components
Posted by Andrea Del Bene <an...@gmail.com>.
Are you referring to the example from book "Apache-Wicket-Cookbook",
page n°34? If so, how do you populate the list of C? Maybe you should
not set to null B model when you change value in A.
If you can try to give an example of values from A,B and C.
On 11/16/2011 07:33 PM, Alberto wrote:
> On 11/16/2011 06:06 PM, Andrea Del Bene wrote:
>> Hi,
>>
>> can you elaborate a little bit more what behavior you want to achieve?
>> I mean, C becomes empty because A#onSelectionChanged sets its model
>> to null. This should not be strange.
> Yes, sounds obvious to me too. But I found an examples with 2
> dropdownchoice where in onSelectionChanged() of the first one is set to
> null the model of the second one.
> For two choices works well.
> Maybe is a wrong pattern, but I not found anything useful.
> Do you have other solutions?
>
> A
>
>>> I have a form with with 3 choice components:
>>>
>>> A) DropDownChoice
>>> B) DropDownChoice
>>> C) ListMultipleChoice
>>>
>>> The values of B depend on selected value of A.
>>> The values of C depend on selected values of A and B
>>>
>>> I override the wantOnSelectionChangedNotifications() and
>>> onSelectionChanged() methods of A and B.
>>>
>>> A#onSelectionChanged
>>> @Override
>>> protected void onSelectionChanged(IntegerSelectChoice newSelection) {
>>> super.onSelectionChanged(newSelection);
>>> SearchForm.this.getModelObject().setInstrument(null);
>>> SearchForm.this.getModelObject().setParams(null);
>>> }
>>>
>>> B#onSelectionChanged
>>> @Override
>>> protected void onSelectionChanged(IntegerSelectChoice newSelection) {
>>> super.onSelectionChanged(newSelection);
>>> SearchForm.this.getModelObject().setParams(null);
>>> }
>>>
>>> In A I set to null the model value of both B and C.
>>> In B I set to null the model value only of B.
>>>
>>> This code works only on the startup of the form. When I change the
>>> value in A the list of C become empty. I have to change the value of
>>> B to fill C.
>>> http://www.corriere.it/index.shtml?refresh_ce
>>> How can I manage this?
>>>
>>> A
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Dealing with 3 choice components
Posted by Alberto <ab...@ogs.trieste.it>.
On 11/16/2011 06:06 PM, Andrea Del Bene wrote:
> Hi,
>
> can you elaborate a little bit more what behavior you want to achieve?
> I mean, C becomes empty because A#onSelectionChanged sets its model
> to null. This should not be strange.
Yes, sounds obvious to me too. But I found an examples with 2
dropdownchoice where in onSelectionChanged() of the first one is set to
null the model of the second one.
For two choices works well.
Maybe is a wrong pattern, but I not found anything useful.
Do you have other solutions?
A
>>
>> I have a form with with 3 choice components:
>>
>> A) DropDownChoice
>> B) DropDownChoice
>> C) ListMultipleChoice
>>
>> The values of B depend on selected value of A.
>> The values of C depend on selected values of A and B
>>
>> I override the wantOnSelectionChangedNotifications() and
>> onSelectionChanged() methods of A and B.
>>
>> A#onSelectionChanged
>> @Override
>> protected void onSelectionChanged(IntegerSelectChoice newSelection) {
>> super.onSelectionChanged(newSelection);
>> SearchForm.this.getModelObject().setInstrument(null);
>> SearchForm.this.getModelObject().setParams(null);
>> }
>>
>> B#onSelectionChanged
>> @Override
>> protected void onSelectionChanged(IntegerSelectChoice newSelection) {
>> super.onSelectionChanged(newSelection);
>> SearchForm.this.getModelObject().setParams(null);
>> }
>>
>> In A I set to null the model value of both B and C.
>> In B I set to null the model value only of B.
>>
>> This code works only on the startup of the form. When I change the
>> value in A the list of C become empty. I have to change the value of
>> B to fill C.
>>
>> How can I manage this?
>>
>> A
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Dealing with 3 choice components
Posted by Andrea Del Bene <ad...@ciseonweb.it>.
Hi,
can you elaborate a little bit more what behavior you want to achieve? I
mean, C becomes empty because A#onSelectionChanged sets its model to
null. This should not be strange.
>
> I have a form with with 3 choice components:
>
> A) DropDownChoice
> B) DropDownChoice
> C) ListMultipleChoice
>
> The values of B depend on selected value of A.
> The values of C depend on selected values of A and B
>
> I override the wantOnSelectionChangedNotifications() and
> onSelectionChanged() methods of A and B.
>
> A#onSelectionChanged
> @Override
> protected void onSelectionChanged(IntegerSelectChoice newSelection) {
> super.onSelectionChanged(newSelection);
> SearchForm.this.getModelObject().setInstrument(null);
> SearchForm.this.getModelObject().setParams(null);
> }
>
> B#onSelectionChanged
> @Override
> protected void onSelectionChanged(IntegerSelectChoice newSelection) {
> super.onSelectionChanged(newSelection);
> SearchForm.this.getModelObject().setParams(null);
> }
>
> In A I set to null the model value of both B and C.
> In B I set to null the model value only of B.
>
> This code works only on the startup of the form. When I change the
> value in A the list of C become empty. I have to change the value of B
> to fill C.
>
> How can I manage this?
>
> A
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org