Re: Panel/Localizer issue

2007-08-29 Thread Johan Compagner
i changed it on 2 places.

On 8/29/07, Johan Compagner [EMAIL PROTECTED] wrote:

 yes that should also be lazy through a model
 can you create an jira issue ? (with a patch if possible)

 On 8/29/07, Edvin Syse  [EMAIL PROTECTED] wrote:
 
  I have found that when I create a new Palette with the constructor:
 
  (String id, IModel model, IModel choicesModel, IChoiceRenderer
  choiceRenderer, int rows, boolean allowOrder)
 
  .. it calls add(newAvailableHeader(AVAILABLE_HEADER_ID)) in the
  constructor, which in turn does a:
 
  new Label(componentId, getString(palette.available, null,
  Available));
 
  This gives the same error message, since the Palette is not added to the
  page yet.
 
  Should this be rewritten to
 
  new Label(componentId, new ResourceModel(palette.available));
 
  or something instead or am I missing something?
 
  -- Edvin
 
 
  Edvin Syse wrote:
   Thank you!
  
   That both solved the problem and made my code cleaner :)
  
   -- Edvin
  
   Matej Knopp wrote:
   You should use ResourceModel for this, it does the
  localization/message
   lookup for you.
  
   -Matej
  
   On 8/28/07, Edvin Syse  [EMAIL PROTECTED] wrote:
   Hi,
  
   When I instantiate a Panel that does getLocalizer().getString() in
  the
   constructor, I obviously get the errormessage:
  
   WARN  [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 = idHere, page = No
  Page,
   path = path-here]]
  
   This is understandable, since I haven't added the component to a
  page
   before the constructor is run.
  
   In the constructor, I do things like:
  
   add(new Label(articleTitle, new
   Model(getLocalizer().getString(articleTitle, this;
  
   and:
  
   deleteLink.add(new
   ConfirmBehaviour(getLocalizer().getString(confirmDelete, this)));
  
   Is there a way to create the panel and give it a page-instance
  directly,
   or how should I get around this the wicket way?
  
   I use 1.3-SNAPSHOT, btw.
  
   -- Edvin
  
  
  -
   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]
  
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 



Re: Panel/Localizer issue

2007-08-28 Thread Matej Knopp
You should use ResourceModel for this, it does the localization/message
lookup for you.

-Matej

On 8/28/07, Edvin Syse [EMAIL PROTECTED] wrote:

 Hi,

 When I instantiate a Panel that does getLocalizer().getString() in the
 constructor, I obviously get the errormessage:

 WARN  [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 = idHere, page = No Page,
 path = path-here]]

 This is understandable, since I haven't added the component to a page
 before the constructor is run.

 In the constructor, I do things like:

 add(new Label(articleTitle, new
 Model(getLocalizer().getString(articleTitle, this;

 and:

 deleteLink.add(new
 ConfirmBehaviour(getLocalizer().getString(confirmDelete, this)));

 Is there a way to create the panel and give it a page-instance directly,
 or how should I get around this the wicket way?

 I use 1.3-SNAPSHOT, btw.

 -- Edvin

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: Panel/Localizer issue

2007-08-28 Thread Edvin Syse

Thank you!

That both solved the problem and made my code cleaner :)

-- Edvin

Matej Knopp wrote:

You should use ResourceModel for this, it does the localization/message
lookup for you.

-Matej

On 8/28/07, Edvin Syse [EMAIL PROTECTED] wrote:

Hi,

When I instantiate a Panel that does getLocalizer().getString() in the
constructor, I obviously get the errormessage:

WARN  [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 = idHere, page = No Page,
path = path-here]]

This is understandable, since I haven't added the component to a page
before the constructor is run.

In the constructor, I do things like:

add(new Label(articleTitle, new
Model(getLocalizer().getString(articleTitle, this;

and:

deleteLink.add(new
ConfirmBehaviour(getLocalizer().getString(confirmDelete, this)));

Is there a way to create the panel and give it a page-instance directly,
or how should I get around this the wicket way?

I use 1.3-SNAPSHOT, btw.

-- Edvin

-
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]