AspectJ provided around advice might help you :) 
  with AOP you could instrument any classes and inject custom code quite 
cleanly.

John Smith <[EMAIL PROTECTED]> wrote: I could but then I would have to change 
all the code to use that extended 
class. Like for PageLink, everything now would have to use MyCustomPageLink. 
Or I would have to crack open the tapestry.jar and change the component 
class of PageLink to MyCustomPageLink.

----Original Message Follows----
From: "Patrick Casey" 

Reply-To: "Tapestry users" 
To: "'Tapestry users'" ,
Subject: RE: How to add logic for all components that render
Date: Fri, 30 Dec 2005 11:48:41 -0800
MIME-Version: 1.0
Received: from mail.apache.org ([209.237.227.199]) by 
bay0-mc7-f3.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.211); Fri, 30 
Dec 2005 11:49:17 -0800
Received: (qmail 28059 invoked by uid 500); 30 Dec 2005 19:49:12 -0000
Received: (qmail 28045 invoked by uid 99); 30 Dec 2005 19:49:11 -0000
Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49)    by 
apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Dec 2005 11:49:11 -0800
Received: pass (asf.osuosl.org: domain of [EMAIL PROTECTED] designates 
68.168.78.44 as permitted sender)
Received: from [68.168.78.44] (HELO mta13.adelphia.net) (68.168.78.44)    by 
apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Dec 2005 11:49:11 -0800
Received: from PCASEY ([67.23.34.52]) by mta13.adelphia.net          
(InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP          id 
<[EMAIL PROTECTED]>;          Fri, 30 Dec 
2005 14:48:49 -0500
X-Message-Info: 6sSXyD95QpUWxVoG5yhceMSfP368eqVqa7Q5Qvt+/vM=
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
Precedence: bulk
List-Unsubscribe: 
List-Help: 
List-Post: 
List-Id: "Tapestry users" 
Delivered-To: mailing list tapestry-user@jakarta.apache.org
X-ASF-Spam-Status: No, hits=1.9 
required=10.0tests=DNS_FROM_RFC_ABUSE,DNS_FROM_RFC_POST,SPF_PASS
X-Spam-Check-By: apache.org
X-Mailer: Microsoft Office Outlook 11
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Thread-Index: AcYNcf1fkRCzh5aIQSCb997Lrs+xXAAB+jkg
X-Virus-Checked: Checked by ClamAV on apache.org
Return-Path: 
[EMAIL PROTECTED]
X-OriginalArrivalTime: 30 Dec 2005 19:49:17.0203 (UTC) 
FILETIME=[1E4AD630:01C60D7A]


 Couldn't you just override the component's renderBody method? And
then do something like:

Public void renderBody(IRequestCycle cycle) {
 If (foo)
  Super.renderBody(cycle);
}

 --- Pat

 > -----Original Message-----
 > From: John Smith [mailto:[EMAIL PROTECTED]
 > Sent: Friday, December 30, 2005 10:51 AM
 > To: tapestry-user@jakarta.apache.org
 > Subject: How to add logic for all components that render
 >
 > I am trying to find a way to provide a hook into everything that renders.
 > I
 > want to integrate some business rules into Tapestry so that I can turn 
off
 > the rendering of some components if some condition is true. For example,
 > if
 > you are not part of the admin group then the "Delete User" button doesn't
 > render.
 >
 > I realize I could use Conditional components around the things that I may
 > want to prevent rendering, but I would have to use tons of Conditionals
 > and
 > properties just to control whether something should render. I also want
 > this
 > "dynamic rendering turning off switch" to be behind the scenes. I don't
 > really want the page desinger to have to always provide ways to turn off
 > rendering.
 >
 > I have tried using enhancement workers, but I can only append logic to 
the
 > render method, not override it. I have also tried using an enhancement
 > worker to replace the render method, but then I lose all the
 > previous-existing rendering logic.
 >
 > I tried extending BasePage, and I can get an inspect all the components,
 > but
 > there's no way for me to tell them not to render themselves.
 >
 > Since all the components implement render, but they all extend from
 > different classes, and because the classes are always enhanced (so I 
don't
 > know what logic there actually is in the render method for any given
 > component), I can't just write new render methods for the components.
 >
 > I have looked into overriding the page service or creating a different
 > IMarkupWriter, but that seems awfully severe just to control whether a
 > component should render itself or not.
 >
 > I have thought about writing extended versions of all the components 
(like
 > a
 > RulesPageLink, etc), but that's a lot of components and the page desginer
 > would always have to use these new components.
 >
 > Without being majorly intrusive into tapestry or hivement I don't know of
 > any other way other than using tons of Conditionals. Anyone have any
 > ideas?
 >
 > Greatly appreciated.
 >
 >
 >
 > ---------------------------------------------------------------------
 > To unsubscribe, e-mail: [EMAIL PROTECTED]
 > For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






Konstantin Ignatyev




PS: If this is a typical day on planet earth, humans will add fifteen million 
tons of carbon to the atmosphere, destroy 115 square miles of tropical 
rainforest, create seventy-two miles of desert, eliminate between forty to one 
hundred species, erode seventy-one million tons of topsoil, add 2,700 tons of 
CFCs to the stratosphere, and increase their population by 263,000

Bowers, C.A.  The Culture of Denial:  Why the Environmental Movement Needs a 
Strategy for Reforming Universities and Public Schools.  New York:  State 
University of New York Press, 1997: (4) (5) (p.206)

Reply via email to