You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Anton Veretennikov <an...@gmail.com> on 2009/02/15 12:47:35 UTC

ComponentPropertyModel inside some border

Hello, Wicket users,

Please, help me to find the difference between theese two
ComponentPropertyModel's (inside some Panel):

add(new Label("currencyPayed", new
ComponentPropertyModel<String>("currentPriceSumCurrency")));

and this (inside some border):

border.add(new Label("currencyPayed", new
ComponentPropertyModel<String>("currentPriceSumCurrency")));



I ask because the second one brings me to this exception:

WicketMessage: Exception in rendering component: [Component id = currencyPayed]

Root cause:

java.lang.NullPointerException
at org.apache.wicket.model.ComponentPropertyModel$AssignmentWrapper.getObject(ComponentPropertyModel.java:105)
at org.apache.wicket.Component.getDefaultModelObject(Component.java:1627)
at org.apache.wicket.Component.getDefaultModelObjectAsString(Component.java:1649)
at org.apache.wicket.markup.html.basic.Label.onComponentTagBody(Label.java:114)
at org.apache.wicket.Component.renderComponent(Component.java:2596)
at org.apache.wicket.markup.html.WebComponent.onRender(WebComponent.java:62)
at org.apache.wicket.Component.render(Component.java:2421)
at org.apache.wicket.markup.html.border.Border$BorderBodyContainer.resolve(Border.java:398)


Thank you!

-- Tony

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: ComponentPropertyModel inside some border

Posted by Anton Veretennikov <an...@gmail.com>.
Okey, I found it. Model object must be passed to Border's constructor.

I want to ask, please, add short example in javadoc in
ComponentPropertyModel class code like:

For example:

If you write this:
   someComponent.add(new Label("id", new
ComponentPropertyModel<String>("name")));
then "name" will be taken from someComponent's model object with
"name" property.

I attached quickstart if someone also will find it difficult to grasp
at first time.

-- Tony.

P.S. Here Igor would say "That is why I ask to make quickstart every 3
messages."


On Sun, Feb 15, 2009 at 6:47 PM, Anton Veretennikov
<an...@gmail.com> wrote:
> Hello, Wicket users,
>
> Please, help me to find the difference between theese two
> ComponentPropertyModel's (inside some Panel):
>
> add(new Label("currencyPayed", new
> ComponentPropertyModel<String>("currentPriceSumCurrency")));
>
> and this (inside some border):
>
> border.add(new Label("currencyPayed", new
> ComponentPropertyModel<String>("currentPriceSumCurrency")));
>
>
>
> I ask because the second one brings me to this exception:
>
> WicketMessage: Exception in rendering component: [Component id = currencyPayed]
>
> Root cause:
>
> java.lang.NullPointerException
> at org.apache.wicket.model.ComponentPropertyModel$AssignmentWrapper.getObject(ComponentPropertyModel.java:105)
> at org.apache.wicket.Component.getDefaultModelObject(Component.java:1627)
> at org.apache.wicket.Component.getDefaultModelObjectAsString(Component.java:1649)
> at org.apache.wicket.markup.html.basic.Label.onComponentTagBody(Label.java:114)
> at org.apache.wicket.Component.renderComponent(Component.java:2596)
> at org.apache.wicket.markup.html.WebComponent.onRender(WebComponent.java:62)
> at org.apache.wicket.Component.render(Component.java:2421)
> at org.apache.wicket.markup.html.border.Border$BorderBodyContainer.resolve(Border.java:398)
>
>
> Thank you!
>
> -- Tony
>