Re: Passing a wrapper component to a page-level component
Re: Passing a wrapper component to a page-level component
- Subject: Re: Passing a wrapper component to a page-level component
- From: Paul Hoadley <email@hidden>
- Date: Thu, 7 May 2009 14:50:29 +0930
On 07/05/2009, at 1:50 PM, Ramsey Lee Gurley wrote:
So I rolled my own solution. EditFooPage has a WOSwitchComponent
as its outermost element. The app-specific LAF class is passed to
EditFooPage after construction so that it knows what to substitute
for the WOSwitchComponent. Key-value pairs are stored in
context().userInfo() to simulate the bindings intended for LAF.
The keys are in a namespace specific to the app-specific LAF, which
knows to look for them and change its behaviour accordingly. Of
course, context() disappears at the end of the transaction, so if
LAF finds key-values in userInfo(), it also caches them locally for
reuse if required.
It works, but I feel dirty. Critiques welcome.
It sounds like you're trying to use the WOContext like a d2wContext...
I probably am, because I got the idea from your posts and reading the
code you suggested.
I think if you do something like this in a D2WComponent named
'MyD2WComponentWrapper'
<wo:WOSwitchComponent
componentName="$pageWrapperName"><wo:EditFooPage /></
wo:WOSwitchComponent>
and set up a rule like
100: task = 'edit' and entity.name = 'Foo' => pageName =
MyD2WComponentWrapper
and generate the page in your app by using
D2W.editPageForEntityNamed
... then I think it should work and you should be able to pass
bindings to your wrapper via the d2wContext using the rule system.
As I've mentioned earlier, I've never tried this without using a
real D2WPage. Perhaps you tried this already and ran into something
else?
No, I didn't get as far as writing code in that direction. With this
extra help, though, I'll give it a shot. Thanks Ramsey.
--
Paul.
w http://logicsquad.net/
h http://paul.hoadley.name/
_______________________________________________
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