an example where I replace panels instead of updating:

        dropDownExercise = new DropDownChoice("exercise", new Model(),
                                new PropertyModel(selectedCategory, 
"exercises"),
                                new HasNameRender()) {
                        @Override
                        protected boolean wantOnSelectionChangedNotifications() 
{
                                return true;
                        }

                        @Override
                        protected void onSelectionChanged(Object newSelection) {
                                super.onSelectionChanged(newSelection);
                                selectedExercise.setObject(newSelection);
                                Panel panel = new 
ExercisePanel(EXERCISE_PANEL_ID,
                                                selectedExercise);
                                exercisePanel.replaceWith(panel);
                                exercisePanel = panel;

                        }
                };

2009/8/5 nino martinez wael <[email protected]>:
> hmm what I have is this:
>
>                       �...@override
>                        protected void onSelectionChanged(Object newSelection) 
> {
>                                // TODO Auto-generated method stub
>                                super.onSelectionChanged(newSelection);
>                                
> selectedCategoryNameTranslatable.modelChanged();
>                                dropDownExercise.setModelObject(null);
>                                
> dropDownExercise.setChoices(((ExerciseCategory) newSelection)
>                                                .getExercises());
>                                dropDownExercise.setVisible(true);
>                        }
>
> it's from an old 1.3 project... So seems similar to what you do..
>
> 2009/8/5 David Leangen <[email protected]>:
>>
>> Hello!
>>
>> I have a form in a panel like so:
>>
>> public class MyPanel extends Panel
>> {
>>    Object someModelObject;
>>
>>    public MyPanel( ... )
>>   {
>>        setModel( new Model( Object ) );
>>        ....
>>
>>        add( new MyForm( ... ) );
>>   }
>>
>>   private static MyForm extends Form
>>   {
>>        private final MyPanel panel;
>>
>>        MyForm( ... )
>>        {
>>                add( new TextField( "text", new PropertyModel( panel,
>> "someModelObject" );
>>
>>                add( new MyDropDownChoice( "dropdown" ..., new PropertyModel(
>> panel, "someModelObject" );
>>        }
>>   }
>>
>> }
>>
>>
>>
>> I have MyDropDownChoice set to capture onChange, and in onSelectionChanged I
>> update the model object.
>>
>> Problem is that the field is not getting updated upon refresh, even if the
>> model object is being changed (yes, the model is indeed changed, and yes,
>> they all refer to the same model).
>>
>> Do I need to mark the model object as dirty or something for the other
>> components to refresh?
>>
>> BTW, in onSelectionChanged, I tried:
>>
>>  panel.modelChanged();
>>
>> but that didn't help much.
>>
>>
>> Thanks!
>> =David
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to