You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "Oliver B. Fischer" <ma...@swe-blog.net> on 2013/08/09 13:48:51 UTC
AttributeModifier and RepeatingView
Dear list,
I have problems to add an attribute the <a> element generated by
BookmarkablePageLink. I use a RepeatingView to generate a unordered
list. The attribute I would like to add is not added to <a> element but
to the <li> element. The question is why? If I try the same code without
a repeating view the attribute is added the <a> element and not to the
<li> element. Does someone know why?
Where is my code:
RepeatingView rv = new RepeatingView("repeatme");
for (Pair<? extends Class<? extends WebPage>, String> entry : menuEntries) {
Model<String> gradientModel = new Model<String>("greenGradient");
BookmarkablePageLink link
= new BookmarkablePageLink(rv.newChildId(), entry.getLeft());
link.add(AttributeModifier.append("class", gradientModel));
link.add(new Label("label", entry.getRight()));
rv.add(link);
}
Best,
Oliver
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: AttributeModifier and RepeatingView
Posted by Martin Grigorov <mg...@apache.org>.
On Fri, Aug 9, 2013 at 4:41 PM, Oliver B. Fischer <ma...@swe-blog.net>wrote:
> Hi Martin,
>
> this is the markup I use:
>
> <div class="top-nav">
> <ul>
> <li wicket:id="repeatme">
> <a href="#">
>
The wicket:id is on <li>, so BookmarkablePageLink is attached to it.
The <a> element has no wicket:id
> <span wicket:id="label"></span>
> </a>
> </li>
> </ul>
> <div class="clearfix"></div>
> </div>
>
>
RepeatingView rv = new RepeatingView("repeatme");
for (Pair<? extends Class<? extends WebPage>, String> entry : menuEntries) {
WebMarkupContainer li = new WebMarkupContainer(rv.**newChildId());
rv.add(li);
BookmarkablePageLink link
= new BookmarkablePageLink("link", entry.getLeft());
link.add(AttributeModifier.**append("class", "greenGradient", " "));
link.setModel(Model.of(entry.getRight())));
rv.add(link);
}
>
> Am 09.08.13 13:54, schrieb Martin Grigorov:
>
>> Hi,
>>
>> It looks like your markup is not correct.
>> Please paste it too.
>>
>>
>> On Fri, Aug 9, 2013 at 2:48 PM, Oliver B. Fischer <mailsink@swe-blog.net
>> >wrote:
>>
>> Dear list,
>>>
>>> I have problems to add an attribute the <a> element generated by
>>> BookmarkablePageLink. I use a RepeatingView to generate a unordered list.
>>> The attribute I would like to add is not added to <a> element but to the
>>> <li> element. The question is why? If I try the same code without a
>>> repeating view the attribute is added the <a> element and not to the <li>
>>> element. Does someone know why?
>>>
>>> Where is my code:
>>>
>>> RepeatingView rv = new RepeatingView("repeatme");
>>>
>>> for (Pair<? extends Class<? extends WebPage>, String> entry :
>>> menuEntries)
>>> {
>>>
>>> Model<String> gradientModel = new Model<String>("greenGradient")****;
>>>
>>> BookmarkablePageLink link
>>> = new BookmarkablePageLink(rv.****newChildId(), entry.getLeft());
>>>
>>> link.add(AttributeModifier.****append("class", gradientModel));
>>>
>>>
>>> link.add(new Label("label", entry.getRight()));
>>>
>>> rv.add(link);
>>> }
>>>
>>> Best,
>>>
>>> Oliver
>>>
>>> ------------------------------****----------------------------**
>>> --**---------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>> <us...@wicket.apache.org>
>>> >
>>>
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: AttributeModifier and RepeatingView
Posted by "Oliver B. Fischer" <ma...@swe-blog.net>.
Hi Martin,
this is the markup I use:
<div class="top-nav">
<ul>
<li wicket:id="repeatme">
<a href="#">
<span wicket:id="label"></span>
</a>
</li>
</ul>
<div class="clearfix"></div>
</div>
Am 09.08.13 13:54, schrieb Martin Grigorov:
> Hi,
>
> It looks like your markup is not correct.
> Please paste it too.
>
>
> On Fri, Aug 9, 2013 at 2:48 PM, Oliver B. Fischer <ma...@swe-blog.net>wrote:
>
>> Dear list,
>>
>> I have problems to add an attribute the <a> element generated by
>> BookmarkablePageLink. I use a RepeatingView to generate a unordered list.
>> The attribute I would like to add is not added to <a> element but to the
>> <li> element. The question is why? If I try the same code without a
>> repeating view the attribute is added the <a> element and not to the <li>
>> element. Does someone know why?
>>
>> Where is my code:
>>
>> RepeatingView rv = new RepeatingView("repeatme");
>>
>> for (Pair<? extends Class<? extends WebPage>, String> entry : menuEntries)
>> {
>>
>> Model<String> gradientModel = new Model<String>("greenGradient")**;
>>
>> BookmarkablePageLink link
>> = new BookmarkablePageLink(rv.**newChildId(), entry.getLeft());
>>
>> link.add(AttributeModifier.**append("class", gradientModel));
>>
>> link.add(new Label("label", entry.getRight()));
>>
>> rv.add(link);
>> }
>>
>> Best,
>>
>> Oliver
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: AttributeModifier and RepeatingView
Posted by Martin Grigorov <mg...@apache.org>.
Hi,
It looks like your markup is not correct.
Please paste it too.
On Fri, Aug 9, 2013 at 2:48 PM, Oliver B. Fischer <ma...@swe-blog.net>wrote:
> Dear list,
>
> I have problems to add an attribute the <a> element generated by
> BookmarkablePageLink. I use a RepeatingView to generate a unordered list.
> The attribute I would like to add is not added to <a> element but to the
> <li> element. The question is why? If I try the same code without a
> repeating view the attribute is added the <a> element and not to the <li>
> element. Does someone know why?
>
> Where is my code:
>
> RepeatingView rv = new RepeatingView("repeatme");
>
> for (Pair<? extends Class<? extends WebPage>, String> entry : menuEntries)
> {
>
> Model<String> gradientModel = new Model<String>("greenGradient")**;
>
> BookmarkablePageLink link
> = new BookmarkablePageLink(rv.**newChildId(), entry.getLeft());
>
> link.add(AttributeModifier.**append("class", gradientModel));
>
> link.add(new Label("label", entry.getRight()));
>
> rv.add(link);
> }
>
> Best,
>
> Oliver
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
> For additional commands, e-mail: users-help@wicket.apache.org
>
>