Alternately alternately … :-)

You could use an Enum instead of a string for your row color.  Then you not 
only get enum's typesafe awesomeness, but you could sort by the ordinal.

public enum RowColor {
        NONE, GREEN, RED, GOLD;
}

I covered how to use an enum with the ERD2WEditToOneRelationship component in 
my WOWODC 2010 presentation. The presentation is available on the WOCommunity 
podcast titled "D2W Custom Assignments and Component Design"

The sample project is available on Github:

https://github.com/wocommunity/WOWODC-2010/tree/master/ComponentAssignment

Ramsey

On Jan 22, 2012, at 10:40 AM, David LeBer wrote:

> Did you actually need a rowColor named None, or just have an option for no 
> row color?
> 
> Making the relationship optional and setting the 'noSelectionString' in your 
> rules would perform the latter.
> 
> Alternately if 'None' is the default rowColor, I would set that in 
> awakeFromInsertion on my EO.
> 
> D
> 
> --
> David LeBer
> Codeferous Software
> 
> On 2012-01-22, at 12:24 PM, Theodore Petrosky wrote:
> 
>> What I was trying to accomplish was to have the zeroth item be a rowcolor 
>> whose name was None. As I still don't understand how to target the popup 
>> list and order it, I decided on the next tack. Assign a default value to the 
>> new EO. 
>> 
>> My solution is:
>> EditPageInterface component = 
>> D2W.factory().editPageForNewObjectWithConfigurationNamed("CreateAdRelease", 
>> session());
>> component.setNextPage(session().context().page());
>> /*
>> * set the default row color to none
>> */
>> ((AdRelease)(((D2WComponent)component).object())).setRowColor(RowColor.fetchRequiredRowColor(((D2WComponent)component).object().editingContext(),
>>  RowColor.ROW_COLOR_NAME.eq("None")));
>> 
>> I don't really care about ordering the list I just wanted None to be the 
>> first item on the list.
>> 
>> I still have a lot to learn with how to target these Rules. 
>> 
>> Ted
>> 
>> 
>> 
>> --- On Sun, 1/22/12, David LeBer <[email protected]> wrote:
>> 
>>> From: David LeBer <[email protected]>
>>> Subject: Re: d2w ordering an array for display
>>> To: "Theodore Petrosky" <[email protected]>
>>> Cc: [email protected]
>>> Date: Sunday, January 22, 2012, 10:57 AM
>>> On 2012-01-22, at 12:20 AM, Theodore
>>> Petrosky wrote:
>>> 
>>>> I am creating a new AdRelease object and there is a
>>> popup with RowColor choices. It is this popup that I am
>>> trying to order.
>>> 
>>> Well that would be your problem.
>>> 
>>> Try setting sortKey in your rules.
>>> 
>>> From ERDEditToOneRelationship wod:
>>> 
>>> EditToOneRelationship: ERXToOneRelationship {
>>>        destinationDisplayKey =
>>> keyWhenRelationship;
>>>        possibleChoices =
>>> restrictedChoiceList;
>>>        destinationSortKey =
>>> d2wContext.sortKey;
>>>        isMandatory =
>>> d2wContext.isMandatory;
>>>        maxColumns =
>>> d2wContext.numCols;
>>>        relationshipKey =
>>> d2wContext.propertyKey;
>>>        size = d2wContext.size;
>>>        sourceEntityName =
>>> object.entityName;
>>>        sourceObject = object;
>>>        uiStyle =
>>> d2wContext.toOneUIStyle;
>>>    noSelectionString =
>>> d2wContext.noSelectionString;
>>>    popupName = d2wContext.popupName;
>>>    localizeDisplayKeys =
>>> d2wContext.localizeDisplayKeys;
>>>    uniqueID = d2wContext.propertyKey;
>>>    destinationEntityName =
>>> d2wContext.destinationEntityName;
>>> }
>>> 
>>> --
>>> David LeBer
>>> Codeferous Software
>>> 
>>> 
>>> 
>>> 
>>> 
>> 
> 
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/ramseygurley%40gmail.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:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to