Re: Getting the model
You were right, fixed it On Wed, Apr 6, 2016 at 6:49 PM Martin Grigorov <mgrigo...@apache.org> wrote: > Please read the answers. > On Apr 6, 2016 7:26 PM, "Ron Smits" <ron.sm...@gmail.com> wrote: > > > This alas does not work:( > > > > First I am using wicket 7.2.0 and the getModelObject does not exist so I > > finally made: > > > > @Override > > protected void onComponentTag(ComponentTag tag) { > > add(new AttributeAppender("class", " number")); > > if(getDefaultModel().getObject() instanceof Number){ > > Number number = (Number) getDefaultModelObject(); > > if(number.doubleValue()<0.0) > > add(new AttributeAppender("class", " negative")); > >} > > } > > > > This however gives the following exception: > > > > 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:3623) > > at org.apache.wicket.Component.addStateChange(Component.java:3538) > > at org.apache.wicket.Behaviors.add(Behaviors.java:55) > > at org.apache.wicket.Component.add(Component.java:4559) > > at > > > nl.codetribe.budget.web.common.MoneyLabel.onComponentTag(MoneyLabel.java:36) > > at > > org.apache.wicket.Component.internalRenderComponent(Component.java:2521) > > > > On Fri, Apr 1, 2016 at 3:11 PM Tobias Soloschenko > > tobiassolosche...@googlemail.com > > <http://mailto:tobiassolosche...@googlemail.com> wrote: > > > > Cool - thanks! > > > > > > kind regards > > > > > > Tobias > > > > > > > Am 01.04.2016 um 14:56 schrieb Martin Grigorov <mgrigo...@apache.org > >: > > > > > > > > I've added an example with > > > > > > > > > > https://github.com/apache/wicket/commit/2417322673238d57a794c237e84dd5dacf890804 > > > > > > > > I think we should explain that those are just convenience. It is > better > > > to > > > > use the "old way" one cares about memory usage. I'll add it soon. > > > > > > > > Martin Grigorov > > > > Wicket Training and Consulting > > > > https://twitter.com/mtgrigorov > > > > > > > > On Fri, Apr 1, 2016 at 2:48 PM, Tobias Soloschenko < > > > > tobiassolosche...@googlemail.com> wrote: > > > > > > > >> Hi, > > > >> > > > >> would be great to see some information how to use lambda models in > the > > > >> user guide. > > > >> > > > >> kind regards > > > >> > > > >> Tobias > > > >> > > > >>>> Am 01.04.2016 um 13:57 schrieb Martin Grigorov < > > mgrigo...@apache.org > > > >: > > > >>>> > > > >>>> On Fri, Apr 1, 2016 at 12:45 AM, Sven Meier <s...@meiers.net> > > wrote: > > > >>>> > > > >>>> Hi, > > > >>>> > > > >>>> yeah, of course this is right: > > > >>>> > > > >>>> protected void onComponentTag(final ComponentTag tag) { > > > >>>> > > > >>>> if (getModelObject().doubleValue() < 0.0) { > > > >>>> tag.put("class", " negative"); > > > >>>> } > > > >>>> } > > > >>>> > > > >>>> Otherwise you'll end up with one additional behavior for each > > render - > > > >>>> stupid copy-paste error :/. > > > >>>> > > > >>>> BTW this might be an additional candidate for the new Wicket 8 > > > lambdas: > > > >>>> > > > >>>> label.add(onTag(tag -> if (getModelObject().doubleValue() < 0.0) > > > >>>> tag.put("class", "negative") )); > > > >>> > > > >>> +1 > > > >>> > > > >> > > > >> +1 > > > >> > > > >>> > > > >>>> > > > >>>> Sven > > > >>>> > > > >>>> > > > >>>> > > > >>>>> On 31.03.2016
Re: Getting the model
Please read the answers. On Apr 6, 2016 7:26 PM, "Ron Smits" <ron.sm...@gmail.com> wrote: > This alas does not work:( > > First I am using wicket 7.2.0 and the getModelObject does not exist so I > finally made: > > @Override > protected void onComponentTag(ComponentTag tag) { > add(new AttributeAppender("class", " number")); > if(getDefaultModel().getObject() instanceof Number){ > Number number = (Number) getDefaultModelObject(); > if(number.doubleValue()<0.0) > add(new AttributeAppender("class", " negative")); >} > } > > This however gives the following exception: > > 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:3623) > at org.apache.wicket.Component.addStateChange(Component.java:3538) > at org.apache.wicket.Behaviors.add(Behaviors.java:55) > at org.apache.wicket.Component.add(Component.java:4559) > at > nl.codetribe.budget.web.common.MoneyLabel.onComponentTag(MoneyLabel.java:36) > at > org.apache.wicket.Component.internalRenderComponent(Component.java:2521) > > On Fri, Apr 1, 2016 at 3:11 PM Tobias Soloschenko > tobiassolosche...@googlemail.com > <http://mailto:tobiassolosche...@googlemail.com> wrote: > > Cool - thanks! > > > > kind regards > > > > Tobias > > > > > Am 01.04.2016 um 14:56 schrieb Martin Grigorov <mgrigo...@apache.org>: > > > > > > I've added an example with > > > > > > https://github.com/apache/wicket/commit/2417322673238d57a794c237e84dd5dacf890804 > > > > > > I think we should explain that those are just convenience. It is better > > to > > > use the "old way" one cares about memory usage. I'll add it soon. > > > > > > Martin Grigorov > > > Wicket Training and Consulting > > > https://twitter.com/mtgrigorov > > > > > > On Fri, Apr 1, 2016 at 2:48 PM, Tobias Soloschenko < > > > tobiassolosche...@googlemail.com> wrote: > > > > > >> Hi, > > >> > > >> would be great to see some information how to use lambda models in the > > >> user guide. > > >> > > >> kind regards > > >> > > >> Tobias > > >> > > >>>> Am 01.04.2016 um 13:57 schrieb Martin Grigorov < > mgrigo...@apache.org > > >: > > >>>> > > >>>> On Fri, Apr 1, 2016 at 12:45 AM, Sven Meier <s...@meiers.net> > wrote: > > >>>> > > >>>> Hi, > > >>>> > > >>>> yeah, of course this is right: > > >>>> > > >>>> protected void onComponentTag(final ComponentTag tag) { > > >>>> > > >>>> if (getModelObject().doubleValue() < 0.0) { > > >>>> tag.put("class", " negative"); > > >>>> } > > >>>> } > > >>>> > > >>>> Otherwise you'll end up with one additional behavior for each > render - > > >>>> stupid copy-paste error :/. > > >>>> > > >>>> BTW this might be an additional candidate for the new Wicket 8 > > lambdas: > > >>>> > > >>>> label.add(onTag(tag -> if (getModelObject().doubleValue() < 0.0) > > >>>> tag.put("class", "negative") )); > > >>> > > >>> +1 > > >>> > > >> > > >> +1 > > >> > > >>> > > >>>> > > >>>> Sven > > >>>> > > >>>> > > >>>> > > >>>>> On 31.03.2016 21:16, Martin Grigorov wrote: > > >>>>> > > >>>>> Hi, > > >>>>> > > >>>>> On Thu, Mar 31, 2016 at 4:29 PM, Sven Meier <s...@meiers.net> > wrote: > > >>>>> > > >>>>> Hi, > > >>>>>> > > >>>>>> you can access a component's model with #getDefaultModel() or - if > > it > > >> is > > >>>>>> a > > >>>>>> generic component - with #getModel(). > > >>>>>> > > >>>>>> To properly 'bind' to a model you shoul
Re: Getting the model
This alas does not work:( First I am using wicket 7.2.0 and the getModelObject does not exist so I finally made: @Override protected void onComponentTag(ComponentTag tag) { add(new AttributeAppender("class", " number")); if(getDefaultModel().getObject() instanceof Number){ Number number = (Number) getDefaultModelObject(); if(number.doubleValue()<0.0) add(new AttributeAppender("class", " negative")); } } This however gives the following exception: 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:3623) at org.apache.wicket.Component.addStateChange(Component.java:3538) at org.apache.wicket.Behaviors.add(Behaviors.java:55) at org.apache.wicket.Component.add(Component.java:4559) at nl.codetribe.budget.web.common.MoneyLabel.onComponentTag(MoneyLabel.java:36) at org.apache.wicket.Component.internalRenderComponent(Component.java:2521) On Fri, Apr 1, 2016 at 3:11 PM Tobias Soloschenko tobiassolosche...@googlemail.com <http://mailto:tobiassolosche...@googlemail.com> wrote: Cool - thanks! > > kind regards > > Tobias > > > Am 01.04.2016 um 14:56 schrieb Martin Grigorov <mgrigo...@apache.org>: > > > > I've added an example with > > > https://github.com/apache/wicket/commit/2417322673238d57a794c237e84dd5dacf890804 > > > > I think we should explain that those are just convenience. It is better > to > > use the "old way" one cares about memory usage. I'll add it soon. > > > > Martin Grigorov > > Wicket Training and Consulting > > https://twitter.com/mtgrigorov > > > > On Fri, Apr 1, 2016 at 2:48 PM, Tobias Soloschenko < > > tobiassolosche...@googlemail.com> wrote: > > > >> Hi, > >> > >> would be great to see some information how to use lambda models in the > >> user guide. > >> > >> kind regards > >> > >> Tobias > >> > >>>> Am 01.04.2016 um 13:57 schrieb Martin Grigorov <mgrigo...@apache.org > >: > >>>> > >>>> On Fri, Apr 1, 2016 at 12:45 AM, Sven Meier <s...@meiers.net> wrote: > >>>> > >>>> Hi, > >>>> > >>>> yeah, of course this is right: > >>>> > >>>> protected void onComponentTag(final ComponentTag tag) { > >>>> > >>>> if (getModelObject().doubleValue() < 0.0) { > >>>> tag.put("class", " negative"); > >>>> } > >>>> } > >>>> > >>>> Otherwise you'll end up with one additional behavior for each render - > >>>> stupid copy-paste error :/. > >>>> > >>>> BTW this might be an additional candidate for the new Wicket 8 > lambdas: > >>>> > >>>> label.add(onTag(tag -> if (getModelObject().doubleValue() < 0.0) > >>>> tag.put("class", "negative") )); > >>> > >>> +1 > >>> > >> > >> +1 > >> > >>> > >>>> > >>>> Sven > >>>> > >>>> > >>>> > >>>>> On 31.03.2016 21:16, Martin Grigorov wrote: > >>>>> > >>>>> Hi, > >>>>> > >>>>> On Thu, Mar 31, 2016 at 4:29 PM, Sven Meier <s...@meiers.net> wrote: > >>>>> > >>>>> Hi, > >>>>>> > >>>>>> you can access a component's model with #getDefaultModel() or - if > it > >> is > >>>>>> a > >>>>>> generic component - with #getModel(). > >>>>>> > >>>>>> To properly 'bind' to a model you should delay invocation of > >> #getObject() > >>>>>> as late as possible, so better overwrite #onComponentTag(): > >>>>>> > >>>>>>protected void onComponentTag(final ComponentTag tag) { > >>>>>> > >>>>>>if (getModelObject().doubleValue() < 0.0) { > >>>>>>add(new AttributeAppender("class", " negative")); > >>>>>> > >>>>>> Since you are in #onComponentTag() there is no reason to add a > >> Behavior. > >>>>> Just use the tag: tag.append("class", "
Re: Getting the model
Cool - thanks! kind regards Tobias > Am 01.04.2016 um 14:56 schrieb Martin Grigorov <mgrigo...@apache.org>: > > I've added an example with > https://github.com/apache/wicket/commit/2417322673238d57a794c237e84dd5dacf890804 > > I think we should explain that those are just convenience. It is better to > use the "old way" one cares about memory usage. I'll add it soon. > > Martin Grigorov > Wicket Training and Consulting > https://twitter.com/mtgrigorov > > On Fri, Apr 1, 2016 at 2:48 PM, Tobias Soloschenko < > tobiassolosche...@googlemail.com> wrote: > >> Hi, >> >> would be great to see some information how to use lambda models in the >> user guide. >> >> kind regards >> >> Tobias >> >>>> Am 01.04.2016 um 13:57 schrieb Martin Grigorov <mgrigo...@apache.org>: >>>> >>>> On Fri, Apr 1, 2016 at 12:45 AM, Sven Meier <s...@meiers.net> wrote: >>>> >>>> Hi, >>>> >>>> yeah, of course this is right: >>>> >>>> protected void onComponentTag(final ComponentTag tag) { >>>> >>>> if (getModelObject().doubleValue() < 0.0) { >>>> tag.put("class", " negative"); >>>> } >>>> } >>>> >>>> Otherwise you'll end up with one additional behavior for each render - >>>> stupid copy-paste error :/. >>>> >>>> BTW this might be an additional candidate for the new Wicket 8 lambdas: >>>> >>>> label.add(onTag(tag -> if (getModelObject().doubleValue() < 0.0) >>>> tag.put("class", "negative") )); >>> >>> +1 >>> >> >> +1 >> >>> >>>> >>>> Sven >>>> >>>> >>>> >>>>> On 31.03.2016 21:16, Martin Grigorov wrote: >>>>> >>>>> Hi, >>>>> >>>>> On Thu, Mar 31, 2016 at 4:29 PM, Sven Meier <s...@meiers.net> wrote: >>>>> >>>>> Hi, >>>>>> >>>>>> you can access a component's model with #getDefaultModel() or - if it >> is >>>>>> a >>>>>> generic component - with #getModel(). >>>>>> >>>>>> To properly 'bind' to a model you should delay invocation of >> #getObject() >>>>>> as late as possible, so better overwrite #onComponentTag(): >>>>>> >>>>>>protected void onComponentTag(final ComponentTag tag) { >>>>>> >>>>>>if (getModelObject().doubleValue() < 0.0) { >>>>>>add(new AttributeAppender("class", " negative")); >>>>>> >>>>>> Since you are in #onComponentTag() there is no reason to add a >> Behavior. >>>>> Just use the tag: tag.append("class", "negative", " "); >>>>> >>>>> >>>>>} >>>>>>} >>>>>> >>>>>> >>>>>> Have fun >>>>>> Sven >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> On 31.03.2016 16:06, Ron Smits wrote: >>>>>> >>>>>> I have searched but I dont find a clear way of getting the model when >> one >>>>>>> is creating a custom component: >>>>>>> >>>>>>> >>>>>>> public MoneyLabel(String id) { >>>>>>> super(id); >>>>>>> add(new AttributeAppender("class", " number")); >>>>>>> } >>>>>>> >>>>>>> It sounds like you always need the model. >>>>> If there is a CompoundPropertyModel in the parents' hierarchy then move >>>>> your logic to #onComponentTag(), as per Sven's suggestion. >>>>> If there is no CPM in the parents then just remove this constructor. >>>>> >>>>> >>>>> public MoneyLabel(String id, Model >> bigDecimalModel) >>>>>>> { >>>>>>> super(id, bigDecimalModel); >>>>>>> add(new AttributeAppender("class", " number")); >>>>>>> if (bigDecimalModel.getObject().doubleValue() < 0.0) { >>>>>>> add(new AttributeAppender("class", " negative")); >>>>>>> } >>>>>>> } >>>>>>> >>>>>>> In the second constructor I can use the supplied model to determine >> to >>>>>>> add >>>>>>> the negative class. However in the first constructor I cannot find a >> way >>>>>>> to >>>>>>> access the model. >>>>>>> >>>>>>> What am I missing? >>>>>>> >>>>>>> Ron >>>>>>> >>>>>>> >>>>>>> >>>>>>> - >>>>>> 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: Getting the model
I've added an example with https://github.com/apache/wicket/commit/2417322673238d57a794c237e84dd5dacf890804 I think we should explain that those are just convenience. It is better to use the "old way" one cares about memory usage. I'll add it soon. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Fri, Apr 1, 2016 at 2:48 PM, Tobias Soloschenko < tobiassolosche...@googlemail.com> wrote: > Hi, > > would be great to see some information how to use lambda models in the > user guide. > > kind regards > > Tobias > > > Am 01.04.2016 um 13:57 schrieb Martin Grigorov <mgrigo...@apache.org>: > > > >> On Fri, Apr 1, 2016 at 12:45 AM, Sven Meier <s...@meiers.net> wrote: > >> > >> Hi, > >> > >> yeah, of course this is right: > >> > >>protected void onComponentTag(final ComponentTag tag) { > >> > >>if (getModelObject().doubleValue() < 0.0) { > >>tag.put("class", " negative"); > >>} > >>} > >> > >> Otherwise you'll end up with one additional behavior for each render - > >> stupid copy-paste error :/. > >> > >> BTW this might be an additional candidate for the new Wicket 8 lambdas: > >> > >>label.add(onTag(tag -> if (getModelObject().doubleValue() < 0.0) > >> tag.put("class", "negative") )); > > > > +1 > > > > +1 > > > > >> > >> Sven > >> > >> > >> > >>> On 31.03.2016 21:16, Martin Grigorov wrote: > >>> > >>> Hi, > >>> > >>> On Thu, Mar 31, 2016 at 4:29 PM, Sven Meier <s...@meiers.net> wrote: > >>> > >>> Hi, > >>>> > >>>> you can access a component's model with #getDefaultModel() or - if it > is > >>>> a > >>>> generic component - with #getModel(). > >>>> > >>>> To properly 'bind' to a model you should delay invocation of > #getObject() > >>>> as late as possible, so better overwrite #onComponentTag(): > >>>> > >>>> protected void onComponentTag(final ComponentTag tag) { > >>>> > >>>> if (getModelObject().doubleValue() < 0.0) { > >>>> add(new AttributeAppender("class", " negative")); > >>>> > >>>> Since you are in #onComponentTag() there is no reason to add a > Behavior. > >>> Just use the tag: tag.append("class", "negative", " "); > >>> > >>> > >>> } > >>>> } > >>>> > >>>> > >>>> Have fun > >>>> Sven > >>>> > >>>> > >>>> > >>>> > >>>> On 31.03.2016 16:06, Ron Smits wrote: > >>>> > >>>> I have searched but I dont find a clear way of getting the model when > one > >>>>> is creating a custom component: > >>>>> > >>>>> > >>>>> public MoneyLabel(String id) { > >>>>> super(id); > >>>>> add(new AttributeAppender("class", " number")); > >>>>> } > >>>>> > >>>>> It sounds like you always need the model. > >>> If there is a CompoundPropertyModel in the parents' hierarchy then move > >>> your logic to #onComponentTag(), as per Sven's suggestion. > >>> If there is no CPM in the parents then just remove this constructor. > >>> > >>> > >>> public MoneyLabel(String id, Model > bigDecimalModel) > >>>>> { > >>>>> super(id, bigDecimalModel); > >>>>> add(new AttributeAppender("class", " number")); > >>>>> if (bigDecimalModel.getObject().doubleValue() < 0.0) { > >>>>> add(new AttributeAppender("class", " negative")); > >>>>> } > >>>>> } > >>>>> > >>>>> In the second constructor I can use the supplied model to determine > to > >>>>> add > >>>>> the negative class. However in the first constructor I cannot find a > way > >>>>> to > >>>>> access the model. > >>>>> > >>>>> What am I missing? > >>>>> > >>>>> Ron > >>>>> > >>>>> > >>>>> > >>>>> - > >>>> 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: Getting the model
Hi, would be great to see some information how to use lambda models in the user guide. kind regards Tobias > Am 01.04.2016 um 13:57 schrieb Martin Grigorov <mgrigo...@apache.org>: > >> On Fri, Apr 1, 2016 at 12:45 AM, Sven Meier <s...@meiers.net> wrote: >> >> Hi, >> >> yeah, of course this is right: >> >>protected void onComponentTag(final ComponentTag tag) { >> >>if (getModelObject().doubleValue() < 0.0) { >>tag.put("class", " negative"); >>} >>} >> >> Otherwise you'll end up with one additional behavior for each render - >> stupid copy-paste error :/. >> >> BTW this might be an additional candidate for the new Wicket 8 lambdas: >> >>label.add(onTag(tag -> if (getModelObject().doubleValue() < 0.0) >> tag.put("class", "negative") )); > > +1 > +1 > >> >> Sven >> >> >> >>> On 31.03.2016 21:16, Martin Grigorov wrote: >>> >>> Hi, >>> >>> On Thu, Mar 31, 2016 at 4:29 PM, Sven Meier <s...@meiers.net> wrote: >>> >>> Hi, >>>> >>>> you can access a component's model with #getDefaultModel() or - if it is >>>> a >>>> generic component - with #getModel(). >>>> >>>> To properly 'bind' to a model you should delay invocation of #getObject() >>>> as late as possible, so better overwrite #onComponentTag(): >>>> >>>> protected void onComponentTag(final ComponentTag tag) { >>>> >>>> if (getModelObject().doubleValue() < 0.0) { >>>> add(new AttributeAppender("class", " negative")); >>>> >>>> Since you are in #onComponentTag() there is no reason to add a Behavior. >>> Just use the tag: tag.append("class", "negative", " "); >>> >>> >>> } >>>> } >>>> >>>> >>>> Have fun >>>> Sven >>>> >>>> >>>> >>>> >>>> On 31.03.2016 16:06, Ron Smits wrote: >>>> >>>> I have searched but I dont find a clear way of getting the model when one >>>>> is creating a custom component: >>>>> >>>>> >>>>> public MoneyLabel(String id) { >>>>> super(id); >>>>> add(new AttributeAppender("class", " number")); >>>>> } >>>>> >>>>> It sounds like you always need the model. >>> If there is a CompoundPropertyModel in the parents' hierarchy then move >>> your logic to #onComponentTag(), as per Sven's suggestion. >>> If there is no CPM in the parents then just remove this constructor. >>> >>> >>> public MoneyLabel(String id, Model bigDecimalModel) >>>>> { >>>>> super(id, bigDecimalModel); >>>>> add(new AttributeAppender("class", " number")); >>>>> if (bigDecimalModel.getObject().doubleValue() < 0.0) { >>>>> add(new AttributeAppender("class", " negative")); >>>>> } >>>>> } >>>>> >>>>> In the second constructor I can use the supplied model to determine to >>>>> add >>>>> the negative class. However in the first constructor I cannot find a way >>>>> to >>>>> access the model. >>>>> >>>>> What am I missing? >>>>> >>>>> Ron >>>>> >>>>> >>>>> >>>>> - >>>> 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: Getting the model
On Fri, Apr 1, 2016 at 12:45 AM, Sven Meier <s...@meiers.net> wrote: > Hi, > > yeah, of course this is right: > > protected void onComponentTag(final ComponentTag tag) { > > if (getModelObject().doubleValue() < 0.0) { > tag.put("class", " negative"); > } > } > > Otherwise you'll end up with one additional behavior for each render - > stupid copy-paste error :/. > > BTW this might be an additional candidate for the new Wicket 8 lambdas: > > label.add(onTag(tag -> if (getModelObject().doubleValue() < 0.0) > tag.put("class", "negative") )); > +1 > > Sven > > > > On 31.03.2016 21:16, Martin Grigorov wrote: > >> Hi, >> >> On Thu, Mar 31, 2016 at 4:29 PM, Sven Meier <s...@meiers.net> wrote: >> >> Hi, >>> >>> you can access a component's model with #getDefaultModel() or - if it is >>> a >>> generic component - with #getModel(). >>> >>> To properly 'bind' to a model you should delay invocation of #getObject() >>> as late as possible, so better overwrite #onComponentTag(): >>> >>> protected void onComponentTag(final ComponentTag tag) { >>> >>> if (getModelObject().doubleValue() < 0.0) { >>> add(new AttributeAppender("class", " negative")); >>> >>> Since you are in #onComponentTag() there is no reason to add a Behavior. >> Just use the tag: tag.append("class", "negative", " "); >> >> >> } >>> } >>> >>> >>> Have fun >>> Sven >>> >>> >>> >>> >>> On 31.03.2016 16:06, Ron Smits wrote: >>> >>> I have searched but I dont find a clear way of getting the model when one >>>> is creating a custom component: >>>> >>>> >>>> public MoneyLabel(String id) { >>>> super(id); >>>> add(new AttributeAppender("class", " number")); >>>> } >>>> >>>> It sounds like you always need the model. >> If there is a CompoundPropertyModel in the parents' hierarchy then move >> your logic to #onComponentTag(), as per Sven's suggestion. >> If there is no CPM in the parents then just remove this constructor. >> >> >> public MoneyLabel(String id, Model bigDecimalModel) >>>> { >>>> super(id, bigDecimalModel); >>>> add(new AttributeAppender("class", " number")); >>>> if (bigDecimalModel.getObject().doubleValue() < 0.0) { >>>> add(new AttributeAppender("class", " negative")); >>>> } >>>> } >>>> >>>> In the second constructor I can use the supplied model to determine to >>>> add >>>> the negative class. However in the first constructor I cannot find a way >>>> to >>>> access the model. >>>> >>>> What am I missing? >>>> >>>> Ron >>>> >>>> >>>> >>>> - >>> 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: Getting the model
Hi, yeah, of course this is right: protected void onComponentTag(final ComponentTag tag) { if (getModelObject().doubleValue() < 0.0) { tag.put("class", " negative"); } } Otherwise you'll end up with one additional behavior for each render - stupid copy-paste error :/. BTW this might be an additional candidate for the new Wicket 8 lambdas: label.add(onTag(tag -> if (getModelObject().doubleValue() < 0.0) tag.put("class", "negative") )); Sven On 31.03.2016 21:16, Martin Grigorov wrote: Hi, On Thu, Mar 31, 2016 at 4:29 PM, Sven Meier <s...@meiers.net> wrote: Hi, you can access a component's model with #getDefaultModel() or - if it is a generic component - with #getModel(). To properly 'bind' to a model you should delay invocation of #getObject() as late as possible, so better overwrite #onComponentTag(): protected void onComponentTag(final ComponentTag tag) { if (getModelObject().doubleValue() < 0.0) { add(new AttributeAppender("class", " negative")); Since you are in #onComponentTag() there is no reason to add a Behavior. Just use the tag: tag.append("class", "negative", " "); } } Have fun Sven On 31.03.2016 16:06, Ron Smits wrote: I have searched but I dont find a clear way of getting the model when one is creating a custom component: public MoneyLabel(String id) { super(id); add(new AttributeAppender("class", " number")); } It sounds like you always need the model. If there is a CompoundPropertyModel in the parents' hierarchy then move your logic to #onComponentTag(), as per Sven's suggestion. If there is no CPM in the parents then just remove this constructor. public MoneyLabel(String id, Model bigDecimalModel) { super(id, bigDecimalModel); add(new AttributeAppender("class", " number")); if (bigDecimalModel.getObject().doubleValue() < 0.0) { add(new AttributeAppender("class", " negative")); } } In the second constructor I can use the supplied model to determine to add the negative class. However in the first constructor I cannot find a way to access the model. What am I missing? Ron - 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: Getting the model
Hi, On Thu, Mar 31, 2016 at 4:29 PM, Sven Meier <s...@meiers.net> wrote: > Hi, > > you can access a component's model with #getDefaultModel() or - if it is a > generic component - with #getModel(). > > To properly 'bind' to a model you should delay invocation of #getObject() > as late as possible, so better overwrite #onComponentTag(): > > protected void onComponentTag(final ComponentTag tag) { > > if (getModelObject().doubleValue() < 0.0) { > add(new AttributeAppender("class", " negative")); > Since you are in #onComponentTag() there is no reason to add a Behavior. Just use the tag: tag.append("class", "negative", " "); > } > } > > > Have fun > Sven > > > > > On 31.03.2016 16:06, Ron Smits wrote: > >> I have searched but I dont find a clear way of getting the model when one >> is creating a custom component: >> >> >> public MoneyLabel(String id) { >> super(id); >> add(new AttributeAppender("class", " number")); >> } >> > It sounds like you always need the model. If there is a CompoundPropertyModel in the parents' hierarchy then move your logic to #onComponentTag(), as per Sven's suggestion. If there is no CPM in the parents then just remove this constructor. > >> public MoneyLabel(String id, Model bigDecimalModel) >> { >> super(id, bigDecimalModel); >> add(new AttributeAppender("class", " number")); >> if (bigDecimalModel.getObject().doubleValue() < 0.0) { >> add(new AttributeAppender("class", " negative")); >> } >> } >> >> In the second constructor I can use the supplied model to determine to add >> the negative class. However in the first constructor I cannot find a way >> to >> access the model. >> >> What am I missing? >> >> Ron >> >> >> > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: Getting the model
2016-03-31 17:06 GMT+03:00 Ron Smits <ron.sm...@gmail.com>: > I have searched but I dont find a clear way of getting the model when one > is creating a custom component: > > > public MoneyLabel(String id) { > super(id); > add(new AttributeAppender("class", " number")); > } > > public MoneyLabel(String id, Model bigDecimalModel) { > super(id, bigDecimalModel); > add(new AttributeAppender("class", " number")); > if (bigDecimalModel.getObject().doubleValue() < 0.0) { > add(new AttributeAppender("class", " negative")); > } > } > > In the second constructor I can use the supplied model to determine to add > the negative class. However in the first constructor I cannot find a way to > access the model. > > What am I missing? > 1. To answer your question: Is this MoneyLabel your own design? If it is you are free to implement as you whish, or even drop the first constructor. 2. To give a recommendation on your design, I would attach the AttributeAppender in any case and only check if the model is negative at runtime (hollywood principle) like this: add(new AttributeAppender("class", " negative") { @Override isEnabled(..) { bigDecimalModel.getObject().doubleValue() < 0.0 } }); ** Martin > > Ron > >
Re: Getting the model
Hi, you can access a component's model with #getDefaultModel() or - if it is a generic component - with #getModel(). To properly 'bind' to a model you should delay invocation of #getObject() as late as possible, so better overwrite #onComponentTag(): protected void onComponentTag(final ComponentTag tag) { if (getModelObject().doubleValue() < 0.0) { add(new AttributeAppender("class", " negative")); } } Have fun Sven On 31.03.2016 16:06, Ron Smits wrote: I have searched but I dont find a clear way of getting the model when one is creating a custom component: public MoneyLabel(String id) { super(id); add(new AttributeAppender("class", " number")); } public MoneyLabel(String id, Model bigDecimalModel) { super(id, bigDecimalModel); add(new AttributeAppender("class", " number")); if (bigDecimalModel.getObject().doubleValue() < 0.0) { add(new AttributeAppender("class", " negative")); } } In the second constructor I can use the supplied model to determine to add the negative class. However in the first constructor I cannot find a way to access the model. What am I missing? Ron - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Getting the model
I have searched but I dont find a clear way of getting the model when one is creating a custom component: public MoneyLabel(String id) { super(id); add(new AttributeAppender("class", " number")); } public MoneyLabel(String id, Model bigDecimalModel) { super(id, bigDecimalModel); add(new AttributeAppender("class", " number")); if (bigDecimalModel.getObject().doubleValue() < 0.0) { add(new AttributeAppender("class", " negative")); } } In the second constructor I can use the supplied model to determine to add the negative class. However in the first constructor I cannot find a way to access the model. What am I missing? Ron
Image subclass not getting its model object
Hi, I'm trying to make an image subclass that shows an icon. Which icon it shows depends on its model object, which is a boolean. Problem is, I'm not getting the model object: it's always null. If I use a Label instead of InStockIconImage, it works: the label shows a boolean (true/false). Any idea what could cause this? Thanks, Erwin Here's the icon: public class InStockIconImage extends Image { private static final String PATH_IN_STOCK = in_stock.png; private static final String PATH_NOT_IN_STOCK = not_in_stock.png; private static final String PATH_NO_MODEL_OBJECT = empty.png; public InStockIconImage(String id, IModelBoolean model) { super(id, model); } @Override protected ResourceReference getImageResourceReference() { Boolean inStock = (Boolean) getDefaultModelObject(); String path; if (inStock == null) { path = PATH_NO_MODEL_OBJECT; } else if (inStock) { path = PATH_IN_STOCK; } else { path = PATH_NOT_IN_STOCK; } return new ResourceReference(Icons.class, path); } } Here's how I use it: RefreshingListViewProductListing listingRepeater = new RefreshingListViewProductListing( listing, new PropertyModelSetProductListing(getModel(), listings)) { @Override protected void populateItem(ItemProductListing item) { item.add(new Label(webShop.name)); item.add(new Label(price)); item.add(new InStockIconImage(inStock)); } }; add(listingRepeater); RefreshingListView is a utility class which decorates a normal RefreshingView: public abstract class RefreshingListViewT extends RefreshingViewT { public RefreshingListView(String id) { super(id); } public RefreshingListView(String id, IModel? extends CollectionT model) { super(id, model); } @Override protected IteratorIModelT getItemModels() { CollectionT modelObject = getModelObject(); if (modelObject == null) { modelObject = new ArrayListT(); } return new ModelIteratorAdapterT(modelObject.iterator()) { @Override protected IModelT model(T object) { return new CompoundPropertyModelT(object); } }; } public CollectionT getModelObject() { return getModel().getObject(); } @SuppressWarnings(unchecked) public IModelListT getModel() { return (IModelListT) getDefaultModel(); } } - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Image subclass not getting its model object
Oops, I went a bit too far in pruning non-essential code. InStockIconImage has a second constructor: public InStockIconImage(String id) { super(id); } I think it centers around this. If I pass a PropertyModel(listingModel, inStock) explicitly to the constructor, it works, but not if I depend on the automatic property resolution that works well if I use a Label. How can I get it to work if I don't want to pass a PropertyModel explicitly? Erwin On 6/4/10 9:15 AM, Erwin Bolwidt wrote: Hi, I'm trying to make an image subclass that shows an icon. Which icon it shows depends on its model object, which is a boolean. Problem is, I'm not getting the model object: it's always null. If I use a Label instead of InStockIconImage, it works: the label shows a boolean (true/false). Any idea what could cause this? Thanks, Erwin Here's the icon: public class InStockIconImage extends Image { private static final String PATH_IN_STOCK = in_stock.png; private static final String PATH_NOT_IN_STOCK = not_in_stock.png; private static final String PATH_NO_MODEL_OBJECT = empty.png; public InStockIconImage(String id, IModelBoolean model) { super(id, model); } @Override protected ResourceReference getImageResourceReference() { Boolean inStock = (Boolean) getDefaultModelObject(); String path; if (inStock == null) { path = PATH_NO_MODEL_OBJECT; } else if (inStock) { path = PATH_IN_STOCK; } else { path = PATH_NOT_IN_STOCK; } return new ResourceReference(Icons.class, path); } } Here's how I use it: RefreshingListViewProductListing listingRepeater = new RefreshingListViewProductListing( listing, new PropertyModelSetProductListing(getModel(), listings)) { @Override protected void populateItem(ItemProductListing item) { item.add(new Label(webShop.name)); item.add(new Label(price)); item.add(new InStockIconImage(inStock)); } }; add(listingRepeater); RefreshingListView is a utility class which decorates a normal RefreshingView: public abstract class RefreshingListViewT extends RefreshingViewT { public RefreshingListView(String id) { super(id); } public RefreshingListView(String id, IModel? extends CollectionT model) { super(id, model); } @Override protected IteratorIModelT getItemModels() { CollectionT modelObject = getModelObject(); if (modelObject == null) { modelObject = new ArrayListT(); } return new ModelIteratorAdapterT(modelObject.iterator()) { @Override protected IModelT model(T object) { return new CompoundPropertyModelT(object); } }; } public CollectionT getModelObject() { return getModel().getObject(); } @SuppressWarnings(unchecked) public IModelListT getModel() { return (IModelListT) getDefaultModel(); } } - 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: Image subclass not getting its model object
Maybe this is related to this override on Image class? @Override protected IModel? initModel() { // Images don't support Compound models. They either have a simple // model, explicitly set, or they use their tag's src or value // attribute to determine the image. return null; } Ernesto On Fri, Jun 4, 2010 at 9:30 AM, Erwin Bolwidt ebolw...@worldturner.nl wrote: Oops, I went a bit too far in pruning non-essential code. InStockIconImage has a second constructor: public InStockIconImage(String id) { super(id); } I think it centers around this. If I pass a PropertyModel(listingModel, inStock) explicitly to the constructor, it works, but not if I depend on the automatic property resolution that works well if I use a Label. How can I get it to work if I don't want to pass a PropertyModel explicitly? Erwin On 6/4/10 9:15 AM, Erwin Bolwidt wrote: Hi, I'm trying to make an image subclass that shows an icon. Which icon it shows depends on its model object, which is a boolean. Problem is, I'm not getting the model object: it's always null. If I use a Label instead of InStockIconImage, it works: the label shows a boolean (true/false). Any idea what could cause this? Thanks, Erwin Here's the icon: public class InStockIconImage extends Image { private static final String PATH_IN_STOCK = in_stock.png; private static final String PATH_NOT_IN_STOCK = not_in_stock.png; private static final String PATH_NO_MODEL_OBJECT = empty.png; public InStockIconImage(String id, IModelBoolean model) { super(id, model); } �...@override protected ResourceReference getImageResourceReference() { Boolean inStock = (Boolean) getDefaultModelObject(); String path; if (inStock == null) { path = PATH_NO_MODEL_OBJECT; } else if (inStock) { path = PATH_IN_STOCK; } else { path = PATH_NOT_IN_STOCK; } return new ResourceReference(Icons.class, path); } } Here's how I use it: RefreshingListViewProductListing listingRepeater = new RefreshingListViewProductListing( listing, new PropertyModelSetProductListing(getModel(), listings)) { �...@override protected void populateItem(ItemProductListing item) { item.add(new Label(webShop.name)); item.add(new Label(price)); item.add(new InStockIconImage(inStock)); } }; add(listingRepeater); RefreshingListView is a utility class which decorates a normal RefreshingView: public abstract class RefreshingListViewT extends RefreshingViewT { public RefreshingListView(String id) { super(id); } public RefreshingListView(String id, IModel? extends CollectionT model) { super(id, model); } �...@override protected IteratorIModelT getItemModels() { CollectionT modelObject = getModelObject(); if (modelObject == null) { modelObject = new ArrayListT(); } return new ModelIteratorAdapterT(modelObject.iterator()) { �...@override protected IModelT model(T object) { return new CompoundPropertyModelT(object); } }; } public CollectionT getModelObject() { return getModel().getObject(); } �...@suppresswarnings(unchecked) public IModelListT getModel() { return (IModelListT) getDefaultModel(); } } - 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: Image subclass not getting its model object
Hi Ernesto, Just got the 1.4.9 source code and I see what you mean. But why is it like this? I copied the whole Image source code to a new class, removed this initModel method, and then things work fine if I don't supply a model. Why would the Image component behave different from the other components? This isn't documented in the Javadoc so I didn't expect this, but even then, what is the need for making Image work differently than others like Label? I can think of some usecases where it is fine to display in image that is derived from some property on a domain object that is accessed with a CompoundPropertyModel: - when you have a Boolean (like here) or Enum-type property and you want to change the image depending on its value - when you have want to dynamically generate an image with some text (on top of a template image), the image is much like a label then I can't disable this initModel behavior in a subclass, since you can't call super.super.initModel, so to disable this behavior, I have to copy the whole source of the Image class and remove this method. That seems like waste and you're not benefiting from future improvements in the Image class then. Cheers, Erwin Bolwidt On 6/4/10 9:33 AM, Ernesto Reinaldo Barreiro wrote: Maybe this is related to this override on Image class? @Override protected IModel? initModel() { // Images don't support Compound models. They either have a simple // model, explicitly set, or they use their tag's src or value // attribute to determine the image. return null; } Ernesto On Fri, Jun 4, 2010 at 9:30 AM, Erwin Bolwidtebolw...@worldturner.nl wrote: Oops, I went a bit too far in pruning non-essential code. InStockIconImage has a second constructor: public InStockIconImage(String id) { super(id); } I think it centers around this. If I pass a PropertyModel(listingModel, inStock) explicitly to the constructor, it works, but not if I depend on the automatic property resolution that works well if I use a Label. How can I get it to work if I don't want to pass a PropertyModel explicitly? Erwin On 6/4/10 9:15 AM, Erwin Bolwidt wrote: Hi, I'm trying to make an image subclass that shows an icon. Which icon it shows depends on its model object, which is a boolean. Problem is, I'm not getting the model object: it's always null. If I use a Label instead of InStockIconImage, it works: the label shows a boolean (true/false). Any idea what could cause this? Thanks, Erwin Here's the icon: public class InStockIconImage extends Image { private static final String PATH_IN_STOCK = in_stock.png; private static final String PATH_NOT_IN_STOCK = not_in_stock.png; private static final String PATH_NO_MODEL_OBJECT = empty.png; public InStockIconImage(String id, IModelBoolean model) { super(id, model); } @Override protected ResourceReference getImageResourceReference() { Boolean inStock = (Boolean) getDefaultModelObject(); String path; if (inStock == null) { path = PATH_NO_MODEL_OBJECT; } else if (inStock) { path = PATH_IN_STOCK; } else { path = PATH_NOT_IN_STOCK; } return new ResourceReference(Icons.class, path); } } Here's how I use it: RefreshingListViewProductListing listingRepeater = new RefreshingListViewProductListing( listing, new PropertyModelSetProductListing(getModel(), listings)) { @Override protected void populateItem(ItemProductListing item) { item.add(new Label(webShop.name)); item.add(new Label(price)); item.add(new InStockIconImage(inStock)); } }; add(listingRepeater); RefreshingListView is a utility class which decorates a normal RefreshingView: public abstract class RefreshingListViewT extends RefreshingViewT { public RefreshingListView(String id) { super(id); } public RefreshingListView(String id, IModel? extends CollectionT model) { super(id, model); } @Override protected IteratorIModelT getItemModels() { CollectionT modelObject = getModelObject(); if (modelObject == null) { modelObject = new ArrayListT(); } return new ModelIteratorAdapterT(modelObject.iterator()) { @Override protected IModelT model(T object) { return new CompoundPropertyModelT(object); } }; } public CollectionT getModelObject() { return getModel().getObject(); } @SuppressWarnings(unchecked) public IModelListT getModel() { return (IModelListT) getDefaultModel(); } } - To unsubscribe, e-mail: users-unsubscr
Re: Image subclass not getting its model object
I would say you need to use your own image resource, not subclass Image itself. On Fri, Jun 4, 2010 at 7:03 AM, Erwin Bolwidt ebolw...@worldturner.nl wrote: Hi Ernesto, Just got the 1.4.9 source code and I see what you mean. But why is it like this? I copied the whole Image source code to a new class, removed this initModel method, and then things work fine if I don't supply a model. Why would the Image component behave different from the other components? This isn't documented in the Javadoc so I didn't expect this, but even then, what is the need for making Image work differently than others like Label? I can think of some usecases where it is fine to display in image that is derived from some property on a domain object that is accessed with a CompoundPropertyModel: - when you have a Boolean (like here) or Enum-type property and you want to change the image depending on its value - when you have want to dynamically generate an image with some text (on top of a template image), the image is much like a label then I can't disable this initModel behavior in a subclass, since you can't call super.super.initModel, so to disable this behavior, I have to copy the whole source of the Image class and remove this method. That seems like waste and you're not benefiting from future improvements in the Image class then. Cheers, Erwin Bolwidt On 6/4/10 9:33 AM, Ernesto Reinaldo Barreiro wrote: Maybe this is related to this override on Image class? @Override protected IModel? initModel() { // Images don't support Compound models. They either have a simple // model, explicitly set, or they use their tag's src or value // attribute to determine the image. return null; } Ernesto On Fri, Jun 4, 2010 at 9:30 AM, Erwin Bolwidtebolw...@worldturner.nl wrote: Oops, I went a bit too far in pruning non-essential code. InStockIconImage has a second constructor: public InStockIconImage(String id) { super(id); } I think it centers around this. If I pass a PropertyModel(listingModel, inStock) explicitly to the constructor, it works, but not if I depend on the automatic property resolution that works well if I use a Label. How can I get it to work if I don't want to pass a PropertyModel explicitly? Erwin On 6/4/10 9:15 AM, Erwin Bolwidt wrote: Hi, I'm trying to make an image subclass that shows an icon. Which icon it shows depends on its model object, which is a boolean. Problem is, I'm not getting the model object: it's always null. If I use a Label instead of InStockIconImage, it works: the label shows a boolean (true/false). Any idea what could cause this? Thanks, Erwin Here's the icon: public class InStockIconImage extends Image { private static final String PATH_IN_STOCK = in_stock.png; private static final String PATH_NOT_IN_STOCK = not_in_stock.png; private static final String PATH_NO_MODEL_OBJECT = empty.png; public InStockIconImage(String id, IModelBoolean model) { super(id, model); } �...@override protected ResourceReference getImageResourceReference() { Boolean inStock = (Boolean) getDefaultModelObject(); String path; if (inStock == null) { path = PATH_NO_MODEL_OBJECT; } else if (inStock) { path = PATH_IN_STOCK; } else { path = PATH_NOT_IN_STOCK; } return new ResourceReference(Icons.class, path); } } Here's how I use it: RefreshingListViewProductListing listingRepeater = new RefreshingListViewProductListing( listing, new PropertyModelSetProductListing(getModel(), listings)) { �...@override protected void populateItem(ItemProductListing item) { item.add(new Label(webShop.name)); item.add(new Label(price)); item.add(new InStockIconImage(inStock)); } }; add(listingRepeater); RefreshingListView is a utility class which decorates a normal RefreshingView: public abstract class RefreshingListViewT extends RefreshingViewT { public RefreshingListView(String id) { super(id); } public RefreshingListView(String id, IModel? extends CollectionT model) { super(id, model); } �...@override protected IteratorIModelT getItemModels() { CollectionT modelObject = getModelObject(); if (modelObject == null) { modelObject = new ArrayListT(); } return new ModelIteratorAdapterT(modelObject.iterator()) { �...@override protected IModelT model(T object) { return new CompoundPropertyModelT(object); } }; } public CollectionT getModelObject() { return getModel().getObject(); } �...@suppresswarnings(unchecked) public
Re: Image subclass not getting its model object
Hi Erwin, On Fri, Jun 4, 2010 at 1:03 PM, Erwin Bolwidt ebolw...@worldturner.nl wrote: Hi Ernesto, Just got the 1.4.9 source code and I see what you mean. As a rule I always install the source code of any OpenSouce software I use: Javadoc could be wrong or outdated but source code will never mislead you;-) But why is it like this? I copied the whole Image source code to a new class, removed this initModel method, and then things work fine if I don't supply a model. Sorry Erwin but i don't know why this decision was taken... I just did the same as you did: look into the source code and figured out this was the reason. Maybe some of the core developers can comment on this? Or if you think your use case is a valid one just file a RFE on wicket site. Best, Ernesto - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org