0

I have a ButtonGroup which works with standard vaadin buttons, but I need to use the NativeButton class which inherits Button. The problem is if I use NativeButton the buttongroup isn't rendered.

Working:

Button b = new Button();
buttonGroup.addComponent(b);

Not working:

Button b = new NativeButton();
buttonGroup.addComponent(b);

Any idea how can I make ButtonGroup work with NativeButton?

Vaadin version: 7.1.1

acsadam0404
  • 2,711
  • 1
  • 26
  • 36

1 Answers1

1

Investigating the source code, it shows that native buttons are supported on the "server side" of the ButtonGroup component (as NativeButton is a sub-class of Button), but not on the "client side"; see line 53 of here.

Here, the widget is casted to VButton without prior checks; however, in case of a native button, this would have to be VNativeButton. As there is no sub-class relationship between VButton and VNativeButton, this will probably cause errors on the client side.

This is clearly a bug of the ButtonGroup; I suggest to either fix it yourself, report the bug to the author, or create a ButtonGroup-like component by yourself. It is, after all, mostly about styling.

Hannes Obweger
  • 258
  • 1
  • 4