Quantcast

getString, Label -> Warn

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

getString, Label -> Warn

Fabien D.
Hi everybody,


If I use this code :

                BookmarkablePageLink lien_accueil = new BookmarkablePageLink("accueil", HomePage.class);
                Label labelLinkAccueil = new Label ("name",getString("LabelLinkAccueil"));
                labelLinkAccueil.setEscapeModelStrings(false);
                lien_accueil.add(labelLinkAccueil);
                lien_accueil.setVisible(true);
                add(lien_accueil);

In my log file, I have this warning :
(Localizer.java:188) - 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 = panelmenu, page = <No Page>, path = panelmenu.PanelMenu]]


Wicket doesn't like to use the constructor of a label and getString()....

How cant I resolve this warning and use getString with new Label


Thank you in advance
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: getString, Label -> Warn

Mr Mean
Make a model that does the getString in the getObject and give that
model to your label.

Maurice

On Mon, Jun 2, 2008 at 2:15 PM, Fabien D. <[hidden email]> wrote:

>
> Hi everybody,
>
>
> If I use this code :
>
>                BookmarkablePageLink lien_accueil = new BookmarkablePageLink("accueil",
> HomePage.class);
>                Label labelLinkAccueil = new Label ("name",getString("LabelLinkAccueil"));
>                labelLinkAccueil.setEscapeModelStrings(false);
>                lien_accueil.add(labelLinkAccueil);
>                lien_accueil.setVisible(true);
>                add(lien_accueil);
>
> In my log file, I have this warning :
> (Localizer.java:188) - 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 = panelmenu, page = <No Page>,
> path = panelmenu.PanelMenu]]
>
>
> Wicket doesn't like to use the constructor of a label and getString()....
>
> How cant I resolve this warning and use getString with new Label
>
>
> Thank you in advance
> --
> View this message in context: http://www.nabble.com/getString%2C-Label--%3E-Warn-tp17599949p17599949.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: getString, Label -> Warn

James Carman
In reply to this post by Fabien D.
It's not telling you that you can't use it as a constructor param.
It's telling you that you're trying to use it during the constructor
code of your PanelMenu class.  So, either move that code to
onBeforeRender or use a ResourceModel for your label.

On Mon, Jun 2, 2008 at 8:15 AM, Fabien D. <[hidden email]> wrote:

>
> Hi everybody,
>
>
> If I use this code :
>
>                BookmarkablePageLink lien_accueil = new BookmarkablePageLink("accueil",
> HomePage.class);
>                Label labelLinkAccueil = new Label ("name",getString("LabelLinkAccueil"));
>                labelLinkAccueil.setEscapeModelStrings(false);
>                lien_accueil.add(labelLinkAccueil);
>                lien_accueil.setVisible(true);
>                add(lien_accueil);
>
> In my log file, I have this warning :
> (Localizer.java:188) - 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 = panelmenu, page = <No Page>,
> path = panelmenu.PanelMenu]]
>
>
> Wicket doesn't like to use the constructor of a label and getString()....
>
> How cant I resolve this warning and use getString with new Label
>
>
> Thank you in advance
> --
> View this message in context: http://www.nabble.com/getString%2C-Label--%3E-Warn-tp17599949p17599949.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: getString, Label -> Warn

Fabien D.
In reply to this post by Mr Mean
I have tried, but I have the same warning
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: getString, Label -> Warn

James Carman
You tried what?  Moving the code to onBeforeRender() or using ResourceModel?

On Mon, Jun 2, 2008 at 8:33 AM, Fabien D. <[hidden email]> wrote:

>
> I have tried, but I have the same warning
> --
> View this message in context: http://www.nabble.com/getString%2C-Label--%3E-Warn-tp17599949p17600229.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: getString, Label -> Warn

Erik van Oosten
In reply to this post by Fabien D.
Do this instead:

BookmarkablePageLink lien_accueil = new BookmarkablePageLink("accueil", HomePage.class);
Label labelLinkAccueil = new Label ("name",new ResourceModel("LabelLinkAccueil"));


Regards,
    Erik.


Fabien D. wrote:

> Hi everybody,
>
>
> If I use this code :
>
> BookmarkablePageLink lien_accueil = new BookmarkablePageLink("accueil",
> HomePage.class);
> Label labelLinkAccueil = new Label ("name",getString("LabelLinkAccueil"));
> labelLinkAccueil.setEscapeModelStrings(false);
> lien_accueil.add(labelLinkAccueil);
> lien_accueil.setVisible(true);
> add(lien_accueil);
>
> In my log file, I have this warning :
> (Localizer.java:188) - 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 = panelmenu, page = <No Page>,
> path = panelmenu.PanelMenu]]
>
>
> Wicket doesn't like to use the constructor of a label and getString()....
>
> How cant I resolve this warning and use getString with new Label
>
>
> Thank you in advance
>  

--
Erik van Oosten
http://day-to-day-stuff.blogspot.com/



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: getString, Label -> Warn

Fabien D.
In reply to this post by James Carman
To use model and label ... I will try RessourceModel now


Thank you for your help
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: getString, Label -> Warn

James Carman
No problem.  Erik gave you exactly what you need.

On Mon, Jun 2, 2008 at 10:14 AM, Fabien D. <[hidden email]> wrote:

>
> To use model and label ... I will try RessourceModel now
>
>
> Thank you for your help
> --
> View this message in context: http://www.nabble.com/getString%2C-Label--%3E-Warn-tp17599949p17602329.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: getString, Label -> Warn

Fabien D.
In reply to this post by Erik van Oosten
With the ModelRessource, it's working, thank you :) :)
Loading...