Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

RangeSelector/RangeSelectorButton width

Jay Kim
5 years ago Jul 20, 2016 4:14pm
Guillermo Alvarez
5 years ago Jul 21, 2016 7:56am

Hi Jay,

Are you referring to Vaadin Charts' range selector? If yes I'd recommend you to post under '08. Add-ons' category and mention the the product name, it'll make it easier to get an answer.

Regarding the button width, looks like you're right, ButtonTheme is missing the width property. Could you create an issue for the missing API in https://dev.vaadin.com/ ?

Thanks!

Guillermo Alvarez
5 years ago Jul 21, 2016 9:39am

As a workaround you can temporarily extend ButtonTheme like this:

public class ButtonThemeWithWidth extends ButtonTheme {
   @JsonInclude(Include.NON_DEFAULT)
   private Number width = 32;

   public Number getWidth() {
      return width;
   }
   public void setWidth(Number width) {
       this.width = width;
   }
}

And the use it like this:

angeSelector rangeSelector = new RangeSelector();
        ButtonThemeWithWidth buttonTheme = new ButtonThemeWithWidth();
        buttonTheme.setWidth(null);
        rangeSelector.setButtonTheme(buttonTheme);
        configuration.setRangeSelector(rangeSelector);

Width null will resize the button to have the correct size, you can also set it to a fixed value.

Hope this helps,

Guille

Jay Kim
5 years ago Jul 21, 2016 3:01pm
Guillermo Alvarez
5 years ago Aug 02, 2016 7:22am
Michael Benz
4 years ago Jan 05, 2018 5:27pm