WG: AW: Re: Re: Re: FormTester and IModel

2016-06-14 Thread hansheinrichbraun
It's definitively the combination wicket hibernate which provokes this 
behaviour.


Von meinem Samsung Galaxy Smartphone gesendet.
 Ursprüngliche Nachricht Von: hansheinrichbraun 
 Datum: 11.06.16  15:41  (GMT+01:00) An: 
Martin Grigorov  Cc: Users  
Betreff: AW: Re: Re: Re: FormTester and IModel 

Martin thank you for your advice.i logged my Entity model and found that 
executeBehaviour set the properties to null.Then i blocked the null setting now 
the example was ok but now a property which had no Behaviour was set to null 
when i gave him a nonsense Behavior it worked.But i was not satisfied by the 
solution.I now made an IModel of a bean which included my properties for the 
form.still the nullifying problem.At the end i put all hibernate hsqld spring 
out of my example and it worked.So it must some of the packages i added which 
caused the problem.So i will go now the way back step by step.Any case thanks 
for you advice

Von meinem Samsung Galaxy Smartphone gesendet.
 Ursprüngliche Nachricht Von: Martin Grigorov 
 Datum: 30.05.16  16:52  (GMT+01:00) An: Hans-Heinrich 
Braun  Cc: Users  Betreff: 
Re: Re: Re: FormTester and IModel 
Hi,
Please try to make the demo application simpler.At the moment is uses Spring, 
Hibernate, DBUtil, ... A simple Wicket-only application that demonstrates the 
problem should be possible to be created.Also try with default Wicket model 
classes. If it works then the problem should be in your EntityModel.
Martin GrigorovWicket Training and Consulting
https://twitter.com/mtgrigorov


On Sun, May 29, 2016 at 6:54 PM, Hans-Heinrich Braun 
 wrote:
excuse me Martin that i confused you. So let me try to repeat once more the 
problem:
there are 2 DropDownChoice Fields:
            final DropDownChoice land = new 
DropDownChoice("land",new 
PropertyModel(this,"selectedLand.entity"),   
makeChoicesLand,new ChoiceRenderer("landname","id"));  

            final DropDownChoice orte = new 
DropDownChoice("orte",new PropertyModel(this,"selectedOrt.entity"), 
               makeChoicesOrt,new 
ChoiceRenderer("ortname","id"));   setting the fields :

IModel selectedLand=new EntityModel(Land.class,null);
IModel selectedOrt=new EntityModel(Orte.class,null);
the selection of land changes the choices of orte
which i trigger by
land.add(new AjaxFormComponentUpdatingBehavior("onchange")        {            
@Override            protected void onUpdate(AjaxRequestTarget target)          
  {            orte.setVisible(true);            target.add(orte);            } 
       });
when i click nextButton i check which fields were set..
if land was set or if orte was set.
this is ok when i run as webapplication under jetty.
but when i test with WicketTester and FormTester :
 tester.assertInvisible("form:orte");    
tester.assertVisible("form:land");         formTester.select("land", 0);        
 
tester.executeBehavior((AbstractAjaxBehavior)tester.getComponentFromLastRenderedPage("form:land").getBehaviors().get(0));
         tester.assertVisible("form:orte");   
formTester.submit("nextButton");

but formTester.submit("nextButton")finds land is null if land is set and orte 
not.
Hope you are not fed up by my problemdescription

   Von: Martin Grigorov 
 An: hansheinrichbraun  
CC: "users@wicket.apache.org" 
 Gesendet: 10:33 Mittwoch, 25.Mai 2016
 Betreff: Re: Re: Re: FormTester and IModel
   

On Wed, May 25, 2016 at 10:20 AM, hansheinrichbraun 
 wrote:

I thought i did the trigger here :

tester.getComponentFromLastRenderedPage("form:land").getBehaviors().get(0));
This is just an execution of a getter.You need to 
tester.executeBehavior(ajaxBehavior) it 



Von meinem Samsung Galaxy Smartphone gesendet.
---- Ursprüngliche Nachricht Von: Martin Grigorov 
 Datum: 25.05.16  09:25  (GMT+01:00) An: 
hansheinrichbraun  Cc: users@wicket.apache.org 
Betreff: Re: Re: FormTester and IModel 
Hi,

On Wed, May 25, 2016 at 7:42 AM, hansheinrichbraun  
wrote:
Excuse me i didn't communicate here for a long time so i am a little unfamiliar 
how to describe my problem here.
so i try to describe it here and send you once more the reduced application 
there is a field i defined with my own EntityModel class
IModel selectedLand=new EntityModel(Land.class,null); 
it is set by a DropDownChoice 
final DropDownChoice land
> = new DropDownChoice("land",new
> PropertyModel(this,"selectedLand.entity"),
the selection of this field sets the Choices of another DropDownChoice  by 
land.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override

Here you use Ajax behavior to submit the form component. protected void 
onUpdate(AjaxRequestTarget target)

AW: Re: Re: Re: FormTester and IModel

2016-06-11 Thread hansheinrichbraun

Martin thank you for your advice.i logged my Entity model and found that 
executeBehaviour set the properties to null.Then i blocked the null setting now 
the example was ok but now a property which had no Behaviour was set to null 
when i gave him a nonsense Behavior it worked.But i was not satisfied by the 
solution.I now made an IModel of a bean which included my properties for the 
form.still the nullifying problem.At the end i put all hibernate hsqld spring 
out of my example and it worked.So it must some of the packages i added which 
caused the problem.So i will go now the way back step by step.Any case thanks 
for you advice

Von meinem Samsung Galaxy Smartphone gesendet.
 Ursprüngliche Nachricht Von: Martin Grigorov 
 Datum: 30.05.16  16:52  (GMT+01:00) An: Hans-Heinrich 
Braun  Cc: Users  Betreff: 
Re: Re: Re: FormTester and IModel 
Hi,
Please try to make the demo application simpler.At the moment is uses Spring, 
Hibernate, DBUtil, ... A simple Wicket-only application that demonstrates the 
problem should be possible to be created.Also try with default Wicket model 
classes. If it works then the problem should be in your EntityModel.
Martin GrigorovWicket Training and Consulting
https://twitter.com/mtgrigorov


On Sun, May 29, 2016 at 6:54 PM, Hans-Heinrich Braun 
 wrote:
excuse me Martin that i confused you. So let me try to repeat once more the 
problem:
there are 2 DropDownChoice Fields:
            final DropDownChoice land = new 
DropDownChoice("land",new 
PropertyModel(this,"selectedLand.entity"),   
makeChoicesLand,new ChoiceRenderer("landname","id"));  

            final DropDownChoice orte = new 
DropDownChoice("orte",new PropertyModel(this,"selectedOrt.entity"), 
               makeChoicesOrt,new 
ChoiceRenderer("ortname","id"));   setting the fields :

IModel selectedLand=new EntityModel(Land.class,null);
IModel selectedOrt=new EntityModel(Orte.class,null);
the selection of land changes the choices of orte
which i trigger by
land.add(new AjaxFormComponentUpdatingBehavior("onchange")        {            
@Override            protected void onUpdate(AjaxRequestTarget target)          
  {            orte.setVisible(true);            target.add(orte);            } 
       });
when i click nextButton i check which fields were set..
if land was set or if orte was set.
this is ok when i run as webapplication under jetty.
but when i test with WicketTester and FormTester :
 tester.assertInvisible("form:orte");    
tester.assertVisible("form:land");         formTester.select("land", 0);        
 
tester.executeBehavior((AbstractAjaxBehavior)tester.getComponentFromLastRenderedPage("form:land").getBehaviors().get(0));
         tester.assertVisible("form:orte");   
formTester.submit("nextButton");

but formTester.submit("nextButton")finds land is null if land is set and orte 
not.
Hope you are not fed up by my problemdescription

   Von: Martin Grigorov 
 An: hansheinrichbraun  
CC: "users@wicket.apache.org" 
 Gesendet: 10:33 Mittwoch, 25.Mai 2016
 Betreff: Re: Re: Re: FormTester and IModel
   

On Wed, May 25, 2016 at 10:20 AM, hansheinrichbraun 
 wrote:

I thought i did the trigger here :

tester.getComponentFromLastRenderedPage("form:land").getBehaviors().get(0));
This is just an execution of a getter.You need to 
tester.executeBehavior(ajaxBehavior) it 



Von meinem Samsung Galaxy Smartphone gesendet.
-------- Ursprüngliche Nachricht Von: Martin Grigorov 
 Datum: 25.05.16  09:25  (GMT+01:00) An: 
hansheinrichbraun  Cc: users@wicket.apache.org 
Betreff: Re: Re: FormTester and IModel 
Hi,

On Wed, May 25, 2016 at 7:42 AM, hansheinrichbraun  
wrote:
Excuse me i didn't communicate here for a long time so i am a little unfamiliar 
how to describe my problem here.
so i try to describe it here and send you once more the reduced application 
there is a field i defined with my own EntityModel class
IModel selectedLand=new EntityModel(Land.class,null); 
it is set by a DropDownChoice 
final DropDownChoice land
> = new DropDownChoice("land",new
> PropertyModel(this,"selectedLand.entity"),
the selection of this field sets the Choices of another DropDownChoice  by 
land.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override

Here you use Ajax behavior to submit the form component. protected void 
onUpdate(AjaxRequestTarget target) {orte.setVisible(true); target.add(orte); }  
});
if i select land but don't select orte
and then click at the nextButton 
when i run with jetty land is still set.
when i simulate this behaviour by WicketTester and FormTester 

formTester.select("land", 0);
Here you don't trigger trigger the Ajax behavior t

AW: Re: Re: Re: FormTester and IModel

2016-06-01 Thread hansheinrichbraun

i tried to reduce the complexity which is rather difficult.
Then i tried to follow what me ModelEntity does.
Rather difficult to interpret.
Finally i ended up in case i need the preceding ModelEntity set  to set it once 
more after
tester.executeBehavior((AbstractAjaxBehavior)tester.getComponentFromLastRenderedPage("form:land").getBehaviors().get(0));

and the test does what i want.
Thanks Martin for your help.
Maybe when i have time i look what tester.executeBehaviour really doesVon 
meinem Samsung Galaxy Smartphone gesendet.
 Ursprüngliche Nachricht Von: Martin Grigorov 
 Datum: 30.05.16  16:52  (GMT+01:00) An: Hans-Heinrich 
Braun  Cc: Users  Betreff: 
Re: Re: Re: FormTester and IModel 
Hi,

Please try to make the demo application simpler.
At the moment is uses Spring, Hibernate, DBUtil, ...
A simple Wicket-only application that demonstrates the problem should be
possible to be created.
Also try with default Wicket model classes. If it works then the problem
should be in your EntityModel.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Sun, May 29, 2016 at 6:54 PM, Hans-Heinrich Braun <
hansheinrichbr...@yahoo.de> wrote:

> excuse me Martin that i confused you. So let me try to repeat once more
> the problem:
>
> there are 2 DropDownChoice Fields:
>
>
> final DropDownChoice land = new DropDownChoice("land",new
> PropertyModel(this,"selectedLand.entity"),
> makeChoicesLand,new ChoiceRenderer("landname","id"));
>
>
>    final DropDownChoice orte = new
> DropDownChoice("orte",new
> PropertyModel(this,"selectedOrt.entity"),
>   makeChoicesOrt,new ChoiceRenderer("ortname","id"));
> setting the fields :
>
>
> IModel selectedLand=new EntityModel(Land.class,null);
>
> IModel selectedOrt=new EntityModel(Orte.class,null);
> the selection of land changes the choices of orte
>
> which i trigger by
>
> land.add(new AjaxFormComponentUpdatingBehavior("onchange")
> {
> @Override
> protected void onUpdate(AjaxRequestTarget target)
> {
> orte.setVisible(true);
> target.add(orte);
> }
> });
>
> when i click nextButton i check which fields were set..
>
> if land was set or if orte was set.
>
> this is ok when i run as webapplication under jetty.
>
> but when i test with WicketTester and FormTester :
>
>  tester.assertInvisible("form:orte");
> tester.assertVisible("form:land");
>  formTester.select("land", 0);
>
>  
>tester.executeBehavior((AbstractAjaxBehavior)tester.getComponentFromLastRenderedPage("form:land").getBehaviors().get(0));
>  tester.assertVisible("form:orte");
>   formTester.submit("nextButton");
>
>
> but formTester.submit("nextButton")
> finds land is null if land is set and orte not.
>
> Hope you are not fed up by my problemdescription
>
>
> --
> *Von:* Martin Grigorov 
> *An:* hansheinrichbraun 
> *CC:* "users@wicket.apache.org" 
> *Gesendet:* 10:33 Mittwoch, 25.Mai 2016
> *Betreff:* Re: Re: Re: FormTester and IModel
>
>
> On Wed, May 25, 2016 at 10:20 AM, hansheinrichbraun <
> hansheinrichbr...@yahoo.de> wrote:
>
>
> I thought i did the trigger here :
>
>
>
> tester.getComponentFromLastRenderedPage("form:land").getBehaviors().get(0));
>
>
> This is just an execution of a getter.
> You need to tester.executeBehavior(ajaxBehavior) it
>
>
>
>
>
>
> Von meinem Samsung Galaxy Smartphone gesendet.
>
>  Ursprüngliche Nachricht 
> Von: Martin Grigorov 
> Datum: 25.05.16 09:25 (GMT+01:00)
> An: hansheinrichbraun 
> Cc: users@wicket.apache.org
> Betreff: Re: Re: FormTester and IModel
>
> Hi,
>
>
> On Wed, May 25, 2016 at 7:42 AM, hansheinrichbraun <
> hansheinrichbr...@yahoo.de> wrote:
>
> Excuse me i didn't communicate here for a long time so i am a little
> unfamiliar how to describe my problem here.
>
> so i try to describe it here and send you once more the reduced
> application
>
> there is a field i defined with my own EntityModel class
>
> IModel selectedLand=new EntityModel(Land.class,null);
>
> it is set by a DropDownChoice
>
> final DropDownChoice land
> > = new DropDownChoice("land",new
> > PropertyModel(this,"selectedLand.entity"),
>
> the selection of this field sets the Choices of another DropDownChoice  by
>
> land.add(new AjaxFormComponentUpdatingBehavior("onchange") 

Re: Re: Re: FormTester and IModel

2016-05-30 Thread Martin Grigorov
Hi,

Please try to make the demo application simpler.
At the moment is uses Spring, Hibernate, DBUtil, ...
A simple Wicket-only application that demonstrates the problem should be
possible to be created.
Also try with default Wicket model classes. If it works then the problem
should be in your EntityModel.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Sun, May 29, 2016 at 6:54 PM, Hans-Heinrich Braun <
hansheinrichbr...@yahoo.de> wrote:

> excuse me Martin that i confused you. So let me try to repeat once more
> the problem:
>
> there are 2 DropDownChoice Fields:
>
>
> final DropDownChoice land = new DropDownChoice("land",new
> PropertyModel(this,"selectedLand.entity"),
> makeChoicesLand,new ChoiceRenderer("landname","id"));
>
>
>final DropDownChoice orte = new
> DropDownChoice("orte",new
> PropertyModel(this,"selectedOrt.entity"),
>   makeChoicesOrt,new ChoiceRenderer("ortname","id"));
> setting the fields :
>
>
> IModel selectedLand=new EntityModel(Land.class,null);
>
> IModel selectedOrt=new EntityModel(Orte.class,null);
> the selection of land changes the choices of orte
>
> which i trigger by
>
> land.add(new AjaxFormComponentUpdatingBehavior("onchange")
> {
> @Override
> protected void onUpdate(AjaxRequestTarget target)
> {
> orte.setVisible(true);
> target.add(orte);
> }
> });
>
> when i click nextButton i check which fields were set..
>
> if land was set or if orte was set.
>
> this is ok when i run as webapplication under jetty.
>
> but when i test with WicketTester and FormTester :
>
>  tester.assertInvisible("form:orte");
> tester.assertVisible("form:land");
>  formTester.select("land", 0);
>
>  
> tester.executeBehavior((AbstractAjaxBehavior)tester.getComponentFromLastRenderedPage("form:land").getBehaviors().get(0));
>  tester.assertVisible("form:orte");
>   formTester.submit("nextButton");
>
>
> but formTester.submit("nextButton")
> finds land is null if land is set and orte not.
>
> Hope you are not fed up by my problemdescription
>
>
> --
> *Von:* Martin Grigorov 
> *An:* hansheinrichbraun 
> *CC:* "users@wicket.apache.org" 
> *Gesendet:* 10:33 Mittwoch, 25.Mai 2016
> *Betreff:* Re: Re: Re: FormTester and IModel
>
>
> On Wed, May 25, 2016 at 10:20 AM, hansheinrichbraun <
> hansheinrichbr...@yahoo.de> wrote:
>
>
> I thought i did the trigger here :
>
>
>
> tester.getComponentFromLastRenderedPage("form:land").getBehaviors().get(0));
>
>
> This is just an execution of a getter.
> You need to tester.executeBehavior(ajaxBehavior) it
>
>
>
>
>
>
> Von meinem Samsung Galaxy Smartphone gesendet.
>
>  Ursprüngliche Nachricht 
> Von: Martin Grigorov 
> Datum: 25.05.16 09:25 (GMT+01:00)
> An: hansheinrichbraun 
> Cc: users@wicket.apache.org
> Betreff: Re: Re: FormTester and IModel
>
> Hi,
>
>
> On Wed, May 25, 2016 at 7:42 AM, hansheinrichbraun <
> hansheinrichbr...@yahoo.de> wrote:
>
> Excuse me i didn't communicate here for a long time so i am a little
> unfamiliar how to describe my problem here.
>
> so i try to describe it here and send you once more the reduced
> application
>
> there is a field i defined with my own EntityModel class
>
> IModel selectedLand=new EntityModel(Land.class,null);
>
> it is set by a DropDownChoice
>
> final DropDownChoice land
> > = new DropDownChoice("land",new
> > PropertyModel(this,"selectedLand.entity"),
>
> the selection of this field sets the Choices of another DropDownChoice  by
>
> land.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override
>
>
> Here you use Ajax behavior to submit the form component.
>
>
> protected void onUpdate(AjaxRequestTarget target) {
> orte.setVisible(true);
> target.add(orte); }  });
>
> if i select land but don't select orte
>
> and then click at the nextButton
>
> when i run with jetty land is still set.
>
> when i simulate this behaviour by WicketTester and FormTester
>
>
> formTester.select("land", 0);
>
>
> Here you don't trigger trigger the Ajax behavior to update the model
> object of this form component, so its value is still the old.
>
>
>
> .getComponentFromLastRenderedPagtestere("form:land").getBehavior

Re: Re: Re: FormTester and IModel

2016-05-29 Thread Hans-Heinrich Braun
excuse me Martin that i confused you. So let me try to repeat once more the 
problem:
there are 2 DropDownChoice Fields:
              final DropDownChoice land = new 
DropDownChoice("land",new 
PropertyModel(this,"selectedLand.entity"),      makeChoicesLand,new 
ChoiceRenderer("landname","id"));   

             final DropDownChoice orte = new 
DropDownChoice("orte",new PropertyModel(this,"selectedOrt.entity"), 
               makeChoicesOrt,new ChoiceRenderer("ortname","id"));   
setting the fields :

IModel selectedLand=new EntityModel(Land.class,null);
 IModel selectedOrt=new EntityModel(Orte.class,null); the selection 
of land changes the choices of orte
which i trigger by
land.add(new AjaxFormComponentUpdatingBehavior("onchange")        {            
@Override            protected void onUpdate(AjaxRequestTarget target)          
  {            orte.setVisible(true);            target.add(orte);            } 
       });
when i click nextButton i check which fields were set..
if land was set or if orte was set.
this is ok when i run as webapplication under jetty.
but when i test with WicketTester and FormTester :
 tester.assertInvisible("form:orte");      tester.assertVisible("form:land");   
      formTester.select("land", 0);         
tester.executeBehavior((AbstractAjaxBehavior)tester.getComponentFromLastRenderedPage("form:land").getBehaviors().get(0));
         tester.assertVisible("form:orte");    formTester.submit("nextButton");

but formTester.submit("nextButton")finds land is null if land is set and orte 
not.
Hope you are not fed up by my problemdescription

  Von: Martin Grigorov 
 An: hansheinrichbraun  
CC: "users@wicket.apache.org" 
 Gesendet: 10:33 Mittwoch, 25.Mai 2016
 Betreff: Re: Re: Re: FormTester and IModel
   

On Wed, May 25, 2016 at 10:20 AM, hansheinrichbraun 
 wrote:


I thought i did the trigger here :

tester.getComponentFromLastRenderedPage("form:land").getBehaviors().get(0));

This is just an execution of a getter.You need to 
tester.executeBehavior(ajaxBehavior) it 




Von meinem Samsung Galaxy Smartphone gesendet.
---- Ursprüngliche Nachricht Von: Martin Grigorov 
 Datum: 25.05.16 09:25 (GMT+01:00) An: hansheinrichbraun 
 Cc: users@wicket.apache.org Betreff: Re: Re: 
FormTester and IModel 
Hi,

On Wed, May 25, 2016 at 7:42 AM, hansheinrichbraun  
wrote:

Excuse me i didn't communicate here for a long time so i am a little unfamiliar 
how to describe my problem here.
so i try to describe it here and send you once more the reduced application 
there is a field i defined with my own EntityModel class
IModel selectedLand=new EntityModel(Land.class,null); 
it is set by a DropDownChoice 
final DropDownChoice land
> = new DropDownChoice("land",new
> PropertyModel(this,"selectedLand.entity"),
the selection of this field sets the Choices of another DropDownChoice  by 
land.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override


Here you use Ajax behavior to submit the form component. 
protected void onUpdate(AjaxRequestTarget target) {orte.setVisible(true); 
target.add(orte); }  });
if i select land but don't select orte
and then click at the nextButton 
when i run with jetty land is still set.
when i simulate this behaviour by WicketTester and FormTester 

formTester.select("land", 0);

Here you don't trigger trigger the Ajax behavior to update the model object of 
this form component, so its value is still the old. 
.getComponentFromLastRenderedPagtestere("form:land").getBehaviors().get(0));tester.assertVisible("form:orte");
formTester.submit("nextButton");
i found out in nextButton that land is null.
Maybe it's my version of EntityModel
i send you once more the whole application.Von meinem Samsung Galaxy Smartphone 
gesendet.
 Ursprüngliche Nachricht Von: Martin Grigorov 
 Datum: 19.05.16 10:19 (GMT+01:00) An: 
users@wicket.apache.org, Hans-Heinrich Braun  
Betreff: Re: FormTester and IModel 
Sorry, but your email is hardly readable.
You may use some pastebin service for the code.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Thu, May 19, 2016 at 10:13 AM, Hans-Heinrich Braun <
hansheinrichbr...@yahoo.de.invalid> wrote:

> I tested a little bit but the reason is not so obviousthere is a series of
> DropDowbFields where each sets the choices for the next protected
> IModel selectedLand=new EntityModel(Land.class,null); protected
> IModel selectedOrt=new EntityModel(Orte.class,null);; protected
> IModel selectedStrasse=new
> EntityModel(Strassen.class,null); protected IModel
> selectedObjekt=new EntityModel(Objekte.class,null); IModel extends Land>>makeChoicesLand= new AbstractReadOnlyModel L

AW: Re: Re: Re: FormTester and IModel

2016-05-25 Thread hansheinrichbraun

excuse me by all this handycopying i lost the part you mentioned if you would 
have looked at the example i send you you would have seen that the instruction 
is :

tester.executeBehavior ((AbstractAjaxBehavior) 
tester.getComponentFromLastRenderedPage("form:land").getBehaviors().get(0));
Von meinem Samsung Galaxy Smartphone gesendet.
 Ursprüngliche Nachricht Von: Martin Grigorov 
 Datum: 25.05.16  10:33  (GMT+01:00) An: 
hansheinrichbraun  Cc: users@wicket.apache.org 
Betreff: Re: Re: Re: FormTester and IModel 
On Wed, May 25, 2016 at 10:20 AM, hansheinrichbraun <
hansheinrichbr...@yahoo.de> wrote:

>
> I thought i did the trigger here :
>
>
>
> tester.getComponentFromLastRenderedPage("form:land").getBehaviors().get(0));
>

This is just an execution of a getter.
You need to tester.executeBehavior(ajaxBehavior) it


>
>
>
>
> Von meinem Samsung Galaxy Smartphone gesendet.
>
>  Ursprüngliche Nachricht 
> Von: Martin Grigorov 
> Datum: 25.05.16 09:25 (GMT+01:00)
> An: hansheinrichbraun 
> Cc: users@wicket.apache.org
> Betreff: Re: Re: FormTester and IModel
>
> Hi,
>
>
> On Wed, May 25, 2016 at 7:42 AM, hansheinrichbraun <
> hansheinrichbr...@yahoo.de> wrote:
>
>> Excuse me i didn't communicate here for a long time so i am a little
>> unfamiliar how to describe my problem here.
>>
>> so i try to describe it here and send you once more the reduced
>> application
>>
>> there is a field i defined with my own EntityModel class
>>
>> IModel selectedLand=new EntityModel(Land.class,null);
>>
>> it is set by a DropDownChoice
>>
>> final DropDownChoice land
>> > = new DropDownChoice("land",new
>> > PropertyModel(this,"selectedLand.entity"),
>>
>> the selection of this field sets the Choices of another DropDownChoice
>>  by
>>
>> land.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override
>>
>
> Here you use Ajax behavior to submit the form component.
>
>
>> protected void onUpdate(AjaxRequestTarget target) {
>> orte.setVisible(true);
>> target.add(orte); }  });
>>
>> if i select land but don't select orte
>>
>> and then click at the nextButton
>>
>> when i run with jetty land is still set.
>>
>> when i simulate this behaviour by WicketTester and FormTester
>>
>>
>> formTester.select("land", 0);
>>
>
> Here you don't trigger trigger the Ajax behavior to update the model
> object of this form component, so its value is still the old.
>
>
>>
>> .getComponentFromLastRenderedPagtestere("form:land").getBehaviors().get(0));
>> tester.assertVisible("form:orte");
>> formTester.submit("nextButton");
>>
>> i found out in nextButton that land is null.
>>
>> Maybe it's my version of EntityModel
>>
>> i send you once more the whole application.
>> Von meinem Samsung Galaxy Smartphone gesendet.
>>
>>  Ursprüngliche Nachricht 
>> Von: Martin Grigorov 
>> Datum: 19.05.16 10:19 (GMT+01:00)
>> An: users@wicket.apache.org, Hans-Heinrich Braun <
>> hansheinrichbr...@yahoo.de>
>> Betreff: Re: FormTester and IModel
>>
>> Sorry, but your email is hardly readable.
>> You may use some pastebin service for the code.
>>
>> Martin Grigorov
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>>
>> On Thu, May 19, 2016 at 10:13 AM, Hans-Heinrich Braun <
>> hansheinrichbr...@yahoo.de.invalid> wrote:
>>
>> > I tested a little bit but the reason is not so obviousthere is a series
>> of
>> > DropDowbFields where each sets the choices for the next protected
>> > IModel selectedLand=new EntityModel(Land.class,null);
>> protected
>> > IModel selectedOrt=new EntityModel(Orte.class,null);;
>> protected
>> > IModel selectedStrasse=new
>> > EntityModel(Strassen.class,null); protected IModel
>> > selectedObjekt=new EntityModel(Objekte.class,null);
>> IModel> > extends Land>>makeChoicesLand= new AbstractReadOnlyModel> > Land>>() { @Override public List getObject() { List
>> > landlist=new ArrayList(); if(landManager!=null){ Iterator
>> > landiterator=landManager.getLandes().iterator();
>> > while(landiterator.hasNext()){ Land land=(Land) landiterator.next();
>> > landlist.add(land); } } return landlist; } };  private IModel> > extends Orte>> makeChoicesOrt = new AbstractReadOnlyModel> > Orte>>()

Re: Re: Re: FormTester and IModel

2016-05-25 Thread Martin Grigorov
On Wed, May 25, 2016 at 10:20 AM, hansheinrichbraun <
hansheinrichbr...@yahoo.de> wrote:

>
> I thought i did the trigger here :
>
>
>
> tester.getComponentFromLastRenderedPage("form:land").getBehaviors().get(0));
>

This is just an execution of a getter.
You need to tester.executeBehavior(ajaxBehavior) it


>
>
>
>
> Von meinem Samsung Galaxy Smartphone gesendet.
>
>  Ursprüngliche Nachricht 
> Von: Martin Grigorov 
> Datum: 25.05.16 09:25 (GMT+01:00)
> An: hansheinrichbraun 
> Cc: users@wicket.apache.org
> Betreff: Re: Re: FormTester and IModel
>
> Hi,
>
>
> On Wed, May 25, 2016 at 7:42 AM, hansheinrichbraun <
> hansheinrichbr...@yahoo.de> wrote:
>
>> Excuse me i didn't communicate here for a long time so i am a little
>> unfamiliar how to describe my problem here.
>>
>> so i try to describe it here and send you once more the reduced
>> application
>>
>> there is a field i defined with my own EntityModel class
>>
>> IModel selectedLand=new EntityModel(Land.class,null);
>>
>> it is set by a DropDownChoice
>>
>> final DropDownChoice land
>> > = new DropDownChoice("land",new
>> > PropertyModel(this,"selectedLand.entity"),
>>
>> the selection of this field sets the Choices of another DropDownChoice
>>  by
>>
>> land.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override
>>
>
> Here you use Ajax behavior to submit the form component.
>
>
>> protected void onUpdate(AjaxRequestTarget target) {
>> orte.setVisible(true);
>> target.add(orte); }  });
>>
>> if i select land but don't select orte
>>
>> and then click at the nextButton
>>
>> when i run with jetty land is still set.
>>
>> when i simulate this behaviour by WicketTester and FormTester
>>
>>
>> formTester.select("land", 0);
>>
>
> Here you don't trigger trigger the Ajax behavior to update the model
> object of this form component, so its value is still the old.
>
>
>>
>> .getComponentFromLastRenderedPagtestere("form:land").getBehaviors().get(0));
>> tester.assertVisible("form:orte");
>> formTester.submit("nextButton");
>>
>> i found out in nextButton that land is null.
>>
>> Maybe it's my version of EntityModel
>>
>> i send you once more the whole application.
>> Von meinem Samsung Galaxy Smartphone gesendet.
>>
>>  Ursprüngliche Nachricht 
>> Von: Martin Grigorov 
>> Datum: 19.05.16 10:19 (GMT+01:00)
>> An: users@wicket.apache.org, Hans-Heinrich Braun <
>> hansheinrichbr...@yahoo.de>
>> Betreff: Re: FormTester and IModel
>>
>> Sorry, but your email is hardly readable.
>> You may use some pastebin service for the code.
>>
>> Martin Grigorov
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>>
>> On Thu, May 19, 2016 at 10:13 AM, Hans-Heinrich Braun <
>> hansheinrichbr...@yahoo.de.invalid> wrote:
>>
>> > I tested a little bit but the reason is not so obviousthere is a series
>> of
>> > DropDowbFields where each sets the choices for the next protected
>> > IModel selectedLand=new EntityModel(Land.class,null);
>> protected
>> > IModel selectedOrt=new EntityModel(Orte.class,null);;
>> protected
>> > IModel selectedStrasse=new
>> > EntityModel(Strassen.class,null); protected IModel
>> > selectedObjekt=new EntityModel(Objekte.class,null);
>> IModel> > extends Land>>makeChoicesLand= new AbstractReadOnlyModel> > Land>>() { @Override public List getObject() { List
>> > landlist=new ArrayList(); if(landManager!=null){ Iterator
>> > landiterator=landManager.getLandes().iterator();
>> > while(landiterator.hasNext()){ Land land=(Land) landiterator.next();
>> > landlist.add(land); } } return landlist; } };  private IModel> > extends Orte>> makeChoicesOrt = new AbstractReadOnlyModel> > Orte>>() { @Override public List getObject() { List
>> > ortelist=new ArrayList(); try{ if
>> (selectedLand.getObject()!=null){
>> > Iterator orteiterator=selectedLand.getObject().getOrte().iterator();
>> > while(orteiterator.hasNext()){ Orte orte=(Orte)orteiterator.next();
>> > Iterator strasseniterator=orte.getStrassen().iterator();
>> > while(strasseniterator.hasNext()){ Strassen
>> > strassen=(Strassen)strasseniterator.next();  Iterator
>> > objekteiterator=strassen.getOb

AW: Re: Re: FormTester and IModel

2016-05-25 Thread hansheinrichbraun

I thought i did the trigger here :

tester.getComponentFromLastRenderedPage("form:land").getBehaviors().get(0));



Von meinem Samsung Galaxy Smartphone gesendet.
 Ursprüngliche Nachricht Von: Martin Grigorov 
 Datum: 25.05.16  09:25  (GMT+01:00) An: 
hansheinrichbraun  Cc: users@wicket.apache.org 
Betreff: Re: Re: FormTester and IModel 
Hi,

On Wed, May 25, 2016 at 7:42 AM, hansheinrichbraun  
wrote:
Excuse me i didn't communicate here for a long time so i am a little unfamiliar 
how to describe my problem here.
so i try to describe it here and send you once more the reduced application 
there is a field i defined with my own EntityModel class
IModel selectedLand=new EntityModel(Land.class,null); 
it is set by a DropDownChoice 
final DropDownChoice land
> = new DropDownChoice("land",new
> PropertyModel(this,"selectedLand.entity"),
the selection of this field sets the Choices of another DropDownChoice  by 
land.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override

Here you use Ajax behavior to submit the form component. protected void 
onUpdate(AjaxRequestTarget target) {orte.setVisible(true); target.add(orte); }  
});
if i select land but don't select orte
and then click at the nextButton 
when i run with jetty land is still set.
when i simulate this behaviour by WicketTester and FormTester 

formTester.select("land", 0);
Here you don't trigger trigger the Ajax behavior to update the model object of 
this form component, so its value is still the old. 
.getComponentFromLastRenderedPagtestere("form:land").getBehaviors().get(0));tester.assertVisible("form:orte");
formTester.submit("nextButton");
i found out in nextButton that land is null.
Maybe it's my version of EntityModel
i send you once more the whole application.Von meinem Samsung Galaxy Smartphone 
gesendet.
 Ursprüngliche Nachricht Von: Martin Grigorov 
 Datum: 19.05.16  10:19  (GMT+01:00) An: 
users@wicket.apache.org, Hans-Heinrich Braun  
Betreff: Re: FormTester and IModel 
Sorry, but your email is hardly readable.
You may use some pastebin service for the code.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Thu, May 19, 2016 at 10:13 AM, Hans-Heinrich Braun <
hansheinrichbr...@yahoo.de.invalid> wrote:

> I tested a little bit but the reason is not so obviousthere is a series of
> DropDowbFields where each sets the choices for the next protected
> IModel selectedLand=new EntityModel(Land.class,null); protected
> IModel selectedOrt=new EntityModel(Orte.class,null);; protected
> IModel selectedStrasse=new
> EntityModel(Strassen.class,null); protected IModel
> selectedObjekt=new EntityModel(Objekte.class,null); IModel extends Land>>makeChoicesLand= new AbstractReadOnlyModel Land>>() { @Override public List getObject() { List
> landlist=new ArrayList(); if(landManager!=null){ Iterator
> landiterator=landManager.getLandes().iterator();
> while(landiterator.hasNext()){ Land land=(Land) landiterator.next();
> landlist.add(land); } } return landlist; } };  private IModel extends Orte>> makeChoicesOrt = new AbstractReadOnlyModel Orte>>() { @Override public List getObject() { List
> ortelist=new ArrayList(); try{ if (selectedLand.getObject()!=null){
> Iterator orteiterator=selectedLand.getObject().getOrte().iterator();
> while(orteiterator.hasNext()){ Orte orte=(Orte)orteiterator.next();
> Iterator strasseniterator=orte.getStrassen().iterator();
> while(strasseniterator.hasNext()){ Strassen
> strassen=(Strassen)strasseniterator.next();  Iterator
> objekteiterator=strassen.getObjekte().iterator();
> while(objekteiterator.hasNext()){ Objekte
> objekte=(Objekte)objekteiterator.next(); } }
> if(Strings.isEmpty(selectedOrtstring)){ortelist.add(orte);}  else{
> if(orte.getOrtname().startsWith(selectedOrtstring, 0)) ortelist.add(orte);
> } } }  }catch(Exception e){System.err.println(e);} return ortelist; }  };
>
>
>  private IModel> makeChoicesStrassen = new
> AbstractReadOnlyModel>() { @Override public
> List getObject() { List strassenlist=new
> ArrayList(); if (selectedOrt.getObject()!=null){   Iterator
> strasseniterator=selectedOrt.getObject().getStrassen().iterator();
> while(strasseniterator.hasNext()){ Strassen
> strassen=(Strassen)strasseniterator.next();
> if(Strings.isEmpty(selectedStrassenstring)){strassenlist.add(strassen);}
> else{ if(strassen.getStrname().startsWith(selectedStrassenstring, 0))
> strassenlist.add(strassen); } }  }  return strassenlist; } };
>
>
>
>
>  private IModel> makeChoicesObjekte = new
> AbstractReadOnlyModel>() { @Override public
> List getObject() { List objektelist=new
> ArrayList(); if(selectedStrasse.getObject()!=null){  Iterator
> objekteiterator=selec

Re: Re: FormTester and IModel

2016-05-25 Thread Martin Grigorov
Hi,


On Wed, May 25, 2016 at 7:42 AM, hansheinrichbraun <
hansheinrichbr...@yahoo.de> wrote:

> Excuse me i didn't communicate here for a long time so i am a little
> unfamiliar how to describe my problem here.
>
> so i try to describe it here and send you once more the reduced
> application
>
> there is a field i defined with my own EntityModel class
>
> IModel selectedLand=new EntityModel(Land.class,null);
>
> it is set by a DropDownChoice
>
> final DropDownChoice land
> > = new DropDownChoice("land",new
> > PropertyModel(this,"selectedLand.entity"),
>
> the selection of this field sets the Choices of another DropDownChoice  by
>
> land.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override
>

Here you use Ajax behavior to submit the form component.


> protected void onUpdate(AjaxRequestTarget target) {
> orte.setVisible(true);
> target.add(orte); }  });
>
> if i select land but don't select orte
>
> and then click at the nextButton
>
> when i run with jetty land is still set.
>
> when i simulate this behaviour by WicketTester and FormTester
>
>
> formTester.select("land", 0);
>

Here you don't trigger trigger the Ajax behavior to update the model object
of this form component, so its value is still the old.


>
> tester.getComponentFromLastRenderedPage("form:land").getBehaviors().get(0));
> tester.assertVisible("form:orte");
> formTester.submit("nextButton");
>
> i found out in nextButton that land is null.
>
> Maybe it's my version of EntityModel
>
> i send you once more the whole application.
> Von meinem Samsung Galaxy Smartphone gesendet.
>
>  Ursprüngliche Nachricht 
> Von: Martin Grigorov 
> Datum: 19.05.16 10:19 (GMT+01:00)
> An: users@wicket.apache.org, Hans-Heinrich Braun <
> hansheinrichbr...@yahoo.de>
> Betreff: Re: FormTester and IModel
>
> Sorry, but your email is hardly readable.
> You may use some pastebin service for the code.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Thu, May 19, 2016 at 10:13 AM, Hans-Heinrich Braun <
> hansheinrichbr...@yahoo.de.invalid> wrote:
>
> > I tested a little bit but the reason is not so obviousthere is a series
> of
> > DropDowbFields where each sets the choices for the next protected
> > IModel selectedLand=new EntityModel(Land.class,null);
> protected
> > IModel selectedOrt=new EntityModel(Orte.class,null);;
> protected
> > IModel selectedStrasse=new
> > EntityModel(Strassen.class,null); protected IModel
> > selectedObjekt=new EntityModel(Objekte.class,null);
> IModel > extends Land>>makeChoicesLand= new AbstractReadOnlyModel > Land>>() { @Override public List getObject() { List
> > landlist=new ArrayList(); if(landManager!=null){ Iterator
> > landiterator=landManager.getLandes().iterator();
> > while(landiterator.hasNext()){ Land land=(Land) landiterator.next();
> > landlist.add(land); } } return landlist; } };  private IModel > extends Orte>> makeChoicesOrt = new AbstractReadOnlyModel > Orte>>() { @Override public List getObject() { List
> > ortelist=new ArrayList(); try{ if (selectedLand.getObject()!=null){
> > Iterator orteiterator=selectedLand.getObject().getOrte().iterator();
> > while(orteiterator.hasNext()){ Orte orte=(Orte)orteiterator.next();
> > Iterator strasseniterator=orte.getStrassen().iterator();
> > while(strasseniterator.hasNext()){ Strassen
> > strassen=(Strassen)strasseniterator.next();  Iterator
> > objekteiterator=strassen.getObjekte().iterator();
> > while(objekteiterator.hasNext()){ Objekte
> > objekte=(Objekte)objekteiterator.next(); } }
> > if(Strings.isEmpty(selectedOrtstring)){ortelist.add(orte);}  else{
> > if(orte.getOrtname().startsWith(selectedOrtstring, 0))
> ortelist.add(orte);
> > } } }  }catch(Exception e){System.err.println(e);} return ortelist; }  };
> >
> >
> >  private IModel> makeChoicesStrassen = new
> > AbstractReadOnlyModel>() { @Override public
> > List getObject() { List strassenlist=new
> > ArrayList(); if (selectedOrt.getObject()!=null){   Iterator
> > strasseniterator=selectedOrt.getObject().getStrassen().iterator();
> > while(strasseniterator.hasNext()){ Strassen
> > strassen=(Strassen)strasseniterator.next();
> > if(Strings.isEmpty(selectedStrassenstring)){strassenlist.add(strassen);}
> > else{ if(strassen.getStrname().startsWith(selectedStrassenstring, 0))
> > strassenlist.add(strassen); } }  }  return strassenlist; } };
> >
> >
> >
> >
&

AW: Re: FormTester and IModel

2016-05-24 Thread hansheinrichbraun
Excuse me i didn't communicate here for a long time so i am a little unfamiliar 
how to describe my problem here.
so i try to describe it here and send you once more the reduced application 
there is a field i defined with my own EntityModel class
IModel selectedLand=new EntityModel(Land.class,null); 
it is set by a DropDownChoice 
final DropDownChoice land
> = new DropDownChoice("land",new
> PropertyModel(this,"selectedLand.entity"),
the selection of this field sets the Choices of another DropDownChoice  by 
land.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override
protected void onUpdate(AjaxRequestTarget target) {orte.setVisible(true); 
target.add(orte); }  });
if i select land but don't select orte
and then click at the nextButton 
when i run with jetty land is still set.
when i simulate this behaviour by WicketTester and FormTester 

formTester.select("land", 
0);tester.getComponentFromLastRenderedPage("form:land").getBehaviors().get(0));
tester.assertVisible("form:orte");
formTester.submit("nextButton");
i found out in nextButton that land is null.
Maybe it's my version of EntityModel
i send you once more the whole application.Von meinem Samsung Galaxy Smartphone 
gesendet.
 Ursprüngliche Nachricht Von: Martin Grigorov 
 Datum: 19.05.16  10:19  (GMT+01:00) An: 
users@wicket.apache.org, Hans-Heinrich Braun  
Betreff: Re: FormTester and IModel 
Sorry, but your email is hardly readable.
You may use some pastebin service for the code.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Thu, May 19, 2016 at 10:13 AM, Hans-Heinrich Braun <
hansheinrichbr...@yahoo.de.invalid> wrote:

> I tested a little bit but the reason is not so obviousthere is a series of
> DropDowbFields where each sets the choices for the next protected
> IModel selectedLand=new EntityModel(Land.class,null); protected
> IModel selectedOrt=new EntityModel(Orte.class,null);; protected
> IModel selectedStrasse=new
> EntityModel(Strassen.class,null); protected IModel
> selectedObjekt=new EntityModel(Objekte.class,null); IModel extends Land>>makeChoicesLand= new AbstractReadOnlyModel Land>>() { @Override public List getObject() { List
> landlist=new ArrayList(); if(landManager!=null){ Iterator
> landiterator=landManager.getLandes().iterator();
> while(landiterator.hasNext()){ Land land=(Land) landiterator.next();
> landlist.add(land); } } return landlist; } };  private IModel extends Orte>> makeChoicesOrt = new AbstractReadOnlyModel Orte>>() { @Override public List getObject() { List
> ortelist=new ArrayList(); try{ if (selectedLand.getObject()!=null){
> Iterator orteiterator=selectedLand.getObject().getOrte().iterator();
> while(orteiterator.hasNext()){ Orte orte=(Orte)orteiterator.next();
> Iterator strasseniterator=orte.getStrassen().iterator();
> while(strasseniterator.hasNext()){ Strassen
> strassen=(Strassen)strasseniterator.next();  Iterator
> objekteiterator=strassen.getObjekte().iterator();
> while(objekteiterator.hasNext()){ Objekte
> objekte=(Objekte)objekteiterator.next(); } }
> if(Strings.isEmpty(selectedOrtstring)){ortelist.add(orte);}  else{
> if(orte.getOrtname().startsWith(selectedOrtstring, 0)) ortelist.add(orte);
> } } }  }catch(Exception e){System.err.println(e);} return ortelist; }  };
>
>
>  private IModel> makeChoicesStrassen = new
> AbstractReadOnlyModel>() { @Override public
> List getObject() { List strassenlist=new
> ArrayList(); if (selectedOrt.getObject()!=null){   Iterator
> strasseniterator=selectedOrt.getObject().getStrassen().iterator();
> while(strasseniterator.hasNext()){ Strassen
> strassen=(Strassen)strasseniterator.next();
> if(Strings.isEmpty(selectedStrassenstring)){strassenlist.add(strassen);}
> else{ if(strassen.getStrname().startsWith(selectedStrassenstring, 0))
> strassenlist.add(strassen); } }  }  return strassenlist; } };
>
>
>
>
>  private IModel> makeChoicesObjekte = new
> AbstractReadOnlyModel>() { @Override public
> List getObject() { List objektelist=new
> ArrayList(); if(selectedStrasse.getObject()!=null){  Iterator
> objekteiterator=selectedStrasse.getObject().getObjekte().iterator();
> while(objekteiterator.hasNext()){ Objekte
> objekte=(Objekte)objekteiterator.next(); objektelist.add(objekte);  } }
> return objektelist; } };  final DropDownChoice objekte = new
> DropDownChoice("objekte",new
> PropertyModel(this,"selectedObjekt.entity"),
> makeChoicesObjekte,objektechoicerenderer); final DropDownChoice land
> = new DropDownChoice("land",new
> PropertyModel(this,"selectedLand.entity"), makeChoicesLand,new
> ChoiceRenderer("landname","id")); final DropDownChoice orte =
> new DropD

Re: FormTester and IModel

2016-05-19 Thread Martin Grigorov
Sorry, but your email is hardly readable.
You may use some pastebin service for the code.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Thu, May 19, 2016 at 10:13 AM, Hans-Heinrich Braun <
hansheinrichbr...@yahoo.de.invalid> wrote:

> I tested a little bit but the reason is not so obviousthere is a series of
> DropDowbFields where each sets the choices for the next protected
> IModel selectedLand=new EntityModel(Land.class,null); protected
> IModel selectedOrt=new EntityModel(Orte.class,null);; protected
> IModel selectedStrasse=new
> EntityModel(Strassen.class,null); protected IModel
> selectedObjekt=new EntityModel(Objekte.class,null); IModel extends Land>>makeChoicesLand= new AbstractReadOnlyModel Land>>() { @Override public List getObject() { List
> landlist=new ArrayList(); if(landManager!=null){ Iterator
> landiterator=landManager.getLandes().iterator();
> while(landiterator.hasNext()){ Land land=(Land) landiterator.next();
> landlist.add(land); } } return landlist; } };  private IModel extends Orte>> makeChoicesOrt = new AbstractReadOnlyModel Orte>>() { @Override public List getObject() { List
> ortelist=new ArrayList(); try{ if (selectedLand.getObject()!=null){
> Iterator orteiterator=selectedLand.getObject().getOrte().iterator();
> while(orteiterator.hasNext()){ Orte orte=(Orte)orteiterator.next();
> Iterator strasseniterator=orte.getStrassen().iterator();
> while(strasseniterator.hasNext()){ Strassen
> strassen=(Strassen)strasseniterator.next();  Iterator
> objekteiterator=strassen.getObjekte().iterator();
> while(objekteiterator.hasNext()){ Objekte
> objekte=(Objekte)objekteiterator.next(); } }
> if(Strings.isEmpty(selectedOrtstring)){ortelist.add(orte);}  else{
> if(orte.getOrtname().startsWith(selectedOrtstring, 0)) ortelist.add(orte);
> } } }  }catch(Exception e){System.err.println(e);} return ortelist; }  };
>
>
>  private IModel> makeChoicesStrassen = new
> AbstractReadOnlyModel>() { @Override public
> List getObject() { List strassenlist=new
> ArrayList(); if (selectedOrt.getObject()!=null){   Iterator
> strasseniterator=selectedOrt.getObject().getStrassen().iterator();
> while(strasseniterator.hasNext()){ Strassen
> strassen=(Strassen)strasseniterator.next();
> if(Strings.isEmpty(selectedStrassenstring)){strassenlist.add(strassen);}
> else{ if(strassen.getStrname().startsWith(selectedStrassenstring, 0))
> strassenlist.add(strassen); } }  }  return strassenlist; } };
>
>
>
>
>  private IModel> makeChoicesObjekte = new
> AbstractReadOnlyModel>() { @Override public
> List getObject() { List objektelist=new
> ArrayList(); if(selectedStrasse.getObject()!=null){  Iterator
> objekteiterator=selectedStrasse.getObject().getObjekte().iterator();
> while(objekteiterator.hasNext()){ Objekte
> objekte=(Objekte)objekteiterator.next(); objektelist.add(objekte);  } }
> return objektelist; } };  final DropDownChoice objekte = new
> DropDownChoice("objekte",new
> PropertyModel(this,"selectedObjekt.entity"),
> makeChoicesObjekte,objektechoicerenderer); final DropDownChoice land
> = new DropDownChoice("land",new
> PropertyModel(this,"selectedLand.entity"), makeChoicesLand,new
> ChoiceRenderer("landname","id")); final DropDownChoice orte =
> new DropDownChoice("orte",new
> PropertyModel(this,"selectedOrt.entity"), makeChoicesOrt,new
> ChoiceRenderer("ortname","id")); final DropDownChoice
> strassen = new DropDownChoice("strassen",new
> PropertyModel(this,"selectedStrasse.entity"),
> makeChoicesStrassen,new ChoiceRenderer("strname","id")); First
> only land is visible if selected orte becomes visible if this is selected
> the next dropdown becomes visible etc.
> This is triggered by
> land.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override
> protected void onUpdate(AjaxRequestTarget target) {
> ortemarkup.setVisible(true); target.add(ortemarkup);
> textsearchmarkup.setVisible(false); target.add(textsearchmarkup); }  });
>  orte.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override
> protected void onUpdate(AjaxRequestTarget target) {
> strassenmarkup.setVisible(true); target.add(strassenmarkup); } });
>
>
> strassen.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override
> protected void onUpdate(AjaxRequestTarget target) {  if(withNext==false){
> customCSS = "btn btn-info pull-left col-sm-4 disabled"; customEnabled =
> false;} if(whithObjekt==1) {  objektemarkup.setVisible(true);
> personenmarkup.setVisible(false); } if(whithObjekt==2){
> objektemarkup.setVisible(true); personenmarkup.setVisible(true); }
> if(whithObjekt==0){ objektemarkup.setVisible(false);
> personenmarkup.setVisible(false); } if(whithObjekt==-1) {
> personenmarkup.setVisible(true); objektemarkup.setVisible(false);}
> target.add(objektemarkup); target.add(personenmarkup); target.add(onNext);
> } });the dropdowns are in Markupcontainers which might be visible or not.In
> each position you can hit a nextButton.which looks which selectedFields are
> not empty and decides

FormTester and IModel

2016-05-19 Thread Hans-Heinrich Braun
I tested a little bit but the reason is not so obviousthere is a series of 
DropDowbFields where each sets the choices for the next protected IModel 
selectedLand=new EntityModel(Land.class,null); protected IModel 
selectedOrt=new EntityModel(Orte.class,null);; protected IModel 
selectedStrasse=new EntityModel(Strassen.class,null); protected 
IModel selectedObjekt=new EntityModel(Objekte.class,null); 
IModel>makeChoicesLand= new AbstractReadOnlyModel>() { @Override public List getObject() { List 
landlist=new ArrayList(); if(landManager!=null){ Iterator 
landiterator=landManager.getLandes().iterator(); while(landiterator.hasNext()){ 
Land land=(Land) landiterator.next(); landlist.add(land); } } return landlist; 
} };  private IModel> makeChoicesOrt = new 
AbstractReadOnlyModel>() { @Override public List 
getObject() { List ortelist=new ArrayList(); try{ if 
(selectedLand.getObject()!=null){  Iterator 
orteiterator=selectedLand.getObject().getOrte().iterator(); 
while(orteiterator.hasNext()){ Orte orte=(Orte)orteiterator.next();  Iterator 
strasseniterator=orte.getStrassen().iterator(); 
while(strasseniterator.hasNext()){ Strassen 
strassen=(Strassen)strasseniterator.next();  Iterator 
objekteiterator=strassen.getObjekte().iterator();  
while(objekteiterator.hasNext()){ Objekte 
objekte=(Objekte)objekteiterator.next(); } }  
if(Strings.isEmpty(selectedOrtstring)){ortelist.add(orte);}  else{ 
if(orte.getOrtname().startsWith(selectedOrtstring, 0)) ortelist.add(orte);  } } 
}  }catch(Exception e){System.err.println(e);} return ortelist; }  }; 


 private IModel> makeChoicesStrassen = new 
AbstractReadOnlyModel>() { @Override public 
List getObject() { List strassenlist=new 
ArrayList(); if (selectedOrt.getObject()!=null){   Iterator 
strasseniterator=selectedOrt.getObject().getStrassen().iterator(); 
while(strasseniterator.hasNext()){ Strassen 
strassen=(Strassen)strasseniterator.next(); 
if(Strings.isEmpty(selectedStrassenstring)){strassenlist.add(strassen);} else{ 
if(strassen.getStrname().startsWith(selectedStrassenstring, 0)) 
strassenlist.add(strassen); } }  }  return strassenlist; } }; 




 private IModel> makeChoicesObjekte = new 
AbstractReadOnlyModel>() { @Override public 
List getObject() { List objektelist=new ArrayList(); 
if(selectedStrasse.getObject()!=null){  Iterator 
objekteiterator=selectedStrasse.getObject().getObjekte().iterator();  
while(objekteiterator.hasNext()){ Objekte 
objekte=(Objekte)objekteiterator.next(); objektelist.add(objekte);  } }  return 
objektelist; } };  final DropDownChoice objekte = new 
DropDownChoice("objekte",new 
PropertyModel(this,"selectedObjekt.entity"), 
makeChoicesObjekte,objektechoicerenderer); final DropDownChoice land = 
new DropDownChoice("land",new 
PropertyModel(this,"selectedLand.entity"), makeChoicesLand,new 
ChoiceRenderer("landname","id")); final DropDownChoice orte = new 
DropDownChoice("orte",new PropertyModel(this,"selectedOrt.entity"), 
makeChoicesOrt,new ChoiceRenderer("ortname","id")); final 
DropDownChoice strassen = new DropDownChoice("strassen",new 
PropertyModel(this,"selectedStrasse.entity"), makeChoicesStrassen,new 
ChoiceRenderer("strname","id")); First only land is visible if 
selected orte becomes visible if this is selected the next dropdown becomes 
visible etc.
This is triggered by
land.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override 
protected void onUpdate(AjaxRequestTarget target) { 
ortemarkup.setVisible(true); target.add(ortemarkup); 
textsearchmarkup.setVisible(false); target.add(textsearchmarkup); }  }); 
 orte.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override 
protected void onUpdate(AjaxRequestTarget target) { 
strassenmarkup.setVisible(true); target.add(strassenmarkup); } }); 


strassen.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override 
protected void onUpdate(AjaxRequestTarget target) {  if(withNext==false){ 
customCSS = "btn btn-info pull-left col-sm-4 disabled"; customEnabled = false;} 
if(whithObjekt==1) {  objektemarkup.setVisible(true); 
personenmarkup.setVisible(false); } if(whithObjekt==2){ 
objektemarkup.setVisible(true); personenmarkup.setVisible(true); } 
if(whithObjekt==0){ objektemarkup.setVisible(false);  
personenmarkup.setVisible(false); } if(whithObjekt==-1) { 
personenmarkup.setVisible(true); objektemarkup.setVisible(false);} 
target.add(objektemarkup); target.add(personenmarkup); target.add(onNext); } 
});the dropdowns are in Markupcontainers which might be visible or not.In each 
position you can hit a nextButton.which looks which selectedFields are not 
empty and decides which action to take.
this works in real life and with WicketTester i make the following:
tester.executeUrl("../../wicket/bookmarkable/braunimmobilien.bootstrap.webapp.pages.breadcrumb.IndexBootstrap?objid=null");
 tester.assertRenderedPage(IndexBootstrap.class); FormTester formTester = 
tester.newFormTester("panel:form"); 
Assert.assertEquals("",formTester.getForm().getClass().getSim

Re: FormTester and IModel

2016-05-18 Thread Martin Grigorov
Hi,

Show us some code please!

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Thu, May 19, 2016 at 4:19 AM, hansheinrichbraun <
hansheinrichbr...@yahoo.de.invalid> wrote:

>
> i use forms with DropDownChoices with fields which are IModel. When i test
> in real life they work fine but when i test with FormTester field.getObject
> () only delivers null in onSubmit ()
>
> Von meinem Samsung Galaxy Smartphone gesendet.


FormTester and IModel

2016-05-18 Thread hansheinrichbraun

i use forms with DropDownChoices with fields which are IModel. When i test in 
real life they work fine but when i test with FormTester field.getObject () 
only delivers null in onSubmit ()

Von meinem Samsung Galaxy Smartphone gesendet.