Example usage for com.vaadin.ui ComboBox ComboBox

List of usage examples for com.vaadin.ui ComboBox ComboBox

Introduction

In this page you can find the example usage for com.vaadin.ui ComboBox ComboBox.

Prototype

public ComboBox() 

Source Link

Document

Constructs an empty combo box without a caption.

Usage

From source file:com.dungnv.streetfood.ui.CommonSearchPagedUI.java

private final void init() {

    setWidth("100%");
    setStyleName("item-search-box");
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);/* w  w w. ja v a2  s  .  c om*/
    this.addComponent(layout);

    FormLayout form = new FormLayout();
    //        form.setWidth("100%");
    form.setMargin(false);
    layout.addComponent(form);
    layout.setComponentAlignment(form, Alignment.MIDDLE_CENTER);

    cbRecordPerPage = new ComboBox();
    cbRecordPerPage.setWidth("65px");
    cbRecordPerPage.setStyleName(ValoTheme.COMBOBOX_TINY);
    cbRecordPerPage.setCaption(BundleUtils.getLanguage("lbl.recordsPerPage"));
    cbRecordPerPage.setTextInputAllowed(false);
    cbRecordPerPage.addItem(10);
    cbRecordPerPage.addItem(20);
    cbRecordPerPage.addItem(30);
    cbRecordPerPage.addItem(50);
    cbRecordPerPage.addItem(100);
    cbRecordPerPage.addItem(200);
    cbRecordPerPage.select(10);
    form.addComponent(cbRecordPerPage);
    cbRecordPerPage.setNullSelectionAllowed(false);

    btnFastBackward = new Button();
    btnFastBackward.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnFastBackward.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnFastBackward.setIcon(FontAwesome.FAST_BACKWARD);
    layout.addComponent(btnFastBackward);
    layout.setComponentAlignment(btnFastBackward, Alignment.MIDDLE_CENTER);

    btnBackward = new Button();
    btnBackward.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnBackward.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnBackward.setIcon(FontAwesome.BACKWARD);
    layout.addComponent(btnBackward);
    layout.setComponentAlignment(btnBackward, Alignment.MIDDLE_CENTER);

    cbPaged = new ComboBox();
    cbPaged.setTextInputAllowed(false);
    for (int i = 1; i <= pageCount; i++) {
        cbPaged.addItem(i);
    }

    cbPaged.setNullSelectionAllowed(false);
    cbPaged.select(1);
    cbPaged.addStyleName(ValoTheme.COMBOBOX_TINY);
    cbPaged.setWidth("60px");
    layout.addComponent(cbPaged);
    layout.setComponentAlignment(cbPaged, Alignment.MIDDLE_CENTER);

    btnFoward = new Button();
    btnFoward.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnFoward.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnFoward.setIcon(FontAwesome.FORWARD);
    layout.addComponent(btnFoward);
    layout.setComponentAlignment(btnFoward, Alignment.MIDDLE_CENTER);

    btnFastFoward = new Button();
    btnFastFoward.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnFastFoward.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnFastFoward.setIcon(FontAwesome.FAST_FORWARD);
    layout.addComponent(btnFastFoward);
    layout.setComponentAlignment(btnFastFoward, Alignment.MIDDLE_CENTER);
    enableComponent();
}

From source file:com.esofthead.mycollab.vaadin.ui.CurrencyComboBoxField.java

License:Open Source License

public CurrencyComboBoxField() {
    super();/* w ww . j  av  a  2s .  c o  m*/

    currencyBox = new ComboBox();
    currencyBox.setItemCaptionMode(ItemCaptionMode.EXPLICIT);

    CurrencyService currencyService = ApplicationContextUtil.getSpringBean(CurrencyService.class);
    List<Currency> currencyList = currencyService.getCurrencies();
    for (Currency currency : currencyList) {
        currencyBox.addItem(currency.getId());
        currencyBox.setItemCaption(currency.getId(),
                currency.getShortname() + " (" + currency.getSymbol() + ")");
    }
}

From source file:com.esofthead.mycollab.vaadin.ui.DateComboboxSelectionField.java

License:Open Source License

public DateComboboxSelectionField() {
    cboMonth = new ComboBox();
    cboMonth.setNullSelectionAllowed(true);
    cboMonth.setImmediate(true);/*from  www  . j a v a  2 s.c om*/

    addMonthItems();
    cboMonth.setWidth("117px");

    cboDate = new ComboBox();
    cboDate.setNullSelectionAllowed(true);
    cboDate.setImmediate(true);

    addDayItems();
    cboDate.setWidth("50px");

    cboYear = new ComboBox();
    cboYear.setNullSelectionAllowed(true);
    cboYear.setImmediate(true);

    addYearItems();
    cboYear.setWidth("70px");
}

From source file:com.esofthead.mycollab.vaadin.web.ui.TimeZoneSelectionField.java

License:Open Source License

public TimeZoneSelectionField(boolean isVerticalDisplay) {
    this.isVerticalDisplay = isVerticalDisplay;
    areaSelection = new ValueComboBox(false, TimezoneVal.getAreas());
    areaSelection.addValueChangeListener(new Property.ValueChangeListener() {

        @Override/*  w w w .  j av a2  s.c o m*/
        public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) {
            setCboTimeZone((String) areaSelection.getValue());
        }
    });
    timezoneSelection = new ComboBox();
    timezoneSelection.setItemCaptionMode(AbstractSelect.ItemCaptionMode.EXPLICIT_DEFAULTS_ID);
    String area = (String) areaSelection.getItemIds().iterator().next();
    areaSelection.setValue(area);
    setCboTimeZone(area);
}

From source file:com.etest.common.CommonComboBox.java

public static ComboBox getYearLevelComboBox(String inputPrompt) {
    ComboBox select = new ComboBox();
    select.setWidth("100%");
    select.setInputPrompt(inputPrompt);/*www.ja v a2  s  .c o  m*/
    select.setNullSelectionAllowed(false);
    select.addContainerProperty("y", String.class, "");
    select.setItemCaptionPropertyId("y");

    Item i = select.addItem(1);
    i.getItemProperty("y").setValue("1st Year");
    i = select.addItem(2);
    i.getItemProperty("y").setValue("2nd Year");
    i = select.addItem(3);
    i.getItemProperty("y").setValue("3rd Year");
    i = select.addItem(4);
    i.getItemProperty("y").setValue("4th Year");
    i = select.addItem(5);
    i.getItemProperty("y").setValue("5th Year");

    select.addStyleName("small");
    select.setImmediate(true);
    return select;
}

From source file:com.etest.common.CommonComboBox.java

public static ComboBox getNormCourseOfferingComboBox(String inputPrompt) {
    ComboBox select = new ComboBox();
    select.setWidth("100%");
    select.setInputPrompt(inputPrompt);/*from  ww  w.java 2  s.c o m*/
    select.setNullSelectionAllowed(false);
    select.addContainerProperty("y", String.class, "");
    select.setItemCaptionPropertyId("y");

    Item i = select.addItem(1);
    i.getItemProperty("y").setValue("First Semester");
    i = select.addItem(2);
    i.getItemProperty("y").setValue("Second Semester");

    select.addStyleName("small");
    select.setImmediate(true);
    return select;
}

From source file:com.etest.common.CommonComboBox.java

public static ComboBox getSubjectFromCurriculum(String inputPrompt) {
    ComboBox select = new ComboBox();
    select.setWidth("100%");
    select.setInputPrompt(inputPrompt);//  www.j  ava 2  s .c o  m
    select.setNullSelectionAllowed(false);
    select.addContainerProperty("y", String.class, "");
    select.setItemCaptionPropertyId("y");

    Item i;
    for (Map.Entry<Integer, String> entry : CurriculumDAO.getSubjectsFromCurriculum().entrySet()) {
        i = select.addItem(entry.getKey());
        i.getItemProperty("y").setValue(entry.getValue());
    }

    select.addStyleName(ValoTheme.COMBOBOX_SMALL);
    select.setImmediate(true);
    return select;
}

From source file:com.etest.common.CommonComboBox.java

public static ComboBox getAllFaculty(String inputPrompt) {
    ComboBox select = new ComboBox();
    select.setWidth("100%");
    select.setInputPrompt(inputPrompt);//  w w w .  j  a  va2 s . c om
    select.setNullSelectionAllowed(false);
    select.addContainerProperty("y", String.class, "");
    select.setItemCaptionPropertyId("y");

    Item i;
    for (Users u : FacultyDAO.getAllFaculty()) {
        i = select.addItem(u.getFacultyId());
        i.getItemProperty("y").setValue(u.getName());
    }

    select.addStyleName("small");
    select.setImmediate(true);
    return select;
}

From source file:com.etest.common.CommonComboBox.java

public static ComboBox getFacultyPosition(String inputPrompt) {
    ComboBox select = new ComboBox();
    select.setWidth("100%");
    select.setInputPrompt(inputPrompt);// w  w w  .ja v  a2  s.  co m
    select.setNullSelectionAllowed(false);
    select.addContainerProperty("y", String.class, "");
    select.setItemCaptionPropertyId("y");

    Item i = select.addItem(1);
    i.getItemProperty("y").setValue("Faculty");
    i = select.addItem(2);
    i.getItemProperty("y").setValue("Dean");

    select.addStyleName("small");
    select.setImmediate(true);
    return select;
}

From source file:com.etest.common.CommonComboBox.java

public static ComboBox getFacultyUserType(String inputPrompt) {
    ComboBox select = new ComboBox();
    select.setWidth("100%");
    select.setInputPrompt(inputPrompt);// ww w. jav  a 2  s . c  o m
    select.setNullSelectionAllowed(false);
    select.addContainerProperty("y", String.class, "");
    select.setItemCaptionPropertyId("y");

    Item i = select.addItem(1);
    i.getItemProperty("y").setValue("Dean");
    i = select.addItem(2);
    i.getItemProperty("y").setValue("Year Level Coordinator");
    i = select.addItem(3);
    i.getItemProperty("y").setValue("Team Teach Leader");
    i = select.addItem(4);
    i.getItemProperty("y").setValue("Team Teach Member");
    i = select.addItem(5);
    i.getItemProperty("y").setValue("Faculty Member");

    select.addStyleName("small");
    select.setImmediate(true);
    return select;
}