You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Niels van Kampenhout <n....@hippo.nl> on 2007/11/22 16:40:26 UTC
Markup variants on component level
Hello Wicketeers,
I read about markup variants on the wiki [1]. I need this, however I
need it on component level rather than page level. Is this possible?
In the most extreme case I would like to have different instances of the
same component on one page, but each with their own markup variant.
The workaround I use right now is extending my component with an empty
class for each variant.
Thanks
Niels
[1] http://cwiki.apache.org/WICKET/multiple-markups-per-page.html
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Markup variants on component level
Posted by Igor Vaynberg <ig...@gmail.com>.
feel free to add it, it is a wiki after all...
-igor
On Nov 23, 2007 3:50 AM, Niels van Kampenhout <n....@hippo.nl> wrote:
> Igor Vaynberg wrote:
> > variants and styles work on component level...pages inherit that
> > functionality from components
>
> Right, I think I understand how this works now (simpler than I thought!).
>
> I find the Wiki page a bit short on info. I suggest to add some
> explanatory introduction like:
>
> ------------------------------8<------------------------------
>
> Each Wicket component has at least one associated markup (in the form of
> an HTML file). It is possible to have multiple markup alternatives for
> one component. These are called "variations", and have an HTML file with
> a name like "ComponentName_foo.html". Which markup variation is used, is
> determined by the getVariation() method of Component, i.e. if it returns
> the string "foo", the HTML file "ComponentName_foo.html" is loaded
> instead of "ComponentName.html".
>
> Variations are inherited down the component hierarchy, and the default
> is null, which means no variation (i.e. load "ComponentName.html"). Any
> component can override the getVariation() method to change this behaviour.
>
> If a markup variation with the name returned by getVariation() is not
> found, Wicket will load the default markup for that component.
>
> The example below shows how you can use a request parameter to load
> different markup variations for a Page on the fly.
>
> [and then the example which is already on the page]
>
> ------------------------------8<------------------------------
>
> If this make sense I'll add it to the page. Or is this already
> documented somewhere else?
>
> Regards
>
> Niels
>
>
>
> >
> > -igor
> >
> > On Nov 22, 2007 7:40 AM, Niels van Kampenhout <n....@hippo.nl> wrote:
> >> Hello Wicketeers,
> >>
> >> I read about markup variants on the wiki [1]. I need this, however I
> >> need it on component level rather than page level. Is this possible?
> >>
> >> In the most extreme case I would like to have different instances of the
> >> same component on one page, but each with their own markup variant.
> >>
> >> The workaround I use right now is extending my component with an empty
> >> class for each variant.
> >>
> >> Thanks
> >>
> >> Niels
> >>
> >> [1] http://cwiki.apache.org/WICKET/multiple-markups-per-page.html
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Markup variants on component level
Posted by Johan Compagner <jc...@gmail.com>.
About the Any component can implement it.
Variation really makes only sense for pages and panels, So components that
do have there own markup..
johan
On Nov 23, 2007 12:50 PM, Niels van Kampenhout <n....@hippo.nl>
wrote:
> Igor Vaynberg wrote:
> > variants and styles work on component level...pages inherit that
> > functionality from components
>
> Right, I think I understand how this works now (simpler than I thought!).
>
> I find the Wiki page a bit short on info. I suggest to add some
> explanatory introduction like:
>
> ------------------------------8<------------------------------
>
> Each Wicket component has at least one associated markup (in the form of
> an HTML file). It is possible to have multiple markup alternatives for
> one component. These are called "variations", and have an HTML file with
> a name like "ComponentName_foo.html". Which markup variation is used, is
> determined by the getVariation() method of Component, i.e. if it returns
> the string "foo", the HTML file "ComponentName_foo.html" is loaded
> instead of "ComponentName.html".
>
> Variations are inherited down the component hierarchy, and the default
> is null, which means no variation (i.e. load "ComponentName.html"). Any
> component can override the getVariation() method to change this behaviour.
>
> If a markup variation with the name returned by getVariation() is not
> found, Wicket will load the default markup for that component.
>
> The example below shows how you can use a request parameter to load
> different markup variations for a Page on the fly.
>
> [and then the example which is already on the page]
>
> ------------------------------8<------------------------------
>
> If this make sense I'll add it to the page. Or is this already
> documented somewhere else?
>
> Regards
>
> Niels
>
>
> >
> > -igor
> >
> > On Nov 22, 2007 7:40 AM, Niels van Kampenhout <n....@hippo.nl>
> wrote:
> >> Hello Wicketeers,
> >>
> >> I read about markup variants on the wiki [1]. I need this, however I
> >> need it on component level rather than page level. Is this possible?
> >>
> >> In the most extreme case I would like to have different instances of
> the
> >> same component on one page, but each with their own markup variant.
> >>
> >> The workaround I use right now is extending my component with an empty
> >> class for each variant.
> >>
> >> Thanks
> >>
> >> Niels
> >>
> >> [1] http://cwiki.apache.org/WICKET/multiple-markups-per-page.html
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: Markup variants on component level
Posted by Niels van Kampenhout <n....@hippo.nl>.
Igor Vaynberg wrote:
> variants and styles work on component level...pages inherit that
> functionality from components
Right, I think I understand how this works now (simpler than I thought!).
I find the Wiki page a bit short on info. I suggest to add some
explanatory introduction like:
------------------------------8<------------------------------
Each Wicket component has at least one associated markup (in the form of
an HTML file). It is possible to have multiple markup alternatives for
one component. These are called "variations", and have an HTML file with
a name like "ComponentName_foo.html". Which markup variation is used, is
determined by the getVariation() method of Component, i.e. if it returns
the string "foo", the HTML file "ComponentName_foo.html" is loaded
instead of "ComponentName.html".
Variations are inherited down the component hierarchy, and the default
is null, which means no variation (i.e. load "ComponentName.html"). Any
component can override the getVariation() method to change this behaviour.
If a markup variation with the name returned by getVariation() is not
found, Wicket will load the default markup for that component.
The example below shows how you can use a request parameter to load
different markup variations for a Page on the fly.
[and then the example which is already on the page]
------------------------------8<------------------------------
If this make sense I'll add it to the page. Or is this already
documented somewhere else?
Regards
Niels
>
> -igor
>
> On Nov 22, 2007 7:40 AM, Niels van Kampenhout <n....@hippo.nl> wrote:
>> Hello Wicketeers,
>>
>> I read about markup variants on the wiki [1]. I need this, however I
>> need it on component level rather than page level. Is this possible?
>>
>> In the most extreme case I would like to have different instances of the
>> same component on one page, but each with their own markup variant.
>>
>> The workaround I use right now is extending my component with an empty
>> class for each variant.
>>
>> Thanks
>>
>> Niels
>>
>> [1] http://cwiki.apache.org/WICKET/multiple-markups-per-page.html
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Markup variants on component level
Posted by Niels van Kampenhout <n....@hippo.nl>.
Igor Vaynberg wrote:
> variants and styles work on component level...pages inherit that
> functionality from components
Ah, I see. Stupid question eh? ;-)
I'll give it a try.
Thanks
Niels
> -igor
>
> On Nov 22, 2007 7:40 AM, Niels van Kampenhout <n....@hippo.nl> wrote:
>> Hello Wicketeers,
>>
>> I read about markup variants on the wiki [1]. I need this, however I
>> need it on component level rather than page level. Is this possible?
>>
>> In the most extreme case I would like to have different instances of the
>> same component on one page, but each with their own markup variant.
>>
>> The workaround I use right now is extending my component with an empty
>> class for each variant.
>>
>> Thanks
>>
>> Niels
>>
>> [1] http://cwiki.apache.org/WICKET/multiple-markups-per-page.html
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Markup variants on component level
Posted by Igor Vaynberg <ig...@gmail.com>.
variants and styles work on component level...pages inherit that
functionality from components
-igor
On Nov 22, 2007 7:40 AM, Niels van Kampenhout <n....@hippo.nl> wrote:
> Hello Wicketeers,
>
> I read about markup variants on the wiki [1]. I need this, however I
> need it on component level rather than page level. Is this possible?
>
> In the most extreme case I would like to have different instances of the
> same component on one page, but each with their own markup variant.
>
> The workaround I use right now is extending my component with an empty
> class for each variant.
>
> Thanks
>
> Niels
>
> [1] http://cwiki.apache.org/WICKET/multiple-markups-per-page.html
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org