You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Tommy Sadiq Hinrichsen <to...@gmail.com> on 2013/07/19 10:13:48 UTC
StringResourceModel object value = null
Hey
I'm using a Stringresourcemodel to display a custom message label. Its
constructed like this.
new Label("maxAmount", new
StringResourceModel("bookkeeping.amount.to.move",null, new Object[]{
new PropertyModel(this, "valueReport.lastValuationDate"),
new PropertyModel(this, "valueReport.totalValueLocal"),
new
PropertyModel(getCurrentSelections().getSelectedLegalEntity(),
"bookkeepingCurrency")
})));
With the following entry in a property file
bookkeeping.amount.to.move=Booked value per {0,date} is {1,number,###.##}
{2}
My problem is that the valuereport object is not populated before the user
makes a choice on the page. So my label is showing like this
Booked value per null is null DKK
When i try to use "" as default value in the constructor i get a conversion
error.
Caused by: java.lang.IllegalArgumentException: Cannot format given Object
as a Date
Anybody got any ideas?
Med venlig hilsen / Best regards
Tommy Sadiq Hinrichsen
Re: StringResourceModel object value = null
Posted by Sven Meier <sv...@meiers.net>.
Hi,
it's java.text.MessageFormat which renders null parameters as 'null'.
I'd suggest you use a custom model that uses two different
StringResourceModels depending on the present parameters.
Sven
On 07/19/2013 10:13 AM, Tommy Sadiq Hinrichsen wrote:
> Hey
>
> I'm using a Stringresourcemodel to display a custom message label. Its
> constructed like this.
>
> new Label("maxAmount", new
> StringResourceModel("bookkeeping.amount.to.move",null, new Object[]{
> new PropertyModel(this, "valueReport.lastValuationDate"),
> new PropertyModel(this, "valueReport.totalValueLocal"),
> new
> PropertyModel(getCurrentSelections().getSelectedLegalEntity(),
> "bookkeepingCurrency")
> })));
>
> With the following entry in a property file
>
> bookkeeping.amount.to.move=Booked value per {0,date} is {1,number,###.##}
> {2}
>
> My problem is that the valuereport object is not populated before the user
> makes a choice on the page. So my label is showing like this
>
> Booked value per null is null DKK
>
> When i try to use "" as default value in the constructor i get a conversion
> error.
> Caused by: java.lang.IllegalArgumentException: Cannot format given Object
> as a Date
>
> Anybody got any ideas?
>
> Med venlig hilsen / Best regards
>
> Tommy Sadiq Hinrichsen
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org