You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by mohallo <mo...@qwest.com> on 2013/01/26 01:08:07 UTC
Issue with panel ,model refresh
I have the following code with a label and a model .Which works as expected
.I added a timer which refreshes the component and hence the getObject of
the model is called .
If I use the same code and Replace the timerLabel with a panel I would have
thought it would work the same way .
The Idea is to attach a model to the Panel and when the panel gets refreshed
it will call the getObject on the model .
public void init(){
timerTaskForm = new TimerTaskForm("timertaskform");
this.add(timerTaskForm);
}
private class TimerTaskForm extends Form {
public TimerTaskForm(String id) {
super(id);
timerLabel = new Label("status",new Model(){
@Override
public Serializable getObject(){
Date dt = new Date();
SimpleDateFormat sdfout = new SimpleDateFormat("dd-MMMM-yyyy
hh:mm:ss");
String convertedValue = sdfout.format(dt);
return convertedValue;
}
});
ajaxTimer = new AjaxSelfUpdatingTimerBehavior(Duration.seconds(5));
timerLabel.add(ajaxTimer);
this.add(timerLabel);
}
}
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Issue-with-panel-model-refresh-tp4655775.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: Issue with panel ,model refresh
Posted by Paul Bors <pa...@bors.ws>.
Thank you sir!
On Tue, Jan 29, 2013 at 3:04 AM, Martin Grigorov <mg...@apache.org>wrote:
> The examples for 1.5.x are online again.
>
>
> On Tue, Jan 29, 2013 at 8:54 AM, Martin Grigorov <mgrigorov@apache.org
> >wrote:
>
> > The examples for 6.x are OK -
> > http://www.wicket-library.com/wicket-examples-6.0.x/index.html
> > I'll see what is the problem with 1.5.x
> >
> >
> > On Tue, Jan 29, 2013 at 1:31 AM, Paul Bors <pa...@bors.ws> wrote:
> >
> >> Unfortunately the live wicket examples for the component references is
> >> offline right now so I can't point you to an Ajax example :(
> >> http://www.wicket-library.com/wicket-examples/compref/
> >>
> >> But take a look at:
> >> http://wicket.apache.org/learn/examples/ajaxcounter.html
> >>
> >> Your code is too complex to follow for me to understand what you're
> doing
> >> wrong.
> >> Try simplifying the problem with the least code possible.
> >>
> >> ~ Thank you,
> >> Paul Bors
> >>
> >> On Mon, Jan 28, 2013 at 4:36 PM, mohallo <mo...@qwest.com> wrote:
> >>
> >> > It works for the Label .Trying to implement the same for the Panel .
> >> >
> >> >
> >> >
> >> > --
> >> > View this message in context:
> >> >
> >>
> http://apache-wicket.1842946.n4.nabble.com/Issue-with-panel-model-refresh-tp4655775p4655855.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
> >> >
> >> >
> >>
> >
> >
> >
> > --
> > Martin Grigorov
> > jWeekend
> > Training, Consulting, Development
> > http://jWeekend.com <http://jweekend.com/>
> >
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com <http://jweekend.com/>
>
Re: Issue with panel ,model refresh
Posted by Martin Grigorov <mg...@apache.org>.
The examples for 1.5.x are online again.
On Tue, Jan 29, 2013 at 8:54 AM, Martin Grigorov <mg...@apache.org>wrote:
> The examples for 6.x are OK -
> http://www.wicket-library.com/wicket-examples-6.0.x/index.html
> I'll see what is the problem with 1.5.x
>
>
> On Tue, Jan 29, 2013 at 1:31 AM, Paul Bors <pa...@bors.ws> wrote:
>
>> Unfortunately the live wicket examples for the component references is
>> offline right now so I can't point you to an Ajax example :(
>> http://www.wicket-library.com/wicket-examples/compref/
>>
>> But take a look at:
>> http://wicket.apache.org/learn/examples/ajaxcounter.html
>>
>> Your code is too complex to follow for me to understand what you're doing
>> wrong.
>> Try simplifying the problem with the least code possible.
>>
>> ~ Thank you,
>> Paul Bors
>>
>> On Mon, Jan 28, 2013 at 4:36 PM, mohallo <mo...@qwest.com> wrote:
>>
>> > It works for the Label .Trying to implement the same for the Panel .
>> >
>> >
>> >
>> > --
>> > View this message in context:
>> >
>> http://apache-wicket.1842946.n4.nabble.com/Issue-with-panel-model-refresh-tp4655775p4655855.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
>> >
>> >
>>
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com <http://jweekend.com/>
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>
Re: Issue with panel ,model refresh
Posted by Martin Grigorov <mg...@apache.org>.
The examples for 6.x are OK -
http://www.wicket-library.com/wicket-examples-6.0.x/index.html
I'll see what is the problem with 1.5.x
On Tue, Jan 29, 2013 at 1:31 AM, Paul Bors <pa...@bors.ws> wrote:
> Unfortunately the live wicket examples for the component references is
> offline right now so I can't point you to an Ajax example :(
> http://www.wicket-library.com/wicket-examples/compref/
>
> But take a look at:
> http://wicket.apache.org/learn/examples/ajaxcounter.html
>
> Your code is too complex to follow for me to understand what you're doing
> wrong.
> Try simplifying the problem with the least code possible.
>
> ~ Thank you,
> Paul Bors
>
> On Mon, Jan 28, 2013 at 4:36 PM, mohallo <mo...@qwest.com> wrote:
>
> > It works for the Label .Trying to implement the same for the Panel .
> >
> >
> >
> > --
> > View this message in context:
> >
> http://apache-wicket.1842946.n4.nabble.com/Issue-with-panel-model-refresh-tp4655775p4655855.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
> >
> >
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>
Re: Issue with panel ,model refresh
Posted by Paul Bors <pa...@bors.ws>.
Unfortunately the live wicket examples for the component references is
offline right now so I can't point you to an Ajax example :(
http://www.wicket-library.com/wicket-examples/compref/
But take a look at:
http://wicket.apache.org/learn/examples/ajaxcounter.html
Your code is too complex to follow for me to understand what you're doing
wrong.
Try simplifying the problem with the least code possible.
~ Thank you,
Paul Bors
On Mon, Jan 28, 2013 at 4:36 PM, mohallo <mo...@qwest.com> wrote:
> It works for the Label .Trying to implement the same for the Panel .
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Issue-with-panel-model-refresh-tp4655775p4655855.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: Issue with panel ,model refresh
Posted by mohallo <mo...@qwest.com>.
It works for the Label .Trying to implement the same for the Panel .
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Issue-with-panel-model-refresh-tp4655775p4655855.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: Issue with panel ,model refresh
Posted by Paul Bors <pa...@bors.ws>.
I'm confused by your question...
"The Idea is to attach a model to the Panel and when the panel gets
refreshed
it will call the getObject on the model"... is this what Wicket's MVC dose
for you?
If you want to refresh a panel via Ajax, then simply call
setOutputMarkupId() on the panel and add it to the Ajax target.
Wicket will handle calling the getObject() method for you when the panel
will be refreshed.
If you want to see it in action, turn on the DEVELOPMENT mode on your
application and watch the "WICKET AJAX DEBUG" window (link in the lower
right corner of your screen). For other cool debug tools build in Wicket
that help you develop faster, see also the DebugBar.
~ Thank you,
Paul Bors
On Mon, Jan 28, 2013 at 11:13 AM, Martin Grigorov <mg...@apache.org>wrote:
> Hi,
>
> This is the working code, right ?
> Can you show us the non-working one ?
>
>
> On Sat, Jan 26, 2013 at 2:08 AM, mohallo <mo...@qwest.com> wrote:
>
> > I have the following code with a label and a model .Which works as
> expected
> > .I added a timer which refreshes the component and hence the getObject of
> > the model is called .
> > If I use the same code and Replace the timerLabel with a panel I would
> have
> > thought it would work the same way .
> >
> > The Idea is to attach a model to the Panel and when the panel gets
> > refreshed
> > it will call the getObject on the model .
> >
> > public void init(){
> >
> > timerTaskForm = new TimerTaskForm("timertaskform");
> > this.add(timerTaskForm);
> > }
> >
> > private class TimerTaskForm extends Form {
> >
> > public TimerTaskForm(String id) {
> > super(id);
> >
> >
> > timerLabel = new Label("status",new Model(){
> >
> > @Override
> > public Serializable getObject(){
> >
> > Date dt = new Date();
> > SimpleDateFormat sdfout = new
> > SimpleDateFormat("dd-MMMM-yyyy
> > hh:mm:ss");
> > String convertedValue =
> > sdfout.format(dt);
> > return convertedValue;
> >
> > }
> >
> > });
> > ajaxTimer = new
> > AjaxSelfUpdatingTimerBehavior(Duration.seconds(5));
> > timerLabel.add(ajaxTimer);
> > this.add(timerLabel);
> > }
> >
> >
> >
> > }
> >
> >
> >
> >
> > --
> > View this message in context:
> >
> http://apache-wicket.1842946.n4.nabble.com/Issue-with-panel-model-refresh-tp4655775.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
> >
> >
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com <http://jweekend.com/>
>
Re: Issue with panel ,model refresh
Posted by mohallo <mo...@qwest.com>.
Thanks for your help .
The only way I could get the getObject method called in the panel was by
adding the getDefaultModelObject call in the Timer as follows .
ajaxTimer = new AjaxSelfUpdatingTimerBehavior(Duration.seconds(5)){
public void onPostProcessTarget(AjaxRequestTarget target){
refreshPanel.getDefaultModelObject();
}
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Issue-with-panel-model-refresh-tp4655775p4655894.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: Issue with panel ,model refresh
Posted by Paul Bors <pa...@bors.ws>.
Now that the live examples are back up, take a look at:
http://www.wicket-library.com/wicket-examples/ajax/
To see how to swap out panels, see the Tabbed Panel example:
http://www.wicket-library.com/wicket-examples/ajax/tabbed-panel?2
Have fun!
~ Thank you,
Paul Bors
-----
~ Thank you,
Paul@Bors.ws
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Issue-with-panel-model-refresh-tp4655775p4655885.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: Issue with panel ,model refresh
Posted by mohallo <mo...@qwest.com>.
Thanks for looking at this .
that is the working code that I previously posted .
This is what I am trying to do .
private RefreshPanel refreshPanel;
private WebMarkupContainer container;
private AjaxSelfUpdatingTimerBehavior ajaxTimer;
private PanelRefreshForm panelRefreshForm;
public PanelPageRefresh(){
init();
}
public void init(){
panelRefreshForm = new PanelRefreshForm("refreshform");
this.add(panelRefreshForm);
}
public class PanelRefreshForm extends Form{
public PanelRefreshForm(String id) {
super(id);
container = new WebMarkupContainer("container");
container.setOutputMarkupId(true);
this.add(container);
refreshPanel = new RefreshPanel("refreshPanel",new Model(){
@Override
public Serializable getObject() {
System.out.println("Returning Database objects");
return "0000000";
}
});
container.add(refreshPanel);
ajaxTimer = new AjaxSelfUpdatingTimerBehavior(Duration.seconds(5));
container.add(ajaxTimer);
}
}
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Issue-with-panel-model-refresh-tp4655775p4655854.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: Issue with panel ,model refresh
Posted by Martin Grigorov <mg...@apache.org>.
Hi,
This is the working code, right ?
Can you show us the non-working one ?
On Sat, Jan 26, 2013 at 2:08 AM, mohallo <mo...@qwest.com> wrote:
> I have the following code with a label and a model .Which works as expected
> .I added a timer which refreshes the component and hence the getObject of
> the model is called .
> If I use the same code and Replace the timerLabel with a panel I would have
> thought it would work the same way .
>
> The Idea is to attach a model to the Panel and when the panel gets
> refreshed
> it will call the getObject on the model .
>
> public void init(){
>
> timerTaskForm = new TimerTaskForm("timertaskform");
> this.add(timerTaskForm);
> }
>
> private class TimerTaskForm extends Form {
>
> public TimerTaskForm(String id) {
> super(id);
>
>
> timerLabel = new Label("status",new Model(){
>
> @Override
> public Serializable getObject(){
>
> Date dt = new Date();
> SimpleDateFormat sdfout = new
> SimpleDateFormat("dd-MMMM-yyyy
> hh:mm:ss");
> String convertedValue =
> sdfout.format(dt);
> return convertedValue;
>
> }
>
> });
> ajaxTimer = new
> AjaxSelfUpdatingTimerBehavior(Duration.seconds(5));
> timerLabel.add(ajaxTimer);
> this.add(timerLabel);
> }
>
>
>
> }
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Issue-with-panel-model-refresh-tp4655775.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
>
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>