I thought I tried that! I think I must have had a LHS that made it not target what I thought I was targeting. But now it is beautiful.
Thanks,
Ted --- On Thu, 1/12/12, James Cicenia <email@hidden> wrote: From: James Cicenia <email@hidden> Subject: Re: d2w set the UI of a ERD2WEditToOneRelationship To: "Theodore Petrosky" <email@hidden> Cc: "Ramsey Gurley" <email@hidden>, "WebObjects-Dev Mailing List List" <email@hidden> Date: Thursday, January 12, 2012, 7:38 AM
Set the rule for
toOneUIStyle = "popup"
On Jan 12, 2012, at 6:14 AM, Theodore Petrosky wrote: I get most of this however, is there a simpler way to set the UI of the toOne? 100 : (entity.name = 'AdRelease' and propertyKey = 'client') => componentName = ERD2WEditToOneRelationship [com.webobjects.directtoweb.Assignment], 100 : (entity.name = 'AdRelease' and propertyKey = 'client') => restrictedChoiceKey = object.currentClients [com.webobjects.directtoweb.Assignment], 100 : (propertyType = 'r' and relationship.destinationEntity.name = 'Client') => keyWhenRelationship = clientName [com.webobjects.directtoweb.Assignment], works beautifully however the UI is (are) radioButtons. Did I miss something do set the UI to a popup? Ted --- On Fri, 12/16/11, Ramsey Gurley < email@hidden> wrote: From: Ramsey Gurley <email@hidden>
Subject: Re: stumbling around with D2W
To: "Theodore Petrosky" <email@hidden>
Cc: "WebObjects-Dev Mailing List List" <email@hidden>
Date: Friday, December 16, 2011, 12:18
PM
Okay, so to expand on my original
reply,
Add at least two rules.
100: entity.name = "Employee" and propertyKey =
"employmentTitle" => componentName =
ERD2WEditToOneRelationship [Assignment]
100: entity.name = "Employee" and propertyKey =
"employmentTitle" => restrictedChoiceKey =
object.currentTitles [Assignment]
Then in your Employee.java add a method like:
public NSArray<EmploymentTitle> currentTitles() {
NSArray<EmploymentTitle>
employmentTitleList =
EmploymentTitle.fetchEmploymentTitles(
editingContext(),
EmploymentTitle.IS_CURRENT.eq(true),
EmploymentTitle.ORDERING_INT.ascs());
return employmentTitleList;
}
Optionally, you can set a key to be the value displayed in
the popup list. Say your employment title entity has
an attribute named titleName, you would do it using a rule
like
100: (propertyType = 'r' and
relationship.destinationEntity.name = 'EmploymentTitle')
=> keyWhenRelationship = "titleName"
By default, the rule system will use the
userPresentableDescription()
method on your eo. So you
could just do that in your EO:
public String userPresentableDescription() {
return valueForKey("titleName");
}
You can also localize the values if you like, using a rule
like:
100: (propertyType = 'r' and
relationship.destinationEntity.name = 'EmploymentTitle')
=> localizeDisplayKeys = true [BooleanAssignment]
So if one employee title is "Manager"
then in your french
localizable strings file you would have
"Manager" = "Gestionnaire";
And your popup values would be localized. You might
instead prefer to use localized columns in your database for
larger datasets. You can do that using the
ERXLanguages userInfo key in your eomodel. That's up to
you.
Ramsey
On Dec 15, 2011, at 8:28 AM, Ramsey Gurley wrote:
Hi Ted,
componentName = ERD2WEditToOneRelationship
restrictedChoiceKey = object.currentTitles
Then create a method on your object returning an array
of current employment titles like you have below.
Ramsey
On Dec 15, 2011, at 8:03 AM, Theodore Petrosky wrote:
OK so this is a real newbie thing.
In my Wonder app, I would:
create a list of entries to populate a popup
employmentTitleList =
EmploymentTitle.fetchEmploymentTitles(newEmployeeEC,
EmploymentTitle.IS_CURRENT.eq(true),
EmploymentTitle.ORDERING_INT.ascs());
I don't understand how to do this in an Edit page
in D2W.
Is there
anything like this in an example?
Ted
_______________________________________________
Do not post admin requests to the list. They will
be ignored.
Webobjects-dev mailing list
(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:
|