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 <[email protected]>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 <[email protected]> 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: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> >
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com <http://jweekend.com/>
>

Reply via email to