On Wed, 07 Feb 2007, Igor Vaynberg wrote:
> what you want can easily be accomplished via
>
> <span wicket:id="fragmentid">
>
> add(new WebMarkupContainer("fragmentid").add(new
> SimpleAttributeModifier("class","error"));
Hmm... Do you mean that the second markup example below
should work with WebMarkupContainer? (I.e. that
WebMarkupContainer that contains other components can get
its markup from the parent markup file.)
I tried it but didn't get it to work, it complains that
markup with path 'label' not found in fragment fragmentid.
> fragments are meant to be used where panels usually would in usecases like:
Yep, for now I have panels but sometimes they get so small
that I wouldn't want to bother breaking up their markup to
a separate file (as is necessary for a Panel). A workmate
pointed me to look at Fragments but I find the syntax a bit
complex for this use case:
> other places where it makes sense to use a panel but it is only used within
> a component that already has its own markup
This is what I have in mind.
- Timo
>
>
> -igor
>
>
> On 2/7/07, Timo Rantalaiho <[EMAIL PROTECTED]> wrote:
> >
> >Hello all,
> >
> >Sometimes when working with fine-grained components it might
> >be handy to use Fragments, but for cases when the same fragment
> >is not reused, I find the current syntax a bit complex.
> >
> >So when it's currently like this
> >
> >======================== klips ===================================
> >
> ><?xml version="1.0" encoding="UTF-8"?>
> ><html xmlns="http://www.w3.org/1999/xhtml" >
> ><head>
> > <title>Wicket Examples - component reference</title>
> > <link rel="stylesheet" type="text/css" href="style.css"/>
> ></head>
> ><body>
> > <span wicket:id="mainNavigation"/>
> >
> > <h1>wicket.markup.html.panel.Fragment</h1>
> > <wicket:link><a href="Index.html">[back to the
> >reference]</a></wicket:link>
> >
> > <p>
> > Use fragments for inline panels..<br />
> >
> > <span wicket:id="fragment">fragments contents come here</span>
> > </p>
> > <span wicket:id="explainPanel">panel contents come here</span>
> >
> ></body>
> ></html>
> >
> ><wicket:fragment wicket:id="fragmentid" >
> >
> > <p style="border: 2px dotted #fc0; padding: 5px;">
> > A fragment is like a panel, but can be 'inlined',
> > meaning it does not need it's own markup file, but
> > can be defined in the markup file of another. For this
> > example, we use the parent's markup file as the host,
> > and we do not explicitly tell the fragment which host
> > to use.<br />
> > Like panels, fragments can contain arbitrairy components,
> > like this label: <span wicket:id="label" class="mark">to be
> >replaced</span>, or<br />
> > even another panel: <span
> >wicket:id="otherPanel" class="mark">also to be replaced</span>.
> > </p>
> >
> ></wicket:fragment>
> >
> >======================== klaps ===================================
> >
> >
> >I would like to do this:
> >
> >======================== klips ===================================
> >
> ><?xml version="1.0" encoding="UTF-8"?>
> ><html xmlns="http://www.w3.org/1999/xhtml" >
> ><head>
> > <title>Wicket Examples - component reference</title>
> > <link rel="stylesheet" type="text/css" href="style.css"/>
> ></head>
> ><body>
> > <span wicket:id="mainNavigation"/>
> >
> > <h1>wicket.markup.html.panel.Fragment</h1>
> > <wicket:link><a href="Index.html">[back to the
> >reference]</a></wicket:link>
> >
> > <p>
> > Use fragments for inline panels..<br />
> >
> > <span wicket:id="fragmentid">
> > <p style="border: 2px dotted #fc0; padding: 5px;">
> > A fragment is like a panel, but can be 'inlined',
> > meaning it does not need it's own markup file, but
> > can be defined in the markup file of another. For this
> > example, we use the parent's markup file as the host,
> > and we do not explicitly tell the fragment which host
> > to use.<br />
> > Like panels, fragments can contain arbitrairy components,
> > like this label: <span wicket:id="label" class="mark">to be
> >replaced</span>, or<br />
> > even another panel: <span
> >wicket:id="otherPanel" class="mark">also to be replaced</span>.
> > </p>
> > </span>
> > </p>
> > <span wicket:id="explainPanel">panel contents come here</span>
> >
> ></body>
> ></html>
> >
> >======================== klaps ===================================
> >
> >I find the latter clearer for the typical (?) case when you just
> >need to add some serverside logic to some markup tag and have to
> >create a Wicket component for that.
> >
> >
> >Best wishes,
> >
> >Timo
> >
> >--
> >Timo Rantalaiho
> >Reaktor Innovations Oy <URL: http://www.ri.fi/ >
> >
--
Timo Rantalaiho
Reaktor Innovations Oy <URL: http://www.ri.fi/ >