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:org.eclipse.hawkbit.ui.filtermanagement.AutoCompleteTextFieldComponent.java

License:Open Source License

private static void setInitialStatusIconStyle(final Label statusIcon) {
    statusIcon.setValue(FontAwesome.CHECK_CIRCLE.getHtml());
    statusIcon.setStyleName("hide-status-label");
}

From source file:org.eclipse.hawkbit.ui.filtermanagement.CreateOrUpdateFilterTable.java

License:Open Source License

private Component getStatusIcon(final Object itemId) {
    final Item row1 = getItem(itemId);
    final TargetUpdateStatus targetStatus = (TargetUpdateStatus) row1
            .getItemProperty(SPUILabelDefinitions.VAR_TARGET_STATUS).getValue();
    final Label label = new LabelBuilder().name("").buildLabel();
    label.setContentMode(ContentMode.HTML);
    if (targetStatus == TargetUpdateStatus.PENDING) {
        label.setDescription(i18n.getMessage(UIMessageIdProvider.TOOLTIP_STATUS_PENDING));
        label.setStyleName(SPUIStyleDefinitions.STATUS_ICON_YELLOW);
        label.setValue(FontAwesome.ADJUST.getHtml());
    } else if (targetStatus == TargetUpdateStatus.REGISTERED) {
        label.setDescription(i18n.getMessage(UIMessageIdProvider.TOOLTIP_STATUS_REGISTERED));
        label.setStyleName(SPUIStyleDefinitions.STATUS_ICON_LIGHT_BLUE);
        label.setValue(FontAwesome.DOT_CIRCLE_O.getHtml());
    } else if (targetStatus == TargetUpdateStatus.ERROR) {
        label.setDescription(i18n.getMessage(i18n.getMessage(UIMessageIdProvider.TOOLTIP_STATUS_ERROR)));
        label.setStyleName(SPUIStyleDefinitions.STATUS_ICON_RED);
        label.setValue(FontAwesome.EXCLAMATION_CIRCLE.getHtml());
    } else if (targetStatus == TargetUpdateStatus.IN_SYNC) {
        label.setStyleName(SPUIStyleDefinitions.STATUS_ICON_GREEN);
        label.setDescription(i18n.getMessage(UIMessageIdProvider.TOOLTIP_STATUS_INSYNC));
        label.setValue(FontAwesome.CHECK_CIRCLE.getHtml());
    } else if (targetStatus == TargetUpdateStatus.UNKNOWN) {
        label.setStyleName(SPUIStyleDefinitions.STATUS_ICON_BLUE);
        label.setDescription(i18n.getMessage(UIMessageIdProvider.TOOLTIP_TARGET_STATUS_UNKNOWN));
        label.setValue(FontAwesome.QUESTION_CIRCLE.getHtml());
    }//from www.  j a  v  a 2s.  c om
    return label;
}

From source file:org.eclipse.hawkbit.ui.management.actionhistory.ActionHistoryTable.java

License:Open Source License

private Component getForcedColumn(final Object itemId) {
    final Action actionWithActiveStatus = (Action) hierarchicalContainer.getItem(itemId)
            .getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_FORCED).getValue();
    final Label actionLabel = new LabelBuilder().name("").buildCaptionLabel();
    actionLabel.setContentMode(ContentMode.HTML);
    actionLabel.setStyleName("action-history-table-col-forced-label");
    if (actionWithActiveStatus != null && actionWithActiveStatus.getActionType() == ActionType.FORCED) {
        actionLabel.setValue(FontAwesome.BOLT.getHtml());
        // setted Id for Forced.
        actionLabel.setId("action.history.table.forcedId");
    } else if (actionWithActiveStatus != null
            && actionWithActiveStatus.getActionType() == ActionType.TIMEFORCED) {
        return actionLabelWithTimeForceIcon(actionWithActiveStatus, actionLabel);
    }/*from   www .  j ava2  s .  com*/
    return actionLabel;
}

From source file:org.eclipse.hawkbit.ui.management.actionhistory.ActionHistoryTable.java

License:Open Source License

/**
 * Get status icon.//w w w  .j  ava 2  s . c  o m
 *
 * @param status
 *            as Status
 * @return Label as UI
 */
private Label getStatusIcon(final Action.Status status) {
    final Label label = new LabelBuilder().name("").buildLabel();
    final String statusIconPending = "statusIconPending";
    label.setContentMode(ContentMode.HTML);
    if (Action.Status.FINISHED == status) {
        label.setDescription(i18n.get("label.finished"));
        label.setStyleName(STATUS_ICON_GREEN);
        label.setValue(FontAwesome.CHECK_CIRCLE.getHtml());
    } else if (Action.Status.ERROR == status) {
        label.setDescription(i18n.get("label.error"));
        label.setStyleName("statusIconRed");
        label.setValue(FontAwesome.EXCLAMATION_CIRCLE.getHtml());
    } else if (Action.Status.WARNING == status) {
        label.setStyleName("statusIconOrange");
        label.setDescription(i18n.get("label.warning"));
        label.setValue(FontAwesome.EXCLAMATION_CIRCLE.getHtml());
    } else if (Action.Status.RUNNING == status) {
        // dynamic spinner
        label.setStyleName(statusIconPending);
        label.setDescription(i18n.get("label.running"));
        label.setValue(FontAwesome.ADJUST.getHtml());
    } else if (Action.Status.CANCELING == status) {
        label.setStyleName(statusIconPending);
        label.setDescription(i18n.get("label.cancelling"));
        label.setValue(FontAwesome.TIMES_CIRCLE.getHtml());
    } else if (Action.Status.CANCELED == status) {
        label.setStyleName(statusIconPending);
        label.setDescription(i18n.get("label.cancelled"));
        label.setStyleName(STATUS_ICON_GREEN);
        label.setValue(FontAwesome.TIMES_CIRCLE.getHtml());
    } else if (Action.Status.RETRIEVED == status) {
        label.setStyleName(statusIconPending);
        label.setDescription(i18n.get("label.retrieved"));
        label.setValue(FontAwesome.CIRCLE_O.getHtml());
    } else if (Action.Status.DOWNLOAD == status) {
        label.setStyleName(statusIconPending);
        label.setDescription(i18n.get("label.download"));
        label.setValue(FontAwesome.CLOUD_DOWNLOAD.getHtml());
    } else if (Action.Status.SCHEDULED == status) {
        label.setStyleName(statusIconPending);
        label.setDescription(i18n.get("label.scheduled"));
        label.setValue(FontAwesome.HOURGLASS_1.getHtml());
    } else {
        label.setDescription("");
        label.setValue("");
    }
    return label;

}

From source file:org.eclipse.hawkbit.ui.management.actionhistory.ActionHistoryTable.java

License:Open Source License

private Component actionLabelWithTimeForceIcon(final Action actionWithActiveStatus, final Label actionLabel) {
    final long currentTimeMillis = System.currentTimeMillis();

    final HorizontalLayout hLayout = new HorizontalLayout();
    final Label autoForceLabel = new LabelBuilder().name("").id("action.history.table.timedforceId")
            .buildLabel();/*from w  w  w  . java 2 s .  com*/

    actionLabel.setValue(FontAwesome.BOLT.getHtml());
    autoForceLabel.setContentMode(ContentMode.HTML);
    autoForceLabel.setValue(FontAwesome.HISTORY.getHtml());

    hLayout.addComponent(actionLabel);
    hLayout.addComponent(autoForceLabel);

    if (actionWithActiveStatus.isHitAutoForceTime(currentTimeMillis)) {
        autoForceLabel.setDescription("autoforced");
        autoForceLabel.setStyleName(STATUS_ICON_GREEN);
        autoForceLabel.setDescription("auto forced since " + SPDateTimeUtil
                .getDurationFormattedString(actionWithActiveStatus.getForcedTime(), currentTimeMillis, i18n));
    } else {
        autoForceLabel.setDescription("auto forcing in " + SPDateTimeUtil
                .getDurationFormattedString(currentTimeMillis, actionWithActiveStatus.getForcedTime(), i18n));
        autoForceLabel.setStyleName("statusIconPending");
        autoForceLabel.setValue(FontAwesome.HISTORY.getHtml());
    }
    return hLayout;
}

From source file:org.eclipse.hawkbit.ui.management.actionhistory.ActionHistoryTable.java

License:Open Source License

/**
 * Create Status Label./*w  ww .ja  v  a 2  s .co m*/
 *
 * @param activeValue
 *            as String
 * @return Labeal as UI
 */
private static Label createActiveStatusLabel(final String activeValue, final boolean endedWithError) {
    final Label label = new LabelBuilder().name("").buildLabel();
    label.setContentMode(ContentMode.HTML);
    if (SPUIDefinitions.SCHEDULED.equals(activeValue)) {
        label.setDescription("Scheduled");
        label.setValue(FontAwesome.HOURGLASS_1.getHtml());
    } else if (SPUIDefinitions.ACTIVE.equals(activeValue)) {
        label.setDescription("Active");
        label.setStyleName("statusIconActive");
    } else if (SPUIDefinitions.IN_ACTIVE.equals(activeValue)) {
        if (endedWithError) {
            label.setStyleName("statusIconRed");
        } else {
            label.setStyleName("statusIconNeutral");
        }
        label.setDescription("In-active");
        label.setValue(FontAwesome.CHECK_CIRCLE.getHtml());
    } else {
        label.setValue("");
    }
    return label;
}

From source file:org.eclipse.hawkbit.ui.management.targettable.TargetDetails.java

License:Open Source License

private Label buildAttributesUpdateLabel() {
    final Label attributesUpdateLabel = new Label();
    attributesUpdateLabel.setStyleName(ValoTheme.LABEL_SMALL);
    attributesUpdateLabel.setValue(getI18n().getMessage("label.target.attributes.update.pending"));

    return attributesUpdateLabel;
}

From source file:org.eclipse.hawkbit.ui.management.targettable.TargetTable.java

License:Open Source License

private Label getTargetPollTime(final Object itemId) {
    final Label statusLabel = new Label();
    statusLabel.addStyleName(ValoTheme.LABEL_SMALL);
    statusLabel.setHeightUndefined();//from   w  ww. j  a  v a2  s  . com
    statusLabel.setContentMode(ContentMode.HTML);
    final String pollStatusToolTip = (String) getContainerDataSource().getItem(itemId)
            .getItemProperty(SPUILabelDefinitions.VAR_POLL_STATUS_TOOL_TIP).getValue();
    if (StringUtils.hasText(pollStatusToolTip)) {
        statusLabel.setValue(FontAwesome.EXCLAMATION_CIRCLE.getHtml());
        statusLabel.setDescription(pollStatusToolTip);
    } else {
        statusLabel.setValue(FontAwesome.CLOCK_O.getHtml());
        statusLabel.setDescription(getI18n().getMessage(UIMessageIdProvider.TOOLTIP_IN_TIME));
    }

    return statusLabel;
}

From source file:org.eclipse.hawkbit.ui.management.targettable.TargetTableHeader.java

License:Open Source License

private void addFilterTextField(final DistributionSetIdName distributionSetIdName) {
    final Button filterLabelClose = SPUIComponentProvider.getButton("drop.filter.close", "", "", "", true,
            FontAwesome.TIMES_CIRCLE, SPUIButtonStyleNoBorder.class);
    filterLabelClose.addClickListener(clickEvent -> closeFilterByDistribution());
    final Label filteredDistLabel = new Label();
    filteredDistLabel.setStyleName(ValoTheme.LABEL_COLORED + " " + ValoTheme.LABEL_SMALL);
    String name = HawkbitCommonUtil.getDistributionNameAndVersion(distributionSetIdName.getName(),
            distributionSetIdName.getVersion());
    if (name.length() > SPUITargetDefinitions.DISTRIBUTION_NAME_MAX_LENGTH_ALLOWED) {
        name = new StringBuilder(name.substring(0, SPUITargetDefinitions.DISTRIBUTION_NAME_LENGTH_ON_FILTER))
                .append("...").toString();
    }//from  w  w w . ja v  a 2  s  .  co m
    filteredDistLabel.setValue(name);
    filteredDistLabel.setSizeUndefined();
    getFilterDroppedInfo().removeAllComponents();
    getFilterDroppedInfo().setSizeFull();
    getFilterDroppedInfo().addComponent(filteredDistLabel);
    getFilterDroppedInfo().addComponent(filterLabelClose);
    getFilterDroppedInfo().setExpandRatio(filteredDistLabel, 1.0F);
    eventBus.publish(this, TargetFilterEvent.FILTER_BY_DISTRIBUTION);
}

From source file:org.eclipse.hawkbit.ui.menu.DashboardMenu.java

License:Open Source License

private Component buildVersionInfo() {
    final Label label = new Label();
    label.setSizeFull();//from w  ww.j a v a2 s.c o  m
    label.setStyleName("version-layout");
    label.setValue(serverProperties.getBuild().getVersion());
    return label;
}