I would probably use a helper method, along with AttributeAppender
instead of creating an entirely new class for this:

On 3/19/08, Martin Makundi <[EMAIL PROTECTED]> wrote:
> You should specify separate css classes for the odd and the even labels:
>
>  public class CSSClass extends AttributeModifier {
>   public CSSClass(final String clazz) {
>     super("class", true, new AbstractReadOnlyModel() {
>       /**  */
>       private static final long serialVersionUID = 1L;
>
>       @Override
>       public Object getObject() {
>         return clazz;
>       }
>     });
>   }
>  }
>
>  public class MyPage extends WebPage {
>   public MyPage() {
>     add(new Label().add(new CSSClass("even_line")));
>     add(new Label().add(new CSSClass("even_odd")));
>   }
>  }
>
>

protected <T extends Component> T cssClass(T component, String newClass)
{
  component.add( new AttributeAppender("class", new Model(newClass), " ") );
  return component;
}


>
>  2008/3/19, vincent Renaville <[EMAIL PROTECTED]>:
>
> > Hello,
>  >
>  >  I try to display a application a table with odd line in red and even line 
> in
>  >  blue.
>  >  For each cell of the table I use a label.
>  >
>  >  Somebody know how can I set the color to a label.
>  >
>  >  Thanks for your help
>  >
>  >
>  >  Vincent
>  >
>
>
> ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to