Package com.vaadin.ui

Examples of com.vaadin.ui.Slider


*/
public class SliderUpdateFromValueChange extends AbstractTestUI {

    @Override
    protected void setup(VaadinRequest request) {
        final Slider slider = new Slider(0, 100, 1);
        slider.addValueChangeListener(new ValueChangeListener() {

            @Override
            public void valueChange(ValueChangeEvent event) {
                Double value = (Double) event.getProperty().getValue();
                if (value < 100.0) {
                    slider.setValue(100.0);
                }
                slider.markAsDirty();
            }

        });
        slider.setImmediate(true);
        slider.setWidth(200, Unit.PIXELS);

        addComponent(slider);
    }
View Full Code Here


public class SliderPrimaryStyleName extends TestBase {

    @Override
    protected void setup() {
        final Slider slider = new Slider(0, 100);
        slider.setWidth("100px");
        slider.setPrimaryStyleName("my-slider");
        addComponent(slider);

        addComponent(new Button("Change primary style",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        slider.setPrimaryStyleName("my-second-slider");
                    }
                }));
    }
View Full Code Here

        // Set spacing between the buttons
        playback.setSpacing(true);

        // Volume controls
        Button mute = new NativeButton("mute");
        Slider vol = new Slider();
        vol.setOrientation(SliderOrientation.HORIZONTAL);
        vol.setWidth("100px");
        Button max = new NativeButton("max");
        volume.addComponent(mute);
        volume.addComponent(vol);
        volume.addComponent(max);

        // Status area
        status.setWidth("80%");
        status.setSpacing(true);

        Button toggleVisualization = new NativeButton("Mode");
        Label timeFromStart = new Label("0:00");

        // We'll need another layout to show currently playing track and
        // progress
        VerticalLayout trackDetails = new VerticalLayout();
        trackDetails.setWidth("100%");
        Label track = new Label("Track Name");
        Label album = new Label("Album Name - Artist");
        track.setWidth(null);
        album.setWidth(null);
        Slider progress = new Slider();
        progress.setOrientation(SliderOrientation.HORIZONTAL);
        progress.setWidth("100%");
        trackDetails.addComponent(track);
        trackDetails.addComponent(album);
        trackDetails.addComponent(progress);
        trackDetails.setComponentAlignment(track, Alignment.TOP_CENTER);
        trackDetails.setComponentAlignment(album, Alignment.TOP_CENTER);
View Full Code Here

public class SliderKeyboardFocus extends TestBase {

    @Override
    protected void setup() {
        Slider slider = new Slider("The slider", 0, 100);
        slider.setWidth("300px");
        addComponent(slider);

    }
View Full Code Here

    private static final long serialVersionUID = 1L;

    @Override
    protected void setup(VaadinRequest request) {
        Table t = new Table();
        Slider s = new Slider();
        t.setWidth("200px");
        s.setWidth("100px");
        t.addContainerProperty("s", Slider.class, null);
        Item i = t.addItem("123");
        i.getItemProperty("s").setValue(s);
        getLayout().addComponent(t);
    }
View Full Code Here

        final VerticalLayout layout = new VerticalLayout();
        layout.setSpacing(true);
        layout.setWidth("500px");
        addComponent(layout);

        Slider slider = new Slider();
        slider.setId("horizontal");
        slider.setValue(100.0);
        slider.setWidth("100%");

        Button changeWidth = new Button("Set layout width to 300px",
                new Button.ClickListener() {

                    @Override
View Full Code Here

        l.setSpacing(true);
        l.setWidth("400px");
        l.setColumnExpandRatio(0, 1);

        l.addComponent(new Label("Horizontal Slider", ContentMode.HTML));
        Slider s = new Slider();
        s.setWidth("200px");
        try {
            s.setValue(50.0);
        } catch (ValueOutOfBoundsException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        l.addComponent(s);

        l.addComponent(new Label("Vertical Slider", ContentMode.HTML));
        s = new Slider();
        s.setOrientation(SliderOrientation.VERTICAL);
        s.setHeight("200px");
        try {
            s.setValue(50.0);
        } catch (ValueOutOfBoundsException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        l.addComponent(s);
View Full Code Here

        return c;
    }

    /** Create new Slider and add it to current component container. */
    public Slider slider() {
        Slider c = new Slider();
        c.setImmediate(true);
        add(c);
        return c;
    }
View Full Code Here

    /**
     * Create new Slider with given caption and add it to current component
     * container.
     */
    public Slider slider(String caption) {
        Slider c = slider();
        c.setCaption(caption);
        return c;
    }
View Full Code Here

    }

    /** Create new Slider with given caption and listener. */
    public Slider slider(String caption,
            Property.ValueChangeListener changeListener) {
        Slider c = slider(caption);
        c.addListener(changeListener);
        return c;
    }
View Full Code Here

TOP

Related Classes of com.vaadin.ui.Slider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.