Re: AW: AW: Update ListMultipleChoice by Ajax

2017-01-12 Thread Sven Meier

Hi Christoph,

a https://wicket.apache.org/start/quickstart.html allows us to debug the 
problem.


You've probably got your model usage wrong, that will be hard to analyze 
without seeing more code.


Regards
Sven


On 13.01.2017 08:08, christoph.ma...@t-systems.com wrote:

After refreshing the page I see the same page. Its not a listView it is a 
ListMultipleChoice.

What do you mean with a quickstart.


Mit freundlichen Grüßen
Christoph Manig

-Ursprüngliche Nachricht-
Von: Sven Meier [mailto:s...@meiers.net]
Gesendet: Donnerstag, 12. Januar 2017 22:51
An: users@wicket.apache.org
Betreff: Re: AW: Update ListMultipleChoice by Ajax

Hm, with CompoundPropertyModel all inherited models after dropped on detach and 
re-acquired on following access.

So in theory that should work.

What happens if you refresh the page (F5) after clicking the Ajax link?
Does the new data show up in the listView and passwordField?

Could you build a quickstart for a deeper look?

Regards
Sven



On 12.01.2017 15:35, christoph.ma...@t-systems.com wrote:

They are member of a form and this has a CompoundPropertyModel.

setDefaultModel(new CompoundPropertyModel(new
UserModel()));

And this holds all data which are relevant for user. The other components of 
the form show the data of the user which I set as the default model.

Mit freundlichen Grüßen
Christoph Manig

-Ursprüngliche Nachricht-
Von: Sven Meier [mailto:s...@meiers.net]
Gesendet: Donnerstag, 12. Januar 2017 14:20
An: users@wicket.apache.org
Betreff: Re: Update ListMultipleChoice by Ajax

Hi,

your components probably hold a reference to the former model.

Where do 'groups' and 'password' get their model from?

Have fun
Sven


On 12.01.2017 12:37, christoph.ma...@t-systems.com wrote:

Hello,

I have a form which contains a ListMultipleChoice and a PasswordTextField.

ListMultipleChoice groups = new ListMultipleChoice<>("groups",
groupDao.getAllGroups(), new ChoiceRenderer("groupname"));


PasswordTextField password = new RequiredPasswordField("password");


After clicking an AjaxLink I set a user object to the default model of the 
form. Then the form will be rendered and I see all data of the user in the 
fields of the form.

But the ListMultipleChoice and the PasswordTextField are not updated. But the 
user object contains the data for the ListMultipleChoice and the 
PasswordTextField.
Can anyone help please.


Mit freundlichen Grüßen
Christoph Manig




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


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



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


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




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



AW: AW: Update ListMultipleChoice by Ajax

2017-01-12 Thread Christoph.Manig
After refreshing the page I see the same page. Its not a listView it is a 
ListMultipleChoice. 

What do you mean with a quickstart.


Mit freundlichen Grüßen
Christoph Manig

-Ursprüngliche Nachricht-
Von: Sven Meier [mailto:s...@meiers.net] 
Gesendet: Donnerstag, 12. Januar 2017 22:51
An: users@wicket.apache.org
Betreff: Re: AW: Update ListMultipleChoice by Ajax

Hm, with CompoundPropertyModel all inherited models after dropped on detach and 
re-acquired on following access.

So in theory that should work.

What happens if you refresh the page (F5) after clicking the Ajax link? 
Does the new data show up in the listView and passwordField?

Could you build a quickstart for a deeper look?

Regards
Sven



On 12.01.2017 15:35, christoph.ma...@t-systems.com wrote:
> They are member of a form and this has a CompoundPropertyModel.
>
> setDefaultModel(new CompoundPropertyModel(new 
> UserModel()));
>
> And this holds all data which are relevant for user. The other components of 
> the form show the data of the user which I set as the default model.
>
> Mit freundlichen Grüßen
> Christoph Manig
>
> -Ursprüngliche Nachricht-
> Von: Sven Meier [mailto:s...@meiers.net]
> Gesendet: Donnerstag, 12. Januar 2017 14:20
> An: users@wicket.apache.org
> Betreff: Re: Update ListMultipleChoice by Ajax
>
> Hi,
>
> your components probably hold a reference to the former model.
>
> Where do 'groups' and 'password' get their model from?
>
> Have fun
> Sven
>
>
> On 12.01.2017 12:37, christoph.ma...@t-systems.com wrote:
>> Hello,
>>
>> I have a form which contains a ListMultipleChoice and a PasswordTextField.
>>
>> ListMultipleChoice groups = new ListMultipleChoice<>("groups", 
>> groupDao.getAllGroups(), new ChoiceRenderer("groupname"));
>> 
>>
>> PasswordTextField password = new RequiredPasswordField("password");
>> 
>>
>> After clicking an AjaxLink I set a user object to the default model of the 
>> form. Then the form will be rendered and I see all data of the user in the 
>> fields of the form.
>>
>> But the ListMultipleChoice and the PasswordTextField are not updated. But 
>> the user object contains the data for the ListMultipleChoice and the 
>> PasswordTextField.
>> Can anyone help please.
>>
>>
>> Mit freundlichen Grüßen
>> Christoph Manig
>>
>>
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>


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


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



Re: Cannot modify component hierarchy after render phase has started

2017-01-12 Thread Dirk Forchel
Hi Sven,
could it be that this belongs to
https://issues.apache.org/jira/browse/WICKET-6303? I'm not sure, but after
migrating to Wicket 7.5.0 we've got several errors belonging to this issue.
I'll try to provide a quickstart though.
Thanks,
  Dirk

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Cannot-modify-component-hierarchy-after-render-phase-has-started-tp4676711p4676728.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



Re: AW: Update ListMultipleChoice by Ajax

2017-01-12 Thread Sven Meier
Hm, with CompoundPropertyModel all inherited models after dropped on 
detach and re-acquired on following access.


So in theory that should work.

What happens if you refresh the page (F5) after clicking the Ajax link? 
Does the new data show up in the listView and passwordField?


Could you build a quickstart for a deeper look?

Regards
Sven



On 12.01.2017 15:35, christoph.ma...@t-systems.com wrote:

They are member of a form and this has a CompoundPropertyModel.

setDefaultModel(new CompoundPropertyModel(new UserModel()));

And this holds all data which are relevant for user. The other components of 
the form show the data of the user which I set as the default model.

Mit freundlichen Grüßen
Christoph Manig

-Ursprüngliche Nachricht-
Von: Sven Meier [mailto:s...@meiers.net]
Gesendet: Donnerstag, 12. Januar 2017 14:20
An: users@wicket.apache.org
Betreff: Re: Update ListMultipleChoice by Ajax

Hi,

your components probably hold a reference to the former model.

Where do 'groups' and 'password' get their model from?

Have fun
Sven


On 12.01.2017 12:37, christoph.ma...@t-systems.com wrote:

Hello,

I have a form which contains a ListMultipleChoice and a PasswordTextField.

ListMultipleChoice groups = new ListMultipleChoice<>("groups", groupDao.getAllGroups(), 
new ChoiceRenderer("groupname"));


PasswordTextField password = new RequiredPasswordField("password");


After clicking an AjaxLink I set a user object to the default model of the 
form. Then the form will be rendered and I see all data of the user in the 
fields of the form.

But the ListMultipleChoice and the PasswordTextField are not updated. But the 
user object contains the data for the ListMultipleChoice and the 
PasswordTextField.
Can anyone help please.


Mit freundlichen Grüßen
Christoph Manig





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


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




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



Re: Re-create bookmarkable pages on Ajax calls

2017-01-12 Thread Thomas Heigl
Alternatively, if this does not make any sense or is not possible at all,
would it be an option to approach this from the opposite direction, i.e.
make the pages really stateless, but still store them in the application
level cache so they don't have to be fully re-created for every Ajax call?

On Thu, Jan 12, 2017 at 6:48 PM, Thomas Heigl  wrote:

> Hi Martin,
>
> Yes, I tried that, but what happens is this:
>
> When a user clicks on the an an Ajax link on a page that is not in the
> application cache, the whole page gets refreshed and nothing else happens.
> This is due to the following code in ListenerInterfaceRequestHandler:
>
> if (!canCallListenerInterfaceAfterExpiry && freshPage &&
>> (pageComponentProvider.getPageId() != null || component == null))
>> {
>> // A listener interface is invoked on an expired page.
>> // If the page is stateful then we cannot assume that the listener
>> interface is
>> // invoked on its initial state (right after page initialization) and
>> that its
>> // component and/or behavior will be available. That's why the
>> listener interface
>> // should be ignored and the best we can do is to re-paint the newly
>> constructed
>> // page.
>> if (isAjax)
>> {
>> policy = RedirectPolicy.ALWAYS_REDIRECT;
>> }
>> requestCycle.scheduleRequestHandlerAfterCurrent(new
>> RenderPageRequestHandler(
>> pageProvider, policy));
>> return;
>> }
>
>
> What I would like to do is mark some of my pages as "semi-stateless" (i.e.
> all state can be inferred from the URL), use fixed markup IDs for
> components with Ajax listeners, and let the listener be invoked anyway. I
> know that this is not the way Wicket is meant to be used, but it would
> allow me to massively reduce the memory footprint and simplify session
> distribution. My sessions are only around 1.5kb without the PageMap.
>
> I'd like to give this a try, but Page.isPageStateless() is final and I do
> not see a way to hook into this.
>
> Do you have any suggestions?
>
> Best regards,
>
> Thomas
>
> On Thu, Jan 12, 2017 at 12:43 PM, Martin Grigorov 
> wrote:
>
>> Hi,
>>
>> You can setup a no-op IPageStore.
>> This way there won't be a call to ISerializer#serialize(Object) at all.
>>
>> Martin Grigorov
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>>
>> On Thu, Jan 12, 2017 at 11:53 AM, Thomas Heigl 
>> wrote:
>>
>> > I forgot to add:
>> >
>> > We are using the HTML5 History API to push state to the (bookmarkable)
>> URL,
>> > so a page can be re-created with *all* state from the URL alone.
>> >
>> > Thomas
>> >
>> > On Thu, Jan 12, 2017 at 11:47 AM, Thomas Heigl 
>> > wrote:
>> >
>> > > Hi all,
>> > >
>> > > I'm looking for a solution to avoid serialization of bookmarkable
>> pages.
>> > >
>> > > These are yesterday's metrics from an instrumented version of
>> > Fast2WicketSerializer:
>> > >
>> > > "WicketSerializer.deserialize" : {
>> > >>   "count" : 4084,
>> > >>   "max" : 0.0308421623,
>> > >>   "mean" : 0.005861568417930906,
>> > >>   "min" : 0.00144874502,
>> > >>   "mean_rate" : 0.01926885221303454,
>> > >>   "duration_units" : "seconds",
>> > >>   "rate_units" : "calls/second"
>> > >> },
>> > >> "WicketSerializer.serialize" : {
>> > >>   "count" : 498884,
>> > >>   "max" : 0.007742393,
>> > >>   "mean" : 0.002135383760700826,
>> > >>   "min" : 8.2115001E-4,
>> > >>   "mean_rate" : 2.3538006959615907,
>> > >>   "duration_units" : "seconds",
>> > >>   "rate_units" : "calls/second"
>> > >> }
>> > >
>> > >
>> > > As you can see, Wicket serialized about 500.000 pages, but only 4000
>> > were ever
>> > > de-serialized. The deserialization is caused by users who use multiple
>> > tabs and
>> > > then trigger an ajax action on one of them.
>> > >
>> > > All my pages are unversioned, bookmarkable and mounted in a way that
>> > strips
>> > > version parameters from the URL.
>> > >
>> > > What I would like to do is completely disable HttpSessionDataStore,
>> rely
>> > only
>> > > on the application level cache that (from looking at the metrics is
>> > sufficient
>> > > in the vast majority of cases) and recreate the bookmarkable page for
>> the
>> > > remaining cases instead of de-serializing a stored version.
>> > >
>> > > I know this is possible with stateless pages, but my application is
>> very
>> > large
>> > > and converting it all to stateless would require a massive effort.
>> > >
>> > > Is there a way to implement this with Wicket 7.6?
>> > >
>> > > I'm aware of the flags "setRecreateBookmarkablePagesAfterExpiry" and
>> "
>> > setCallListenerInterfaceAfterExpiry"
>> > > but I'm not sure they apply to bookmarkable pages and Ajax calls.
>> > >
>> > > Any ideas would be greatly appreciated!
>> > >
>> > >
>> > > Best regards,
>> > >
>> > > Thomas
>> > >
>> > >
>> >
>>
>
>


Re: Re-create bookmarkable pages on Ajax calls

2017-01-12 Thread Thomas Heigl
Hi Martin,

Yes, I tried that, but what happens is this:

When a user clicks on the an an Ajax link on a page that is not in the
application cache, the whole page gets refreshed and nothing else happens.
This is due to the following code in ListenerInterfaceRequestHandler:

if (!canCallListenerInterfaceAfterExpiry && freshPage &&
> (pageComponentProvider.getPageId() != null || component == null))
> {
> // A listener interface is invoked on an expired page.
> // If the page is stateful then we cannot assume that the listener
> interface is
> // invoked on its initial state (right after page initialization) and
> that its
> // component and/or behavior will be available. That's why the
> listener interface
> // should be ignored and the best we can do is to re-paint the newly
> constructed
> // page.
> if (isAjax)
> {
> policy = RedirectPolicy.ALWAYS_REDIRECT;
> }
> requestCycle.scheduleRequestHandlerAfterCurrent(new
> RenderPageRequestHandler(
> pageProvider, policy));
> return;
> }


What I would like to do is mark some of my pages as "semi-stateless" (i.e.
all state can be inferred from the URL), use fixed markup IDs for
components with Ajax listeners, and let the listener be invoked anyway. I
know that this is not the way Wicket is meant to be used, but it would
allow me to massively reduce the memory footprint and simplify session
distribution. My sessions are only around 1.5kb without the PageMap.

I'd like to give this a try, but Page.isPageStateless() is final and I do
not see a way to hook into this.

Do you have any suggestions?

Best regards,

Thomas

On Thu, Jan 12, 2017 at 12:43 PM, Martin Grigorov 
wrote:

> Hi,
>
> You can setup a no-op IPageStore.
> This way there won't be a call to ISerializer#serialize(Object) at all.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Thu, Jan 12, 2017 at 11:53 AM, Thomas Heigl 
> wrote:
>
> > I forgot to add:
> >
> > We are using the HTML5 History API to push state to the (bookmarkable)
> URL,
> > so a page can be re-created with *all* state from the URL alone.
> >
> > Thomas
> >
> > On Thu, Jan 12, 2017 at 11:47 AM, Thomas Heigl 
> > wrote:
> >
> > > Hi all,
> > >
> > > I'm looking for a solution to avoid serialization of bookmarkable
> pages.
> > >
> > > These are yesterday's metrics from an instrumented version of
> > Fast2WicketSerializer:
> > >
> > > "WicketSerializer.deserialize" : {
> > >>   "count" : 4084,
> > >>   "max" : 0.0308421623,
> > >>   "mean" : 0.005861568417930906,
> > >>   "min" : 0.00144874502,
> > >>   "mean_rate" : 0.01926885221303454,
> > >>   "duration_units" : "seconds",
> > >>   "rate_units" : "calls/second"
> > >> },
> > >> "WicketSerializer.serialize" : {
> > >>   "count" : 498884,
> > >>   "max" : 0.007742393,
> > >>   "mean" : 0.002135383760700826,
> > >>   "min" : 8.2115001E-4,
> > >>   "mean_rate" : 2.3538006959615907,
> > >>   "duration_units" : "seconds",
> > >>   "rate_units" : "calls/second"
> > >> }
> > >
> > >
> > > As you can see, Wicket serialized about 500.000 pages, but only 4000
> > were ever
> > > de-serialized. The deserialization is caused by users who use multiple
> > tabs and
> > > then trigger an ajax action on one of them.
> > >
> > > All my pages are unversioned, bookmarkable and mounted in a way that
> > strips
> > > version parameters from the URL.
> > >
> > > What I would like to do is completely disable HttpSessionDataStore,
> rely
> > only
> > > on the application level cache that (from looking at the metrics is
> > sufficient
> > > in the vast majority of cases) and recreate the bookmarkable page for
> the
> > > remaining cases instead of de-serializing a stored version.
> > >
> > > I know this is possible with stateless pages, but my application is
> very
> > large
> > > and converting it all to stateless would require a massive effort.
> > >
> > > Is there a way to implement this with Wicket 7.6?
> > >
> > > I'm aware of the flags "setRecreateBookmarkablePagesAfterExpiry" and "
> > setCallListenerInterfaceAfterExpiry"
> > > but I'm not sure they apply to bookmarkable pages and Ajax calls.
> > >
> > > Any ideas would be greatly appreciated!
> > >
> > >
> > > Best regards,
> > >
> > > Thomas
> > >
> > >
> >
>


AW: Update ListMultipleChoice by Ajax

2017-01-12 Thread Christoph.Manig
They are member of a form and this has a CompoundPropertyModel.

setDefaultModel(new CompoundPropertyModel(new UserModel()));

And this holds all data which are relevant for user. The other components of 
the form show the data of the user which I set as the default model. 

Mit freundlichen Grüßen
Christoph Manig

-Ursprüngliche Nachricht-
Von: Sven Meier [mailto:s...@meiers.net] 
Gesendet: Donnerstag, 12. Januar 2017 14:20
An: users@wicket.apache.org
Betreff: Re: Update ListMultipleChoice by Ajax

Hi,

your components probably hold a reference to the former model.

Where do 'groups' and 'password' get their model from?

Have fun
Sven


On 12.01.2017 12:37, christoph.ma...@t-systems.com wrote:
> Hello,
>
> I have a form which contains a ListMultipleChoice and a PasswordTextField.
>
> ListMultipleChoice groups = new ListMultipleChoice<>("groups", 
> groupDao.getAllGroups(), new ChoiceRenderer("groupname"));
> 
>
> PasswordTextField password = new RequiredPasswordField("password");
> 
>
> After clicking an AjaxLink I set a user object to the default model of the 
> form. Then the form will be rendered and I see all data of the user in the 
> fields of the form.
>
> But the ListMultipleChoice and the PasswordTextField are not updated. But the 
> user object contains the data for the ListMultipleChoice and the 
> PasswordTextField.
> Can anyone help please.
>
>
> Mit freundlichen Grüßen
> Christoph Manig
>
>
>


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


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



Re: Cannot modify component hierarchy after render phase has started

2017-01-12 Thread Sven Meier

Hi,

a quick lock on a 7.4-7.5 diff didn't reveal any change that has 
something to do with checking the hierarchy.


Could you provide a quickstart, so I can find the difference?

Sven


On 12.01.2017 08:56, Dirk Forchel wrote:

Hi,
I would like to know why we shouldn't change the model object within the
configure phase for Wicket components. We're running our application with
Wicket 7.4 and all works as expected. After migrating to Wicket 7.5 we get
the following exception for different pages, mainly due to modifying the
model object. Could someone explain why this is a bad thing to do?

org.apache.wicket.WicketRuntimeException: Cannot modify component hierarchy
after render phase has started (page version cant change then anymore)
  at
org.apache.wicket.Component.checkHierarchyChange(Component.java:3662)
  at org.apache.wicket.Page.dirty(Page.java:271)
  at org.apache.wicket.markup.html.WebPage.dirty(WebPage.java:332)
  at org.apache.wicket.Page.dirty(Page.java:250)
  at org.apache.wicket.Page.componentModelChanging(Page.java:904)
  at org.apache.wicket.Component.modelChanging(Component.java:2218)
  at
org.apache.wicket.Component.setDefaultModelObject(Component.java:3121)
  at
org.apache.wicket.markup.html.form.FormComponent.setModelObject(FormComponent.java:1579)
  at
com.mycompany.wicket.components.TestPanel.onConfigure(TestPanel.java:111)

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Cannot-modify-component-hierarchy-after-render-phase-has-started-tp4676711.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




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



Re: Update ListMultipleChoice by Ajax

2017-01-12 Thread Sven Meier

Hi,

your components probably hold a reference to the former model.

Where do 'groups' and 'password' get their model from?

Have fun
Sven


On 12.01.2017 12:37, christoph.ma...@t-systems.com wrote:

Hello,

I have a form which contains a ListMultipleChoice and a PasswordTextField.

ListMultipleChoice groups = new ListMultipleChoice<>("groups", groupDao.getAllGroups(), 
new ChoiceRenderer("groupname"));


PasswordTextField password = new RequiredPasswordField("password");


After clicking an AjaxLink I set a user object to the default model of the 
form. Then the form will be rendered and I see all data of the user in the 
fields of the form.

But the ListMultipleChoice and the PasswordTextField are not updated. But the 
user object contains the data for the ListMultipleChoice and the 
PasswordTextField.
Can anyone help please.


Mit freundlichen Grüßen
Christoph Manig






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



Re: Re-create bookmarkable pages on Ajax calls

2017-01-12 Thread Martin Grigorov
Hi,

You can setup a no-op IPageStore.
This way there won't be a call to ISerializer#serialize(Object) at all.

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

On Thu, Jan 12, 2017 at 11:53 AM, Thomas Heigl  wrote:

> I forgot to add:
>
> We are using the HTML5 History API to push state to the (bookmarkable) URL,
> so a page can be re-created with *all* state from the URL alone.
>
> Thomas
>
> On Thu, Jan 12, 2017 at 11:47 AM, Thomas Heigl 
> wrote:
>
> > Hi all,
> >
> > I'm looking for a solution to avoid serialization of bookmarkable pages.
> >
> > These are yesterday's metrics from an instrumented version of
> Fast2WicketSerializer:
> >
> > "WicketSerializer.deserialize" : {
> >>   "count" : 4084,
> >>   "max" : 0.0308421623,
> >>   "mean" : 0.005861568417930906,
> >>   "min" : 0.00144874502,
> >>   "mean_rate" : 0.01926885221303454,
> >>   "duration_units" : "seconds",
> >>   "rate_units" : "calls/second"
> >> },
> >> "WicketSerializer.serialize" : {
> >>   "count" : 498884,
> >>   "max" : 0.007742393,
> >>   "mean" : 0.002135383760700826,
> >>   "min" : 8.2115001E-4,
> >>   "mean_rate" : 2.3538006959615907,
> >>   "duration_units" : "seconds",
> >>   "rate_units" : "calls/second"
> >> }
> >
> >
> > As you can see, Wicket serialized about 500.000 pages, but only 4000
> were ever
> > de-serialized. The deserialization is caused by users who use multiple
> tabs and
> > then trigger an ajax action on one of them.
> >
> > All my pages are unversioned, bookmarkable and mounted in a way that
> strips
> > version parameters from the URL.
> >
> > What I would like to do is completely disable HttpSessionDataStore, rely
> only
> > on the application level cache that (from looking at the metrics is
> sufficient
> > in the vast majority of cases) and recreate the bookmarkable page for the
> > remaining cases instead of de-serializing a stored version.
> >
> > I know this is possible with stateless pages, but my application is very
> large
> > and converting it all to stateless would require a massive effort.
> >
> > Is there a way to implement this with Wicket 7.6?
> >
> > I'm aware of the flags "setRecreateBookmarkablePagesAfterExpiry" and "
> setCallListenerInterfaceAfterExpiry"
> > but I'm not sure they apply to bookmarkable pages and Ajax calls.
> >
> > Any ideas would be greatly appreciated!
> >
> >
> > Best regards,
> >
> > Thomas
> >
> >
>


Update ListMultipleChoice by Ajax

2017-01-12 Thread Christoph.Manig
Hello,

I have a form which contains a ListMultipleChoice and a PasswordTextField.

ListMultipleChoice groups = new ListMultipleChoice<>("groups", 
groupDao.getAllGroups(), new ChoiceRenderer("groupname"));


PasswordTextField password = new RequiredPasswordField("password");


After clicking an AjaxLink I set a user object to the default model of the 
form. Then the form will be rendered and I see all data of the user in the 
fields of the form.

But the ListMultipleChoice and the PasswordTextField are not updated. But the 
user object contains the data for the ListMultipleChoice and the 
PasswordTextField.
Can anyone help please.


Mit freundlichen Grüßen
Christoph Manig




Re: Re-create bookmarkable pages on Ajax calls

2017-01-12 Thread Thomas Heigl
I forgot to add:

We are using the HTML5 History API to push state to the (bookmarkable) URL,
so a page can be re-created with *all* state from the URL alone.

Thomas

On Thu, Jan 12, 2017 at 11:47 AM, Thomas Heigl  wrote:

> Hi all,
>
> I'm looking for a solution to avoid serialization of bookmarkable pages.
>
> These are yesterday's metrics from an instrumented version of 
> Fast2WicketSerializer:
>
> "WicketSerializer.deserialize" : {
>>   "count" : 4084,
>>   "max" : 0.0308421623,
>>   "mean" : 0.005861568417930906,
>>   "min" : 0.00144874502,
>>   "mean_rate" : 0.01926885221303454,
>>   "duration_units" : "seconds",
>>   "rate_units" : "calls/second"
>> },
>> "WicketSerializer.serialize" : {
>>   "count" : 498884,
>>   "max" : 0.007742393,
>>   "mean" : 0.002135383760700826,
>>   "min" : 8.2115001E-4,
>>   "mean_rate" : 2.3538006959615907,
>>   "duration_units" : "seconds",
>>   "rate_units" : "calls/second"
>> }
>
>
> As you can see, Wicket serialized about 500.000 pages, but only 4000 were ever
> de-serialized. The deserialization is caused by users who use multiple tabs 
> and
> then trigger an ajax action on one of them.
>
> All my pages are unversioned, bookmarkable and mounted in a way that strips
> version parameters from the URL.
>
> What I would like to do is completely disable HttpSessionDataStore, rely only
> on the application level cache that (from looking at the metrics is sufficient
> in the vast majority of cases) and recreate the bookmarkable page for the
> remaining cases instead of de-serializing a stored version.
>
> I know this is possible with stateless pages, but my application is very large
> and converting it all to stateless would require a massive effort.
>
> Is there a way to implement this with Wicket 7.6?
>
> I'm aware of the flags "setRecreateBookmarkablePagesAfterExpiry" and 
> "setCallListenerInterfaceAfterExpiry"
> but I'm not sure they apply to bookmarkable pages and Ajax calls.
>
> Any ideas would be greatly appreciated!
>
>
> Best regards,
>
> Thomas
>
>


Re-create bookmarkable pages on Ajax calls

2017-01-12 Thread Thomas Heigl
Hi all,

I'm looking for a solution to avoid serialization of bookmarkable pages.

These are yesterday's metrics from an instrumented version of
Fast2WicketSerializer:

"WicketSerializer.deserialize" : {
>   "count" : 4084,
>   "max" : 0.0308421623,
>   "mean" : 0.005861568417930906,
>   "min" : 0.00144874502,
>   "mean_rate" : 0.01926885221303454,
>   "duration_units" : "seconds",
>   "rate_units" : "calls/second"
> },
> "WicketSerializer.serialize" : {
>   "count" : 498884,
>   "max" : 0.007742393,
>   "mean" : 0.002135383760700826,
>   "min" : 8.2115001E-4,
>   "mean_rate" : 2.3538006959615907,
>   "duration_units" : "seconds",
>   "rate_units" : "calls/second"
> }


As you can see, Wicket serialized about 500.000 pages, but only 4000 were ever
de-serialized. The deserialization is caused by users who use multiple tabs and
then trigger an ajax action on one of them.

All my pages are unversioned, bookmarkable and mounted in a way that strips
version parameters from the URL.

What I would like to do is completely disable HttpSessionDataStore, rely only
on the application level cache that (from looking at the metrics is sufficient
in the vast majority of cases) and recreate the bookmarkable page for the
remaining cases instead of de-serializing a stored version.

I know this is possible with stateless pages, but my application is very large
and converting it all to stateless would require a massive effort.

Is there a way to implement this with Wicket 7.6?

I'm aware of the flags "setRecreateBookmarkablePagesAfterExpiry" and
"setCallListenerInterfaceAfterExpiry"
but I'm not sure they apply to bookmarkable pages and Ajax calls.

Any ideas would be greatly appreciated!


Best regards,

Thomas


Re: Cannot mock final SortableDataProvider.getSortState

2017-01-12 Thread Bas Gooren
Eric,


All of our data providers use an external source to load the actual data,
e.g. a repository or dao.

As all of our repositories and daos are interfaces, those are easy to mock.


Testing the provider is then simply a matter of ensuring the right methods,
with the right parameters are called on the mocked objects.


What functionality in your (custom) data providers do you have that you
want to test? In general I would say that final methods in a known and
tested library (wicket) do not need to be tested anyway - that is the
responsibility of the library.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 12 januari 2017 bij 10:23:12, Eric J. Van der Velden (
ericjvandervel...@gmail.com) schreef:

Hello,

SortableDataProvider, in
package org.apache.wicket.extensions.markup.html.repeater.util, has a final
method getSortState().

I cannot mock this method.

I have copied SortableDataProvider under a different name, and subclassed
this one,but I do not like this.

The same happens with final LoadableDetachableModel.getObject(), but in
this case I could mock LoadableDetachableModel.load().

So why are these methods final, and how do programmers test the provider?

Thank you!


Cannot mock final SortableDataProvider.getSortState

2017-01-12 Thread Eric J. Van der Velden
Hello,

SortableDataProvider, in
package org.apache.wicket.extensions.markup.html.repeater.util, has a final
method getSortState().

I cannot mock this method.

I have copied SortableDataProvider under a different name, and subclassed
this one,but I do not like this.

The same happens with final LoadableDetachableModel.getObject(), but in
this case I could mock LoadableDetachableModel.load().

So why are these methods final, and how do programmers test the provider?

Thank you!


Re: DropDownChoice models

2017-01-12 Thread Zbynek Vavros
Hi,

sry got to this just now. You are correct sir! Thanks!

Zbynek

On Wed, Jan 11, 2017 at 1:47 PM, Sven Meier  wrote:

> Hi,
>
> Im not sure I got this right but seems to me you still have to call
>> "User.findOne(id)" for each user
>>
>
> actually not, findOne() is called for the currently selected user only -
> that's the advantage.
>
> Regards
> Sven
>
>
> On 11.01.2017 13:16, Zbynek Vavros wrote:
>
>> Hi,
>>
>> Im not sure I got this right but seems to me you still have to call
>> "User.findOne(id)" for each user
>> that touches DB (big nope) or create a Map that doesn't sound
>> great either.
>>
>> Seems to me the best way is to fetch all users from DB and in
>> ChoiceRenderer just
>> iterate and get the correct one by ID...
>>
>> Zbynek
>>
>> On Wed, Jan 11, 2017 at 1:01 PM, Sven Meier  wrote:
>>
>> Hi,
>>>
>>> as an alternative you can use a custom model instead:
>>>
>>>  IModel target = ...;
>>>
>>>  IModel userModel = new IModel() {
>>>  public void setObject(User user) {
>>>  target.set(user.getId());
>>>  }
>>>  public User getObject() {
>>>  return User.findOne(target.get());
>>>  }
>>>  }
>>>
>>> Then your choice can just work on a user:
>>>
>>>  DropDownChoice usersDropDown = new DropDownChoice<>("userId",
>>> userModel, User.getUsers());
>>>
>>> Both approaches have advantages and disadvantages.
>>>
>>> Have fun
>>> Sven
>>>
>>>
>>>
>>> On 11.01.2017 11:38, Zbynek Vavros wrote:
>>>
>>> Hey,

 I have a DropDownChoice for list of users. I want to display user's name
 but bind user's ID.
 So far I have come to this (ugly) solution that can surely be improved:

 // create model with Long userId...
 final DropDownChoice usersDropDown = new DropDownChoice<>(
   "userId", Lists.transform(User.getUsers(), new
 Function() {
   @Nullable
   @Override
   public Long apply(@Nullable final User user) {
   return user.getId();
   }
   }),
   new ChoiceRenderer() {
   @Override
   public Object getDisplayValue(final Long id) {
   return User.findOne(id);
   }
   }
   );

 Thanks for any pointers.
 Zbynek


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