There's a couple of options here.

One is to use a common base class that defines all of these getters.

Create your own component that acts like an If but the tests is hard
coded against the
getUsesSetting() logic.

Another option is to create a new binding prefix, i.e.,

<t:if test="uses:fiscale_yearsingle">

Where the uses: prefix would be something you can (relatively easily)
implement.  There are some decent notes on the wiki for this.

I would strongly explore the latter possibility.  To me, this is a
very exciting avenue in Tapestry 5 (present also in T4, but just
easier in T5) that components can be reused not just by aggregation
and inheritance, but also with a kind of dramatic reinterpretation of
what their parameters mean.

On 10/9/07, Daniel Jue <[EMAIL PROTECTED]> wrote:
> Hi, I wanted to try eliminating a bunch of getters in my Java class.
>
> Right now I have something like this in my template:
>
> <t:if test="showYear">
>         <t:selectyear />
> </t:if>
>
> And I have a getter that is
>
> public boolean getShowYear() {
>         return this.getUsesSetting(ReportVariableEnum.FISCALYEARSINGLE);
> }
>
>
> I want to do something like this:
>
> <t:if test="getUsesSetting(ReportVariableEnum.PARTICULARVARIABLE)">
>      This uses Particular Variable
> </t:if>
>
> So I will only have to have getUsesSetting() in my page class.
>
> I have about 30 or so components, with 30 or so getters, and with 30
> or so getShowComponentName() methods.
>
> This class is getting to be a pain to read through.
>
> Any Ideas?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Howard M. Lewis Ship
Partner and Senior Architect at Feature50

Creator Apache Tapestry and Apache HiveMind

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

Reply via email to