in this case not. depending on itemreuse strategy a row item can be even or odd - thats why oncomponenttag polls the item's index attribute.

-Igor


On 9/6/06, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
I don't know about this particular class, but in general, an
alternative is to use attribute modifiers:

  protected Item newRowItem(String id, int index, IModel model) {
    Item item = super.newRowItem(id, index, model);
    item.add(new SimpleAttributeModifier("class, (index % 2 == 0) ?
"even" : "odd");
    return new MyOddEvenElement(id, index, model);
  }

Providing a custom class that overrides onComponentTag is slightly
more efficient btw.

Eelco

On 9/6/06, Thomas K├╝chenthal <[EMAIL PROTECTED]> wrote:
> Thank you for your help!!
>
> I did it that way now:
>
>
> public class MyDataTable extends DefaultDataTable
> {
>
>         public MyDataTable(String id, List columns, SortableDataProvider
> dataProvider, int rowsPerPage)
>         {
>                 super(id, columns, dataProvider, rowsPerPage);
>         }
>
>         protected Item newRowItem(String id, int index, IModel model)
>         {
>                 return new MyOddEvenElement(id, index, model);
>         }
> }
>
>
> public class MyOddEvenElement extends OddEvenItem
> {
>         private String CLASS_EVEN = "even";
>         private String CLASS_ODD = "odd";
>         private String >>         private String >>         private String this.className='even';";
>
>         public MyOddEvenElement(String id, int index, IModel model)
>         {
>                 super(id, index, model);
>         }
>         protected void onComponentTag(ComponentTag tag)
>         {
>         super.onComponentTag(tag);
>         tag.put("class", (getIndex() % 2 == 0) ? CLASS_EVEN :CLASS_ODD);
>         tag.put("onmouseover", ON_MOUSE_OVER);
>         tag.put("onmouseout", (getIndex() % 2 == 0) ? ON_MOUSE_OUT_EVEN :
> ON_MOUSE_OUT_ODD);
>         }
> }
>
>
> What do you think? Is that a reasonable approach?
>
>
> /thomas
>
>
> Gwyn Evans wrote:
> > The problem you've not addressed is how you set the different
> > 'onmouseout' functions in the repeater... I expect it can be done by
> > extending the way that the OddEvenItem itself extends things, though.
> >
> > What I was thinking about was if there'd be a way of putting in a
> > <span> or similar, such that the mouseovers could just do their set &
> > clear, leaving the "odd/even" being set on the <tr>?  While I don't
> > know, I've got the impression that I'd run into issues as to what tags
> > would actually be allowed where I'd need them in order to do that...
> >
> > /Gwyn
> >
> > On 06/09/06, Erik van Oosten <[EMAIL PROTECTED]> wrote:
> >> The combination won't work.
> >>
> >> Try this for the even rows:
> >>
> >> <tr wicket:id="results" class="even"
> >>                         ;"
> >>                         >> >>
> >> and for the odd rows:
> >>
> >> <tr wicket:id="results" class="odd"
> >>                         >> >>                         >> >>
> >> I removed the class litupRow as it contains no style in your example. If
> >> you want to maintain it do this:
> >>
> >> <tr wicket:id="results" class="litupRow even"
> >>                         ;"
> >>                         even';">
> >>
> >> and for the odd rows:
> >>
> >> <tr wicket:id="results" class="litupRow odd"
> >>                         >> >>                         odd';">
> >>
> >> There are also _javascript_ functions available on the net that allow you
> >> to add and remove classes from an element.
> >>
> >> Regards,
> >>     Erik.
> >>
> >> --
> >> Erik van Oosten
> >> http://www.day-to-day-stuff.blogspot.com/
> >>
> >>
> >>
> >> Gwyn Evans schreef:
> >>> I'm not sure enought of CSS and tables to be able to say if there's
> >>> going to be any issues with trying to have both this and the Odd/Even
> >>> classes working in the table row, though!
> >>>
> >>> /Gwyn
> >>>
> >>
> >> -------------------------------------------------------------------------
> >> Using Tomcat but need to do more? Need to support web services, security?
> >> Get stuff done quickly with pre-integrated technology to make your job easier
> >> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> >> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> >> _______________________________________________
> >> Wicket-user mailing list
> >> Wicket-user@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/wicket-user
> >>
> >
> >
>
> --
> Thomas K├╝chenthal
> Technical Director
>
> - Business Domain Management -
>
>
>  LEMARIT Domain Management GmbH
>  Werkstrasse 12
>  D - 24955 Harrislee / Flensburg
>  ---------------------------------
>  Tel.Nr: +49 (0)461 / 5050 35 - 90
>  Fax Nr: +49 (0)461 / 5050 35 - 35
>  E-Mail: [EMAIL PROTECTED]
>  Domain: www.lemarit.com
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to