Example usage for com.vaadin.ui Label setId

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

Introduction

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

Prototype

@Override
    public void setId(String id) 

Source Link

Usage

From source file:io.subutai.plugin.accumulo.ui.manager.Manager.java

private void populateTracersTable(final Table table, Set<EnvironmentContainerHost> containerHosts,
        final boolean masters) {
    table.removeAllItems();/*from   ww w .  j a  v a  2 s.  c  o  m*/
    for (final EnvironmentContainerHost containerHost : containerHosts) {
        final Button checkBtn = new Button(CHECK_BUTTON_CAPTION);
        checkBtn.setId(containerHost.getIpByInterfaceName("eth0") + "-accumuloCheck");
        final Button destroyBtn = new Button(DESTROY_BUTTON_CAPTION);
        destroyBtn.setId(containerHost.getIpByInterfaceName("eth0") + "-accumuloDestroy");
        final Label resultHolder = new Label();
        resultHolder.setId(containerHost.getIpByInterfaceName("eth0") + "accumuloResult");

        HorizontalLayout availableOperations = new HorizontalLayout();
        availableOperations.setSpacing(true);

        addGivenComponents(availableOperations, checkBtn, destroyBtn);
        addStyleName(checkBtn, destroyBtn, availableOperations);

        table.addItem(
                new Object[] { containerHost.getHostname(), containerHost.getIpByInterfaceName("eth0"),
                        filterNodeRole(NodeType.ACCUMULO_TRACER.name()), resultHolder, availableOperations },
                null);

        checkBtn.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                PROGRESS_ICON.setVisible(true);
                disableButtons(checkBtn, destroyBtn);
                executorService.execute(new CheckTask(accumulo, tracker, accumuloClusterConfig.getClusterName(),
                        containerHost.getHostname(), new CompleteEvent() {
                            public void onComplete(String result) {
                                synchronized (PROGRESS_ICON) {
                                    resultHolder.setValue(parseStatus(result, NodeType.ACCUMULO_TRACER));
                                    enableButtons(checkBtn, destroyBtn);
                                    PROGRESS_ICON.setVisible(false);
                                }
                            }
                        }));
            }
        });

        destroyBtn.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {

                if (accumuloClusterConfig.getTracers().size() == 1) {
                    show("This is last tracer node in cluster, please destroy whole cluster");
                    return;
                }

                ConfirmationDialog alert = new ConfirmationDialog(
                        String.format("Do you want to destroy the %s node?", containerHost.getHostname()),
                        "Yes", "No");
                alert.getOk().addClickListener(new Button.ClickListener() {
                    @Override
                    public void buttonClick(Button.ClickEvent clickEvent) {
                        UUID trackID = accumulo.destroyNode(accumuloClusterConfig.getClusterName(),
                                containerHost.getHostname(), NodeType.ACCUMULO_TRACER);

                        ProgressWindow window = new ProgressWindow(executorService, tracker, trackID,
                                AccumuloClusterConfig.PRODUCT_KEY);
                        window.getWindow().addCloseListener(new Window.CloseListener() {
                            @Override
                            public void windowClose(Window.CloseEvent closeEvent) {
                                refreshClustersInfo();
                            }
                        });
                        contentRoot.getUI().addWindow(window.getWindow());
                    }
                });
                contentRoot.getUI().addWindow(alert.getAlert());
            }
        });
    }
}

From source file:io.subutai.plugin.accumulo.ui.manager.Manager.java

private void populateTabletServersTable(final Table table, Set<EnvironmentContainerHost> containerHosts,
        final boolean masters) {
    table.removeAllItems();//from  w w w . j  a  va2  s.c o m
    for (final EnvironmentContainerHost containerHost : containerHosts) {
        final Button checkBtn = new Button(CHECK_BUTTON_CAPTION);
        checkBtn.setId(containerHost.getIpByInterfaceName("eth0") + "-accumuloCheck");
        final Button destroyBtn = new Button(DESTROY_BUTTON_CAPTION);
        destroyBtn.setId(containerHost.getIpByInterfaceName("eth0") + "-accumuloDestroy");
        final Label resultHolder = new Label();
        resultHolder.setId(containerHost.getIpByInterfaceName("eth0") + "accumuloResult");

        HorizontalLayout availableOperations = new HorizontalLayout();
        availableOperations.setSpacing(true);

        addGivenComponents(availableOperations, checkBtn, destroyBtn);
        addStyleName(checkBtn, destroyBtn, availableOperations);

        table.addItem(new Object[] { containerHost.getHostname(), containerHost.getIpByInterfaceName("eth0"),
                filterNodeRole(NodeType.ACCUMULO_TABLET_SERVER.name()), resultHolder, availableOperations },
                null);

        checkBtn.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                PROGRESS_ICON.setVisible(true);
                disableButtons(checkBtn, destroyBtn);
                executorService.execute(new CheckTask(accumulo, tracker, accumuloClusterConfig.getClusterName(),
                        containerHost.getHostname(), new CompleteEvent() {
                            public void onComplete(String result) {
                                synchronized (PROGRESS_ICON) {
                                    resultHolder.setValue(parseStatus(result, NodeType.ACCUMULO_TABLET_SERVER));
                                    enableButtons(checkBtn, destroyBtn);
                                    PROGRESS_ICON.setVisible(false);
                                }
                            }
                        }));
            }
        });

        destroyBtn.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                if (accumuloClusterConfig.getSlaves().size() == 1) {
                    show("This is last tablet server in cluster, please destroy whole cluster");
                    return;
                }

                ConfirmationDialog alert = new ConfirmationDialog(
                        String.format("Do you want to destroy the %s node?", containerHost.getHostname()),
                        "Yes", "No");
                alert.getOk().addClickListener(new Button.ClickListener() {
                    @Override
                    public void buttonClick(Button.ClickEvent clickEvent) {
                        UUID trackID = accumulo.destroyNode(accumuloClusterConfig.getClusterName(),
                                containerHost.getHostname(), NodeType.ACCUMULO_TABLET_SERVER);

                        ProgressWindow window = new ProgressWindow(executorService, tracker, trackID,
                                AccumuloClusterConfig.PRODUCT_KEY);
                        window.getWindow().addCloseListener(new Window.CloseListener() {
                            @Override
                            public void windowClose(Window.CloseEvent closeEvent) {
                                refreshClustersInfo();
                            }
                        });
                        contentRoot.getUI().addWindow(window.getWindow());
                    }
                });
                contentRoot.getUI().addWindow(alert.getAlert());
            }
        });
    }
}

From source file:net.sourceforge.javydreamercsw.validation.manager.web.demo.DemoProvider.java

License:Apache License

@Override
public void update() {
    layout.removeAllComponents();//  w w  w  .  ja v a 2s  .  c o m
    VmUserJpaController controller = new VmUserJpaController(DataBaseManager.getEntityManagerFactory());
    layout.addComponent(new Label("<h1>" + TRANSLATOR.translate("demo.tab.title") + "</h1>", ContentMode.HTML));
    Label l = new Label();
    l.setId("demo.tab.message");
    layout.addComponent(l);
    StringBuilder sb = new StringBuilder("<ul>");
    controller.findVmUserEntities().stream().filter((u) -> (u.getId() < 1_000)).forEachOrdered((u) -> {
        try {
            //Default accounts
            if (u.getPassword() != null && u.getPassword().equals(MD5.encrypt(u.getUsername()))) {
                sb.append("<li><b>").append(TRANSLATOR.translate("general.username")).append(":</b> ")
                        .append(u.getUsername()).append(", <b>")
                        .append(TRANSLATOR.translate("general.password")).append(":</b> ")
                        .append(u.getUsername()).append(" <b>").append(TRANSLATOR.translate("general.role"))
                        .append(":</b> ").append(TRANSLATOR.translate(u.getRoleList().get(0).getDescription()))
                        .append("</li>");
            }
        } catch (VMException ex) {
            LOG.log(Level.SEVERE, null, ex);
        }
    });
    sb.append("</ul>");
    layout.addComponent(new Label(sb.toString(), ContentMode.HTML));
    layout.setId(getComponentCaption());
}

From source file:org.eclipse.hawkbit.ui.artifacts.smtable.SoftwareModuleDetails.java

License:Open Source License

private void updateSoftwareModuleDetailsLayout(final String type, final String vendor, final String maxAssign) {
    final VerticalLayout detailsTabLayout = getDetailsLayout();

    detailsTabLayout.removeAllComponents();

    final Label vendorLabel = SPUIComponentProvider.createNameValueLabel(
            getI18n().get("label.dist.details.vendor"),
            HawkbitCommonUtil.trimAndNullIfEmpty(vendor) == null ? "" : vendor);
    vendorLabel.setId(UIComponentIdProvider.DETAILS_VENDOR_LABEL_ID);
    detailsTabLayout.addComponent(vendorLabel);

    if (type != null) {
        final Label typeLabel = SPUIComponentProvider
                .createNameValueLabel(getI18n().get("label.dist.details.type"), type);
        typeLabel.setId(UIComponentIdProvider.DETAILS_TYPE_LABEL_ID);
        detailsTabLayout.addComponent(typeLabel);
    }/*from w  w  w .jav  a  2s. c o m*/

    final Label assignLabel = SPUIComponentProvider.createNameValueLabel(getI18n().get("label.assigned.type"),
            HawkbitCommonUtil.trimAndNullIfEmpty(maxAssign) == null ? "" : maxAssign);
    assignLabel.setId(UIComponentIdProvider.SWM_DTLS_MAX_ASSIGN);
    detailsTabLayout.addComponent(assignLabel);

}

From source file:org.eclipse.hawkbit.ui.artifacts.upload.UploadConfirmationWindow.java

License:Open Source License

private void addFileNameLayout(final Item newItem, final String baseSoftwareModuleNameVersion,
        final String customFileName, final String itemId) {
    final HorizontalLayout horizontalLayout = new HorizontalLayout();
    final TextField fileNameTextField = createTextField(
            baseSoftwareModuleNameVersion + "/" + customFileName + "/customFileName");
    fileNameTextField.setData(baseSoftwareModuleNameVersion + "/" + customFileName);
    fileNameTextField.setValue(customFileName);

    newItem.getItemProperty(FILE_NAME).setValue(fileNameTextField.getValue());

    final Label warningIconLabel = getWarningLabel();
    warningIconLabel.setId(baseSoftwareModuleNameVersion + "/" + customFileName + "/icon");
    setWarningIcon(warningIconLabel, fileNameTextField.getValue(), itemId);
    newItem.getItemProperty(WARNING_ICON).setValue(warningIconLabel);

    horizontalLayout.addComponent(fileNameTextField);
    horizontalLayout.setComponentAlignment(fileNameTextField, Alignment.MIDDLE_LEFT);
    horizontalLayout.addComponent(warningIconLabel);
    horizontalLayout.setComponentAlignment(warningIconLabel, Alignment.MIDDLE_RIGHT);
    newItem.getItemProperty(FILE_NAME_LAYOUT).setValue(horizontalLayout);

    fileNameTextField.addTextChangeListener(event -> onFileNameChange(event, warningIconLabel, newItem));
}

From source file:org.eclipse.hawkbit.ui.artifacts.upload.UploadResultWindow.java

License:Open Source License

private void populateUploadResultTable() {
    setTableContainer();//from   ww w . j ava  2  s.c  om
    Label statusLabel;
    Label reasonLabel;
    for (final UploadStatus uploadResult : uploadResultList) {
        final Item newItem = tabelContainer
                .addItem(uploadResult.getBaseSwModuleName() + "/" + uploadResult.getFileName());
        newItem.getItemProperty(FILE_NAME)
                .setValue(HawkbitCommonUtil.getFormatedLabel(uploadResult.getFileName()));
        newItem.getItemProperty(BASE_SW_MODULE)
                .setValue(HawkbitCommonUtil.getFormatedLabel(uploadResult.getBaseSwModuleName()));

        if (uploadResult.getUploadResult().equals(SPUILabelDefinitions.SUCCESS)) {
            statusLabel = new Label(HawkbitCommonUtil.getFormatedLabel(i18n.getMessage("upload.success")));
            statusLabel.addStyleName("validation-success");
            newItem.getItemProperty(UPLOAD_RESULT).setValue(statusLabel);
        } else {
            statusLabel = new Label(HawkbitCommonUtil.getFormatedLabel(i18n.getMessage("upload.failed")));
            statusLabel.addStyleName("validation-failed");
            newItem.getItemProperty(UPLOAD_RESULT).setValue(statusLabel);
        }

        reasonLabel = HawkbitCommonUtil.getFormatedLabel(uploadResult.getReason());
        reasonLabel.setDescription(uploadResult.getReason());
        final String idStr = UIComponentIdProvider.UPLOAD_ERROR_REASON + uploadResult.getBaseSwModuleName()
                + "/" + uploadResult.getFileName();
        reasonLabel.setId(idStr);
        newItem.getItemProperty(REASON).setValue(reasonLabel);
    }
}

From source file:org.eclipse.hawkbit.ui.common.builder.LabelBuilder.java

License:Open Source License

private Label createLabel() {
    final Label label = new Label(name);
    label.setVisible(visible);//from w  ww.jav a2s .c  o  m
    final StringBuilder style = new StringBuilder(ValoTheme.LABEL_SMALL);
    style.append(' ');
    style.append(ValoTheme.LABEL_BOLD);
    label.addStyleName(style.toString());
    if (id != null) {
        label.setId(id);
    }

    return label;
}

From source file:org.eclipse.hawkbit.ui.common.detailslayout.AbstractDistributionSetDetails.java

License:Open Source License

private void updateDistributionSetDetailsLayout(final String type, final Boolean isMigrationRequired) {
    final VerticalLayout detailsTabLayout = getDetailsLayout();
    detailsTabLayout.removeAllComponents();

    final Label typeLabel = SPUIComponentProvider
            .createNameValueLabel(getI18n().getMessage("label.dist.details.type"), type == null ? "" : type);
    typeLabel.setId(UIComponentIdProvider.DETAILS_TYPE_LABEL_ID);
    detailsTabLayout.addComponent(typeLabel);

    detailsTabLayout.addComponent(//from  www  . j  a  va2s  . c  o m
            SPUIComponentProvider.createNameValueLabel(getI18n().getMessage("checkbox.dist.migration.required"),
                    getMigrationRequiredValue(isMigrationRequired)));
}

From source file:org.eclipse.hawkbit.ui.common.detailslayout.AbstractSoftwareModuleDetails.java

License:Open Source License

protected void updateSoftwareModuleDetailsLayout(final String type, final String vendor,
        final String maxAssign) {
    final VerticalLayout detailsTabLayout = getDetailsLayout();

    detailsTabLayout.removeAllComponents();

    final Label vendorLabel = SPUIComponentProvider.createNameValueLabel(
            getI18n().getMessage("label.dist.details.vendor"), vendor == null ? "" : vendor);
    vendorLabel.setId(UIComponentIdProvider.DETAILS_VENDOR_LABEL_ID);
    detailsTabLayout.addComponent(vendorLabel);

    if (type != null) {
        final Label typeLabel = SPUIComponentProvider
                .createNameValueLabel(getI18n().getMessage("label.dist.details.type"), type);
        typeLabel.setId(UIComponentIdProvider.DETAILS_TYPE_LABEL_ID);
        detailsTabLayout.addComponent(typeLabel);
    }/*from www  .ja  va2 s. co m*/

    final Label assignLabel = SPUIComponentProvider.createNameValueLabel(
            getI18n().getMessage("label.assigned.type"), maxAssign == null ? "" : maxAssign);
    assignLabel.setId(UIComponentIdProvider.SWM_DTLS_MAX_ASSIGN);
    detailsTabLayout.addComponent(assignLabel);
}

From source file:org.eclipse.hawkbit.ui.common.detailslayout.AbstractTableDetailsLayout.java

License:Open Source License

protected void updateDescriptionLayout(final String description) {
    descriptionLayout.removeAllComponents();
    final Label descLabel = SPUIComponentProvider.createNameValueLabel("",
            description == null ? "" : description);
    /**/*from  w ww .  ja v  a  2  s . c o  m*/
     * By default text will be truncated based on layout width. So removing
     * it as we need full description.
     */
    descLabel.removeStyleName("label-style");
    descLabel.setId(UIComponentIdProvider.DETAILS_DESCRIPTION_LABEL_ID);
    descriptionLayout.addComponent(descLabel);
}