Re: [Noobie] Making one action available to all WOComponents
Re: [Noobie] Making one action available to all WOComponents
- Subject: Re: [Noobie] Making one action available to all WOComponents
- From: Miguel Arroz <email@hidden>
- Date: Sat, 23 Dec 2006 22:53:38 +0000
Hi!
The solution is so simple that in fact it's hard to think on it
before seeing it done anywhere else. I had the same problem. And the
solution is... subclassing!
I usually do a TopLevelComponent that contains all the stuff I
need everywhere. Then, all my "page" components (ie, the components I
use to render a page, not the subcomponents I use to compose it) are
subclasses of TopLevelComponent. You don't need to care about the .wo
and .api files of TopLevelComponent, they won't be used anywhere.
Also, as expected :), the methods and instance variables you define
on TopLevelComponent will appear on WebObjects Builder as options for
binding stuff! :)
This is the generic answer for your question. But this has a
problem: the Java part is solved, the presentation part is not - you
still need to repeat the Logout link everywhere. So, I recommend you
to create a LogoutSubcomponent, or a HeaderComponent or something
like that. Just include it in your page components, and it will
appear and behave as expected.
Even better, you could create a "WrapperComponent" that contained
the logout link already, and all your page components would be
wrapped by it!
OK, I love the WO component system! :) Please enjoy!
On 2006/12/23, at 22:31, email@hidden wrote:
Thank you * very much and a merry, peaceful and blessed x.mas time
to all of us.
I don't like x.mas... my house is a mess and there's not enough
peace for coding! ;)
Yours
Miguel Arroz
"I felt like putting a bullet between
the eyes of every Panda that wouldn't
scr*w to save its species." -- Fight Club
Miguel Arroz
http://www.ipragma.com
_______________________________________________
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