Re: [Wicket-user] question on localization

2007-04-27 Thread Vadim Tesis
Thank you all for your help.  it worked.

Igor,

do you mean that getPageTitle() virtual method of subclass will be called 
from constructor of the base class?  but in the implementation below it 
doesn't reference any members of subclass, it simply creates new 
ResourceModel object.  am i missing something?
and in the fix you suggested pagetitlemodel.getObject() will be called when 
subclass page will be rendered, that is after subclass is constructed.  is 
this correct?

Vadim



From: Igor Vaynberg [EMAIL PROTECTED]
Reply-To: wicket-user@lists.sourceforge.net
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] question on localization
Date: Tue, 24 Apr 2007 11:00:05 -0700

this is bad. getpagetitle() might get called from a partially constructed
object

it should be

public BasePage() {
add(new Label(pageHeaderTitle, new pagetitlemodel()));
}

private class pagetitlemodel extends abstractreadonlymodel {
object getobject() { return getpagetitle().getobject(); }
void detach() { getpagetitle().detach(); }
 }

-igor

On 4/24/07, John Krasnay [EMAIL PROTECTED] wrote:

You might want to make it so you can dynamically generate a page title
where you need to, instead of always requiring a static page title. The
trick is to return an IModel from the getPageTitle method in your base
page. Here's how I've done it:

title wicket:id=pageHeaderTitleFoo/title

public class BasePage extends WebPage {

 public BasePage() {
 add(new Label(pageHeaderTitle, getPageTitle()));
 }

 public IModel getPageTitle() {
 return new ResourceModel(page.title);
 }
}

jk

On Tue, Apr 24, 2007 at 10:33:54AM +0900, David Leangen wrote:
   i tried to use Label() with PropertyModel(pageTitle) but didn't 
work
for
   me.  it rendered Home string all the time, no matter what the 
locale
was.
   any ideas how to do this?
 
  You can do something like this:
 
  new Label( componentId, new StringResourceModel( pageTitle, this, new
  Model() ) );
 
  In your properties file:
  pageTitle=Home
 
  In your html:
  span wicket:id=componentIdDummy text/span
 
 
  Look for StringResourceModel in ProWicket or in the API docs.
 
 
  HTH
  Dave
 
 
 
 
 
-
  This SF.net email is sponsored by DB2 Express
  Download DB2 Express C - the FREE version of DB2 express and take
  control of your XML. No limits. Just data. Click to get it now.
  http://sourceforge.net/powerbar/db2/
  ___
  Wicket-user mailing list
  Wicket-user@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/wicket-user

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user



-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/


___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

_
Exercise your brain! Try Flexicon. 
http://games.msn.com/en/flexicon/default.htm?icid=flexicon_hmemailtaglineapril07


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] question on localization

2007-04-27 Thread Igor Vaynberg

in the current implementation sure, its fine.

but what if later down the road you do override it in some subclass and
depend on something? its just not a good practice because it is error prone.

-igor


On 4/27/07, Vadim Tesis [EMAIL PROTECTED] wrote:


Thank you all for your help.  it worked.

Igor,

do you mean that getPageTitle() virtual method of subclass will be called
from constructor of the base class?  but in the implementation below it
doesn't reference any members of subclass, it simply creates new
ResourceModel object.  am i missing something?
and in the fix you suggested pagetitlemodel.getObject() will be called
when
subclass page will be rendered, that is after subclass is constructed.  is
this correct?

Vadim



From: Igor Vaynberg [EMAIL PROTECTED]
Reply-To: wicket-user@lists.sourceforge.net
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] question on localization
Date: Tue, 24 Apr 2007 11:00:05 -0700

this is bad. getpagetitle() might get called from a partially constructed
object

it should be

public BasePage() {
add(new Label(pageHeaderTitle, new pagetitlemodel()));
}

private class pagetitlemodel extends abstractreadonlymodel {
object getobject() { return getpagetitle().getobject(); }
void detach() { getpagetitle().detach(); }
 }

-igor

On 4/24/07, John Krasnay [EMAIL PROTECTED] wrote:

You might want to make it so you can dynamically generate a page title
where you need to, instead of always requiring a static page title. The
trick is to return an IModel from the getPageTitle method in your base
page. Here's how I've done it:

title wicket:id=pageHeaderTitleFoo/title

public class BasePage extends WebPage {

 public BasePage() {
 add(new Label(pageHeaderTitle, getPageTitle()));
 }

 public IModel getPageTitle() {
 return new ResourceModel(page.title);
 }
}

jk

On Tue, Apr 24, 2007 at 10:33:54AM +0900, David Leangen wrote:
   i tried to use Label() with PropertyModel(pageTitle) but didn't
work
for
   me.  it rendered Home string all the time, no matter what the
locale
was.
   any ideas how to do this?
 
  You can do something like this:
 
  new Label( componentId, new StringResourceModel( pageTitle, this,
new
  Model() ) );
 
  In your properties file:
  pageTitle=Home
 
  In your html:
  span wicket:id=componentIdDummy text/span
 
 
  Look for StringResourceModel in ProWicket or in the API docs.
 
 
  HTH
  Dave
 
 
 
 
 

-
  This SF.net email is sponsored by DB2 Express
  Download DB2 Express C - the FREE version of DB2 express and take
  control of your XML. No limits. Just data. Click to get it now.
  http://sourceforge.net/powerbar/db2/
  ___
  Wicket-user mailing list
  Wicket-user@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/wicket-user


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user



-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/


___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

_
Exercise your brain! Try Flexicon.

http://games.msn.com/en/flexicon/default.htm?icid=flexicon_hmemailtaglineapril07


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] question on localization

2007-04-24 Thread John Krasnay
You might want to make it so you can dynamically generate a page title
where you need to, instead of always requiring a static page title. The
trick is to return an IModel from the getPageTitle method in your base
page. Here's how I've done it:

title wicket:id=pageHeaderTitleFoo/title

public class BasePage extends WebPage {

public BasePage() {
add(new Label(pageHeaderTitle, getPageTitle()));
}

public IModel getPageTitle() {
return new ResourceModel(page.title);
}
}

jk

On Tue, Apr 24, 2007 at 10:33:54AM +0900, David Leangen wrote:
  i tried to use Label() with PropertyModel(pageTitle) but didn't work for 
  me.  it rendered Home string all the time, no matter what the locale was.
  any ideas how to do this?
 
 You can do something like this:
 
 new Label( componentId, new StringResourceModel( pageTitle, this, new
 Model() ) );
 
 In your properties file:
 pageTitle=Home
 
 In your html:
 span wicket:id=componentIdDummy text/span
 
 
 Look for StringResourceModel in ProWicket or in the API docs.
 
 
 HTH
 Dave
 
 
 
 
 -
 This SF.net email is sponsored by DB2 Express
 Download DB2 Express C - the FREE version of DB2 express and take
 control of your XML. No limits. Just data. Click to get it now.
 http://sourceforge.net/powerbar/db2/
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] question on localization

2007-04-24 Thread Igor Vaynberg

this is bad. getpagetitle() might get called from a partially constructed
object

it should be

   public BasePage() {
   add(new Label(pageHeaderTitle, new pagetitlemodel()));
   }

   private class pagetitlemodel extends abstractreadonlymodel {
   object getobject() { return getpagetitle().getobject(); }
   void detach() { getpagetitle().detach(); }
}

-igor

On 4/24/07, John Krasnay [EMAIL PROTECTED] wrote:


You might want to make it so you can dynamically generate a page title
where you need to, instead of always requiring a static page title. The
trick is to return an IModel from the getPageTitle method in your base
page. Here's how I've done it:

title wicket:id=pageHeaderTitleFoo/title

public class BasePage extends WebPage {

public BasePage() {
add(new Label(pageHeaderTitle, getPageTitle()));
}

public IModel getPageTitle() {
return new ResourceModel(page.title);
}
}

jk

On Tue, Apr 24, 2007 at 10:33:54AM +0900, David Leangen wrote:
  i tried to use Label() with PropertyModel(pageTitle) but didn't work
for
  me.  it rendered Home string all the time, no matter what the locale
was.
  any ideas how to do this?

 You can do something like this:

 new Label( componentId, new StringResourceModel( pageTitle, this, new
 Model() ) );

 In your properties file:
 pageTitle=Home

 In your html:
 span wicket:id=componentIdDummy text/span


 Look for StringResourceModel in ProWicket or in the API docs.


 HTH
 Dave





-
 This SF.net email is sponsored by DB2 Express
 Download DB2 Express C - the FREE version of DB2 express and take
 control of your XML. No limits. Just data. Click to get it now.
 http://sourceforge.net/powerbar/db2/
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] question on localization

2007-04-24 Thread John Krasnay
Ah, yes, this is much better. It bothered me enough to put a warning in
the Javadoc, but that's a poor substitute for something that just works.
I'll be fixing our code in the morning. Thanks Igor.

jk

On Tue, Apr 24, 2007 at 11:00:05AM -0700, Igor Vaynberg wrote:
 this is bad. getpagetitle() might get called from a partially constructed
 object
 
 it should be
 
public BasePage() {
add(new Label(pageHeaderTitle, new pagetitlemodel()));
}
 
private class pagetitlemodel extends abstractreadonlymodel {
object getobject() { return getpagetitle().getobject(); }
void detach() { getpagetitle().detach(); }
 }
 
 -igor
 
 On 4/24/07, John Krasnay [EMAIL PROTECTED] wrote:
 
 You might want to make it so you can dynamically generate a page title
 where you need to, instead of always requiring a static page title. The
 trick is to return an IModel from the getPageTitle method in your base
 page. Here's how I've done it:
 
 title wicket:id=pageHeaderTitleFoo/title
 
 public class BasePage extends WebPage {
 
 public BasePage() {
 add(new Label(pageHeaderTitle, getPageTitle()));
 }
 
 public IModel getPageTitle() {
 return new ResourceModel(page.title);
 }
 }
 
 jk
 
 On Tue, Apr 24, 2007 at 10:33:54AM +0900, David Leangen wrote:
   i tried to use Label() with PropertyModel(pageTitle) but didn't work
 for
   me.  it rendered Home string all the time, no matter what the locale
 was.
   any ideas how to do this?
 
  You can do something like this:
 
  new Label( componentId, new StringResourceModel( pageTitle, this, new
  Model() ) );
 
  In your properties file:
  pageTitle=Home
 
  In your html:
  span wicket:id=componentIdDummy text/span
 
 
  Look for StringResourceModel in ProWicket or in the API docs.
 
 
  HTH
  Dave
 
 
 
 
 
 -
  This SF.net email is sponsored by DB2 Express
  Download DB2 Express C - the FREE version of DB2 express and take
  control of your XML. No limits. Just data. Click to get it now.
  http://sourceforge.net/powerbar/db2/
  ___
  Wicket-user mailing list
  Wicket-user@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/wicket-user
 
 -
 This SF.net email is sponsored by DB2 Express
 Download DB2 Express C - the FREE version of DB2 express and take
 control of your XML. No limits. Just data. Click to get it now.
 http://sourceforge.net/powerbar/db2/
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user
 

 -
 This SF.net email is sponsored by DB2 Express
 Download DB2 Express C - the FREE version of DB2 express and take
 control of your XML. No limits. Just data. Click to get it now.
 http://sourceforge.net/powerbar/db2/
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] question on localization

2007-04-23 Thread David Leangen
 i tried to use Label() with PropertyModel(pageTitle) but didn't work for 
 me.  it rendered Home string all the time, no matter what the locale was.
 any ideas how to do this?

You can do something like this:

new Label( componentId, new StringResourceModel( pageTitle, this, new
Model() ) );

In your properties file:
pageTitle=Home

In your html:
span wicket:id=componentIdDummy text/span


Look for StringResourceModel in ProWicket or in the API docs.


HTH
Dave




-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user