• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: D2W: Selectors for enum types?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: D2W: Selectors for enum types?


  • Subject: Re: D2W: Selectors for enum types?
  • From: Ramsey Gurley <email@hidden>
  • Date: Thu, 31 May 2012 13:50:35 -0700


On May 30, 2012, at 1:59 AM, Paul Hoadley wrote:

Hi Ramsey,

On 30/05/2012, at 10:06 AM, Ramsey Gurley wrote:

It shouldn't have made it to the dataSource() method. You should log what rules are firing for restrictedChoiceKey.  Open your log4j page and set up a d2w rule logger for that key. See what the console tells you when you load the page.

Ah, OK, this is subtle.  As I mentioned, this is an attribute I'm adding to the model at runtime (Organisation.billingStatus).  As such, the Organisation class knows nothing about it, and I don't get the opportunity to set a default value.  So when the page calls object.billingStatus.allValues to get the values for the drop-down, it gets a null at billingStatus.  Adding this third line works:

            EditPageInterface epi = D2W.factory().editPageForNewObjectWithEntityNamed(Organisation.ENTITY_NAME, session());
            epi.setNextPage(session().context().page());
            ((ERMODWizardCreationPage) epi).object().takeValueForKey(BillingStatus.Billed, "billingStatus");

But obviously that's going to be brittle—casting the EditPageInterface to an ERMODWizardCreationPage.  (I don't see myself changing looks any time soon, so it will work indefinitely, but it's still ugly.)  Got any better ideas?

Create a method called availableBillingStatuses() on the eo. It returns the list of possible billing statuses the object can have in its current state. Then just use object.availableBillingStatuses. 

Not only does that solve the problem, but it permits the removal of statuses that don't make sense. For example, if amountDue == $0, then billingStatus == PAST_DUE doesn't make sense.


 _______________________________________________
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

References: 
 >D2W: Selectors for enum types? (From: Paul Hoadley <email@hidden>)
 >Re: D2W: Selectors for enum types? (From: Ramsey Gurley <email@hidden>)
 >Re: D2W: Selectors for enum types? (From: Paul Hoadley <email@hidden>)
 >Re: D2W: Selectors for enum types? (From: Ramsey Gurley <email@hidden>)
 >Re: D2W: Selectors for enum types? (From: Paul Hoadley <email@hidden>)
 >Re: D2W: Selectors for enum types? (From: Ramsey Gurley <email@hidden>)
 >Re: D2W: Selectors for enum types? (From: Paul Hoadley <email@hidden>)
 >Re: D2W: Selectors for enum types? (From: Ramsey Gurley <email@hidden>)
 >Re: D2W: Selectors for enum types? (From: Paul Hoadley <email@hidden>)
 >Re: D2W: Selectors for enum types? (From: Ramsey Gurley <email@hidden>)
 >Re: D2W: Selectors for enum types? (From: Paul Hoadley <email@hidden>)
 >Re: D2W: Selectors for enum types? (From: Ramsey Gurley <email@hidden>)
 >Re: D2W: Selectors for enum types? (From: Paul Hoadley <email@hidden>)

  • Prev by Date: Re: Maven WARN
  • Next by Date: RE: Wrong CLASSPATH when installing WOApp with WOLips
  • Previous by thread: Re: D2W: Selectors for enum types?
  • Next by thread: Re: ERAttachment and Rackspace CloudFiles?
  • Index(es):
    • Date
    • Thread