Actually... ;) I can't speak for 4.x, but this works with 3.0.3.
I had a similar sort of situation where I needed to override all
link-component types to use a custom renderer.
So... if you do something like the following in your .application file:
<component-type type="DirectLink"
specification-path="path/to/YourDirectLink.jwc"/>

Then all references in your application to DirectLink will use your
custom direct link instead.  There's a caveat here, though, in that any
third-party components (bundled in libraries, etc.) will still use the
tapestry-supplied components. Still... if it's your page designer that
you're worried about... it works... or, does in 3.0.3. :) HTH.

Robert

John Smith 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" <[EMAIL PROTECTED]>
> Reply-To: "Tapestry users" <[email protected]>
> To: "'Tapestry users'"
> <[email protected]>,<[EMAIL PROTECTED]>
> 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: <mailto:[EMAIL PROTECTED]>
> List-Help: <mailto:[EMAIL PROTECTED]>
> List-Post: <mailto:[email protected]>
> List-Id: "Tapestry users" <tapestry-user.jakarta.apache.org>
> Delivered-To: mailing list [email protected]
> 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: [email protected]
>> 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]


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

Reply via email to