• 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: Chuck Hill's quite good Practices, WOWODC 08
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Chuck Hill's quite good Practices, WOWODC 08


  • Subject: Re: Chuck Hill's quite good Practices, WOWODC 08
  • From: Jean-Francois Veillette <email@hidden>
  • Date: Mon, 10 Aug 2009 11:55:09 -0400

Wow, a bit late, but I'm back from vacation ...

Le 09-07-23 à 02:02, Tim Worman a écrit :

On Jul 21, 2009, at 5:34 PM, Chuck Hill wrote:

For components that you will use on CommonPage, you will sub-class CustomComponent as CommonComponent and implement editingContext() as:


public EOEditingContext editingContext(){
return ((CommonPage)context().page()).editingContext();
}


Or, you can allow for components to possibly have their own editing context (with more than one EC on a page) and implement it like this:

public EOEditingContext editingContext(){
return ((CustomComponent)parent()).editingContext();
}


I've used another approach and now I'd be interested to know if I'd be branded a fool for it. :-)

If you're a fool, I'm one too.  This is the pattern I use as well for sub-component that take a single eo.

 Since my sub-components often have an EO passed to them via a binding, I often set the sub-component's editing context like this:

public EOEditingContext editingContext() {
if(_editingContext == null) {
_editingContext = passedEO().editingContext();
}
return _editingContext;
}

My thought was that I then knew for sure that my subcomponent was using the same ec as the parent.

I second that approach.
If a component is in charge of modifying an eo, it should do it in the same ec as the eo itself.
It put the charge of having the correct ec at the same place as the routing of the eo, and ensure that they are both in sync.
Don't care much about the parent.ec when you already have an eo in hand.

These topics are awesome. Thanks Chuck!!

- jfv

 _______________________________________________
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

  • Prev by Date: Re: JSONRpcClientException happening every 3-4 days
  • Next by Date: Detecting Javascript enabled (browser side)
  • Previous by thread: Re: JSONRpcClientException happening every 3-4 days
  • Next by thread: Detecting Javascript enabled (browser side)
  • Index(es):
    • Date
    • Thread