Use StringResourceModel.

2008/11/13 Anders <[EMAIL PROTECTED]>

> Hi,
>
> I writed my own wicket panel component, and this component contains a
> label.
> I use Component's getString() to set label's model, like:
>
>  *//constructor*
> *  public InvoiceWaferDataSetPanel(String id, InvoiceWaferDataSet dataSet)
>  {
>    super(id);
>    setModel(new CompoundPropertyModel(dataSet));
> ...
>    add(new Label("subTotal", getString("subTotal")).add(new
> AttributeModifier("style", true, new Model(dataSet.getSize() >
> 1?"":"display:none"))));
> ...
>  }*
>
> but below is warning message from wicket:
>
> *[Localizer] Tried to retrieve a localized string for a component that has
> not yet been added to the page. This can sometimes lead to an invalid or no
> localized resource returned. Make sure you are not calling
> Component#getString() inside your Component's constructor. Offending
> component: [MarkupContainer [Component id = dataSet, page = <No Page>, path
> = dataSet.InvoiceWaferDataSetPanel]]*
>
> I defined I18N string in application properties file, like:
> subTotal = Sub Total
>
> Can anyone tell me how to solve this problem?
>
> --
> −−−−−−−−−−−−−−−−−−
> ~Mia は 最高!~
> −−−−−−−−−−−−−−−−−−
>



-- 
Jeremy Thomerson
http://www.wickettraining.com

Reply via email to