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/ >

Reply via email to