Slider on Integer data

Hello.
Perhaps this is more related with data binding issues, so apologizes if this doesn’t fit into this category.

I wonder if Slider can be used on Integer properties. I’m trying to have an Slider into a Form, bound to an Item, actually a BeanItem where the T field bound to the slider is a primitive int type.

I’m getting this error:

java.lang.ClassCastException: java.lang.Integer
	at com.vaadin.ui.Slider.paintContent(Slider.java:426)
	at com.vaadin.ui.AbstractComponent.paint(AbstractComponent.java:746)
	at com.vaadin.ui.CustomLayout.paintContent(CustomLayout.java:236)
	at com.vaadin.ui.AbstractComponent.paint(AbstractComponent.java:746)
	at com.vaadin.ui.Form.paintContent(Form.java:204)
	at com.vaadin.ui.AbstractComponent.paint(AbstractComponent.java:746)
	at com.vaadin.ui.TabSheet.paintContent(TabSheet.java:285)
	at com.vaadin.ui.AbstractComponent.paint(AbstractComponent.java:746)
	at com.vaadin.ui.AbstractOrderedLayout.paintContent(AbstractOrderedLayout.java:146)
	at com.vaadin.ui.AbstractComponent.paint(AbstractComponent.java:746)
	at com.vaadin.ui.AbstractOrderedLayout.paintContent(AbstractOrderedLayout.java:146)
	at com.vaadin.ui.AbstractComponent.paint(AbstractComponent.java:746)
	at com.vaadin.ui.TabSheet.paintContent(TabSheet.java:285)
	at com.vaadin.ui.AbstractComponent.paint(AbstractComponent.java:746)
	at com.vaadin.ui.SplitPanel.paintContent(SplitPanel.java:257)
	at com.vaadin.ui.AbstractComponent.paint(AbstractComponent.java:746)
	at com.vaadin.ui.TabSheet.paintContent(TabSheet.java:285)
	at com.vaadin.ui.AbstractComponent.paint(AbstractComponent.java:746)
	at com.vaadin.ui.Panel.paintContent(Panel.java:250)
	at com.vaadin.ui.Window.paintContent(Window.java:557)
	at com.vaadin.ui.AbstractComponent.paint(AbstractComponent.java:746)

I wouldn’t like to convert my carrier to handle Double values for those fields, since I would have to take care to convert them to pass to and from the database. Also, is there any other field suitable to select from a discrete range of numeric values? I was missing something like a Spinner. or so.

Greetings.

The
Stepper
add-on might be what you are looking for.

Hello Henri. Thanks for the tip.
I’ve already looked into that add-on. Unfortunately, it doesn’t allow to limit the range to step into, does it?
I also tried to control it’s appearance with setWidth to an absolute amount of pixels, and it doesn’t seem to work.

Greetings.