Re: Enums in D2W
Re: Enums in D2W
- Subject: Re: Enums in D2W
- From: Pascal Robert <email@hidden>
- Date: Wed, 09 Jul 2014 14:01:10 -0500 (CDT)
- Thread-topic: Enums in D2W
It works with your components :-) I have a question about localization (I'm not sure one the D2W presentations talks about localization). My enum is like this:
ANNUAL("com.druide.softwaretype.annual"),
MONTHLY("com.druide.softwaretype.monthly"),
OPEN_SOURCE("com.druide.softwaretype.open_source"),
BINARY_FREE("com.druide.softwaretype.binary_free"),
FREE_LICENSE("com.druide.softwaretype.free_license"),
UPGRADE("com.druide.softwaretype.upgrade"),
NON_EXPIRING("com.druide.softwaretype.non_expiring");
private String _localizationKey;
private SoftwareType(String descriptionEn) {
this._localizationKey = descriptionEn;
}
public String localizationKey() {
return _localizationKey;
}
public static NSArray<Language> allSoftwareTypes() {
return new NSArray<Language>(Language.values());
}
So I added the following rule in the model:
100 : (task = 'edit' and entity.name = 'Software' and propertyKey = 'licenceType') => destinationDisplayKey = "localizationKey" [com.webobjects.directtoweb.Assignment]
And I made some changes to R2D2WEditEnum.enumDisplayString() to add:
if (displayString != null) {
displayString = ERXLocalizer.currentLocalizer().localizedStringForKey(displayString);
}
Is this the way to go?
----- Mail original -----
De: "Ramsey Gurley" <email@hidden>
À: "Pascal Robert" <email@hidden>
Cc: email@hidden
Envoyé: Mercredi 9 Juillet 2014 13:09:15
Objet: Re: Enums in D2W
Use my framework. If you’re not completely satisfied after 30 days, mail it back for a full refund ;-)
https://github.com/nullterminated/ponder/tree/master/ERR2d2w/Components/Nonlocalized.lproj/R2D2WEditEnum.wo
I think you can also use a regular toOneRelationship edit component with the right rules and/or custom assignment class. I did a presentation at a conference about it one time :D
http://www.wocommunity.org/podcasts/wowodc/2010/ComponentAssignment.mov
On Jul 9, 2014, at 9:53 AM, Pascal Robert < email@hidden > wrote:
Hi guys,
What is the trick to select a enum (javaEnum prototype in the model) from a Edit component in D2W?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ( email@hidden )
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden