You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by zabian <za...@gmail.com> on 2009/10/07 16:26:50 UTC
AjaxSelfUpdatingBehavior and nested values updating
Hi,
I want to add self-updating panel which displays some nested properties
ie. two coordinates (x,y - let's say the Point class object).
The point is updated by ejb or webservice.
I tried to use the example from wicket-examples page - clock using
AjaxSelfUpdatingBehavior.
But example case updates just one value, so the model is easy -
AbstractReadOnlyModel<String>.
My case is similar, I could use AbstractReadOnlyModel<Point> which
getObject() calls my ejb or webservice and returns the Point object.
The problem is how to populate nested properties to the Labels on each
update of AjaxSelfUpdatingBehavior.
I'm still fresh to the models, could anybody help me?
Regards,
Wojtek
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: AjaxSelfUpdatingBehavior and nested values updating
Posted by zabian <za...@gmail.com>.
Great, this is exactly what i need.
I just didn't know how to convert one model to another or that you can
get property of model object directly from model :)
I appreciate your commitment.
Regards,
Wojtek
Jeremy Thomerson pisze:
> AbstractReadOnlyModel<Point> point = new AbstractReadOnlyModel() { ...
> return point from your service ... }
>
> PropertyModel<Double> lat = new PropertyModel<Double>(point, "latitude");
> PropertyModel<Double> lng = new PropertyModel<Double>(point, "longitude");
> Label latLabel = new Label("lat", lat);
> Label lngLabel = new Label("lng", lng);
>
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
>
> 2009/10/7 zabian <za...@gmail.com>
>
>
>> Hi,
>> I want to add self-updating panel which displays some nested properties ie.
>> two coordinates (x,y - let's say the Point class object).
>> The point is updated by ejb or webservice.
>>
>> I tried to use the example from wicket-examples page - clock using
>> AjaxSelfUpdatingBehavior.
>> But example case updates just one value, so the model is easy -
>> AbstractReadOnlyModel<String>.
>> My case is similar, I could use AbstractReadOnlyModel<Point> which
>> getObject() calls my ejb or webservice and returns the Point object.
>> The problem is how to populate nested properties to the Labels on each
>> update of AjaxSelfUpdatingBehavior.
>>
>> I'm still fresh to the models, could anybody help me?
>>
>> Regards,
>> Wojtek
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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: AjaxSelfUpdatingBehavior and nested values updating
Posted by Jeremy Thomerson <je...@wickettraining.com>.
Oh, then just add the panel that contains those labels, or add the labels
themselves, to the ajax response (target.addComponent)
--
Jeremy Thomerson
http://www.wickettraining.com
On Wed, Oct 7, 2009 at 10:00 AM, Jeremy Thomerson <jeremy@wickettraining.com
> wrote:
> AbstractReadOnlyModel<Point> point = new AbstractReadOnlyModel() { ...
> return point from your service ... }
>
> PropertyModel<Double> lat = new PropertyModel<Double>(point, "latitude");
> PropertyModel<Double> lng = new PropertyModel<Double>(point, "longitude");
> Label latLabel = new Label("lat", lat);
> Label lngLabel = new Label("lng", lng);
>
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
>
> 2009/10/7 zabian <za...@gmail.com>
>
> Hi,
>> I want to add self-updating panel which displays some nested properties
>> ie. two coordinates (x,y - let's say the Point class object).
>> The point is updated by ejb or webservice.
>>
>> I tried to use the example from wicket-examples page - clock using
>> AjaxSelfUpdatingBehavior.
>> But example case updates just one value, so the model is easy -
>> AbstractReadOnlyModel<String>.
>> My case is similar, I could use AbstractReadOnlyModel<Point> which
>> getObject() calls my ejb or webservice and returns the Point object.
>> The problem is how to populate nested properties to the Labels on each
>> update of AjaxSelfUpdatingBehavior.
>>
>> I'm still fresh to the models, could anybody help me?
>>
>> Regards,
>> Wojtek
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
Re: AjaxSelfUpdatingBehavior and nested values updating
Posted by Jeremy Thomerson <je...@wickettraining.com>.
AbstractReadOnlyModel<Point> point = new AbstractReadOnlyModel() { ...
return point from your service ... }
PropertyModel<Double> lat = new PropertyModel<Double>(point, "latitude");
PropertyModel<Double> lng = new PropertyModel<Double>(point, "longitude");
Label latLabel = new Label("lat", lat);
Label lngLabel = new Label("lng", lng);
--
Jeremy Thomerson
http://www.wickettraining.com
2009/10/7 zabian <za...@gmail.com>
> Hi,
> I want to add self-updating panel which displays some nested properties ie.
> two coordinates (x,y - let's say the Point class object).
> The point is updated by ejb or webservice.
>
> I tried to use the example from wicket-examples page - clock using
> AjaxSelfUpdatingBehavior.
> But example case updates just one value, so the model is easy -
> AbstractReadOnlyModel<String>.
> My case is similar, I could use AbstractReadOnlyModel<Point> which
> getObject() calls my ejb or webservice and returns the Point object.
> The problem is how to populate nested properties to the Labels on each
> update of AjaxSelfUpdatingBehavior.
>
> I'm still fresh to the models, could anybody help me?
>
> Regards,
> Wojtek
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: AjaxSelfUpdatingBehavior and nested values updating
Posted by Michael O'Cleirigh <mi...@rivulet.ca>.
Hi Wojtek,
Create a panel that contains the setup to present the properties of your
Point class.
Add the 'AjaxSelfUpdatingTimerBehavior' to the panel.
So long as the PointPanel is setup properly using an IModel<Point>
implementation that knows how to populate itself and the nested fields
there is nothing else you need to do.
It sounds like you don't have the panel without the ajax working. You
should look at the CompoundPropertyModel or build a custom IModel
implementation to allow you to access the fields of the Point object.
See the wiki for more examples:
http://cwiki.apache.org/WICKET/working-with-wicket-models.html
Mike
> Hi,
> I want to add self-updating panel which displays some nested
> properties ie. two coordinates (x,y - let's say the Point class object).
> The point is updated by ejb or webservice.
>
> I tried to use the example from wicket-examples page - clock using
> AjaxSelfUpdatingBehavior.
> But example case updates just one value, so the model is easy -
> AbstractReadOnlyModel<String>.
> My case is similar, I could use AbstractReadOnlyModel<Point> which
> getObject() calls my ejb or webservice and returns the Point object.
> The problem is how to populate nested properties to the Labels on each
> update of AjaxSelfUpdatingBehavior.
>
> I'm still fresh to the models, could anybody help me?
>
> Regards,
> Wojtek
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>