You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Johannes Schneider <jo...@familieschneider.info> on 2007/08/24 22:08:39 UTC
DataView and "onComponentTag"
Hi,
I use a DataView to create a list (<ul><li>). The DataView is used to
render the <li>-tags. Now I try to add a custom id value to the <li> tag
if some circumstances are fulfilled:
@Override
protected void onComponentTag( @NotNull ComponentTag tag ) {
super.onComponentTag( tag );
Iterator<Item> items = getItems();
while ( items.hasNext() ) {
Item item = items.next();
if ( //some magic here with item.getModelObject() ) {
tag.put( "id", "theIdValue" );
}
}
}
But the method "onComponentTag" in DataView is never called... Any
suggestions?
Thanks,
Johannes Schneider
--
Johannes Schneider
Im Lindenwasen 15
72810 Gomaringen
Fon +49 7072 9229972
Fax +49 7072 509999
Mobil +49 178 1364488
johannes@familieschneider.info
http://www.johannes-schneider.info
Re: DataView and "onComponentTag"
Posted by Johannes Schneider <jo...@familieschneider.info>.
Thanks,
I will try that. And please make those methods final...
Regardy,
Johannes Schneider
Igor Vaynberg wrote:
> dataview doesnt have its own markup, it delegates it to its direct children.
> so you want to put that oncomponenttag into the item the dataview creates.
> override dataview.newitem() and override oncomponenttag on the returned
> item.
>
> -igor
>
>
> On 8/24/07, Johannes Schneider <jo...@familieschneider.info> wrote:
>> Hi,
>>
>>
>> I use a DataView to create a list (<ul><li>). The DataView is used to
>> render the <li>-tags. Now I try to add a custom id value to the <li> tag
>> if some circumstances are fulfilled:
>>
>> @Override
>> protected void onComponentTag( @NotNull ComponentTag tag ) {
>> super.onComponentTag( tag );
>> Iterator<Item> items = getItems();
>> while ( items.hasNext() ) {
>> Item item = items.next();
>> if ( //some magic here with item.getModelObject() ) {
>> tag.put( "id", "theIdValue" );
>> }
>> }
>> }
>>
>>
>> But the method "onComponentTag" in DataView is never called... Any
>> suggestions?
>>
>>
>> Thanks,
>>
>> Johannes Schneider
>> --
>> Johannes Schneider
>> Im Lindenwasen 15
>> 72810 Gomaringen
>>
>> Fon +49 7072 9229972
>> Fax +49 7072 509999
>> Mobil +49 178 1364488
>>
>> johannes@familieschneider.info
>> http://www.johannes-schneider.info
>>
>>
>
--
Johannes Schneider
Im Lindenwasen 15
72810 Gomaringen
Fon +49 7072 9229972
Fax +49 7072 509999
Mobil +49 178 1364488
johannes@familieschneider.info
http://www.johannes-schneider.info
Re: DataView and "onComponentTag"
Posted by Igor Vaynberg <ig...@gmail.com>.
no, of course not the items. whatever calls oncomponenttag can do a
c.getparent() instanceof abstractrepeater check.
-igor
On 8/24/07, Eelco Hillenius <ee...@gmail.com> wrote:
>
> On 8/24/07, Igor Vaynberg <ig...@gmail.com> wrote:
> > or we can forward the call to the repeater....more intuitive for newbies
> > less intuitive for the rest :)
>
> The items would forward the calls? Hmmm. Sounds a bit dangerous/
> confusing.
>
> Eelco
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: DataView and "onComponentTag"
Posted by Eelco Hillenius <ee...@gmail.com>.
On 8/24/07, Igor Vaynberg <ig...@gmail.com> wrote:
> or we can forward the call to the repeater....more intuitive for newbies
> less intuitive for the rest :)
The items would forward the calls? Hmmm. Sounds a bit dangerous/ confusing.
Eelco
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: DataView and "onComponentTag"
Posted by Igor Vaynberg <ig...@gmail.com>.
or we can forward the call to the repeater....more intuitive for newbies
less intuitive for the rest :)
-igor
On 8/24/07, Eelco Hillenius <ee...@gmail.com> wrote:
>
> On 8/24/07, Igor Vaynberg <ig...@gmail.com> wrote:
> > dataview doesnt have its own markup, it delegates it to its direct
> children.
> > so you want to put that oncomponenttag into the item the dataview
> creates.
> > override dataview.newitem() and override oncomponenttag on the returned
> > item.
>
> It would probably be a good idea to make that method final in repeaters,
> right?
>
> Eelco
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: DataView and "onComponentTag"
Posted by Eelco Hillenius <ee...@gmail.com>.
On 8/24/07, Igor Vaynberg <ig...@gmail.com> wrote:
> dataview doesnt have its own markup, it delegates it to its direct children.
> so you want to put that oncomponenttag into the item the dataview creates.
> override dataview.newitem() and override oncomponenttag on the returned
> item.
It would probably be a good idea to make that method final in repeaters, right?
Eelco
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: DataView and "onComponentTag"
Posted by Igor Vaynberg <ig...@gmail.com>.
dataview doesnt have its own markup, it delegates it to its direct children.
so you want to put that oncomponenttag into the item the dataview creates.
override dataview.newitem() and override oncomponenttag on the returned
item.
-igor
On 8/24/07, Johannes Schneider <jo...@familieschneider.info> wrote:
>
> Hi,
>
>
> I use a DataView to create a list (<ul><li>). The DataView is used to
> render the <li>-tags. Now I try to add a custom id value to the <li> tag
> if some circumstances are fulfilled:
>
> @Override
> protected void onComponentTag( @NotNull ComponentTag tag ) {
> super.onComponentTag( tag );
> Iterator<Item> items = getItems();
> while ( items.hasNext() ) {
> Item item = items.next();
> if ( //some magic here with item.getModelObject() ) {
> tag.put( "id", "theIdValue" );
> }
> }
> }
>
>
> But the method "onComponentTag" in DataView is never called... Any
> suggestions?
>
>
> Thanks,
>
> Johannes Schneider
> --
> Johannes Schneider
> Im Lindenwasen 15
> 72810 Gomaringen
>
> Fon +49 7072 9229972
> Fax +49 7072 509999
> Mobil +49 178 1364488
>
> johannes@familieschneider.info
> http://www.johannes-schneider.info
>
>