Example usage for com.vaadin.ui TextField getValue

List of usage examples for com.vaadin.ui TextField getValue

Introduction

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

Prototype

@Override
    public String getValue() 

Source Link

Usage

From source file:org.semanticsoft.vaaclipse.p2.install.ui.impl.RepositoryLoader.java

License:Open Source License

public void initUI() {

    final Label errorLabel = new Label();
    errorLabel.setImmediate(true);//from www . ja  v  a2  s  .c o m
    Label label = new Label("Enter URI here");

    final TextField textField = new TextField();
    textField.setValue("http://localhost/MyUpdateSite");
    textField.setImmediate(true);
    textField.setSizeFull();

    mainLayout.addComponent(errorLabel);
    mainLayout.addComponent(label);
    mainLayout.addComponent(textField);

    textField.addShortcutListener(new ShortcutListener("Enter URI", ShortcutAction.KeyCode.ENTER, null) {

        @Override
        public void handleAction(Object sender, Object target) {
            // TODO Auto-generated method stub
            errorLabel.setValue("");
            validate = true;
            loadRepository.clear();
            String value = textField.getValue();

            if (value != null && !value.trim().isEmpty()) {
                try {
                    loadRepository.addAll(getInstallService().loadRepository(value, getProvisioningAgent()));

                } catch (Exception e) {
                    validate = false;
                    e.printStackTrace();

                    errorLabel.setValue("URI is not valid");

                    errorMessage = e.getMessage();
                }
                iRepositoryExplorer.addRepositories(loadRepository);

            }
        }

    });

}

From source file:org.vaadin.arborgraph.demo.DemoApplication.java

License:Open Source License

@SuppressWarnings("serial")
@Override/*from   w  w  w. j  a v a 2 s  . c om*/
public void init() {
    VerticalLayout aboutLayout = new VerticalLayout();
    aboutLayout.setSizeFull();
    aboutLayout.addComponent(new Label(getBlah(), Label.CONTENT_XHTML));

    final ArborGraph graph = new ArborGraph();
    graph.setSizeFull();

    Button exampleGraphButton = new Button("Show Example", new ClickListener() {

        public void buttonClick(ClickEvent event) {
            graph.showGraph(getDemoBranch());
        }
    });

    Label orLabel = new Label("<i>or</i>", Label.CONTENT_XHTML);
    orLabel.setSizeUndefined();

    final TextField jsonTextfield = new TextField();
    jsonTextfield.setWidth(100, Sizeable.UNITS_PERCENTAGE);
    jsonTextfield.setNullRepresentation("");

    Button jsonBranchButton = new Button("Display Json Branch", new ClickListener() {

        public void buttonClick(ClickEvent event) {
            graph.showGraph(jsonTextfield.getValue().toString());
        }
    });

    Label helpLabel = getHelpLabel(getBranchExplanation());

    HorizontalLayout graphButtonLayout = new HorizontalLayout();
    graphButtonLayout.setWidth(100, Sizeable.UNITS_PERCENTAGE);
    graphButtonLayout.setSpacing(true);
    graphButtonLayout.setMargin(false, false, true, false);
    graphButtonLayout.addComponent(exampleGraphButton);
    graphButtonLayout.addComponent(orLabel);
    graphButtonLayout.setComponentAlignment(orLabel, Alignment.MIDDLE_CENTER);
    graphButtonLayout.addComponent(jsonBranchButton);
    graphButtonLayout.addComponent(helpLabel);
    graphButtonLayout.setComponentAlignment(helpLabel, Alignment.MIDDLE_CENTER);
    graphButtonLayout.addComponent(jsonTextfield);
    graphButtonLayout.setExpandRatio(jsonTextfield, .9f);

    VerticalLayout graphLayout = new VerticalLayout();
    graphLayout.setSizeFull();
    graphLayout.setMargin(true, false, false, false);
    graphLayout.setSpacing(true);
    graphLayout.addComponent(graphButtonLayout);
    graphLayout.addComponent(graph);
    graphLayout.setExpandRatio(graph, .9f);

    TabSheet tabSheet = new TabSheet();
    tabSheet.setStyleName(Reindeer.TABSHEET_MINIMAL);
    tabSheet.setSizeFull();
    tabSheet.addTab(aboutLayout, "About");
    tabSheet.addTab(graphLayout, "Graph");

    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setSizeFull();
    mainLayout.setMargin(true);
    mainLayout.addComponent(tabSheet);
    mainLayout.setExpandRatio(tabSheet, .9f);

    Window mainWindow = new Window("Arbor-Vaadin");
    mainWindow.setSizeFull();
    mainWindow.setContent(mainLayout);

    setTheme("arbor");

    setMainWindow(mainWindow);
}

From source file:org.vaadin.webinars.springandvaadin.i18n.ui.I18nUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    setLocale(request.getLocale());/*  w ww  .  ja v a2s .  com*/

    getPage().setTitle(messageSource.getMessage("page.title", null, getLocale()));

    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);
    setContent(layout);

    final TextField textField = new TextField(messageSource.getMessage("textField.caption", null, getLocale()));
    layout.addComponent(textField);

    final Button button = new Button(messageSource.getMessage("button.caption", null, getLocale()));
    button.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            Notification.show(messageSource.getMessage("greeting.caption",
                    new Object[] { textField.getValue() }, getLocale()));
        }
    });
    layout.addComponent(button);

    final Button swe = new Button("P svenska", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            LocaleContextHolder.setLocale(new Locale("sv"));
            getPage().reload();
        }
    });
    layout.addComponent(swe);

    final Button eng = new Button("In English", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            LocaleContextHolder.setLocale(new Locale("en"));
            getPage().reload();
        }
    });
    layout.addComponent(eng);

}

From source file:pl.exsio.frameset.vaadin.ui.support.dialog.PromptDialog.java

License:Open Source License

private static HorizontalLayout getControls(final Window window, final Handler handler, final TextField value) {
    final HorizontalLayout controls = new HorizontalLayout() {
        {//from   ww w  .  j a  v  a  2 s .c o  m
            Button confirm = new Button(t("core.ok"), FontAwesome.CHECK);
            Button cancel = new Button(t("core.cancel"), FontAwesome.TIMES);

            confirm.addClickListener(new Button.ClickListener() {

                @Override
                public void buttonClick(Button.ClickEvent event) {
                    window.close();
                }
            });
            cancel.addClickListener(new Button.ClickListener() {

                @Override
                public void buttonClick(Button.ClickEvent event) {
                    window.close();
                }
            });

            if (handler instanceof Handler) {
                confirm.addClickListener(new Button.ClickListener() {

                    @Override
                    public void buttonClick(Button.ClickEvent event) {
                        handler.handle(event, value.getValue());
                    }
                });
            }

            confirm.setClickShortcut(KeyCode.ENTER);
            cancel.setClickShortcut(KeyCode.ESCAPE);
            addComponent(confirm);
            addComponent(cancel);
        }
    };
    controls.setMargin(new MarginInfo(true, true, false, true));
    controls.setSpacing(true);
    return controls;
}

From source file:pt.ist.vaadinframework.ui.fields.MultiLanguageStringField.java

License:Open Source License

@Override
protected boolean isEmpty() {
    for (TextField childField : fields.values()) {
        if (((String) childField.getValue()).length() > 0) {
            return true;
        }/*from  w  w  w .j  ava 2  s. c om*/
    }
    return false;
}

From source file:roart.client.MyVaadinUI.java

private Window getLoginWindow() {
    final Window window = new Window("Login");
    window.setWidth("30%");
    window.setHeight("30%");
    window.center();// w  ww . j ava 2 s .  com
    final TextField login = new TextField("Username");
    final PasswordField password = new PasswordField("Password");
    Button button = new Button("Login");
    button.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            tryLogin(login.getValue(), password.getValue());
            window.close();
        }
    });
    VerticalLayout vert = new VerticalLayout();
    vert.addComponent(login);
    vert.addComponent(password);
    vert.addComponent(button);
    window.setContent(vert);
    return window;
}

From source file:rs.pupin.jpo.esta_ld.DSDRepoComponent.java

private void refreshContentCreateDSD(DataSet ds) {
    if (ds == null) {
        getWindow().showNotification("No dataset selected", Window.Notification.TYPE_ERROR_MESSAGE);
        return;//from   ww w.ja  va  2 s .  c om
    }
    Structure struct = ds.getStructure();
    if (struct != null) {
        contentLayout.addComponent(new Label("The dataset already has a DSD!"));
        return;
    }

    dataset = ds.getUri();
    contentLayout.removeAllComponents();
    dataTree = new Tree("Dataset");
    dataTree.setNullSelectionAllowed(true);
    dataTree.setImmediate(true);
    dataTree.setWidth("500px");
    populateDataTree();
    addDataTreeListenersCreate();
    contentLayout.addComponent(dataTree);
    contentLayout.setExpandRatio(dataTree, 0.0f);

    final VerticalLayout right = new VerticalLayout();
    right.setSpacing(true);
    contentLayout.addComponent(right);
    contentLayout.setExpandRatio(right, 2.0f);
    lblUndefined = new Label("There are still x undefined components", Label.CONTENT_XHTML);
    right.addComponent(lblUndefined);
    lblMissingCodeLists = new Label("There are still y missing code lists", Label.CONTENT_XHTML);
    right.addComponent(lblMissingCodeLists);
    final TextField dsdUri = new TextField("Enter DSD URI");
    dsdUri.setWidth("300px");
    right.addComponent(dsdUri);
    final Button btnCreate = new Button("Create DSD");
    right.addComponent(btnCreate);
    right.addComponent(new Label("<hr/>", Label.CONTENT_XHTML));
    compatibleCodeLists = new Tree("Compatible code lists");
    right.addComponent(compatibleCodeLists);

    updateUndefinedAndMissing();

    compatibleCodeLists.addActionHandler(new Action.Handler() {
        public Action[] getActions(Object target, Object sender) {
            if (target == null)
                return null;
            if (compatibleCodeLists.getParent(target) != null)
                return null;
            return new Action[] { ACTION_SET_AS_CL };
        }

        public void handleAction(Action action, Object sender, Object target) {
            if (action == ACTION_SET_AS_CL) {
                Object item = compatibleCodeLists.getData();
                if (item == null) {
                    getWindow().showNotification(
                            "Error, the component cannot determine where to put the code list",
                            Window.Notification.TYPE_ERROR_MESSAGE);
                    return;
                }
                if (dataTree.getChildren(item).size() == 2) {
                    getWindow().showNotification("The component property already has a code list",
                            Window.Notification.TYPE_ERROR_MESSAGE);
                    return;
                }
                try {
                    RepositoryConnection conn = repository.getConnection();
                    String cl = (String) target;
                    String prop = (String) dataTree.getValue();
                    GraphQuery query = conn.prepareGraphQuery(QueryLanguage.SPARQL,
                            DSDRepoUtils.qPullCodeList(cl, prop, repoGraph, dataGraph));
                    query.evaluate();
                    getWindow().showNotification("Code List set");
                    addCodeListToDataTree();
                    updateUndefinedAndMissing();
                } catch (RepositoryException ex) {
                    Logger.getLogger(DSDRepoComponent.class.getName()).log(Level.SEVERE, null, ex);
                } catch (MalformedQueryException ex) {
                    Logger.getLogger(DSDRepoComponent.class.getName()).log(Level.SEVERE, null, ex);
                } catch (QueryEvaluationException ex) {
                    Logger.getLogger(DSDRepoComponent.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }
    });
    btnCreate.addListener(new Button.ClickListener() {
        public void buttonClick(Button.ClickEvent event) {
            if (numUndefinedComponents > 0) {
                getWindow().showNotification("There can be no undefined components",
                        Window.Notification.TYPE_ERROR_MESSAGE);
                return;
            }
            if (numMissingCodeLists > 0) {
                getWindow().showNotification("All code lists must first be created or imported",
                        Window.Notification.TYPE_ERROR_MESSAGE);
                return;
            }
            final String dsd = dsdUri.getValue().toString();
            if (!isUri(dsd)) {
                getWindow().showNotification("Enter a valid URI for the DSD",
                        Window.Notification.TYPE_ERROR_MESSAGE);
            }

            try {
                RepositoryConnection conn = repository.getConnection();
                LinkedList<String> dList = new LinkedList<String>();
                LinkedList<String> mList = new LinkedList<String>();
                LinkedList<String> aList = new LinkedList<String>();
                LinkedList<String> uList = new LinkedList<String>();
                LinkedList<String> propList = new LinkedList<String>();
                LinkedList<String> rangeList = new LinkedList<String>();

                for (Object id : dataTree.rootItemIds()) {
                    Collection<?> children = dataTree.getChildren(id);
                    if (children == null)
                        continue;

                    Collection<String> list = null;
                    if (id.toString().startsWith("D"))
                        list = dList;
                    else if (id.toString().startsWith("M"))
                        list = mList;
                    else if (id.toString().startsWith("A"))
                        list = aList;
                    else if (id.toString().startsWith("U"))
                        list = uList;

                    for (Object prop : dataTree.getChildren(id)) {
                        CountingTreeHeader h = (CountingTreeHeader) dataTree.getChildren(prop).iterator()
                                .next();
                        propList.add(prop.toString());
                        list.add(prop.toString());
                        if (h.toString().startsWith("C")) {
                            rangeList.add("http://www.w3.org/2004/02/skos/core#Concept");
                        } else {
                            rangeList.add(dataTree.getChildren(h).iterator().next().toString());
                        }
                    }
                }
                if (uList.size() > 0) {
                    getWindow().showNotification("There are undefined properties!",
                            Window.Notification.TYPE_WARNING_MESSAGE);
                    return;
                }
                GraphQuery query = conn.prepareGraphQuery(QueryLanguage.SPARQL, DSDRepoUtils.qCreateDSD(dataset,
                        dsd, dList, mList, aList, propList, rangeList, dataGraph));
                query.evaluate();
                getWindow().showNotification("DSD created!");
                DSDRepoComponent.this.ds = new SparqlDataSet(repository, DSDRepoComponent.this.ds.getUri(),
                        dataGraph);
                createDSD();
            } catch (RepositoryException ex) {
                Logger.getLogger(DSDRepoComponent.class.getName()).log(Level.SEVERE, null, ex);
            } catch (MalformedQueryException ex) {
                Logger.getLogger(DSDRepoComponent.class.getName()).log(Level.SEVERE, null, ex);
            } catch (QueryEvaluationException ex) {
                Logger.getLogger(DSDRepoComponent.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    });
}

From source file:rs.pupin.jpo.esta_ld.InspectComponent.java

private void showTransformDimensionView(Dimension dim) {
    dimTransformLayout.removeAllComponents();
    dimTransformLayout.addComponent(new Label("<h1>Manage Temporal Dimension</h1>", Label.CONTENT_XHTML));
    dimTransformLayout.addComponent(new Label("<h2>Dimension: " + dim.getUri() + "</h2>", Label.CONTENT_XHTML));

    // show properties table
    final Table propertiesTable = new Table("Properties");
    propertiesTable.setHeight("250px");
    propertiesTable.setWidth("100%");
    propertiesTable.addContainerProperty("Property", String.class, null);
    propertiesTable.addContainerProperty("Value", String.class, null);
    dimTransformLayout.addComponent(propertiesTable);
    try {/*  w  ww.  java2  s .com*/
        RepositoryConnection conn = repository.getConnection();
        TupleQuery query = conn.prepareTupleQuery(QueryLanguage.SPARQL,
                DSDRepoUtils.qResourcePorperties(dim.getUri(), dataGraph));
        TupleQueryResult res = query.evaluate();
        int i = 0;
        while (res.hasNext()) {
            BindingSet set = res.next();
            Object[] row = new Object[] { set.getValue("p").stringValue(), set.getValue("o").stringValue() };
            propertiesTable.addItem(row, i++);
        }
    } catch (RepositoryException ex) {
        logger.log(Level.SEVERE, null, ex);
    } catch (MalformedQueryException ex) {
        logger.log(Level.SEVERE, null, ex);
    } catch (QueryEvaluationException ex) {
        logger.log(Level.SEVERE, null, ex);
    }

    // add separator
    dimTransformLayout.addComponent(new Label("<hr/>", Label.CONTENT_XHTML));

    // TODO: show transform to time dimension 
    // select: { year, month, date }
    final ComboBox comboType = new ComboBox("Choose type:",
            Arrays.asList(TimeDimensionTransformator.Type.values()));
    comboType.setNullSelectionAllowed(false);
    comboType.select(TimeDimensionTransformator.Type.XSD_YEAR);
    dimTransformLayout.addComponent(comboType);
    // text field: { pattern }
    final TextField fieldPattern = new TextField("Transformation Pattern:");
    fieldPattern.setWidth("400px");
    dimTransformLayout.addComponent(fieldPattern);
    // button: transform
    final Button btnTransform = new Button("Transform");
    dimTransformLayout.addComponent(btnTransform);

    final TimeDimensionTransformator timeTransformator = new TimeDimensionTransformator(repository, dataGraph,
            dim.getUri(), (TimeDimensionTransformator.Type) comboType.getValue());
    try {
        timeTransformator.initialize();
    } catch (RepositoryException ex) {
        logger.log(Level.SEVERE, null, ex);
        btnTransform.setEnabled(false);
        getWindow().showNotification(ex.getMessage(), Window.Notification.TYPE_ERROR_MESSAGE);
    } catch (MalformedQueryException ex) {
        logger.log(Level.SEVERE, null, ex);
        btnTransform.setEnabled(false);
        getWindow().showNotification(ex.getMessage(), Window.Notification.TYPE_ERROR_MESSAGE);
    } catch (QueryEvaluationException ex) {
        logger.log(Level.SEVERE, null, ex);
        btnTransform.setEnabled(false);
        getWindow().showNotification(ex.getMessage(), Window.Notification.TYPE_ERROR_MESSAGE);
    }

    btnTransform.addListener(new Button.ClickListener() {
        public void buttonClick(Button.ClickEvent event) {
            if (fieldPattern.getValue() == null) {
                getWindow().showNotification("Come on, you need to provide the transformation pattern");
            }
            try {
                // set type according to the value in the combo box
                timeTransformator.setType((TimeDimensionTransformator.Type) comboType.getValue());
                // first check if the values can be parsed
                logger.fine("Parsing...");
                timeTransformator.parseLean(fieldPattern.getValue().toString());
                // if parsing went fine fire away
                logger.fine("Modifying dimension...");
                timeTransformator.modifyDimension();
                logger.fine("Removing old...");
                timeTransformator.removeOld();
                logger.fine("Inserting new...");
                timeTransformator.insertNew();
                logger.fine("Finished transformation!!!");
                getWindow().showNotification("Dimension transformed");
                //                } catch (ParseException ex) {
                //                    logger.log(Level.SEVERE, null, ex);
                //                    String msg = "Could not parse values \n";
                //                    getWindow().showNotification(msg + ex.getMessage(), Window.Notification.TYPE_ERROR_MESSAGE);
            } catch (RepositoryException ex) {
                logger.log(Level.SEVERE, null, ex);
                getWindow().showNotification(ex.getMessage(), Window.Notification.TYPE_ERROR_MESSAGE);
            } catch (MalformedQueryException ex) {
                logger.log(Level.SEVERE, null, ex);
                getWindow().showNotification(ex.getMessage(), Window.Notification.TYPE_ERROR_MESSAGE);
            } catch (QueryEvaluationException ex) {
                logger.log(Level.SEVERE, null, ex);
                getWindow().showNotification(ex.getMessage(), Window.Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });
}

From source file:rs.pupin.jpo.esta_ld.InspectComponent.java

private void showManageGeoView(Dimension dim) {
    dimTransformLayout.removeAllComponents();
    dimTransformLayout.addComponent(new Label("<h1>Manage Spatial Dimension</h1>", Label.CONTENT_XHTML));
    dimTransformLayout.addComponent(new Label("<h2>Dimension: " + dim.getUri() + "</h2>", Label.CONTENT_XHTML));

    // show properties table
    final Table propertiesTable = new Table("Properties");
    propertiesTable.setHeight("250px");
    propertiesTable.setWidth("100%");
    propertiesTable.addContainerProperty("Property", String.class, null);
    propertiesTable.addContainerProperty("Value", String.class, null);
    dimTransformLayout.addComponent(propertiesTable);
    try {/*from  w  w w.  j  a  v  a2s . c  o m*/
        RepositoryConnection conn = repository.getConnection();
        TupleQuery query = conn.prepareTupleQuery(QueryLanguage.SPARQL,
                DSDRepoUtils.qResourcePorperties(dim.getUri(), dataGraph));
        TupleQueryResult res = query.evaluate();
        int i = 0;
        while (res.hasNext()) {
            BindingSet set = res.next();
            Object[] row = new Object[] { set.getValue("p").stringValue(), set.getValue("o").stringValue() };
            propertiesTable.addItem(row, i++);
        }
    } catch (RepositoryException ex) {
        logger.log(Level.SEVERE, null, ex);
    } catch (MalformedQueryException ex) {
        logger.log(Level.SEVERE, null, ex);
    } catch (QueryEvaluationException ex) {
        logger.log(Level.SEVERE, null, ex);
    }

    // add separator
    dimTransformLayout.addComponent(new Label("<hr/>", Label.CONTENT_XHTML));

    final SpatialDimensionManipulator manipulator = new SpatialDimensionManipulator(dim,
            SpatialDimensionManipulator.Kind.BY_CODE);

    final ComboBox comboKind = new ComboBox("Choose kind:",
            Arrays.asList(SpatialDimensionManipulator.Kind.values()));
    comboKind.setNullSelectionAllowed(false);
    comboKind.select(SpatialDimensionManipulator.Kind.BY_CODE);
    dimTransformLayout.addComponent(comboKind);
    // text field: { pattern }
    final TextField fieldPrefix = new TextField("Prefix:");
    fieldPrefix.setWidth("400px");
    dimTransformLayout.addComponent(fieldPrefix);
    // button: insert polygons
    final Button btnInsertPolygons = new Button("Insert Polygons");
    dimTransformLayout.addComponent(btnInsertPolygons);

    btnInsertPolygons.addListener(new Button.ClickListener() {
        public void buttonClick(Button.ClickEvent event) {
            String prefix = fieldPrefix.getValue().toString();
            if (prefix == null) {
                return;
            }

            String array = manipulator.extractPairs(prefix);
            String jsCall = "javaInsertPolygons(" + array + ")";
            getWindow().executeJavaScript(jsCall);
        }
    });
}

From source file:rs.pupin.jpo.esta_ld.InspectComponent.java

private void refreshContentCreateDSD(DataSet ds) {
    if (ds == null) {
        getWindow().showNotification("No dataset selected", Window.Notification.TYPE_ERROR_MESSAGE);
        return;/*  w  w w .j a  v  a 2s .c o  m*/
    }
    Structure struct = ds.getStructure();
    if (struct != null) {
        contentLayout.addComponent(new Label("The dataset already has a DSD!"));
        return;
    }

    dataset = ds.getUri();
    contentLayout.removeAllComponents();
    dataTree = new Tree("Dataset");
    dataTree.setNullSelectionAllowed(true);
    dataTree.setImmediate(true);
    dataTree.setWidth("500px");
    populateDataTree();
    addDataTreeListenersCreate();
    contentLayout.addComponent(dataTree);
    contentLayout.setExpandRatio(dataTree, 0.0f);

    final VerticalLayout right = new VerticalLayout();
    right.setSpacing(true);
    contentLayout.addComponent(right);
    contentLayout.setExpandRatio(right, 2.0f);
    lblUndefined = new Label("There are still x undefined components", Label.CONTENT_XHTML);
    right.addComponent(lblUndefined);
    lblMissingCodeLists = new Label("There are still y missing code lists", Label.CONTENT_XHTML);
    right.addComponent(lblMissingCodeLists);
    final TextField dsdUri = new TextField("Enter DSD URI");
    dsdUri.setWidth("300px");
    right.addComponent(dsdUri);
    final Button btnCreate = new Button("Create DSD");
    right.addComponent(btnCreate);
    right.addComponent(new Label("<hr/>", Label.CONTENT_XHTML));
    compatibleCodeLists = new Tree("Compatible code lists");
    right.addComponent(compatibleCodeLists);

    updateUndefinedAndMissing();

    compatibleCodeLists.addActionHandler(new Action.Handler() {
        public Action[] getActions(Object target, Object sender) {
            if (target == null)
                return null;
            if (compatibleCodeLists.getParent(target) != null)
                return null;
            return new Action[] { ACTION_SET_AS_CL };
        }

        public void handleAction(Action action, Object sender, Object target) {
            if (action == ACTION_SET_AS_CL) {
                getWindow().showNotification("Action not available");
            }
        }
    });
    btnCreate.addListener(new Button.ClickListener() {
        public void buttonClick(Button.ClickEvent event) {
            if (numUndefinedComponents > 0) {
                getWindow().showNotification("There can be no undefined components",
                        Window.Notification.TYPE_ERROR_MESSAGE);
                return;
            }
            if (numMissingCodeLists > 0) {
                getWindow().showNotification("All code lists must first be created or imported",
                        Window.Notification.TYPE_ERROR_MESSAGE);
                return;
            }
            final String dsd = dsdUri.getValue().toString();
            if (!isUri(dsd)) {
                getWindow().showNotification("Enter a valid URI for the DSD",
                        Window.Notification.TYPE_ERROR_MESSAGE);
            }

            try {
                RepositoryConnection conn = repository.getConnection();
                LinkedList<String> dList = new LinkedList<String>();
                LinkedList<String> mList = new LinkedList<String>();
                LinkedList<String> aList = new LinkedList<String>();
                LinkedList<String> uList = new LinkedList<String>();
                LinkedList<String> propList = new LinkedList<String>();
                LinkedList<String> rangeList = new LinkedList<String>();

                for (Object id : dataTree.rootItemIds()) {
                    Collection<?> children = dataTree.getChildren(id);
                    if (children == null)
                        continue;

                    Collection<String> list = null;
                    if (id.toString().startsWith("D"))
                        list = dList;
                    else if (id.toString().startsWith("M"))
                        list = mList;
                    else if (id.toString().startsWith("A"))
                        list = aList;
                    else if (id.toString().startsWith("U"))
                        list = uList;

                    for (Object prop : dataTree.getChildren(id)) {
                        CountingTreeHeader h = (CountingTreeHeader) dataTree.getChildren(prop).iterator()
                                .next();
                        propList.add(prop.toString());
                        list.add(prop.toString());
                        if (h.toString().startsWith("C")) {
                            rangeList.add("http://www.w3.org/2004/02/skos/core#Concept");
                        } else {
                            rangeList.add(dataTree.getChildren(h).iterator().next().toString());
                        }
                    }
                }
                if (uList.size() > 0) {
                    getWindow().showNotification("There are undefined properties!",
                            Window.Notification.TYPE_WARNING_MESSAGE);
                    return;
                }
                GraphQuery query = conn.prepareGraphQuery(QueryLanguage.SPARQL, DSDRepoUtils.qCreateDSD(dataset,
                        dsd, dList, mList, aList, propList, rangeList, dataGraph));
                query.evaluate();
                getWindow().showNotification("DSD created!");
                InspectComponent.this.ds = new SparqlDataSet(repository, InspectComponent.this.ds.getUri(),
                        dataGraph);
                createDSD();
            } catch (RepositoryException ex) {
                logger.log(Level.SEVERE, null, ex);
            } catch (MalformedQueryException ex) {
                logger.log(Level.SEVERE, null, ex);
            } catch (QueryEvaluationException ex) {
                logger.log(Level.SEVERE, null, ex);
            }
        }
    });
}