Java Code Examples for com.vaadin.ui.Label#setDescription()

The following examples show how to use com.vaadin.ui.Label#setDescription() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TargetTable.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
private Label getTargetPollTime(final Object itemId) {
    final Label statusLabel = new Label();
    statusLabel.addStyleName(ValoTheme.LABEL_SMALL);
    statusLabel.setHeightUndefined();
    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;
}
 
Example 2
Source File: CertificateAuthenticationConfigurationItem.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
public CertificateAuthenticationConfigurationItem(final TenantConfigurationManagement tenantConfigurationManagement,
        final VaadinMessageSource i18n) {
    super(TenantConfigurationKey.AUTHENTICATION_MODE_HEADER_ENABLED, tenantConfigurationManagement, i18n);

    super.init("label.configuration.auth.header");
    configurationEnabled = isConfigEnabled();

    detailLayout = new VerticalLayout();
    detailLayout.setImmediate(true);

    final HorizontalLayout caRootAuthorityLayout = new HorizontalLayout();
    caRootAuthorityLayout.setSpacing(true);

    final Label caRootAuthorityLabel = new LabelBuilder().name(i18n.getMessage("label.configuration.auth.hashField")).buildLabel();
    caRootAuthorityLabel.setDescription(
            i18n.getMessage("label.configuration.auth.hashField.tooltip"));
    caRootAuthorityLabel.setWidthUndefined();

    caRootAuthorityTextField = new TextFieldBuilder(TenantConfiguration.VALUE_MAX_SIZE).buildTextComponent();
    caRootAuthorityTextField.setWidth("100%");
    caRootAuthorityTextField.addTextChangeListener(event -> caRootAuthorityChanged());

    caRootAuthorityLayout.addComponent(caRootAuthorityLabel);
    caRootAuthorityLayout.setExpandRatio(caRootAuthorityLabel, 0);
    caRootAuthorityLayout.addComponent(caRootAuthorityTextField);
    caRootAuthorityLayout.setExpandRatio(caRootAuthorityTextField, 1);
    caRootAuthorityLayout.setWidth("100%");

    detailLayout.addComponent(caRootAuthorityLayout);

    if (isConfigEnabled()) {
        caRootAuthorityTextField.setValue(getCaRootAuthorityValue());
        setDetailVisible(true);
    }
}
 
Example 3
Source File: CreateOrUpdateFilterTable.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
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());
    }
    return label;
}
 
Example 4
Source File: ActionTypeOptionGroupAssignmentLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private void addAutoForceItemWithLabelAndDateField() {
    final FlexibleOptionGroupItemComponent autoForceItem = actionTypeOptionGroup
            .getItemComponent(ActionTypeOption.AUTO_FORCED);
    autoForceItem.setStyleName(STYLE_DIST_WINDOW_ACTIONTYPE);
    autoForceItem.setId(UIComponentIdProvider.ACTION_TYPE_OPTION_GROUP_SAVE_TIMEFORCED);
    addComponent(autoForceItem);
    final Label autoForceLabel = new Label();
    autoForceLabel.setStyleName("statusIconPending");
    autoForceLabel.setIcon(FontAwesome.HISTORY);
    autoForceLabel.setCaption(i18n.getMessage(UIMessageIdProvider.CAPTION_ACTION_TIME_FORCED));
    autoForceLabel.setDescription(i18n.getMessage(UIMessageIdProvider.TOOLTIP_TIMEFORCED_ITEM));
    autoForceLabel.setStyleName(STYLE_DIST_WINDOW_ACTIONTYPE);
    addComponent(autoForceLabel);

    forcedTimeDateField = new DateField();
    forcedTimeDateField.setInvalidAllowed(false);
    forcedTimeDateField.setInvalidCommitted(false);
    forcedTimeDateField.setEnabled(false);
    forcedTimeDateField.setStyleName("dist-window-forcedtime");

    final TimeZone tz = SPDateTimeUtil.getBrowserTimeZone();
    forcedTimeDateField.setValue(
            Date.from(LocalDateTime.now().plusWeeks(2).atZone(SPDateTimeUtil.getTimeZoneId(tz)).toInstant()));
    forcedTimeDateField.setImmediate(true);
    forcedTimeDateField.setTimeZone(tz);
    forcedTimeDateField.setLocale(HawkbitCommonUtil.getCurrentLocale());
    forcedTimeDateField.setResolution(Resolution.MINUTE);
    forcedTimeDateField.addStyleName(ValoTheme.DATEFIELD_SMALL);
    addComponent(forcedTimeDateField);
}
 
Example 5
Source File: AbstractActionTypeOptionGroupLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
protected void addForcedItemWithLabel() {
    final FlexibleOptionGroupItemComponent forceItem = actionTypeOptionGroup
            .getItemComponent(ActionTypeOption.FORCED);
    forceItem.setStyleName(STYLE_DIST_WINDOW_ACTIONTYPE);
    forceItem.setId(UIComponentIdProvider.SAVE_ACTION_RADIO_FORCED);
    addComponent(forceItem);
    final Label forceLabel = new Label();
    forceLabel.setStyleName("statusIconPending");
    forceLabel.setIcon(FontAwesome.BOLT);
    forceLabel.setCaption(i18n.getMessage(UIMessageIdProvider.CAPTION_ACTION_FORCED));
    forceLabel.setDescription(i18n.getMessage(UIMessageIdProvider.TOOLTIP_FORCED_ITEM));
    forceLabel.setStyleName("padding-right-style");
    addComponent(forceLabel);
}
 
Example 6
Source File: AbstractActionTypeOptionGroupLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
protected void addSoftItemWithLabel() {
    final FlexibleOptionGroupItemComponent softItem = actionTypeOptionGroup.getItemComponent(ActionTypeOption.SOFT);
    softItem.setId(UIComponentIdProvider.ACTION_DETAILS_SOFT_ID);
    softItem.setStyleName(STYLE_DIST_WINDOW_ACTIONTYPE);
    addComponent(softItem);
    final Label softLabel = new Label();
    softLabel.setSizeFull();
    softLabel.setCaption(i18n.getMessage(UIMessageIdProvider.CAPTION_ACTION_SOFT));
    softLabel.setDescription(i18n.getMessage(UIMessageIdProvider.TOOLTIP_SOFT_ITEM));
    softLabel.setStyleName("padding-right-style");
    softLabel.setIcon(FontAwesome.STEP_FORWARD);
    addComponent(softLabel);
}
 
Example 7
Source File: AbstractActionTypeOptionGroupLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
protected void addDownloadOnlyItemWithLabel() {
    final FlexibleOptionGroupItemComponent downloadOnlyItem = actionTypeOptionGroup
            .getItemComponent(ActionTypeOption.DOWNLOAD_ONLY);
    downloadOnlyItem.setId(UIComponentIdProvider.ACTION_DETAILS_DOWNLOAD_ONLY_ID);
    downloadOnlyItem.setStyleName(STYLE_DIST_WINDOW_ACTIONTYPE);
    addComponent(downloadOnlyItem);
    final Label downloadOnlyLabel = new Label();
    downloadOnlyLabel.setSizeFull();
    downloadOnlyLabel.setCaption(i18n.getMessage(UIMessageIdProvider.CAPTION_ACTION_DOWNLOAD_ONLY));
    downloadOnlyLabel.setDescription(i18n.getMessage(UIMessageIdProvider.TOOLTIP_DOWNLOAD_ONLY_ITEM));
    downloadOnlyLabel.setStyleName("padding-right-style");
    downloadOnlyLabel.setIcon(FontAwesome.DOWNLOAD);
    addComponent(downloadOnlyLabel);
}
 
Example 8
Source File: DistributionSetDetails.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private static VerticalLayout createSoftwareModuleLayout(final String softwareModuleName) {
    final VerticalLayout verticalLayout = new VerticalLayout();
    final HorizontalLayout horizontalLayout = new HorizontalLayout();
    horizontalLayout.setSizeFull();
    final Label softwareModule = HawkbitCommonUtil.getFormatedLabel("");
    softwareModule.setValue(softwareModuleName);
    softwareModule.setDescription(softwareModuleName);
    softwareModule.setId(softwareModuleName + "-label");
    horizontalLayout.addComponent(softwareModule);
    horizontalLayout.setExpandRatio(softwareModule, 1F);
    verticalLayout.addComponent(horizontalLayout);
    return verticalLayout;
}
 
Example 9
Source File: SoftwareModuleDetailsTable.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private VerticalLayout createSoftModuleLayout(final SoftwareModuleType swModType,
        final DistributionSet distributionSet, final Set<SoftwareModule> alreadyAssignedSwModules) {
    final VerticalLayout verticalLayout = new VerticalLayout();
    for (final SoftwareModule sw : alreadyAssignedSwModules) {
        if (swModType.getKey().equals(sw.getType().getKey())) {
            final HorizontalLayout horizontalLayout = new HorizontalLayout();
            horizontalLayout.setSizeFull();
            final Label softwareModule = HawkbitCommonUtil.getFormatedLabel("");
            final Button reassignSoftModule = SPUIComponentProvider.getButton(sw.getName(), "", "", "", true,
                    FontAwesome.TIMES, SPUIButtonStyleNoBorder.class);
            reassignSoftModule
                    .addClickListener(event -> unassignSW(event, distributionSet, alreadyAssignedSwModules));
            final String softwareModNameVersion = HawkbitCommonUtil.getFormattedNameVersion(sw.getName(),
                    sw.getVersion());
            softwareModule.setValue(softwareModNameVersion);
            softwareModule.setDescription(softwareModNameVersion);
            softwareModule.setId(sw.getName() + "-label");
            horizontalLayout.addComponent(softwareModule);
            horizontalLayout.setExpandRatio(softwareModule, 1F);
            if (isUnassignSoftModAllowed && permissionChecker.hasUpdateRepositoryPermission() && !isTargetAssigned
                    && (isSoftModAvaiableForSoftType(alreadyAssignedSwModules, swModType))) {
                horizontalLayout.addComponent(reassignSoftModule);
            }
            verticalLayout.addComponent(horizontalLayout);
        }

    }

    return verticalLayout;
}
 
Example 10
Source File: SPUIComponentProvider.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private static Label createUsernameLabel(final String label, final String username) {
    String loadAndFormatUsername = "";
    if (!StringUtils.isEmpty(username)) {
        loadAndFormatUsername = UserDetailsFormatter.loadAndFormatUsername(username);
    }

    final Label nameValueLabel = new Label(getBoldHTMLText(label) + loadAndFormatUsername, ContentMode.HTML);
    nameValueLabel.setSizeFull();
    nameValueLabel.addStyleName(SPUIDefinitions.TEXT_STYLE);
    nameValueLabel.addStyleName(LABEL_STYLE);
    nameValueLabel.setDescription(loadAndFormatUsername);
    return nameValueLabel;
}
 
Example 11
Source File: AutoStartOptionGroupLayout.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
private void createOptionGroup() {
    autoStartOptionGroup = new FlexibleOptionGroup();
    autoStartOptionGroup.addItem(AutoStartOption.MANUAL);
    autoStartOptionGroup.addItem(AutoStartOption.AUTO_START);
    autoStartOptionGroup.addItem(AutoStartOption.SCHEDULED);
    selectDefaultOption();

    final FlexibleOptionGroupItemComponent manualItem = autoStartOptionGroup
            .getItemComponent(AutoStartOption.MANUAL);
    manualItem.setStyleName(STYLE_DIST_WINDOW_AUTO_START);
    // set Id for Forced radio button.
    manualItem.setId(UIComponentIdProvider.ROLLOUT_START_MANUAL_ID);
    addComponent(manualItem);
    final Label manualLabel = new Label();
    manualLabel.setStyleName("statusIconPending");
    manualLabel.setIcon(FontAwesome.HAND_PAPER_O);
    manualLabel.setCaption(i18n.getMessage("caption.rollout.start.manual"));
    manualLabel.setDescription(i18n.getMessage("caption.rollout.start.manual.desc"));
    manualLabel.setStyleName("padding-right-style");
    addComponent(manualLabel);

    final FlexibleOptionGroupItemComponent autoStartItem = autoStartOptionGroup
            .getItemComponent(AutoStartOption.AUTO_START);
    autoStartItem.setId(UIComponentIdProvider.ROLLOUT_START_AUTO_ID);
    autoStartItem.setStyleName(STYLE_DIST_WINDOW_AUTO_START);
    addComponent(autoStartItem);
    final Label autoStartLabel = new Label();
    autoStartLabel.setSizeFull();
    autoStartLabel.setIcon(FontAwesome.PLAY);
    autoStartLabel.setCaption(i18n.getMessage("caption.rollout.start.auto"));
    autoStartLabel.setDescription(i18n.getMessage("caption.rollout.start.auto.desc"));
    autoStartLabel.setStyleName("padding-right-style");
    addComponent(autoStartLabel);

    final FlexibleOptionGroupItemComponent scheduledItem = autoStartOptionGroup
            .getItemComponent(AutoStartOption.SCHEDULED);
    scheduledItem.setStyleName(STYLE_DIST_WINDOW_AUTO_START);
    // setted Id for Time Forced radio button.
    scheduledItem.setId(UIComponentIdProvider.ROLLOUT_START_SCHEDULED_ID);
    addComponent(scheduledItem);
    final Label scheduledLabel = new Label();
    scheduledLabel.setStyleName("statusIconPending");
    scheduledLabel.setIcon(FontAwesome.CLOCK_O);
    scheduledLabel.setCaption(i18n.getMessage("caption.rollout.start.scheduled"));
    scheduledLabel.setDescription(i18n.getMessage("caption.rollout.start.scheduled.desc"));
    scheduledLabel.setStyleName(STYLE_DIST_WINDOW_AUTO_START);
    addComponent(scheduledLabel);

    startAtDateField = new DateField();
    startAtDateField.setInvalidAllowed(false);
    startAtDateField.setInvalidCommitted(false);
    startAtDateField.setEnabled(false);
    startAtDateField.setStyleName("dist-window-forcedtime");

    final TimeZone tz = SPDateTimeUtil.getBrowserTimeZone();
    startAtDateField.setValue(
            Date.from(LocalDateTime.now().plusMinutes(30).atZone(SPDateTimeUtil.getTimeZoneId(tz)).toInstant()));
    startAtDateField.setImmediate(true);
    startAtDateField.setTimeZone(tz);
    startAtDateField.setLocale(HawkbitCommonUtil.getCurrentLocale());
    startAtDateField.setResolution(Resolution.MINUTE);
    startAtDateField.addStyleName(ValoTheme.DATEFIELD_SMALL);
    addComponent(startAtDateField);
}