Example usage for com.vaadin.ui NativeSelect NativeSelect

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

Introduction

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

Prototype

public NativeSelect(String caption) 

Source Link

Document

Creates a new NativeSelect with the given caption and no items.

Usage

From source file:ro.jtonic.handson.HandsonVaadinApplication.java

License:Apache License

@Override
protected void init(VaadinRequest vaadinRequest) {

    setTheme("runo");

    btn = new Button("Click me!!!");
    final VerticalLayout layout = new VerticalLayout(btn);
    layout.addComponent(btn);/*from  w  w  w . j  a  v a  2 s .  co  m*/

    sel1 = new NativeSelect("Country: ");
    sel1.setNullSelectionAllowed(false);
    sel1.setMultiSelect(false);
    sel1.addItems(Lists.asList("Romania", new String[] { "USA" }));
    sel1.select("Romania");
    layout.addComponent(sel1);

    BeanContainer<String, Person> persBeans = new BeanContainer<>(Person.class);
    persBeans.setBeanIdProperty("id");

    final List<Person> persons = Lists.newArrayList();
    persons.add(new Person("1", "Antonel", "Pazargic", 45));
    persons.add(new Person("2", "Liviu", "Pazargic", 32));
    persBeans.addAll(persons);

    tbl = new Table("Persons", persBeans);
    layout.addComponent(tbl);

    tree.setCaption("PM tree");
    tree.setMultiSelect(true);

    List<PmcVo> pms = PmcVo.getPms();
    fillInTree(pms);
    layout.addComponent(tree);

    p.setHeightUndefined();
    p.setWidth("300px");
    p.setContent(layout);

    setContent(p);

    // events
    setupEvents();
}