You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Márcio Pereira <ma...@gmail.com> on 2014/05/29 12:06:08 UTC
Help a newbie? ;)
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.
Re: Help a newbie? ;)
Posted by Martin Grigorov <mg...@apache.org>.
On Thu, May 29, 2014 at 4:22 PM, Andrea Del Bene <an...@gmail.com>
wrote:
> Hi! I will try to answer your questions:
>
> My questions:
>> 1. Shouldn't the uiIconList <div> be substituted/ommited?
>>
> Every direct child of RepeatingView inherits markup from its parent and
> uses its custom markup as tag body. That's why uiIconList <div> is repeated
> for each child. See RepeatingView's Javadoc for more details.
>
>
Just to add: you can use <wicket:container> instead of <div> if you want it
to disappear. See p.2 below.
> 2. Shouldn't <wicket:panel> be substituted/ommited?
>>
>
> Well, it depends. In DEVELOPMENT mode (the default) Wicket renders its
> special tags (like <wicket:panel>) in output. In the guide (
> http://wicket.apache.org/guide/guide/maven.html#maven_1) it's also
> explained how to start Wicket applications in DEPLOYMENT mode. In this mode
> special tags and attributes like wicket:id are removed from the generated
> markup. You can manually control this mechanism with method
> Application.getMarkupSettings().setStripWicketTags
>
>
> 3. Is there an equivalent to newChildId() on ListView?
>>
> No. ListView is designed to repeat more complex markup blocks, i.e blocks
> that contains children components (children tags with wicket:id attribute).
> So instead of directly adding a child component you must populate markup
> bloc with ListView.populateItem. See ListView's Javadoc for more details.
>
> 4. newChildId() generates a wicket:id for each new Icon. Why is it not
>> rendered?
>>
> simply because children use parent's markup and they don't have their own
> wicket:id attribute.
>
> 5. Why don't I get an errror considering the Ids produced by newChildId()
>> exist in java code/container and not in HTML???
>>
> Although most of the time you will find the same wicket ids both in code
> and in markup, that's not always necessary to obtain a consistent component
> hierarchy. In other words the markup is not required to display wicket ids.
>
>
>> Wow :D Hope I could be clear enough, Tx for your help!
>>
>>
>>
>>
>>
>>
> PS: Javadocs for Wicket are here: http://ci.apache.org/projects/
> wicket/apidocs/6.0.x
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: Help a newbie? ;)
Posted by Andrea Del Bene <an...@gmail.com>.
Hi! I will try to answer your questions:
> My questions:
> 1. Shouldn't the uiIconList <div> be substituted/ommited?
Every direct child of RepeatingView inherits markup from its parent and
uses its custom markup as tag body. That's why uiIconList <div> is
repeated for each child. See RepeatingView's Javadoc for more details.
> 2. Shouldn't <wicket:panel> be substituted/ommited?
Well, it depends. In DEVELOPMENT mode (the default) Wicket renders its
special tags (like <wicket:panel>) in output. In the guide (
http://wicket.apache.org/guide/guide/maven.html#maven_1) it's also
explained how to start Wicket applications in DEPLOYMENT mode. In this
mode special tags and attributes like wicket:id are removed from the
generated markup. You can manually control this mechanism with method
Application.getMarkupSettings().setStripWicketTags
> 3. Is there an equivalent to newChildId() on ListView?
No. ListView is designed to repeat more complex markup blocks, i.e
blocks that contains children components (children tags with wicket:id
attribute). So instead of directly adding a child component you must
populate markup bloc with ListView.populateItem. See ListView's Javadoc
for more details.
> 4. newChildId() generates a wicket:id for each new Icon. Why is it not
> rendered?
simply because children use parent's markup and they don't have their
own wicket:id attribute.
> 5. Why don't I get an errror considering the Ids produced by newChildId()
> exist in java code/container and not in HTML???
Although most of the time you will find the same wicket ids both in code
and in markup, that's not always necessary to obtain a consistent
component hierarchy. In other words the markup is not required to
display wicket ids.
>
> Wow :D Hope I could be clear enough, Tx for your help!
>
>
>
>
>
PS: Javadocs for Wicket are here:
http://ci.apache.org/projects/wicket/apidocs/6.0.x
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Help a newbie? ;)
Posted by Márcio Pereira <ma...@gmail.com>.
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 <mg...@apache.org>:
> 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 <
> marciodeazeredo@gmail.com>
> 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.
> >
>
Re: Help a newbie? ;)
Posted by Martin Grigorov <mg...@apache.org>.
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 <ma...@gmail.com>
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.
>