Example usage for com.vaadin.ui Label setStyleName

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

Introduction

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

Prototype

@Override
    public void setStyleName(String style) 

Source Link

Usage

From source file:org.bubblecloud.ilves.HelloComponent.java

License:Open Source License

/**
 * Default constructor which sets up the component.
 *///from  w  ww.j a va  2 s  .  c o  m
public HelloComponent() {
    final User user = Ilves.getCurrentUser();
    final String greeting;
    if (user == null) {
        greeting = "Hello";
    } else {
        greeting = "Hi, " + user.getFirstName() + "!";
    }
    final Label label = new Label(greeting);
    label.setStyleName("custom-welcome-label");
    setCompositionRoot(label);
}

From source file:org.bubblecloud.ilves.WelcomeComponent.java

License:Open Source License

/**
 * Default constructor.//  w  w  w  . j a v a2s  .  co  m
 */
public WelcomeComponent() {
    // Configure the Vaadin user interface.
    final Label customWelcomeLabel = new Label("Welcome to Ilves");
    customWelcomeLabel.setStyleName("custom-welcome-label");
    setCompositionRoot(customWelcomeLabel);
}

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

License:Open Source License

private CommonDialogWindow createWindow() {
    final Label madatoryStarLabel = new Label("*");
    madatoryStarLabel.setStyleName("v-caption v-required-field-indicator");
    madatoryStarLabel.setWidth(null);/*from w w w. j  av a2s .c o  m*/
    addStyleName("lay-color");
    setSizeUndefined();

    formLayout = new FormLayout();
    formLayout.setCaption(null);
    if (editSwModule) {
        formLayout.addComponent(softwareModuleType);
    } else {
        formLayout.addComponent(typeComboBox);
        typeComboBox.focus();
    }

    formLayout.addComponent(nameTextField);
    formLayout.addComponent(versionTextField);
    formLayout.addComponent(vendorTextField);
    formLayout.addComponent(descTextArea);

    setCompositionRoot(formLayout);

    final CommonDialogWindow window = new WindowBuilder(SPUIDefinitions.CREATE_UPDATE_WINDOW)
            .caption(i18n.getMessage("caption.create.new", i18n.getMessage("caption.software.module")))
            .id(UIComponentIdProvider.SW_MODULE_CREATE_DIALOG).content(this).layout(formLayout).i18n(i18n)
            .saveDialogCloseListener(new SaveOnDialogCloseListener()).buildCommonDialogWindow();
    nameTextField.setEnabled(!editSwModule);
    versionTextField.setEnabled(!editSwModule);

    return window;
}

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

License:Open Source License

private static Label createMandatoryLabel(final boolean mandatory) {
    final Label mandatoryLable = mandatory ? HawkbitCommonUtil.getFormatedLabel(" * ")
            : HawkbitCommonUtil.getFormatedLabel("  ");
    if (mandatory) {
        mandatoryLable.setStyleName(SPUIStyleDefinitions.SP_TEXTFIELD_ERROR);
    }/*from w w  w.  j  av a  2s  . c  o m*/
    return mandatoryLable;
}

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  w w w .  j a  v a2  s.  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 w w w.ja v a 2 s.  co m
    return actionLabel;
}

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

License:Open Source License

/**
 * Get status icon./*w w  w.  j  av  a  2 s .c  om*/
 *
 * @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();/*  w w w.ja  va 2 s .c o  m*/

    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./*from w  ww .j a  v a  2 s  .c  o 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;
}