Example usage for com.vaadin.ui Label setValue

List of usage examples for com.vaadin.ui Label setValue

Introduction

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

Prototype

public void setValue(String value) 

Source Link

Document

Sets the text to be shown in the label.

Usage

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

@Override
public void generateGUI() {
    rootLayout.removeAllComponents();/* w  w  w .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 ArrayList<String> listSliceKeys = new ArrayList<String>();
    while (res.hasNext()) {
        BindingSet set = res.next();
        listSliceKeys.add(set.getValue("sliceKey").stringValue());
    }
    if (listSliceKeys.isEmpty()) {
        Label label = new Label();
        label.setValue(
                "No problems were detected - either there are no slice keys or all slice keys are consistent with associated DSD, i.e. for every slice key holds: "
                        + "every component property of the slice key is also declared as a component of the associated DSD");
        rootLayout.addComponent(label);
        return;
    }

    Label label = new Label();
    label.setValue(
            "All slice keys should be consistent with thier associated DSDs, i.e. for every slice key following should hold: "
                    + "every component property of the slice key is also declared as a component of the associated DSD.");
    rootLayout.addComponent(label);
    Label label2 = new Label();
    label2.setValue(
            "Following slice keys should be modified in order to be consistent with the associated DSD");
    rootLayout.addComponent(label2);
    final ListSelect lsSliceKeys = new ListSelect("Slice keys", listSliceKeys);
    lsSliceKeys.setImmediate(true);
    lsSliceKeys.setNullSelectionAllowed(false);
    rootLayout.addComponent(lsSliceKeys);

    final Table detailsTable = new Table("Slice key details");
    detailsTable.setHeight("250px");
    detailsTable.setWidth("100%");
    detailsTable.addContainerProperty("Property", String.class, null);
    detailsTable.addContainerProperty("Object", String.class, null);
    rootLayout.addComponent(detailsTable);

    Button editInOW = new Button("Edit in OntoWiki");
    editInOW.setEnabled(owUrl != null);
    rootLayout.addComponent(editInOW);

    editInOW.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            editManually((String) lsSliceKeys.getValue());
        }
    });
    lsSliceKeys.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            TupleQueryResult res = getResourceProperties((String) event.getProperty().getValue());
            int i = 1;
            detailsTable.removeAllItems();
            try {
                while (res.hasNext()) {
                    BindingSet set = res.next();
                    detailsTable.addItem(
                            new Object[] { set.getValue("p").stringValue(), set.getValue("o").stringValue() },
                            i++);
                }
            } catch (QueryEvaluationException e) {
                e.printStackTrace();
            }
        }
    });
}

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

@Override
public void generateGUI() {
    rootLayout.removeAllComponents();/*from   w ww.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 ArrayList<String> listSlices = new ArrayList<String>();
    while (res.hasNext()) {
        BindingSet set = res.next();
        listSlices.add(set.getValue("slice").stringValue());
    }
    if (listSlices.isEmpty()) {
        Label label = new Label();
        label.setValue(
                "No problems were detected - either there are no slices or every slice has a unique structure, i.e. exactly one associated slice key (via property qb:sliceStructure)");
        rootLayout.addComponent(label);
        return;
    }

    Label label = new Label();
    label.setValue(
            "Following slices have 0 or more than 1 associated slice keys (via property qb:sliceStructure)");
    rootLayout.addComponent(label);
    final ListSelect lsSlices = new ListSelect("Slices", listSlices);
    lsSlices.setImmediate(true);
    lsSlices.setNullSelectionAllowed(false);
    rootLayout.addComponent(lsSlices);

    final Table detailsTable = new Table("Slice details");
    detailsTable.setHeight("250px");
    detailsTable.setWidth("100%");
    detailsTable.addContainerProperty("Property", String.class, null);
    detailsTable.addContainerProperty("Object", String.class, null);
    rootLayout.addComponent(detailsTable);

    Form panelQuickFix = new Form();
    panelQuickFix.setCaption("Quick Fix");
    panelQuickFix.setSizeFull();
    VerticalLayout panelLayout = new VerticalLayout();
    panelLayout.setSpacing(true);
    panelLayout.setSizeFull();
    panelQuickFix.setLayout(panelLayout);
    rootLayout.addComponent(panelQuickFix);
    rootLayout.setExpandRatio(panelQuickFix, 2.0f);

    Label fixLabel = new Label();
    fixLabel.setContentMode(ContentMode.HTML);
    fixLabel.setValue(
            "After the fix, slice chosen above will be associated with the slice key chosen in the below combo box, "
                    + "or the problematic slice can be edited manuallz in OntoWiki");
    panelLayout.addComponent(fixLabel);
    final ComboBox comboKeys = new ComboBox();
    comboKeys.setWidth("100%");
    comboKeys.setNullSelectionAllowed(false);
    comboKeys.setImmediate(true);
    panelLayout.addComponent(comboKeys);
    HorizontalLayout btnLayout = new HorizontalLayout();
    btnLayout.setSpacing(true);
    Button editOW = new Button("Edit in OntoWiki");
    editOW.setEnabled(owUrl != null);
    Button fix = new Button("Quick fix");
    btnLayout.addComponent(fix);
    btnLayout.addComponent(editOW);
    panelLayout.addComponent(btnLayout);
    panelLayout.setExpandRatio(btnLayout, 2.0f);

    editOW.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            editManually((String) lsSlices.getValue());
        }
    });
    lsSlices.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            TupleQueryResult res = getResourceProperties((String) event.getProperty().getValue());
            int i = 1;
            detailsTable.removeAllItems();
            try {
                while (res.hasNext()) {
                    BindingSet set = res.next();
                    detailsTable.addItem(
                            new Object[] { set.getValue("p").stringValue(), set.getValue("o").stringValue() },
                            i++);
                }
            } catch (QueryEvaluationException e) {
                e.printStackTrace();
            }
        }
    });
    lsSlices.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            String slice = event.getProperty().toString();
            comboKeys.removeAllItems();
            TupleQueryResult resKeys = executeTupleQuery(ValidationFixUtils.ic09_getMatchingKeys(graph, slice));
            try {
                while (resKeys.hasNext()) {
                    comboKeys.addItem(resKeys.next().getValue("key"));
                }
            } catch (QueryEvaluationException e) {
                e.printStackTrace();
            }
        }
    });
    fix.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            Object selKey = comboKeys.getValue();
            Object selSlice = lsSlices.getValue();
            if (selKey == null || selSlice == null) {
                Notification.show("No slice key or slice was selected");
                return;
            }

            GraphQueryResult resFix = executeDoubleGraphQuery(
                    ValidationFixUtils.ic09_removeSliceKeys(graph, selSlice.toString()),
                    ValidationFixUtils.ic09_insertSliceKey(graph, selSlice.toString(), selKey.toString()));
            if (resFix != null) {
                Notification.show("Fix executed");
                // evaluate again after the fix
                icQuery.eval();
            }
        }
    });
}

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

@Override
public void generateGUI() {
    rootLayout.removeAllComponents();//from  w w  w. jav a  2  s  .  co  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, ArrayList<String>> map = new HashMap<String, ArrayList<String>>();
    String lastSlice = null;
    ArrayList<String> lastDimensions = new ArrayList<String>();
    while (res.hasNext()) {
        BindingSet set = res.next();
        String s = set.getValue("slice").stringValue();
        if (lastSlice == null) {
            lastSlice = s;
        }
        String d = set.getValue("dim").stringValue();
        if (!s.equals(lastSlice)) {
            map.put(lastSlice, lastDimensions);
            lastSlice = s;
            lastDimensions = new ArrayList<String>();
        }
        lastDimensions.add(d);
    }
    if (lastSlice != null) {
        map.put(lastSlice, lastDimensions);
    }
    if (map.isEmpty()) {
        Label label = new Label();
        label.setValue(
                "No problems were detected - either there are no slices or every slice has a value for every dimension declared in its associated slice key (via property qb:sliceStructure)");
        rootLayout.addComponent(label);
        return;
    }

    Label label = new Label();
    label.setValue(
            "Following slices do not have a value for every dimension declared in its associated slice key (via property qb:sliceStructure)");
    rootLayout.addComponent(label);
    final ListSelect lsSlices = new ListSelect("Slices", map.keySet());
    lsSlices.setImmediate(true);
    lsSlices.setNullSelectionAllowed(false);
    rootLayout.addComponent(lsSlices);

    final Table detailsTable = new Table("Slice details");
    detailsTable.setHeight("250px");
    detailsTable.setWidth("100%");
    detailsTable.addContainerProperty("Property", String.class, null);
    detailsTable.addContainerProperty("Object", String.class, null);
    rootLayout.addComponent(detailsTable);

    final Label lblProblem = new Label("<b>Problem description: </b>", ContentMode.HTML);
    rootLayout.addComponent(lblProblem);

    Button editInOW = new Button("Edit in OntoWiki");
    editInOW.setEnabled(owUrl != null);
    rootLayout.addComponent(editInOW);

    editInOW.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            editManually((String) lsSlices.getValue());
        }
    });
    lsSlices.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            String slice = (String) event.getProperty().getValue();
            TupleQueryResult res = getResourceProperties(slice);
            int i = 1;
            detailsTable.removeAllItems();
            try {
                while (res.hasNext()) {
                    BindingSet set = res.next();
                    detailsTable.addItem(
                            new Object[] { set.getValue("p").stringValue(), set.getValue("o").stringValue() },
                            i++);
                }
            } catch (QueryEvaluationException e) {
                e.printStackTrace();
            }
            StringBuilder sb = new StringBuilder();
            sb.append(
                    "<b>Problem description: </b>Selected slice is missing a value for the following dimensions:");
            for (String dim : map.get(slice)) {
                sb.append(" ").append(dim).append(",");
            }
            sb.deleteCharAt(sb.length() - 1);
            lblProblem.setValue(sb.toString());
        }
    });
}

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

@Override
public void generateGUI() {
    rootLayout.removeAllComponents();//ww  w  .  j  a v  a  2  s  .  co m

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

    rootLayout.addComponent(new Label("Following observation don't have a value for each dimension: "));
    Iterator<BindingSet> res = icQuery.getResults();
    ArrayList<String> listObs = new ArrayList<String>();
    while (res.hasNext()) {
        BindingSet set = res.next();
        listObs.add(set.getValue("obs").stringValue());
    }
    ListSelect ls = new ListSelect("Observations", listObs);
    ls.setNullSelectionAllowed(false);
    ls.setImmediate(true);
    ls.setWidth("100%");
    rootLayout.addComponent(ls);
    Button fix = new Button("Quick Fix");
    fix.setEnabled(false);
    rootLayout.addComponent(fix);
    rootLayout.setExpandRatio(fix, 2.0f);
}

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

@Override
public void generateGUI() {
    rootLayout.removeAllComponents();/*from  w ww  .  j  a  v a  2s  .  com*/

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

    rootLayout.addComponent(new Label(
            "Following observations belong to the same data set and have the same value for all dimensions."));

    final ListSelect ls1 = new ListSelect("Observations");
    ls1.setNullSelectionAllowed(false);
    ls1.setImmediate(true);
    ls1.setWidth("100%");
    rootLayout.addComponent(ls1);

    Iterator<BindingSet> res = icQuery.getResults();
    final HashMap<String, List<String>> mapDuplicates = new HashMap<String, List<String>>();
    String lastObs = "";
    List<String> lastDuplicates = null;
    while (res.hasNext()) {
        BindingSet set = res.next();
        String obs1 = set.getValue("obs1").stringValue();
        if (!obs1.equals(lastObs)) {
            lastObs = obs1;
            lastDuplicates = new ArrayList<String>();
            mapDuplicates.put(lastObs, lastDuplicates);
            ls1.addItem(lastObs);
        }
        lastDuplicates.add(set.getValue("obs2").stringValue());
    }

    final ListSelect ls2 = new ListSelect("Duplicates");
    ls2.setNullSelectionAllowed(false);
    ls2.setImmediate(true);
    ls2.setWidth("100%");
    rootLayout.addComponent(ls2);

    ls1.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            ls2.removeAllItems();
            for (String duplicate : mapDuplicates.get(event.getProperty().getValue())) {
                ls2.addItem(duplicate);
            }
        }
    });

    Form panelQuickFix = new Form();
    panelQuickFix.setCaption("Quick Fix");
    panelQuickFix.setSizeFull();
    VerticalLayout panelLayout = new VerticalLayout();
    panelLayout.setSpacing(true);
    panelLayout.setSizeFull();
    panelQuickFix.setLayout(panelLayout);
    rootLayout.addComponent(panelQuickFix);
    rootLayout.setExpandRatio(panelQuickFix, 2.0f);
    panelLayout.addComponent(
            new Label("After the fix duplicates of the selected observation will be removed from the graph"));

    Button fix = new Button("Quick Fix");
    panelLayout.addComponent(fix);
    panelLayout.setExpandRatio(fix, 2.0f);

    fix.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            String obsString = (String) ls1.getValue();
            if (obsString == null || obsString.isEmpty()) {
                Notification.show("Select observation first", Notification.Type.ERROR_MESSAGE);
                return;
            }
            ValueFactory factory = repository.getValueFactory();

            for (String duplicateString : mapDuplicates.get(obsString)) {
                URI duplicateURI = factory.createURI(duplicateString);
                TupleQueryResult res = getResourceProperties(duplicateString);
                ArrayList<Statement> stmts = new ArrayList<Statement>();
                try {
                    while (res.hasNext()) {
                        BindingSet set = res.next();
                        URI propURI = factory.createURI(set.getValue("p").stringValue());
                        Value objValue = set.getValue("o");
                        stmts.add(factory.createStatement(duplicateURI, propURI, objValue));
                    }
                    res = getResourceLinks(duplicateString);
                    while (res.hasNext()) {
                        BindingSet set = res.next();
                        URI propURI = factory.createURI(set.getValue("p").stringValue());
                        URI subURI = factory.createURI(set.getValue("s").stringValue());
                        stmts.add(factory.createStatement(subURI, propURI, duplicateURI));
                    }
                    removeStatements(stmts);
                } catch (QueryEvaluationException e) {
                    e.printStackTrace();
                }
            }
            Notification.show("Fix executed");
            // evaluate again after the fix
            icQuery.eval();
        }
    });
}

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

@Override
public void generateGUI() {
    rootLayout.removeAllComponents();//from   w ww. j  a  va  2  s.co m
    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> obsMap = new HashMap<String, String>();
    while (res.hasNext()) {
        BindingSet set = res.next();
        obsMap.put(set.getValue("obs").stringValue(), set.getValue("attr").stringValue());
    }

    if (obsMap.isEmpty()) {
        Label label = new Label();
        label.setValue(
                "No problems were detected - Every qb:Observation has a value for each declared attribute that is marked as required");
        rootLayout.addComponent(label);
        return;
    }

    Label lbl = new Label();
    lbl.setValue("Following observations do not have a value for required attribute(s)");
    rootLayout.addComponent(lbl);

    final ListSelect listObservations = new ListSelect("Observations", obsMap.keySet());
    listObservations.setNullSelectionAllowed(false);
    listObservations.setImmediate(true);
    rootLayout.addComponent(listObservations);

    // TODO: add label that tells which attribute is missing
    Form panelQuickFix = new Form();
    panelQuickFix.setCaption("Quick Fix");
    panelQuickFix.setSizeFull();
    VerticalLayout panelLayout = new VerticalLayout();
    panelLayout.setSpacing(true);
    panelLayout.setSizeFull();
    panelQuickFix.setLayout(panelLayout);
    rootLayout.addComponent(panelQuickFix);
    rootLayout.setExpandRatio(panelQuickFix, 2.0f);

    Label fixLabel = new Label();
    fixLabel.setContentMode(ContentMode.HTML);
    fixLabel.setValue(""); // TODO
    panelLayout.addComponent(fixLabel);

    HorizontalLayout btnLayout = new HorizontalLayout();
    btnLayout.setSpacing(true);
    Button removeRequired = new Button("Remove qb:componentRequired");
    Button editOW = new Button("Edit in OntoWiki");
    editOW.setEnabled(owUrl != null);
    btnLayout.addComponent(removeRequired);
    btnLayout.addComponent(editOW);
    panelLayout.addComponent(btnLayout);
    panelLayout.setExpandRatio(btnLayout, 2.0f);

    removeRequired.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            String chosenObs = (String) listObservations.getValue();
            if (chosenObs == null) {
                Notification.show("Cannot execute the action", "Observation needs to be chosen first",
                        Notification.Type.ERROR_MESSAGE);
                return;
            }
            String query = ValidationFixUtils.ic13_removeComponentRequiredTrue(graph, chosenObs,
                    obsMap.get(chosenObs));
            GraphQueryResult fixRes = executeGraphQuery(query);
            if (fixRes != null) {
                Notification.show("Fix executed");
                // evaluate again after the fix
                icQuery.eval();
            }
        }
    });
    editOW.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            editManually((String) listObservations.getValue());
        }
    });
}

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

@Override
public void generateGUI() {
    rootLayout.removeAllComponents();//from  ww w.ja v a2 s.com
    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> obsMap = new HashMap<String, String>();
    while (res.hasNext()) {
        BindingSet set = res.next();
        obsMap.put(set.getValue("obs").stringValue(), set.getValue("measure").stringValue());
    }

    if (obsMap.isEmpty()) {
        Label label = new Label();
        label.setValue(
                "No problems were detected - In Data Sets that do not use a Measure dimension (if there are any) each Observation has a value for every declared measure");
        rootLayout.addComponent(label);
        return;
    }

    Label lbl = new Label();
    lbl.setValue("Following observations are missing a value for declared measure(s)");
    rootLayout.addComponent(lbl);

    final ListSelect listObservations = new ListSelect("Observations", obsMap.keySet());
    listObservations.setNullSelectionAllowed(false);
    listObservations.setImmediate(true);
    rootLayout.addComponent(listObservations);

    // TODO: add label that tells which measure is missing
    Button fix = new Button("Edit in OntoWiki");
    fix.setEnabled(owUrl != null);
    rootLayout.addComponent(fix);
    rootLayout.setExpandRatio(fix, 2.0f);

    fix.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            editManually((String) listObservations.getValue());
        }
    });
}

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

@Override
public void generateGUI() {
    rootLayout.removeAllComponents();/*from w w  w .j av a2s  .com*/
    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> obsMap = new HashMap<String, String>();
    while (res.hasNext()) {
        BindingSet set = res.next();
        obsMap.put(set.getValue("obs").stringValue(), set.getValue("measure").stringValue());
    }

    if (obsMap.isEmpty()) {
        Label label = new Label();
        label.setValue(
                "No problems were detected - In Data Sets that a Measure dimension (if there are any) each Observation has a value for the measure corresponding to its given qb:measureType");
        rootLayout.addComponent(label);
        return;
    }

    Label lbl = new Label();
    lbl.setValue(
            "Following observations are missing a value for the measure corresponding to its given qb:measureType");
    rootLayout.addComponent(lbl);

    final ListSelect listObservations = new ListSelect("Observations", obsMap.keySet());
    listObservations.setNullSelectionAllowed(false);
    listObservations.setImmediate(true);
    rootLayout.addComponent(listObservations);

    // TODO: add label that tells which measure is missing
    Button fix = new Button("Edit in OntoWiki");
    fix.setEnabled(owUrl != null);
    rootLayout.addComponent(fix);
    rootLayout.setExpandRatio(fix, 2.0f);

    fix.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            editManually((String) listObservations.getValue());
        }
    });
}

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

@Override
public void generateGUI() {
    rootLayout.removeAllComponents();//from  w  w w .  j  a va  2 s.co m
    Iterator<BindingSet> res = icQuery.getResults();

    @SuppressWarnings("unused")
    final class MeasureOmeasurePair {

        String measure;
        String omeasure;
    }

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

    final HashMap<String, MeasureOmeasurePair> obsMap = new HashMap<String, MeasureOmeasurePair>();
    while (res.hasNext()) {
        BindingSet set = res.next();
        MeasureOmeasurePair pair = new MeasureOmeasurePair();
        pair.measure = set.getValue("measure").stringValue();
        pair.omeasure = set.getValue("omeasure").stringValue();
        obsMap.put(set.getValue("obs").stringValue(), pair);
    }

    if (obsMap.isEmpty()) {
        Label label = new Label();
        label.setValue(
                "No problems were detected - In Data Sets that use a Measure dimension (if there are any) each Observation only has a value for one measure");
        rootLayout.addComponent(label);
        return;
    }

    Label lbl = new Label();
    lbl.setValue(
            "Following observations belong to data sets that use a Measure dimension and have a value for more than one measure");
    rootLayout.addComponent(lbl);

    final ListSelect listObservations = new ListSelect("Observations", obsMap.keySet());
    listObservations.setNullSelectionAllowed(false);
    listObservations.setImmediate(true);
    rootLayout.addComponent(listObservations);

    // TODO: add label that tells what is the measure dimension and mention the omeasure, perhaps details table
    Button fix = new Button("Edit in OntoWiki");
    fix.setEnabled(owUrl != null);
    rootLayout.addComponent(fix);
    rootLayout.setExpandRatio(fix, 2.0f);

    fix.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            editManually((String) listObservations.getValue());
        }
    });
}

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

@Override
public void generateGUI() {
    rootLayout.removeAllComponents();//from  w w w .  j  av  a 2 s  . co  m
    Iterator<BindingSet> res = icQuery.getResults();

    @SuppressWarnings("unused")
    final class NumMeasuresCountPair {

        String numMeasures;
        String count;
    }

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

    final HashMap<String, NumMeasuresCountPair> obsMap = new HashMap<String, NumMeasuresCountPair>();
    while (res.hasNext()) {
        BindingSet set = res.next();
        NumMeasuresCountPair pair = new NumMeasuresCountPair();
        pair.numMeasures = set.getValue("numMeasures").stringValue();
        pair.count = set.getValue("count").stringValue();
        obsMap.put(set.getValue("obs1").stringValue(), pair);
    }

    if (obsMap.isEmpty()) {
        Label label = new Label();
        label.setValue("No problems were detected - In a data set which uses a measure dimension then "
                + "if there is an Observation for some combination of non-measure dimensions then "
                + "there must be other Observations with the same non-measure dimension values for each of the declared measures");
        rootLayout.addComponent(label);
        return;
    }

    Label lbl = new Label();
    lbl.setValue(
            "Following observations belong to data sets that use a Measure dimension and break a rule that "
                    + "if there is an Observation for some combination of non-measure dimensions then "
                    + "there must be other Observations with the same non-measure dimension values for each of the declared measures");
    rootLayout.addComponent(lbl);

    final ListSelect listObservations = new ListSelect("Observations", obsMap.keySet());
    listObservations.setNullSelectionAllowed(false);
    listObservations.setImmediate(true);
    rootLayout.addComponent(listObservations);

    // TODO: add label that tells what is the difference in counts, maybe even more, perhaps details table
    Button fix = new Button("Edit in OntoWiki");
    fix.setEnabled(owUrl != null);
    rootLayout.addComponent(fix);
    rootLayout.setExpandRatio(fix, 2.0f);

    fix.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            editManually((String) listObservations.getValue());
        }
    });
}