Set the rule for 

toOneUIStyle = "popup"


James


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 protected]> wrote:
> 
>> From: Ramsey Gurley <[email protected]>
>> Subject: Re: stumbling around with D2W
>> To: "Theodore Petrosky" <[email protected]>
>> Cc: "WebObjects-Dev Mailing List List" <[email protected]>
>> 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 protected])
>>>> Help/Unsubscribe/Update your Subscription:
>>>> http://lists.apple.com/mailman/options/webobjects-dev/ramseygurley%40gmail.com
>>>> 
>>>> This email sent to [email protected]
>>> 
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be
>> ignored.
>>> Webobjects-dev mailing list      ([email protected])
>>> Help/Unsubscribe/Update your Subscription:
>>> http://lists.apple.com/mailman/options/webobjects-dev/rgurley%40smarthealth.com
>>> 
>>> This email sent to [email protected]
>> 
>> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/james%40jimijon.com
> 
> This email sent to [email protected]

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to