n8han wrote:
>
> dcastannon wrote:
>> A border component insert its markup into the child tag of the border
>> markup.
>> I think i need a border with multiple body tags, identified by name. Is
>> something like a template (a la facelets). How can i do this with
>> wicket?
> You can do this panels or fragments (or just individual components if
> that is all you need to put in the spot):
> http://www.nabble.com/More-extend-points-tf4442899.html
>
Mmm, but it's not exactly what i want: I want to define some markup/html for
the elements as border component does. Panel and fragments does not do this.
So, in wicket there are this possibilities for composition:
1. Using Border
2. Using Panels
3. Using Fragments
4. Using Socket-Plug technique (link above)
- With Border method you can't define more than one child, but you can
define the markup in the border definition
- With Panels you can't "get" the markup from the base component in which
panel tag is defined. "a Panel has its own associated markup file".
- With fragments you can define markup in the same file it's used, and you
can use it in extended components (MarkupContainer property)
- With Socket-Plug you define a anchor point but the content is defined in
the extension class in a generic form. I'm not sure if the defined markup
can be easily inserted in the socket (fragments?)
So, i try a mix of fragments and panels:
Define some fragments at the target page
<div wicket:id="template" ></div>
<wicket:fragment
wicket:id="fragment-element1">element1</wicket:fragment>
<wicket:fragment
wicket:id="fragment-element2">element2</wicket:fragment>
The code for that page
add(new MyPanel("template",this));
MyPanel markup is
<wicket:panel>
[element1]
[element2]
</wicket:panel>
and MyPanel code says
public MyPanel(String id, MarkupContainer containerProvider) {
super(id);
Fragment f1=new Fragment("panel-element1","fragment-element1",
containerProvider);
Fragment f2=new Fragment("panel-element2","fragment-element2",
containerProvider);
add(f1);
add(f2);
}
It works ...
but i want to define the fragments inside the template, so i can use it many
times, something like
<div wicket:id="template-1" >
<wicket:fragment
wicket:id="fragment-element1">element1</wicket:fragment>
<wicket:fragment
wicket:id="fragment-element2">element2</wicket:fragment>
</div>
<div wicket:id="template-2" >
<wicket:fragment
wicket:id="fragment-element1">elementA</wicket:fragment>
<wicket:fragment
wicket:id="fragment-element2">elemenB</wicket:fragment>
</div>
but this throws a "close tag not found for tag: <div wicket:id="template"> "
exception
I think it's a bit tricky,i will try socket-plug variant and, if that do not
works, i will develop a new component "wicket:template?" similar to the
border component, but allowing multiple bodies. Any comments? I'm missing
something?
--
View this message in context:
http://www.nabble.com/Multiple-children-border--tf4587131.html#a13102738
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]