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:annis.gui.HelpUsWindow.java

License:Apache License

public HelpUsWindow() {
    setSizeFull();/*from w  ww. ja  v  a 2s .  co m*/
    layout = new VerticalLayout();
    setContent(layout);

    layout.setSizeFull();
    layout.setMargin(new MarginInfo(false, false, true, false));

    HorizontalLayout hLayout = new HorizontalLayout();
    hLayout.setSizeFull();
    hLayout.setMargin(false);

    VerticalLayout labelLayout = new VerticalLayout();
    labelLayout.setMargin(true);
    labelLayout.setSizeFull();

    Label lblOpenSource = new Label();

    lblOpenSource.setValue("<h1>ANNIS is <a href=\"http://opensource.org/osd\">Open Source</a> "
            + "software.</h1>" + "<p>This means you are free to download the source code and add new "
            + "features or make other adjustments to ANNIS on your own.<p/>"
            + "Here are some examples how you can help ANNIS:" + "<ul>"
            + "<li>Fix or report problems (bugs) you encounter when using the ANNIS software.</li>"
            + "<li>Add new features.</li>" + "<li>Enhance the documentation</li>" + "</ul>"
            + "<p>Feel free to visit our GitHub page for more information: <a href=\"https://github.com/korpling/ANNIS\" target=\"_blank\">https://github.com/korpling/ANNIS</a></p>");
    lblOpenSource.setContentMode(ContentMode.HTML);
    lblOpenSource.setStyleName("opensource");
    lblOpenSource.setWidth("100%");
    lblOpenSource.setHeight("-1px");
    labelLayout.addComponent(lblOpenSource);

    Link lnkFork = new Link();
    lnkFork.setResource(new ExternalResource("https://github.com/korpling/ANNIS"));
    lnkFork.setIcon(
            new ExternalResource("https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png"));
    lnkFork.setTargetName("_blank");

    hLayout.addComponent(labelLayout);
    hLayout.addComponent(lnkFork);
    hLayout.setComponentAlignment(labelLayout, Alignment.TOP_LEFT);
    hLayout.setComponentAlignment(lnkFork, Alignment.TOP_RIGHT);
    hLayout.setExpandRatio(labelLayout, 1.0f);

    layout.addComponent(hLayout);

    final HelpUsWindow finalThis = this;

    btClose = new Button("Close");
    btClose.addClickListener(new OkClickListener(finalThis));
    layout.addComponent(btClose);

    layout.setComponentAlignment(hLayout, Alignment.MIDDLE_CENTER);
    layout.setComponentAlignment(btClose, Alignment.MIDDLE_CENTER);
    layout.setExpandRatio(hLayout, 1.0f);
}

From source file:annis.visualizers.htmlvis.HTMLVis.java

License:Apache License

@Override
public Panel createComponent(VisualizerInput vi, VisualizationToggle vt) {
    Panel scrollPanel = new Panel();
    scrollPanel.setSizeFull();/*from w  w w .j  a v  a2  s.  com*/
    Label lblResult = new Label("ERROR", ContentMode.HTML);
    lblResult.setSizeUndefined();

    List<String> corpusPath = CommonHelper.getCorpusPath(vi.getDocument().getGraph(), vi.getDocument());
    String corpusName = corpusPath.get(corpusPath.size() - 1);
    corpusName = urlPathEscape.escape(corpusName);

    String wrapperClassName = "annis-wrapped-htmlvis-" + corpusName.replaceAll("[^0-9A-Za-z-]", "_");

    scrollPanel.addStyleName(wrapperClassName);

    String visConfigName = vi.getMappings().getProperty("config");
    String hitMarkConfig = vi.getMappings().getProperty("hitmark", "true");
    hitMark = Boolean.parseBoolean(hitMarkConfig);
    mc = vi.getMarkedAndCovered();

    VisualizationDefinition[] definitions = parseDefinitions(corpusName, vi.getMappings());

    if (definitions != null) {

        lblResult.setValue(createHTML(vi.getSResult().getDocumentGraph(), definitions));

        String labelClass = vi.getMappings().getProperty("class", "htmlvis");
        lblResult.addStyleName(labelClass);

        InputStream inStreamCSSRaw = null;
        if (visConfigName == null) {
            inStreamCSSRaw = HTMLVis.class.getResourceAsStream("htmlvis.css");
        } else {
            WebResource resBinary = Helper.getAnnisWebResource().path("query/corpora/").path(corpusName)
                    .path(corpusName).path("binary").path(visConfigName + ".css");

            ClientResponse response = resBinary.get(ClientResponse.class);
            if (response.getStatus() == ClientResponse.Status.OK.getStatusCode()) {
                inStreamCSSRaw = response.getEntityInputStream();
            }
        }
        if (inStreamCSSRaw != null) {
            try (InputStream inStreamCSS = inStreamCSSRaw) {
                String cssContent = IOUtils.toString(inStreamCSS);
                UI currentUI = UI.getCurrent();
                if (currentUI instanceof AnnisBaseUI) {
                    // do not add identical CSS files
                    ((AnnisBaseUI) currentUI).injectUniqueCSS(cssContent, wrapperClassName);
                }
            } catch (IOException ex) {
                log.error("Could not parse the HTML visualizer CSS file", ex);
                Notification.show("Could not parse the HTML visualizer CSS file", ex.getMessage(),
                        Notification.Type.ERROR_MESSAGE);
            }
        }

    }

    if (vi.getMappings().containsKey("debug")) {
        TextArea txtDebug = new TextArea();
        txtDebug.setValue(lblResult.getValue());
        txtDebug.setReadOnly(true);
        txtDebug.setWidth("100%");
        Label sep = new Label("<hr/>", ContentMode.HTML);
        VerticalLayout layout = new VerticalLayout(txtDebug, sep, lblResult);
        layout.setSizeUndefined();
        scrollPanel.setContent(layout);
    } else {
        scrollPanel.setContent(lblResult);
    }

    return scrollPanel;
}

From source file:com.anothernode.ballkontrolle.BallkontrolleUI.java

License:Open Source License

@Override
protected void init(VaadinRequest request) {

    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);//  w w w  .j  a v a  2  s .  c  om
    setContent(layout);

    Label team1Player1 = new Label("");
    Label team1Player2 = new Label("");
    Label team2Player1 = new Label("");
    Label team2Player2 = new Label("");

    final Button button = new Button("Draw Teams");
    button.addClickListener(event -> {

        final Drawing drawing = new Drawing(Data.summonPlayers());

        team1Player1.setValue(drawing.getTeam1().getPlayer1().toString());
        team1Player2.setValue(drawing.getTeam1().getPlayer2().toString());
        team2Player1.setValue(drawing.getTeam2().getPlayer1().toString());
        team2Player2.setValue(drawing.getTeam2().getPlayer2().toString());

    });

    layout.addComponent(button);
    layout.addComponent(new Label("Team 1:"));
    layout.addComponent(team1Player1);
    layout.addComponent(team1Player2);
    layout.addComponent(new Label("Team 2:"));
    layout.addComponent(team2Player1);
    layout.addComponent(team2Player2);
}

From source file:com.anphat.list.ui.DialogAddMapStaffCustomer.java

private void buildInfoLayout(boolean isCustInfo) {
    infoLayout = new GridLayout();
    infoLayout.setImmediate(true);//  www  . j  a  v  a 2s  . c  o m
    //        infoLayout.setStyleName("custom-feildset");
    //        infoLayout.setCaptionAsHtml(true);
    infoLayout.setWidth("100.0%");
    infoLayout.setHeight("-1px");
    infoLayout.setMargin(true);
    infoLayout.setSpacing(true);
    infoLayout.setColumns(6);
    infoLayout.setRows(1);

    // lblCustCode
    Label lblCustCode = new Label();
    lblCustCode.addStyleName("v-label-bold");
    lblCustCode.setImmediate(true);
    lblCustCode.setWidth("100.0%");
    lblCustCode.setHeight("-1px");

    // tfCustCode
    txtCustCode = new Label();
    txtCustCode.setImmediate(true);
    txtCustCode.setWidth("100.0%");
    txtCustCode.setHeight("-1px");
    // lblCustCode
    Label lblCustName = new Label();
    lblCustName.addStyleName("v-label-bold");
    lblCustName.setImmediate(true);
    lblCustName.setWidth("100.0%");
    lblCustName.setHeight("-1px");

    // tfCustCode
    txtCustName = new Label();
    txtCustName.setImmediate(true);
    txtCustName.setWidth("100.0%");
    txtCustName.setHeight("-1px");

    if (isCustInfo) {
        //            infoLayout.setCaption(BundleUtils.getString("goods.list.panel.caption.customerinfo"));
        //            lblCustCode.setValue(BundleUtils.getString("goods.list.label.customercode"));
        lblCustName.setValue(BundleUtils.getString("goods.list.label.customername"));
    } else {
        //            infoLayout.setCaption(BundleUtils.getString("goods.list.panel.caption.staffInfo"));
        //            lblCustCode.setValue(BundleUtils.getString("lb.deptstaff.emp.code"));
        lblCustName.setValue(BundleUtils.getString("lb.deptstaff.emp.name"));
    }
    //        infoLayout.addComponent(lblCustCode, 0, 0);
    //        infoLayout.addComponent(txtCustCode, 1, 0);
    infoLayout.addComponent(lblCustName, 0, 0);
    infoLayout.addComponent(txtCustName, 1, 0, 5, 0);
}

From source file:com.anphat.list.ui.DialogAddMapStaffCustomer.java

private void buildSearchLayout(boolean isCustInfo) {
    // common part: create layout
    searchLayout = new GridLayout();
    searchLayout.setImmediate(true);/*from w  ww . j  av a  2s. c  o  m*/
    searchLayout.setStyleName("custom-feildset");
    searchLayout.setCaption(MakeURL.makeURLForGrid(BundleUtils.getString("common.searchLabel")));
    searchLayout.setCaptionAsHtml(true);
    searchLayout.setWidth("100.0%");
    searchLayout.setHeight("-1px");
    searchLayout.setMargin(true);
    searchLayout.setSpacing(true);

    // lblCustCode
    Label lblCustCode = new Label();
    lblCustCode.setImmediate(true);
    lblCustCode.setWidth("100.0%");
    lblCustCode.setHeight("-1px");

    // tfCustCode
    txtStaffCode = new TextField();
    txtStaffCode.setImmediate(true);
    txtStaffCode.setWidth("100.0%");
    txtStaffCode.setHeight("-1px");

    // lblCustName
    Label lblCustName = new Label();
    lblCustName.setImmediate(true);
    lblCustName.setWidth("100.0%");
    lblCustName.setHeight("-1px");

    // tfCustName
    txtStaffName = new TextField();
    txtStaffName.setImmediate(true);
    txtStaffName.setWidth("100.0%");
    txtStaffName.setHeight("-1px");
    // lblCustCode
    Label lblEmail = new Label();
    lblEmail.setImmediate(true);
    lblEmail.setWidth("100.0%");
    lblEmail.setHeight("-1px");

    // tfCustCode
    txtEmail = new TextField();
    txtEmail.setImmediate(true);
    txtEmail.setWidth("100.0%");
    txtEmail.setHeight("-1px");

    // lblCustName
    Label lblTelephone = new Label();
    lblTelephone.setImmediate(true);
    lblTelephone.setWidth("100.0%");
    lblTelephone.setHeight("-1px");

    // tfCustName
    txtTelephone = new TextField();
    txtTelephone.setImmediate(true);
    txtTelephone.setWidth("100.0%");
    txtTelephone.setHeight("-1px");
    // lblCustName
    Label lblStaffType = new Label();
    lblStaffType.setImmediate(true);
    lblStaffType.setWidth("100.0%");
    lblStaffType.setHeight("-1px");

    // tfCustName
    cboStaffType = new ComboBox();
    cboStaffType.setImmediate(true);
    cboStaffType.setWidth("100.0%");
    cboStaffType.setHeight("-1px");

    if (isCustInfo) {
        lblCustCode.setValue(BundleUtils.getString("map.staff.customer.staffCode"));
        lblCustName.setValue(BundleUtils.getString("map.staff.customer.staffName"));
        lblEmail.setValue(BundleUtils.getString("goods.list.label.email"));
        lblTelephone.setValue(BundleUtils.getString("lb.deptstaff.common.phone"));
        lblStaffType.setValue(BundleUtils.getString("map.staff.customer.staffType"));
        searchLayout.setColumns(6);
        searchLayout.setRows(2);
        searchLayout.addComponent(lblCustCode, 0, 0);
        searchLayout.addComponent(txtStaffCode, 1, 0);
        searchLayout.addComponent(lblCustName, 2, 0);
        searchLayout.addComponent(txtStaffName, 3, 0);
        searchLayout.addComponent(lblEmail, 4, 0);
        searchLayout.addComponent(txtEmail, 5, 0);
        searchLayout.addComponent(lblStaffType, 0, 1);
        searchLayout.addComponent(cboStaffType, 1, 1);
        searchLayout.addComponent(lblTelephone, 2, 1);
        searchLayout.addComponent(txtTelephone, 3, 1);
    } else {
        lblCustCode.setValue(BundleUtils.getString("map.staff.customer.custCode"));
        lblCustName.setValue(BundleUtils.getString("map.staff.customer.custName"));
        lblEmail.setValue(BundleUtils.getString("goods.list.label.email"));
        lblTelephone.setValue(BundleUtils.getString("lb.deptstaff.common.phone"));
        searchLayout.setColumns(4);
        searchLayout.setRows(2);
        searchLayout.addComponent(lblCustCode, 0, 0);
        searchLayout.addComponent(txtStaffCode, 1, 0);
        searchLayout.addComponent(lblCustName, 2, 0);
        searchLayout.addComponent(txtStaffName, 3, 0);
        searchLayout.addComponent(lblEmail, 0, 1);
        searchLayout.addComponent(txtEmail, 1, 1);
        searchLayout.addComponent(lblTelephone, 2, 1);
        searchLayout.addComponent(txtTelephone, 3, 1);
    }
}

From source file:com.arcusys.liferay.vaadinplugin.ControlPanelUI.java

License:Apache License

private HorizontalLayout createVaadinVersionLayout(String newestVersion, Button changeVersionButton,
        Button updateVaadinVersionButton, ProgressIndicator versionUpgradeProgressIndicator,
        Button detailsButton) {/*www  .j  av a 2s .c o m*/
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);
    layout.setCaption("Vaadin Jar Version");

    Label vaadinVersionLabel = new Label();
    vaadinVersionLabel.setSizeUndefined();
    String version = null;
    try {
        version = ControlPanelPortletUtil.getPortalVaadinServerVersion();
    } catch (FileNotFoundException e) {
        log.warn("vaadin-server.jar couldn't be read. file not found.");
    } catch (IOException e) {
        log.warn("vaadin-server.jar couldn't be read. ", e);
    }

    if (version == null) {
        try {
            version = ControlPanelPortletUtil.getPortalVaadin6Version();
        } catch (IOException e) {
            log.warn("vaadin.jar couldn't be read.");
        }
    }

    if (version == null) {
        version = "could not be determined";
    }
    vaadinVersionLabel.setValue(version);
    layout.addComponent(vaadinVersionLabel);

    if (version.startsWith("7")) {
        layout.addComponent(detailsButton);
    }

    layout.addComponent(changeVersionButton);

    Label newestVaadinVersionLabel = new Label();
    newestVaadinVersionLabel.setSizeUndefined();
    newestVaadinVersionLabel.setValue("(newest stable version: " + newestVersion + ")");
    layout.addComponent(newestVaadinVersionLabel);

    if (!version.equals(newestVersion)) {
        layout.addComponent(updateVaadinVersionButton);
    }
    layout.addComponent(versionUpgradeProgressIndicator);
    return layout;
}

From source file:com.arcusys.liferay.vaadinplugin.ControlPanelUI.java

License:Apache License

private Label createActiveWidgetsetLabel() {
    Label activeWidgetsetLabel = new Label();
    activeWidgetsetLabel.setCaption("Active Widget Set");
    String value = ControlPanelPortletUtil.getPortalWidgetset();
    activeWidgetsetLabel.setValue(value);
    return activeWidgetsetLabel;
}

From source file:com.arcusys.liferay.vaadinplugin.ControlPanelUI.java

License:Apache License

private Label createAddonLibDirLabel() {
    Label addonLibDirLabel = new Label();
    addonLibDirLabel.setSizeUndefined();
    String value = ControlPanelPortletUtil.getPortalLibLocationPath();
    addonLibDirLabel.setValue(value);
    return addonLibDirLabel;
}

From source file:com.arcusys.liferay.vaadinplugin.ControlPanelUI.java

License:Apache License

private Label createAdditionalDependenciesLabel() {
    Label dependencyList = new Label("", ContentMode.HTML);
    dependencyList.setCaption("Other Dependencies");
    if (includedDependencies != null) {
        String value = "";
        if (includedDependencies.size() > 0) {
            for (File file : includedDependencies) {
                if (!value.equals("")) {
                    value += "<br/>";
                }//from   w  ww  . j  a v a2s. c  o m
                value += file.getName();
            }
        } else {
            value = "none";
        }

        dependencyList.setValue(value);
    }
    return dependencyList;
}

From source file:com.blogspot.markogronroos.MainUI.java

License:GNU General Public License

@Override
protected void init(VaadinRequest request) {

    final VerticalLayout main = new VerticalLayout();
    main.setMargin(true);/*  ww  w.  j a va 2s  .  c o m*/
    setContent(main);

    //Window main = new Window("Test Application");

    // Create a menu bar
    final MenuBar menubar = new MenuBar();
    main.addComponent(menubar);

    // A feedback component
    final Label selection = new Label("-");
    main.addComponent(selection);

    MenuBar.MenuItem menuitem1 = menubar.addItem("JPA Examples", null, null);

    MenuBar.MenuItem menuitem2 = menuitem1.addItem("Other Example", null, null);

    MenuBar.Command mycommand = new MenuBar.Command() {
        @Override
        public void menuSelected(MenuBar.MenuItem selectedItem) {
            selection.setValue("Ordered a " + selectedItem.getText() + " from menu.");
            String selectedText = selectedItem.getText();
            if (selectedText.contains("1.1"))
                jpaContTable(main);
            else if (selectedText.contains("1.2"))
                jpaContTable2(main);
            else if (selectedText.contains("1.3"))
                jpaContForm1(main);
            else if (selectedText.contains("1.4"))
                pureJPAExample(main);
            //selectedItem.
        }
    };

    menuitem1.addItem("1.1 demo JPAContainer Table component", null, mycommand);
    menuitem1.addItem("1.2 demo JPAContainer Table component, explicit EntityManager", null, mycommand);
    menuitem1.addItem("1.3 demo JPAContainer Form", null, mycommand);

    menuitem1.addItem("1.4 demo JPA batch", null, mycommand);
    //menuitem1.addItem(menuitem2);

    // Define a common menu command for all the menu items.

    //  initEx2(request);
}