Slider popup text

Hello!
How change text in popup when slider move, default in popup window showing current slider value, how change it (for example how change popup digits to “You position: 123”) ?

If you are referring to framework’s Slider component, you can simply use ValueChangeListener for this. I.e. when you change slider position in UI, it will trigger ValueChangeEvent.

Of course, but in ValueChangeListener i can set value for other label, but question is: how change text value in popup window when slider is moving (element have class .v-slider-feedback)?

Currently there’s no API for that. From VSlider.java:

public void setFeedbackValue(double value) {
    feedback.setText(String.valueOf(value));
}

So it just shows the stringified version of the slider’s double value.

As you see, the method is public, so you could create a custom widget extending VSlider and override the setFeedbackValue to put a custom text there.

-Olli

Olli, but only Slider class available for extends.

public class ExtSlider extends Slider {
    public ExtSlider(String caption) {
        super.setCaption(caption);   
    }     
}

That’s the server side component class Slider. I’m talking about the widget VSlider, the GWT client-side implementation - this one:
https://github.com/vaadin/framework/blob/master/client/src/main/java/com/vaadin/client/ui/VSlider.java

So you’ll need a custom client-side add-on and not just an extended server-side Component.

-Olli

May be I something not undestand, but ‘feedback’ object have private declaration and access to it from child it’s denied.

Oh, sorry, that’s right, I didn’t think to check the visibility of feedback there. You can still access private members in JSNI (native) methods, but of course that’s quite hacky.

-Olli

Can you add to next version of Vaadin framework this functionality? In my task slider is seconds and I want see value in format hours:minutes:sec.
Of course it’s possible.

You could file a feature ticket at GitHub:
https://github.com/vaadin/framework/issues

-Olli