something like this:

new ChoiceFilteredPropertyColumn(....) {
    IModel createLabelModel(IModel itemModel) {
           final IModel property=super.createLabelModel(itemModel);
           return new AbstractReadOnlyModel() {
                 Object getObject(Component c) {
                        // will localize the enum
                         c.getString(((Enum)property.getObject(c)).name());
                  }
                  void ondetach() { property.detach(); }
             }
   }
}


-Igor


On 7/24/06, Wilko Hische <[EMAIL PROTECTED] > wrote:

Hi,

My apologies if the following is simple, but I am relatively new to
Wicket (moving from Tapestry),  and wasn't  able to figure out an
elegant solution:

I would like to add an Enum property to the Contact class of the
wicket-phonebook application, say a Gender:

public enum Gender {
    MALE,
    FEMALE
}

class Contact {
    private Gender gender;
    ...
    // getter and setter
}

The contact's gender should be shown as another
ChoiceFilteredPropertyColumn of the DefaultDataTable on the ListContacts
page.
So far no problem.

Now I would like to localise the Gender type with a Gender.properties
file on the Gender's class path.
This properties file would then be used for
1. the columns filter selection
2. the contact's gender field
3. the Gender column's row values.

This last one I could not figure out. I guess I am looking for a way to
have the StringResourceModel  use  a ClassResourceLoader for the Gender
class, but it does not seem to allow for this.

In the end I got it something working that makes use of keys in my
application.properties (Gender.MALE, Gender.FEMALE) but I would prefer a
separate properties file.

Best regards,

Wilko Hische



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to