Hi,

a Label can have a model of any type, so that you can easily display Dates, 
Booleans, Numbers and so on... IConverters (via getModelObjectAsString() 
call) are responsible for converting these model objects to displayable 
strings in a locale-sensitive manner.

So "public class Label extends WebComponent<String>" would be wrong...

IMHO, Label should be type parameterized itself, extending a raw type is 
unsafe.

public class Label<T> extends WebComponent<T>
{
        ...

        public Label(MarkupContainer parent, final String id, T label)
        {
                this(parent, id, Model.valueOf(label));
        }

        public Label(MarkupContainer parent, final String id, IModel<T> model)
        {
                super(parent, id, model);
        }

        ...
}

The raw type Label can be still used if desired...

What do the wicket developers think?

Regards,
Bendis

On Tuesday 06 of March 2007 11:01:47 Stefan Lindner wrote:
> In Wicket 2 the Label class is defined as
>
>      public class Label extends WebComponent
>
> The Label class inhertis setModelObject from Comonent<T> through the
> genetric class WebComponent<T>. The method
>
>      public final Component setModelObject(final T object)
>
> is generic too.
>
> Now If we have code like
>
>      Label l = new Label(this, "label", "The label's modelObject");
>      l.setModelObject("The new modelObject");
>
> alway leads to a warning like
>
>      the method setModelObject belongs to the raw type Component...
>
> Declaring Label like
>
>      public class Label extends WebComponent<String>
>
> would remove the warning and should not affect any part of wicket. Or am I
> wrong?
>
> Stefan Lindner


Reply via email to