You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by DCarr <li...@gmail.com> on 2010/02/26 01:13:38 UTC
Localized PropertyTreeColumn header string
Hi,
Is there a recommended way to set the header string in a
PropertyTreeColumn when that string should come from a resource file?
It doesn't take a model, so the load cannot be deferred until later;
using getLocalizer().getString(...) results in:
-WARN::org.apache.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 = panel]]
That is only a warning, but I'd prefer to not have any warnings in
production code.
There does not appear to be a way to set the column header value after
the column (or the TreeTable the column is in) has been constructed.
The TreeTable has to be added, or Wicket complains about
Unable to find component with id 'xxxxx' in [MarkupContainer [Component id = panel]].
but I don't think TreeTable can be constructed without the column
definitions (i.e. construct a TreeTable placeholder, and then fill in
the column details later).
Thanks,
Doug.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Localized PropertyTreeColumn header string
Posted by DCarr <li...@gmail.com>.
Doh! Found it - didn't dig deep enough. Thanks!
So the string that is required in the constructor is simply ignored if I
supply an overridden newHeader - it looks like I should be able to use
'null' there without ill effects. I'm curious though: is there a reason
why the constructor wouldn't take an IModel<String> to supply the data
for the default implementation which uses a Label as the column header
Component?
Thanks,
Doug.
Igor Vaynberg wrote:
> all you had to do was look at the source. its not that difficult to do...
>
> new propertytreecolumn(...) {
> public component newhreader(parent, id) {
> label l=super.newheader(parent,id);
> l.setdefaultmodelobject(getstring(l.getdefaultmodelobjectasstring());
> }
> }
>
> -igor
>
> On Sat, Feb 27, 2010 at 5:47 AM, DCarr <li...@gmail.com> wrote:
>
>> Anyone have any hints/tips/wiki page references, or are column headers
>> really not internationalizable?
>>
>> Thanks,
>> Doug.
>>
>> DCarr wrote:
>>
>>> Hi,
>>>
>>> Is there a recommended way to set the header string in a
>>> PropertyTreeColumn when that string should come from a resource file? It
>>> doesn't take a model, so the load cannot be deferred until later; using
>>> getLocalizer().getString(...) results in:
>>>
>>> -WARN::org.apache.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 = panel]]
>>>
>>> That is only a warning, but I'd prefer to not have any warnings in
>>> production code.
>>> There does not appear to be a way to set the column header value after the
>>> column (or the TreeTable the column is in) has been constructed. The
>>> TreeTable has to be added, or Wicket complains about
>>>
>>> Unable to find component with id 'xxxxx' in [MarkupContainer [Component id
>>> = panel]].
>>>
>>> but I don't think TreeTable can be constructed without the column
>>> definitions (i.e. construct a TreeTable placeholder, and then fill in the
>>> column details later).
>>>
>>> Thanks,
>>> Doug.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>>
>
> ---------------------------------------------------------------------
> 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: Localized PropertyTreeColumn header string
Posted by Igor Vaynberg <ig...@gmail.com>.
all you had to do was look at the source. its not that difficult to do...
new propertytreecolumn(...) {
public component newhreader(parent, id) {
label l=super.newheader(parent,id);
l.setdefaultmodelobject(getstring(l.getdefaultmodelobjectasstring());
}
}
-igor
On Sat, Feb 27, 2010 at 5:47 AM, DCarr <li...@gmail.com> wrote:
> Anyone have any hints/tips/wiki page references, or are column headers
> really not internationalizable?
>
> Thanks,
> Doug.
>
> DCarr wrote:
>>
>> Hi,
>>
>> Is there a recommended way to set the header string in a
>> PropertyTreeColumn when that string should come from a resource file? It
>> doesn't take a model, so the load cannot be deferred until later; using
>> getLocalizer().getString(...) results in:
>>
>> -WARN::org.apache.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 = panel]]
>>
>> That is only a warning, but I'd prefer to not have any warnings in
>> production code.
>> There does not appear to be a way to set the column header value after the
>> column (or the TreeTable the column is in) has been constructed. The
>> TreeTable has to be added, or Wicket complains about
>>
>> Unable to find component with id 'xxxxx' in [MarkupContainer [Component id
>> = panel]].
>>
>> but I don't think TreeTable can be constructed without the column
>> definitions (i.e. construct a TreeTable placeholder, and then fill in the
>> column details later).
>>
>> Thanks,
>> Doug.
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Localized PropertyTreeColumn header string
Posted by DCarr <li...@gmail.com>.
Anyone have any hints/tips/wiki page references, or are column headers
really not internationalizable?
Thanks,
Doug.
DCarr wrote:
> Hi,
>
> Is there a recommended way to set the header string in a
> PropertyTreeColumn when that string should come from a resource file?
> It doesn't take a model, so the load cannot be deferred until later;
> using getLocalizer().getString(...) results in:
>
> -WARN::org.apache.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 = panel]]
>
> That is only a warning, but I'd prefer to not have any warnings in
> production code.
> There does not appear to be a way to set the column header value after
> the column (or the TreeTable the column is in) has been constructed.
> The TreeTable has to be added, or Wicket complains about
>
> Unable to find component with id 'xxxxx' in [MarkupContainer
> [Component id = panel]].
>
> but I don't think TreeTable can be constructed without the column
> definitions (i.e. construct a TreeTable placeholder, and then fill in
> the column details later).
>
> Thanks,
> Doug.
>
>
> ---------------------------------------------------------------------
> 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