• 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: Passing a wrapper component to a page-level component
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Passing a wrapper component to a page-level component


  • Subject: Re: Passing a wrapper component to a page-level component
  • From: Ramsey Lee Gurley <email@hidden>
  • Date: Thu, 07 May 2009 00:20:12 -0400


On May 6, 2009, at 11:15 PM, Paul Hoadley wrote:

On 06/05/2009, at 9:57 AM, Paul Hoadley wrote:

On 06/05/2009, at 9:02 AM, Ramsey Lee Gurley wrote:

If you wanted, you could set up a page configuration to use your EditFooPage component and have D2W return it like it would any other page component. However, if your EditFooPage.wo does not descend from D2WComponent, then the D2W factory will not call setLocalContext on your page, so you will not have a D2WContext. And without a d2wContext in your page, you won't be able to get the d2wContext in your page wrapper... You're right back where you started.

D2W is the standard approach to do what you are asking. All D2W pages are general, non-app, page level components wrapped by an app-specific page wrapper. The page wrapper can then get its additional bindings from the page's d2wContext. (Look at ERD2WHead for a concrete example of a pageWrapper component getting binding info from the d2wContext.)

If you can subclass D2WComponent, then I think it should work. Never tried it though :-)

I will give it a try and report back.

Since I started this, I should report on how it turned out.

I'm not D2W-averse, and the app in question uses a few D2W components to good effect, but I just couldn't work out how to implement what Ramsey was describing. Evidently I am still a D2W novice, and I found the documentation for D2W a little, uh, thin.


Yeah, I noticed that too :-)


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 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?

Ramsey


_______________________________________________ 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
  • Follow-Ups:
    • Re: Passing a wrapper component to a page-level component
      • From: Paul Hoadley <email@hidden>
    • Re: Passing a wrapper component to a page-level component
      • From: Paul Hoadley <email@hidden>
References: 
 >Passing a wrapper component to a page-level component (From: Paul Hoadley <email@hidden>)
 >Re: Passing a wrapper component to a page-level component (From: Ramsey Lee Gurley <email@hidden>)
 >Re: Passing a wrapper component to a page-level component (From: Paul Hoadley <email@hidden>)
 >Re: Passing a wrapper component to a page-level component (From: Ramsey Lee Gurley <email@hidden>)
 >Re: Passing a wrapper component to a page-level component (From: Paul Hoadley <email@hidden>)
 >Re: Passing a wrapper component to a page-level component (From: Paul Hoadley <email@hidden>)

  • Prev by Date: Re: Passing a wrapper component to a page-level component
  • Next by Date: Re: Passing a wrapper component to a page-level component
  • Previous by thread: Re: Passing a wrapper component to a page-level component
  • Next by thread: Re: Passing a wrapper component to a page-level component
  • Index(es):
    • Date
    • Thread