Here is another more complex case:
LinkSelection.properties:
edit_label=Edit
done_label=Hide Edit...
linkId=toggle_link_{id}
onclick=toggleEdit('{id}'); return(false);
divId=toggle_div_{id}
LinkSelection.java has the following in the constructor:
@Override
protected void populateItem(ListItem item) {
bk = (BkItemI)item.getModelObject();
// 1. the edit icon
Label editLink = new Label ("edit_item_link",
( isEditBk(bk)
? new ResourceModel ("done_label")
: new ResourceModel ("edit_label")))
{
@Override
protected void onBeforeRender()
{
setOutputMarkupId(true);
setMarkupId (getLocalizer().getString
("linkIdPrefix", LinkSelection.this,
new PropertyModel (LinkSelection.this.bk, "id")));
add (new SimpleAttributeModifier
("onclick", getLocalizer().getString
("onclick", LinkSelection.this,
new PropertyModel (LinkSelection.this.bk, "id"))));
super.onBeforeRender();
}
};
item.add (editLink);
...
ERROR 29 11:58:24.086 Error attaching this container for rendering:
[MarkupContainer [Component id = 0]] [o.a.w.RequestCycle]
org.apache.wicket.WicketRuntimeException: Error attaching this container for
rendering: [MarkupContainer [Component id = 0]]
at
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1717)
at org.apache.wicket.Component.onBeforeRender(Component.java:3757)
igor.vaynberg wrote:
>
> set it in onbeforerender
>
> -igor
>
> On Fri, Jun 26, 2009 at 2:03 PM, OjO<[email protected]> wrote:
>>
>> I am using the following:
>> myCom.setMarkupId (getLocalizer().getString ("handle", MyPanel.this, new
>> Model (handleId)));
>>
>> but still getting WARNing:
>>
>> 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.
>>
>> What would be the correct way to get a property resource when a String
>> value
>> is needed?
>> --
>> View this message in context:
>> http://www.nabble.com/localizer-and-variables-tp16548684p24227247.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
>
--
View this message in context:
http://www.nabble.com/localizer-and-variables-tp16548684p24259437.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]