Re: Chuck Hill's quite good Practices, WOWODC 08
Re: Chuck Hill's quite good Practices, WOWODC 08
- Subject: Re: Chuck Hill's quite good Practices, WOWODC 08
- From: Chuck Hill <email@hidden>
- Date: Mon, 27 Jul 2009 11:43:50 -0700
On Jul 22, 2009, at 11:02 PM, Tim Worman wrote:
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. :-) 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.
That is another way of doing it. With my approach, it is easier to
have multiple EC's on a "page" - useful for Ajax dialogs and such. It
depends on whether you want the page/component to decided on it's EC
strategy, or want to defer that to whoever is passing in an EO. I've
used both, but lately prefer to have the page/component decide.
These topics are awesome. Thanks Chuck!!
Happy to hear they are useful to people.
Chuck
--
Chuck Hill Senior Consultant / VP Development
Learn WO at WOWODC'09 East in Montréal this August!
http://www.wocommunity.org/wowodc09/east
http://arstechnica.com/apple/news/2009/07/webobjects-sliced-from-106but-prognosis-of-death-premature.ars
_______________________________________________
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