New widget - style inheritance

I’ve created widget which inherit from VTextField. Everything works ok, but I don’t know how to inherit CSS style from VTextField.

public class VTimeField extends VTextField implements Paintable {

  public static final String CLASSNAME = "v-timefield";

....some code ommited....

  public VTimeField() {
    setStyleName(CLASSNAME);
    /** maybe addStyleName("v-textfield");  **/
  }

....some code ommited....

}

regards Sean

Hello,

rewrite the constructor like this:


public VTimeField() {
    addStyleName(CLASSNAME);
}

As VTextfield sets its own css class with “setStyleName” you overwrite these settings again and loose the style information from the original text field.

Just a note: As VTextfield already implements Paintable i think you don’t have to implement it again.

Hope that helps,
Marc

Thank you for your reply. Now everything works just like it should.

You have right that I unnecessarily implement interface which was implemented in superclass.

regards Sean