Example usage for com.vaadin.ui ListSelect ListSelect

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

Introduction

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

Prototype

public ListSelect(String caption, Collection<T> options) 

Source Link

Document

Constructs a new ListSelect with caption and the given options.

Usage

From source file:rs.pupin.jpo.validation.gui.constraints.IC20.java

@Override
public void generateGUI() {
    rootLayout.removeAllComponents();/* www .  j a  va 2s .c  o m*/

    final Iterator<BindingSet> res = icQuery.getResults();

    if (icQuery.getStatus() == ICQuery.Status.ERROR) {
        Label label = new Label();
        label.setValue("ERROR \n" + icQuery.getErrorMessage());
        rootLayout.addComponent(label);
        return;
    }

    final HashMap<String, String> map = new HashMap<String, String>();
    while (res.hasNext()) {
        BindingSet set = res.next();
        map.put(set.getValue("dim").stringValue(), set.getValue("p").stringValue());
    }

    if (map.isEmpty()) {
        Label label = new Label();
        label.setValue(
                "All values of hierarchical dimensions with a non-blank qb:parentChildProperty are reachable from a root of the hierarchy");
        rootLayout.addComponent(label);
        return;
    }

    Label label = new Label();
    label.setValue(
            "Following dimensions need to be fixed because some of its values cannot be reached from root of the hierarchy along the qb:parentChildProperty links");
    rootLayout.addComponent(label);

    final ListSelect listValues = new ListSelect("Resources", map.keySet());
    listValues.setNullSelectionAllowed(false);
    listValues.setImmediate(true);
    rootLayout.addComponent(listValues);

    Button editInOW = new Button("Edit in OntoWiki");
    editInOW.setEnabled(owUrl != null);
    editInOW.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            editManually((String) listValues.getValue());
        }
    });
}

From source file:rs.pupin.jpo.validation.gui.constraints.IC21.java

@Override
public void generateGUI() {
    rootLayout.removeAllComponents();/* ww  w. j a  va 2 s.  c  o  m*/

    final Iterator<BindingSet> res = icQuery.getResults();

    if (icQuery.getStatus() == ICQuery.Status.ERROR) {
        Label label = new Label();
        label.setValue("ERROR \n" + icQuery.getErrorMessage());
        rootLayout.addComponent(label);
        return;
    }

    final HashMap<String, String> map = new HashMap<String, String>();
    while (res.hasNext()) {
        BindingSet set = res.next();
        map.put(set.getValue("dim").stringValue(), set.getValue("p").stringValue());
    }

    if (map.isEmpty()) {
        Label label = new Label();
        label.setValue(
                "All values of hierarchical dimensions with an inverse qb:parentChildProperty are reachable from a root of the hierarchy");
        rootLayout.addComponent(label);
        return;
    }

    Label label = new Label();
    label.setValue(
            "Following dimensions need to be fixed becaue some of its values cannot be reached from root of the hierarchy along the inverse qb:parentChildProperty links");
    rootLayout.addComponent(label);

    final ListSelect listValues = new ListSelect("Resources", map.keySet());
    listValues.setNullSelectionAllowed(false);
    listValues.setImmediate(true);
    rootLayout.addComponent(listValues);

    Button editInOW = new Button("Edit in OntoWiki");
    editInOW.setEnabled(owUrl != null);
    editInOW.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            editManually((String) listValues.getValue());
        }
    });
}