RatingStars getValue() always returns null (Vaadin 7)

Hi there,

I’m trying to use RatingStars component as follows

RatingStars rs = new RatingStars();
rs.setId("ratingstars");
rs.setBuffered(true);
layout.addComponent(rs);

and then later when pressed a button I’m looping through layout and pick out the component that has
the same id. According to debugger I’ve found the same component I was hoping for, but if I try to get
the value out of it

Double value = ((RatingStars) component).getValue();

It returns null as its value. I’ve tried using addValueChangeListener but it throws me an error if I try to use getValue() method unlike in Teemu’s own example (
https://github.com/tehapo/RatingStars/blob/master/ratingstars-demo/src/main/java/org/vaadin/teemu/ratingstars/demo/RatingStarsDemo.java
)

Any suggestions?

Have you tried it without rs.setBuffered(true); ?

Yes, and the value is still null even without it.

What error it throws to you?

What I tried to do is the same thing as Teemu had in his code

userRating.addValueChangeListener(event -> {
Double value = event.getValue();
});

but it throws an error because event belongs to com.vaadin.data.Property.ValueChangeEvent class and therefore can not give the value. It merely offers me the options anyone could do with java.lang.Object.

I see what went wrong. I was using 3.0-beta3 version of the add-on. Changed to 2.1 version and now works like a dream.