Browser/Client info navigatorJavaEnabled property returns undefined

2016-05-25 Thread ravala
Hi, 

I was trying to use WebClientInfo to get browser information on the server,
In the Ipad chrome
when retrieving  'navigatorJavaEnabled' is returning 'undefined' instead of
true/false.

The problem is as  'undefined' is string but server is expecting boolean,
leads to exception and causing  browser to reload continuously.

possible solution 

In wicket-browser-info.js
--
info.navigatorJavaEnabled = window.navigator.javaEnabled() || false; 


Regards,
Ramesh V

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Browser-Client-info-navigatorJavaEnabled-property-returns-undefined-tp4674794.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



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>>() { @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{
>> 

Re: Generate css from less for package resources at runtime.

2016-05-25 Thread Lars Törner
Hi Martin, Bas and others!

Unfortunately I got one crucial thing wrong when I described our scenario.

"A less-variable (put in a separate file) gets a new value."

This is not the case, the variable is changed in code and not in a file.
This means that even though we have changed a less variable and regenerated
the css, the less files themselves has not changed (no new modification
time), and therefore the problem we have arises.

To touch the css-file might be a work around, but it seems kind of a
strange way to handle things.

Cheers
Lasse

2016-05-25 12:35 GMT+02:00 Bas Gooren :

> Lars, Martin,
>
>
> Sorry for hijacking this thread (sort of).
>
>
> Hmmm, I am 100% sure it was not working for us in a web app we currently
> have running.
>
> I just checked which version of wicket-bootstrap-less it uses (version
> 0.9.11), and that version already has the recursive check on the
> last-modified time of imported sources.
>
>
> I’ll try to do some debugging to see if it really is not working, and if
> that’s the case: why it’s not working.
>
> Met vriendelijke groet,
> Kind regards,
>
> Bas Gooren
>
> Op 24 mei 2016 bij 20:25:52, Lars Törner (lars.tor...@gmail.com) schreef:
>
> Thanks Martin, I'll take a look at it!
>
> tisdag 24 maj 2016 skrev Martin Grigorov :
>
> > Hi,
> >
> > I checked the code last night and I believe this use case should be
> covered
> > by
> >
> >
> https://github.com/l0rdn1kk0n/wicket-bootstrap/blob/a64af20bcd65f365dbd487c7480db441fd6b6489/bootstrap-less/src/main/java/de/agilecoders/wicket/less/LessCacheManager.java#L156
> > It uses Less4j's APIs to get all imported resources recursively and
> > extracts the latest modification time.
> >
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Wed, May 18, 2016 at 3:17 PM, Lars Törner  > > wrote:
> >
> > > Thanks, we'll try this!
> > >
> > > Cheers
> > > Lasse
> > >
> > > 2016-05-18 13:21 GMT+02:00 Bas Gooren >:
> > >
> > > > Hi all,
> > > >
> > > > We’ve encountered this issue, too; Simple fix is to touch the less
> > file,
> > > > even when a secondary file was the only change.
> > > >
> > > > The root cause is simple: wicket is not aware of any includes in the
> > less
> > > > file, and as such only looks at the “parent” less file to see if it
> was
> > > > changed. A potential way to fix this is to make it more intelligent,
> > > > assuming the less compiler can expose such details (referenced
> files,
> > > > last-modified time of those files).
> > > >
> > > > Met vriendelijke groet,
> > > > Kind regards,
> > > >
> > > > Bas Gooren
> > > >
> > > > Op 18 mei 2016 bij 13:06:59, Martin Grigorov (mgrigo...@apache.org
> > )
> > > > schreef:
> > > >
> > > > Hi Lasse,
> > > >
> > > > I'll take a look in the coming days!
> > > >
> > > > Martin Grigorov
> > > > Wicket Training and Consulting
> > > > https://twitter.com/mtgrigorov
> > > >
> > > > On Wed, May 18, 2016 at 11:43 AM, Lars Törner  > >
> > > > wrote:
> > > >
> > > > > Hi Martin!
> > > > >
> > > > > We have now implemented this solution and we're using
> bootstrap-less
> > -
> > > > > thanks for that!
> > > > >
> > > > > But we have a little problem...
> > > > > The browser does not recognize when the css has changed, the cause
> > > seems
> > > > to
> > > > > be that the newly generated css is placed in a file with the same
> > name
> > > as
> > > > > before. The name has a hashsum in the name that is generated from
> the
> > > > > less-file and the less file has not changed.
> > > > >
> > > > > What happens is:
> > > > > A less-variable (put in a separate file) gets a new value.
> > > > > This triggers the less compiler to re-generate css
> > > > > The name of the file with generated css has the same name as
> before
> > so
> > > > the
> > > > > browser decides to use its cached version instead.
> > > > >
> > > > > (I'm not the developer of this issue, but hopefully I got it
> > right...)
> > > > >
> > > > > Any suggestions?
> > > > >
> > > > > Cheers
> > > > > Lasse
> > > > >
> > > > >
> > > > >
> > > > > 2016-03-01 13:02 GMT+01:00 Lars Törner  > >:
> > > > >
> > > > > > Thanks for your quick answer Martin! We will look into your
> > > suggestions
> > > > > > and get back to you if we have more questions!
> > > > > >
> > > > > > 2016-03-01 11:49 GMT+01:00 Martin Grigorov  > >:
> > > > > >
> > > > > >> Hi Lasse,
> > > > > >>
> > > > > >> I think the easiest would be to save the generated CSS in
> memory,
> > > e.g.
> > > > > in
> > > > > >> YourApplication.
> > > > > >> Once you receive an update from the other system you should
> just
> > > > delete
> > > > > >> the
> > > > > >> cache (entry). I guess you will have to use read lock when
> serving
> > > the
> > > > > >> response and write lock when 

Re: Generate css from less for package resources at runtime.

2016-05-25 Thread Bas Gooren
Lars, Martin,


Sorry for hijacking this thread (sort of).


Hmmm, I am 100% sure it was not working for us in a web app we currently
have running.

I just checked which version of wicket-bootstrap-less it uses (version
0.9.11), and that version already has the recursive check on the
last-modified time of imported sources.


I’ll try to do some debugging to see if it really is not working, and if
that’s the case: why it’s not working.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 24 mei 2016 bij 20:25:52, Lars Törner (lars.tor...@gmail.com) schreef:

Thanks Martin, I'll take a look at it!

tisdag 24 maj 2016 skrev Martin Grigorov :

> Hi,
>
> I checked the code last night and I believe this use case should be
covered
> by
>
>
https://github.com/l0rdn1kk0n/wicket-bootstrap/blob/a64af20bcd65f365dbd487c7480db441fd6b6489/bootstrap-less/src/main/java/de/agilecoders/wicket/less/LessCacheManager.java#L156
> It uses Less4j's APIs to get all imported resources recursively and
> extracts the latest modification time.
>
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Wed, May 18, 2016 at 3:17 PM, Lars Törner  > wrote:
>
> > Thanks, we'll try this!
> >
> > Cheers
> > Lasse
> >
> > 2016-05-18 13:21 GMT+02:00 Bas Gooren >:
> >
> > > Hi all,
> > >
> > > We’ve encountered this issue, too; Simple fix is to touch the less
> file,
> > > even when a secondary file was the only change.
> > >
> > > The root cause is simple: wicket is not aware of any includes in the
> less
> > > file, and as such only looks at the “parent” less file to see if it
was
> > > changed. A potential way to fix this is to make it more intelligent,
> > > assuming the less compiler can expose such details (referenced files,
> > > last-modified time of those files).
> > >
> > > Met vriendelijke groet,
> > > Kind regards,
> > >
> > > Bas Gooren
> > >
> > > Op 18 mei 2016 bij 13:06:59, Martin Grigorov (mgrigo...@apache.org
> )
> > > schreef:
> > >
> > > Hi Lasse,
> > >
> > > I'll take a look in the coming days!
> > >
> > > Martin Grigorov
> > > Wicket Training and Consulting
> > > https://twitter.com/mtgrigorov
> > >
> > > On Wed, May 18, 2016 at 11:43 AM, Lars Törner  >
> > > wrote:
> > >
> > > > Hi Martin!
> > > >
> > > > We have now implemented this solution and we're using
bootstrap-less
> -
> > > > thanks for that!
> > > >
> > > > But we have a little problem...
> > > > The browser does not recognize when the css has changed, the cause
> > seems
> > > to
> > > > be that the newly generated css is placed in a file with the same
> name
> > as
> > > > before. The name has a hashsum in the name that is generated from
the
> > > > less-file and the less file has not changed.
> > > >
> > > > What happens is:
> > > > A less-variable (put in a separate file) gets a new value.
> > > > This triggers the less compiler to re-generate css
> > > > The name of the file with generated css has the same name as before
> so
> > > the
> > > > browser decides to use its cached version instead.
> > > >
> > > > (I'm not the developer of this issue, but hopefully I got it
> right...)
> > > >
> > > > Any suggestions?
> > > >
> > > > Cheers
> > > > Lasse
> > > >
> > > >
> > > >
> > > > 2016-03-01 13:02 GMT+01:00 Lars Törner  >:
> > > >
> > > > > Thanks for your quick answer Martin! We will look into your
> > suggestions
> > > > > and get back to you if we have more questions!
> > > > >
> > > > > 2016-03-01 11:49 GMT+01:00 Martin Grigorov  >:
> > > > >
> > > > >> Hi Lasse,
> > > > >>
> > > > >> I think the easiest would be to save the generated CSS in
memory,
> > e.g.
> > > > in
> > > > >> YourApplication.
> > > > >> Once you receive an update from the other system you should just
> > > delete
> > > > >> the
> > > > >> cache (entry). I guess you will have to use read lock when
serving
> > the
> > > > >> response and write lock when updating it.
> > > > >> Wicket uses AbstractResource#dataNeedsToBeWritten()
> > > > >> <
> > > > >>
> > > >
> > >
> >
>
https://github.com/apache/wicket/blob/ffa34c6bfbd2ccd8340e23ff1601edd3e0e941d6/wicket-core/src/main/java/org/apache/wicket/request/resource/AbstractResource.java#L433
> > > > >> >
> > > > >> method to decide whether the client/browser has the latest
> version.
> > > I.e.
> > > > >> when the browser makes a request for the CSS you should first
> check
> > > > >> whether
> > > > >> there is a cached entry for this CSS file. If there is no such
> then
> > > > >> generate it, save it in the cache and serve it back. If there is
> > such
> > > > >> cache
> > > > >> entry then let Wicket check its last modification time against
the
> > > > request
> > > > >> header value for 'If-Modified-Since'.
> > > > >>
> > > > >> Additionally you may want to pre-build the CSS resources at

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.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();
>> > 

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>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
> 

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; } };
> >
> >
> >
> >
> >  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
> >