Search in sources :

Example 1 with SliderServerComponent

use of com.company.jscomponent.web.toolkit.ui.slider.SliderServerComponent in project documentation by cuba-platform.

the class ProductEdit method postInit.

@Override
protected void postInit() {
    super.postInit();
    Component box = componentsFactory.createComponent(VBoxLayout.class);
    Layout vBox = (Layout) WebComponentsHelper.unwrap(box);
    SliderServerComponent slider = new SliderServerComponent();
    slider.setValue(new double[] { getItem().getMinDiscount(), getItem().getMaxDiscount() });
    slider.setMinValue(0);
    slider.setMaxValue(100);
    slider.setWidth("240px");
    slider.setListener(newValue -> {
        getItem().setMinDiscount(newValue[0]);
        getItem().setMaxDiscount(newValue[1]);
    });
    vBox.addComponent(slider);
    fieldGroup.getFieldNN("slider").setComponent(box);
}
Also used : Layout(com.vaadin.ui.Layout) VBoxLayout(com.haulmont.cuba.gui.components.VBoxLayout) SliderServerComponent(com.company.jscomponent.web.toolkit.ui.slider.SliderServerComponent) Component(com.haulmont.cuba.gui.components.Component) SliderServerComponent(com.company.jscomponent.web.toolkit.ui.slider.SliderServerComponent)

Aggregations

SliderServerComponent (com.company.jscomponent.web.toolkit.ui.slider.SliderServerComponent)1 Component (com.haulmont.cuba.gui.components.Component)1 VBoxLayout (com.haulmont.cuba.gui.components.VBoxLayout)1 Layout (com.vaadin.ui.Layout)1