Example usage for com.vaadin.shared.ui.slider SliderOrientation HORIZONTAL

List of usage examples for com.vaadin.shared.ui.slider SliderOrientation HORIZONTAL

Introduction

In this page you can find the example usage for com.vaadin.shared.ui.slider SliderOrientation HORIZONTAL.

Prototype

SliderOrientation HORIZONTAL

To view the source code for com.vaadin.shared.ui.slider SliderOrientation HORIZONTAL.

Click Source Link

Usage

From source file:com.esofthead.mycollab.module.project.ui.components.TaskCompleteStatusSelection.java

License:Open Source License

public TaskCompleteStatusSelection() {
    this.setOrientation(SliderOrientation.HORIZONTAL);
    this.setImmediate(true);
    this.setWidth("150px");
    this.addValueChangeListener(new ValueChangeListener() {
        @Override//from  w  w w.  j av  a  2s . c  o  m
        public void valueChange(Property.ValueChangeEvent valueChangeEvent) {
            Double value = TaskCompleteStatusSelection.this.getValue();
            if (value != null) {
                double roundValue = Math.ceil(value / 10) * 10;
                TaskCompleteStatusSelection.this.setValue(roundValue);
            } else {
                TaskCompleteStatusSelection.this.setValue(0d);
            }
        }
    });
}

From source file:com.esofthead.mycollab.module.project.ui.components.TaskSliderField.java

License:Open Source License

public TaskSliderField() {
    progressLbl = new Label();
    progressLbl.setWidthUndefined();/* w  w  w.ja v a  2 s .  c  om*/
    slider = new Slider();
    slider.setOrientation(SliderOrientation.HORIZONTAL);
    slider.setImmediate(true);
    slider.setWidth("150px");
    slider.addValueChangeListener(new ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent valueChangeEvent) {
            Double value = (Double) valueChangeEvent.getProperty().getValue();
            if (value != null) {
                double roundValue = Math.ceil(value / 10) * 10;
                slider.setValue(roundValue);
                progressLbl.setValue(roundValue + "%");
                setInternalValue(roundValue);
            } else {
                slider.setValue(0d);
                progressLbl.setValue("0%");
                setInternalValue(0d);
            }
        }
    });
    body = new MHorizontalLayout(slider, progressLbl);
}

From source file:com.foo01.ui.ReservationDetailView.java

@Override
protected final void onBecomingVisible() {
    getNavigationBar().setCaption("Detail Rezervace");

    //buttony pod navbarem
    HorizontalLayout buttonsLayout = new HorizontalLayout();
    buttonsLayout.setStyleName("buttonToolBarLayout");
    buttonsLayout.setWidth("100%");

    Button deleteButton = new Button();
    deleteButton.setCaption("SMAZAT");
    deleteButton.setWidth(null);//from w  w w .ja  va  2  s.  co  m
    buttonsLayout.addComponent(deleteButton);

    Label plug = new Label();
    buttonsLayout.addComponent(plug);

    Button saveButton = new Button();
    saveButton.setCaption("ULOIT");
    saveButton.setWidth(null);
    buttonsLayout.addComponent(saveButton);
    buttonsLayout.setExpandRatio(plug, 1.0f);
    List<Source> sourcesList = MockSource.mockSources();

    //combobox na zdroje a jmeno uzivatele
    HorizontalLayout sourceAndNameLayout = new HorizontalLayout();
    sourceAndNameLayout.setWidth("100%");
    sourceAndNameLayout.setStyleName("sourceAndNameLayout");

    NativeSelect select = new NativeSelect();
    select.setNullSelectionAllowed(false);
    System.out.println(Page.getCurrent().getBrowserWindowWidth());
    String width = Page.getCurrent().getBrowserWindowWidth() / 2.5 + "px";
    select.setWidth(width);
    select.addItems(sourcesList);
    for (Source s : sourcesList) {
        if (reservation.getSource().equals(s)) {
            select.select(s);
            break;
        }
    }
    sourceAndNameLayout.addComponent(select);

    Label plug2 = new Label();
    sourceAndNameLayout.addComponent(plug2);

    Label name = new Label(reservation.getUser());
    name.setWidth(null);
    sourceAndNameLayout.addComponent(name);
    sourceAndNameLayout.setExpandRatio(plug2, 1.0f);

    //datepickery
    DatePicker dateFrom = new DatePicker();
    dateFrom.setStyleName("datePickerDetailView");
    dateFrom.setValue(reservation.getBeginning());
    dateFrom.setUseNative(true);
    dateFrom.setResolution(Resolution.TIME);
    dateFrom.setWidth("100%");

    DatePicker dateTo = new DatePicker();
    dateTo.setStyleName("datePickerDetailView");
    dateTo.setValue(reservation.getEnding());
    dateTo.setUseNative(true);
    dateTo.setResolution(Resolution.TIME);
    dateTo.setWidth("100%");

    //layout pro slider a popisky
    HorizontalLayout sliderLayout = new HorizontalLayout();
    sliderLayout.setStyleName("sliderLayout");
    sliderLayout.setWidth("100%");
    sliderLayout.setSpacing(true);

    Label sliderCaption = new Label("Po?et: ");
    sliderCaption.addStyleName("sliderCaption");
    sliderCaption.setWidth(null);
    sliderLayout.addComponent(sliderCaption);

    final Label horvalue = new Label();
    horvalue.setWidth("45px");
    horvalue.setStyleName("value");
    sliderLayout.addComponent(horvalue);

    final Slider horslider = new Slider(1, 10);
    horslider.setOrientation(SliderOrientation.HORIZONTAL);
    horslider.setValue(Double.valueOf(1));
    horslider.getState();
    horslider.getValue();
    horslider.setImmediate(true);
    horslider.setWidth("100%");
    sliderLayout.addComponent(horslider);
    sliderLayout.setExpandRatio(horslider, 1.0f);

    horvalue.setValue(String.valueOf(horslider.getValue().intValue()));

    horslider.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            int value = horslider.getValue().intValue();

            horvalue.setValue(String.valueOf(value));
        }
    });

    //switch schvaleno
    HorizontalLayout switchLayout = new HorizontalLayout();
    switchLayout.setStyleName("switchLayout");
    switchLayout.addComponent(new Label("Schvleno:"));
    switchLayout.setSpacing(true);
    Switch checkbox = new Switch(null, true);
    switchLayout.addComponent(checkbox);

    //popis rezervace
    TextArea description = new TextArea();
    description.setStyleName("descriptionDetailView");

    description.setWidth("100%");
    description.setImmediate(false);
    description.setCaption("Popis:");
    description.setValue(reservation.getDescription());
    //description.setRequired(true);
    description.setRequiredError("Popis mus bt zadn!");
    description.setNullRepresentation("");
    description.setReadOnly(true);
    //description.setRows(0);

    final VerticalLayout content = new VerticalLayout();
    content.setMargin(true);
    content.setSpacing(true);
    content.setStyleName(width);
    content.addComponent(buttonsLayout);
    content.addComponent(sourceAndNameLayout);
    content.addComponent(dateFrom);
    content.addComponent(dateTo);

    content.addComponent(sliderLayout);
    content.addComponent(switchLayout);
    content.addComponent(description);

    setContent(content);
}

From source file:com.foo01.ui.ReservationView.java

@Override
protected final void onBecomingVisible() {
    getNavigationBar().setCaption("Detail Rezervace");

    //buttony pod navbarem
    //        HorizontalLayout buttonsLayout = new HorizontalLayout();
    //        buttonsLayout.setStyleName("buttonToolBarLayout");
    //        buttonsLayout.setWidth("100%");
    ///*from  w  ww  .j  a va  2  s. com*/
    //        Button deleteButton = new Button();
    //        deleteButton.setCaption("SMAZAT");
    //        deleteButton.setWidth(null);
    //        buttonsLayout.addComponent(deleteButton);
    //
    //        Label plug = new Label();
    //        buttonsLayout.addComponent(plug);
    //
    //        Button saveButton = new Button();
    //        saveButton.setCaption("ULOIT");
    //        saveButton.setWidth(null);
    //        buttonsLayout.addComponent(saveButton);
    //        buttonsLayout.setExpandRatio(plug, 1.0f);  

    //combobox na zdroje a jmeno uzivatele
    List<Source> sourcesList = MockSource.mockSources();
    HorizontalLayout sourceAndNameLayout = new HorizontalLayout();
    sourceAndNameLayout.setWidth("100%");
    sourceAndNameLayout.setStyleName("sourceAndNameLayout");

    NativeSelect select = new NativeSelect();
    select.setNullSelectionAllowed(false);
    System.out.println(Page.getCurrent().getBrowserWindowWidth());
    String width = Page.getCurrent().getBrowserWindowWidth() / 2.5 + "px";
    select.setWidth(width);
    select.addItems(sourcesList);
    for (Source s : sourcesList) {
        if (reservation.getSource().equals(s)) {
            select.select(s);
            break;
        }
    }
    sourceAndNameLayout.addComponent(select);

    Label plug2 = new Label();
    sourceAndNameLayout.addComponent(plug2);

    Label name = new Label(reservation.getUser());
    name.setWidth(null);
    sourceAndNameLayout.addComponent(name);
    sourceAndNameLayout.setExpandRatio(plug2, 1.0f);

    //datepickery
    DatePicker dateFrom = new DatePicker();
    dateFrom.setStyleName("datePickerDetailView");
    dateFrom.setValue(reservation.getBeginning());
    dateFrom.setUseNative(true);
    dateFrom.setResolution(Resolution.TIME);
    dateFrom.setWidth("100%");

    DatePicker dateTo = new DatePicker();
    dateTo.setStyleName("datePickerDetailView");
    dateTo.setValue(reservation.getEnding());
    dateTo.setUseNative(true);
    dateTo.setResolution(Resolution.TIME);
    dateTo.setWidth("100%");

    //layout pro slider a popisky
    HorizontalLayout sliderLayout = new HorizontalLayout();
    sliderLayout.setStyleName("sliderLayout");
    sliderLayout.setWidth("100%");
    sliderLayout.setSpacing(true);

    Label sliderCaption = new Label("Po?et: ");
    sliderCaption.addStyleName("sliderCaption");
    sliderCaption.setWidth(null);
    sliderLayout.addComponent(sliderCaption);

    final Label horvalue = new Label();
    horvalue.setWidth("45px");
    horvalue.setStyleName("value");
    sliderLayout.addComponent(horvalue);

    final Slider horslider = new Slider(1, 10);
    horslider.setOrientation(SliderOrientation.HORIZONTAL);
    horslider.setValue(Double.valueOf(1));
    horslider.getState();
    horslider.getValue();
    horslider.setImmediate(true);
    horslider.setWidth("100%");
    sliderLayout.addComponent(horslider);
    sliderLayout.setExpandRatio(horslider, 1.0f);

    horvalue.setValue(String.valueOf(horslider.getValue().intValue()));

    horslider.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            int value = horslider.getValue().intValue();

            horvalue.setValue(String.valueOf(value));
        }
    });

    //switch schvaleno
    HorizontalLayout switchLayout = new HorizontalLayout();
    switchLayout.setStyleName("switchLayout");
    switchLayout.addComponent(new Label("Schvleno:"));
    switchLayout.setSpacing(true);
    Switch checkbox = new Switch(null, true);
    switchLayout.addComponent(checkbox);

    //popis rezervace
    TextArea description = new TextArea();
    description.setStyleName("descriptionDetailView");

    description.setWidth("100%");
    description.setImmediate(false);
    description.setCaption("Popis:");
    description.setValue(reservation.getDescription());
    //description.setRequired(true);
    description.setRequiredError("Popis mus bt zadn!");
    description.setNullRepresentation("");
    description.setReadOnly(true);
    //description.setRows(0);

    final VerticalLayout content = new VerticalLayout();
    content.setMargin(true);
    content.setSpacing(true);
    content.addComponent(new ButtonToolBarLayout(this));
    content.addComponent(sourceAndNameLayout);
    content.addComponent(dateFrom);
    content.addComponent(dateTo);

    content.addComponent(sliderLayout);
    content.addComponent(switchLayout);
    content.addComponent(description);

    setContent(content);
}

From source file:com.mycollab.module.project.ui.components.TaskSliderField.java

License:Open Source License

public TaskSliderField() {
    progressLbl = new Label();
    progressLbl.setWidthUndefined();/* w w  w  .  j a v  a 2  s . c o m*/
    slider = new Slider();
    slider.setOrientation(SliderOrientation.HORIZONTAL);
    slider.setImmediate(true);
    slider.setWidth("150px");
    slider.addValueChangeListener(valueChangeEvent -> {
        Double value = (Double) valueChangeEvent.getProperty().getValue();
        if (value != null) {
            double roundValue = Math.ceil(value / 10) * 10;
            slider.setValue(roundValue);
            progressLbl.setValue(roundValue + "%");
            setInternalValue(roundValue);
        } else {
            slider.setValue(0d);
            progressLbl.setValue("0%");
            setInternalValue(0d);
        }
    });
    body = new MHorizontalLayout(slider, progressLbl);
}

From source file:edu.kit.dama.ui.admin.staging.processors.StagingProcessorBasePropertiesLayout.java

License:Apache License

private Slider factoryPrioritySlider() {
    Slider slider = new Slider("PRIORITY", 0, 10);
    slider.setDescription(//from  w w w .ja  va2s . c om
            "The priority defined the execution order of staging processors. A higher priority means an earlier execution.");
    slider.setOrientation(SliderOrientation.HORIZONTAL);
    slider.setImmediate(true);
    slider.setWidth("100%");
    slider.addStyleName(CSSTokenContainer.BOLD_CAPTION);
    return slider;
}

From source file:org.lunifera.vaaclipse.ui.preferences.addon.internal.ScaleFieldEditorRenderer.java

License:Open Source License

@Override
public void render() {
    CssLayout layout = new CssLayout();
    layout.setWidth("100%");
    layout.addComponent(new Label(editor.getLabel()));
    slider = new Slider();
    slider.setWidth("100%");
    if (editor.getMaxValue() != null)
        slider.setMax(editor.getMaxValue().doubleValue());
    if (editor.getMinValue() != null)
        slider.setMin(editor.getMinValue().doubleValue());

    try {/*from   w ww.java 2s . co  m*/
        slider.setValue(getValue().doubleValue());
    } catch (ValueOutOfBoundsException vo) {

    }

    slider.setOrientation(SliderOrientation.HORIZONTAL);
    layout.addComponent(slider);
    this.component = layout;
}