I am following the free guide... I got to render some results, which are
very strange however:
I created a Panel descendant "Icon". I want many instances of it in a
repeater.
Home.html (excerpt):
<div wicket:id="uiIconList"></div>
Home.java (excerpt):
RepeatingView lst = new RepeatingView("uiIconList");
lst.add(new Icon(lst.newChildId()));
lst.add(new Icon(lst.newChildId()));
lst.add(new Icon(lst.newChildId()));
Icon.java (not imports etc):
public class Icon extends Panel {
public Icon(String id) {
super(id);
}
}
Icon.html:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<wicket:panel>
<div class="hasmenu icon iconauthor" title="AUTOR: PEREIRA,
Márcio" style="left:63%; top:23%"></div>
</wicket:panel>
</body>
</html>
RESULT!
<div wicket:id="uiIconList">
<wicket:panel>
<div class="hasmenu icon iconauthor ui-draggable" title="AUTOR:
PEREIRA, Márcio" style="left:63%; top:23%"></div>
</wicket:panel>
</div>
<div wicket:id="uiIconList">
<wicket:panel>
<div class="hasmenu icon iconauthor ui-draggable" title="AUTOR:
PEREIRA, Márcio" style="left:63%; top:23%"></div>
</wicket:panel>
</div>
<div wicket:id="uiIconList">
<wicket:panel>
<div class="hasmenu icon iconauthor ui-draggable" title="AUTOR:
PEREIRA, Márcio" style="left:63%; top:23%"></div>
</wicket:panel>
</div>
My questions:
1. Shouldn't the uiIconList <div> be substituted/ommited?
2. Shouldn't <wicket:panel> be substituted/ommited?
3. Is there an equivalent to newChildId() on ListView?
4. newChildId() generates a wicket:id for each new Icon. Why is it not
rendered?
5. Why don't I get an errror considering the Ids produced by newChildId()
exist in java code/container and not in HTML???
Wow :D Hope I could be clear enough, Tx for your help!
2014-05-29 7:31 GMT-03:00 Martin Grigorov <[email protected]>:
> Hi,
>
> Please check http://wicket.apache.org/guide/guide/repeaters.html
> If you still have problems then paste your code (here if it is just few
> lines) or some pastebin service and we will try to help more.
>
> Martin Grigorov
> Wicket Training and Consulting
>
>
> On Thu, May 29, 2014 at 12:06 PM, Márcio Pereira <
> [email protected]>
> wrote:
>
> > Hey guys!
> >
> > I'm trying to use a repeater in the following code:
> >
> > <author.html>
> > <author.html>
> > <author.html>
> > <author.html>
> > <author.html>
> > <author.html>
> > <author.html>
> > <author.html>
> > <author.html>
> > <author.html>
> > <author.html>
> > <author.html><a href="author.html"><div class="hasmenu icon iconauthor"
> > title="AUTHOR: POE, Edgar A." style="left:63%; top:23%"></div></a>
> >
> >
> > 1. I couldn't really get the difference between ListView and
> RefreshingView
> >
> > 2. I found two approaches to write into the "title" property of the <div>
> > tag:
> >
> > 2a: AttributeModifier:
> >
> >
> http://stackoverflow.com/questions/18521416/set-html-element-attribute-from-wicket-message
> > 2b: AbstractBehavior:
> >
> >
> http://www.mkyong.com/wicket/how-to-dynamic-add-attribute-to-a-html-tag-in-wicket/
> >
> > Which is best considering I might want to link this "title" to a property
> > value?
> >
> > 3. this <div> might get more complex with a whole lot of subcomponents
> (ok
> > maybe three). Lets suppose another <div> and an <img>. What would be the
> > best strategy to repeat it as a whole block then?
> >
> > let's say this is the intended exit:
> >
> > <a href="author.html">
> > <div class="hasmenu icon iconauthor" title="AUTHOR: POE, Edgar A."
> > style="left:63%; top:23%">
> > <div>POE, Edgar A.</div>
> > <img src=""></img>
> > </div>
> > </a>
> > <a href="author.html">
> > <div class="hasmenu icon iconauthor" title="AUTHOR: DOYLE, Arthur Conan"
> > style="left:23%; top:63%">
> > <div>DOYLE, Arthur Conan</div>
> > <img src=""></img>
> > </div>
> > </a>
> >
> > Thanks a lot in advance, any help is greatly appreciated.
> >
>