Hi, I would try blocks of components at the end of your template, and
a delegate component.

The delegate refers to a method in your page or component class the
template it for.  It returns an Object, which is actually one of the
component blocks. It can also return null and nothing will be rendered
where the delegate tag was.

Alternatively, you could wrap a section of code in an If component.



For instance, to delegate:

<div xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
<tr>
        <td><t:selectdaterangetype /></td>
</tr>
<tr>
        <td><t:delegate to="typeOfDateRange" /></td>
</tr>

<t:block>
        <t:selectmonth />
        <t:selectmonthrange />
        <t:selectquarter />
        <t:selectquarterrange />
</t:block></div>


--------------------------------
The java:

        @Component(id = "daterangetypeSelector")
        private SelectDateRangeType selectdaterangetype;

        @Component
        private SelectMonth selectmonth;

        @Component
        private SelectMonthRange selectmonthrange;

        @Component
        private SelectQuarter selectquarter;

        @Component
        private SelectQuarterRange selectquarterrange;

        public Object getTypeOfDateRange() {
                DateRangeType drt = selectdaterangetype.getSelected();
                if (drt.equals(DateRangeTypeEnum.DR_ENTIRE_FISCAL_YEAR)) {
                        return null;
                } else if (drt.equals(DateRangeTypeEnum.DR_MONTH_SINGLE)) {
                        return selectmonth;
                } else if (drt.equals(DateRangeTypeEnum.DR_MONTH_RANGE)) {
                        return selectmonthrange;
                } else if (drt.equals(DateRangeTypeEnum.DR_QUARTER_SINGLE)) {
                        return selectquarter;
                } else {
                        logger.debug("getTypeOfDateRange() DRT is unknown to 
me, drt="
                                        + drt.toDisplay());
                        return null;
                }
        }





On 8/3/07, Janko Muzykant <[EMAIL PROTECTED]> wrote:
>
> hello, i would like to omit some part of my page eg. allow only one component
> to be written in output. i did it writing my own MarkupWriter with
> enable/disable function which when enabled works as standard writer and when
> disabled ignores all writings. It's initially disabled and only specific
> component toggles the flag to write out its body. It works, but having in
> mind all the flexibility of tapestry 5 i bet there is much better way to do
> the same thing. Could you enlighten me a bit and suggest better solution?
>
> thanks,
> jm.
>
> --
> View this message in context: 
> http://www.nabble.com/T5-Best-way-to-omit-part-of-result-page-in-output-tf4211016.html#a11978648
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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