You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by eostermueller <eo...@gmail.com> on 2015/09/20 21:48:44 UTC
AjaxSelfUpdatingTimerBehavior breaks browser refresh
Hello all,
I just created a wicket quickstart here:
https://github.com/eostermueller/selfUpdating
I added a AjaxSelfUpdatingTimerBehavior that kind of breaks the browser
refresh.
The details are on the README.md.
I found a number of similar issues on the forum but none quite match this.
Thanks,
--Erik
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxSelfUpdatingTimerBehavior-breaks-browser-refresh-tp4671997.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: AjaxSelfUpdatingTimerBehavior breaks browser refresh
Posted by Sven Meier <sv...@meiers.net>.
Hi Erik,
>Is that ever a valid combo, to have a stateful page and a raw value
for a model?
access to a value without model indirection is discouraged in Wicket.
The Label constructor with a raw value exists just for convenience - and
to shoot yourself in the foot :P
Have fun
Sven
On 21.09.2015 13:20, eostermueller wrote:
> That fixed it, thanks Sven.
> I updated to github repo with your fix.
>
> Is that ever a valid combo, to have a stateful page and a raw value for a
> model?
> Thanks again for the help,
> --Erik
>
> On Sun, Sep 20, 2015 at 3:44 PM, Sven Meier [via Apache Wicket] <
> ml-node+s1842946n4671998h9@n4.nabble.com> wrote:
>
>> Hi,
>>
>> the AjaxSelfUpdatingBehavior makes the page stateful - without it the
>> refresh will serve a new page instance with an up-to-date counter.
>>
>> To make this work for a stateful page, you should use a model that
>> provides the current counter to the label:
>>
>> add(new Label("myCounter", new AbstractReadOnlyModel<Integer>() {
>> @Override
>> public Integer getObject()
>> {
>> Object o = getApplication();
>> if (o instanceof WicketApplication) {
>> WicketApplication w = (WicketApplication)o;
>> return w.getCounter().get();
>> }
>> return null;
>> }
>> }));
>>
>> Have fun
>> Sven
>>
>> On 20.09.2015 21:48, eostermueller wrote:
>>
>>> Hello all,
>>>
>>> I just created a wicket quickstart here:
>>>
>>> https://github.com/eostermueller/selfUpdating
>>>
>>> I added a AjaxSelfUpdatingTimerBehavior that kind of breaks the browser
>>> refresh.
>>> The details are on the README.md.
>>>
>>> I found a number of similar issues on the forum but none quite match
>> this.
>>> Thanks,
>>> --Erik
>>>
>>>
>>> --
>>> View this message in context:
>> http://apache-wicket.1842946.n4.nabble.com/AjaxSelfUpdatingTimerBehavior-breaks-browser-refresh-tp4671997.html
>>> Sent from the Users forum mailing list archive at Nabble.com.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]
>> <http:///user/SendEmail.jtp?type=node&node=4671998&i=0>
>>> For additional commands, e-mail: [hidden email]
>> <http:///user/SendEmail.jtp?type=node&node=4671998&i=1>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> <http:///user/SendEmail.jtp?type=node&node=4671998&i=2>
>> For additional commands, e-mail: [hidden email]
>> <http:///user/SendEmail.jtp?type=node&node=4671998&i=3>
>>
>>
>>
>> ------------------------------
>> If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://apache-wicket.1842946.n4.nabble.com/AjaxSelfUpdatingTimerBehavior-breaks-browser-refresh-tp4671997p4671998.html
>> To unsubscribe from AjaxSelfUpdatingTimerBehavior breaks browser refresh, click
>> here
>> <http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4671997&code=ZW9zdGVybXVlbGxlckBnbWFpbC5jb218NDY3MTk5N3wtNTA0MjE0ODU1>
>> .
>> NAML
>> <http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxSelfUpdatingTimerBehavior-breaks-browser-refresh-tp4671997p4672004.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: AjaxSelfUpdatingTimerBehavior breaks browser refresh
Posted by eostermueller <eo...@gmail.com>.
That fixed it, thanks Sven.
I updated to github repo with your fix.
Is that ever a valid combo, to have a stateful page and a raw value for a
model?
Thanks again for the help,
--Erik
On Sun, Sep 20, 2015 at 3:44 PM, Sven Meier [via Apache Wicket] <
ml-node+s1842946n4671998h9@n4.nabble.com> wrote:
> Hi,
>
> the AjaxSelfUpdatingBehavior makes the page stateful - without it the
> refresh will serve a new page instance with an up-to-date counter.
>
> To make this work for a stateful page, you should use a model that
> provides the current counter to the label:
>
> add(new Label("myCounter", new AbstractReadOnlyModel<Integer>() {
> @Override
> public Integer getObject()
> {
> Object o = getApplication();
> if (o instanceof WicketApplication) {
> WicketApplication w = (WicketApplication)o;
> return w.getCounter().get();
> }
> return null;
> }
> }));
>
> Have fun
> Sven
>
> On 20.09.2015 21:48, eostermueller wrote:
>
> > Hello all,
> >
> > I just created a wicket quickstart here:
> >
> > https://github.com/eostermueller/selfUpdating
> >
> > I added a AjaxSelfUpdatingTimerBehavior that kind of breaks the browser
> > refresh.
> > The details are on the README.md.
> >
> > I found a number of similar issues on the forum but none quite match
> this.
> >
> > Thanks,
> > --Erik
> >
> >
> > --
> > View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/AjaxSelfUpdatingTimerBehavior-breaks-browser-refresh-tp4671997.html
> > Sent from the Users forum mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> <http:///user/SendEmail.jtp?type=node&node=4671998&i=0>
> > For additional commands, e-mail: [hidden email]
> <http:///user/SendEmail.jtp?type=node&node=4671998&i=1>
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> <http:///user/SendEmail.jtp?type=node&node=4671998&i=2>
> For additional commands, e-mail: [hidden email]
> <http:///user/SendEmail.jtp?type=node&node=4671998&i=3>
>
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://apache-wicket.1842946.n4.nabble.com/AjaxSelfUpdatingTimerBehavior-breaks-browser-refresh-tp4671997p4671998.html
> To unsubscribe from AjaxSelfUpdatingTimerBehavior breaks browser refresh, click
> here
> <http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4671997&code=ZW9zdGVybXVlbGxlckBnbWFpbC5jb218NDY3MTk5N3wtNTA0MjE0ODU1>
> .
> NAML
> <http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxSelfUpdatingTimerBehavior-breaks-browser-refresh-tp4671997p4672004.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: AjaxSelfUpdatingTimerBehavior breaks browser refresh
Posted by Sven Meier <sv...@meiers.net>.
Hi,
the AjaxSelfUpdatingBehavior makes the page stateful - without it the
refresh will serve a new page instance with an up-to-date counter.
To make this work for a stateful page, you should use a model that
provides the current counter to the label:
add(new Label("myCounter", new AbstractReadOnlyModel<Integer>() {
@Override
public Integer getObject()
{
Object o = getApplication();
if (o instanceof WicketApplication) {
WicketApplication w = (WicketApplication)o;
return w.getCounter().get();
}
return null;
}
}));
Have fun
Sven
On 20.09.2015 21:48, eostermueller wrote:
> Hello all,
>
> I just created a wicket quickstart here:
>
> https://github.com/eostermueller/selfUpdating
>
> I added a AjaxSelfUpdatingTimerBehavior that kind of breaks the browser
> refresh.
> The details are on the README.md.
>
> I found a number of similar issues on the forum but none quite match this.
>
> Thanks,
> --Erik
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxSelfUpdatingTimerBehavior-breaks-browser-refresh-tp4671997.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org