Java Code Examples for org.eclipse.hawkbit.ui.utils.VaadinMessageSource#getMessage()

The following examples show how to use org.eclipse.hawkbit.ui.utils.VaadinMessageSource#getMessage() . 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: DistributionTable.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
DistributionTable(final UIEventBus eventBus, final VaadinMessageSource i18n,
        final SpPermissionChecker permissionChecker, final UINotification notification,
        final ManagementUIState managementUIState,
        final ManagementViewClientCriterion managementViewClientCriterion, final TargetManagement targetManagement,
        final DistributionSetManagement distributionSetManagement, final DeploymentManagement deploymentManagement,
        final TargetTagManagement targetTagManagement, final UiProperties uiProperties) {
    super(eventBus, i18n, notification, permissionChecker);
    this.permissionChecker = permissionChecker;
    this.managementUIState = managementUIState;
    this.managementViewClientCriterion = managementViewClientCriterion;
    this.targetManagement = targetManagement;
    this.targetTagManagement = targetTagManagement;
    this.distributionSetManagement = distributionSetManagement;
    this.deploymentManagement = deploymentManagement;
    this.actionTypeOptionGroupLayout = new ActionTypeOptionGroupAssignmentLayout(i18n);
    this.maintenanceWindowLayout = new MaintenanceWindowLayout(i18n);
    this.uiProperties = uiProperties;
    notAllowedMsg = i18n.getMessage(UIMessageIdProvider.MESSAGE_ACTION_NOT_ALLOWED);

    addNewContainerDS();
    setColumnProperties();
    setDataAvailable(getContainerDataSource().size() != 0);
}
 
Example 2
Source File: DistributionBarHelper.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private static String getLabel(final Status status, final VaadinMessageSource i18n) {

        String label;

        switch (status) {

            case SCHEDULED :
                label = "label.scheduled";
                break;
            case RUNNING :
                label = "label.running";
                break;
            case ERROR :
                label = "label.error";
                break;
            case FINISHED :
                label = "label.finished";
                break;
            case CANCELLED :
                label = "label.cancelled";
                break;
            case NOTSTARTED :
                label = "label.notStarted";
                break;
            default :
                throw new IllegalStateException("The status " + status + " is not supported.");
        }

        return i18n.getMessage(label);
    }
 
Example 3
Source File: TargetAssignmentOperations.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private static CheckBox maintenanceWindowControl(final VaadinMessageSource i18n,
        final MaintenanceWindowLayout maintenanceWindowLayout, final Consumer<Boolean> saveButtonToggle) {
    final CheckBox enableMaintenanceWindow = new CheckBox(i18n.getMessage("caption.maintenancewindow.enabled"));
    enableMaintenanceWindow.setId(UIComponentIdProvider.MAINTENANCE_WINDOW_ENABLED_ID);
    enableMaintenanceWindow.addStyleName(ValoTheme.CHECKBOX_SMALL);
    enableMaintenanceWindow.addStyleName("dist-window-maintenance-window-enable");
    enableMaintenanceWindow.addValueChangeListener(event -> {
        final Boolean isMaintenanceWindowEnabled = enableMaintenanceWindow.getValue();
        maintenanceWindowLayout.setVisible(isMaintenanceWindowEnabled);
        maintenanceWindowLayout.setEnabled(isMaintenanceWindowEnabled);
        saveButtonToggle.accept(!isMaintenanceWindowEnabled);
        maintenanceWindowLayout.clearAllControls();
    });
    return enableMaintenanceWindow;
}
 
Example 4
Source File: AbstractFilterButtons.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
protected AbstractFilterButtons(final UIEventBus eventBus,
        final AbstractFilterButtonClickBehaviour filterButtonClickBehaviour, final VaadinMessageSource i18n) {
    this.eventBus = eventBus;
    this.i18n = i18n;
    this.filterButtonClickBehaviour = filterButtonClickBehaviour;
    createTable();
    noTagLabel = i18n.getMessage(UIMessageIdProvider.LABEL_NO_TAG);
    if (doSubscribeToEventBus()) {
        eventBus.subscribe(this);
    }
}
 
Example 5
Source File: SPTargetAttributesLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Custom Decorate.
 *
 * @param controllerAttibs
 */
private void decorate(final Map<String, String> controllerAttibs) {
    final VaadinMessageSource i18n = SpringContextHelper.getBean(VaadinMessageSource.class);
    final Label title = new Label(i18n.getMessage("label.target.controller.attrs"), ContentMode.HTML);
    title.addStyleName(SPUIDefinitions.TEXT_STYLE);
    targetAttributesLayout.addComponent(title);
    if (HawkbitCommonUtil.isNotNullOrEmpty(controllerAttibs)) {
        for (final Map.Entry<String, String> entry : controllerAttibs.entrySet()) {
            targetAttributesLayout.addComponent(
                    SPUIComponentProvider.createNameValueLabel(entry.getKey() + ": ", entry.getValue()));
        }
    }
}
 
Example 6
Source File: PollingConfigurationView.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
PollingConfigurationView(final VaadinMessageSource i18n, final ControllerPollProperties controllerPollProperties,
        final TenantConfigurationManagement tenantConfigurationManagement) {
    this.tenantConfigurationManagement = tenantConfigurationManagement;

    final Duration minDuration = DurationHelper
            .formattedStringToDuration(controllerPollProperties.getMinPollingTime());
    final Duration maxDuration = DurationHelper
            .formattedStringToDuration(controllerPollProperties.getMaxPollingTime());
    final Duration globalPollTime = DurationHelper.formattedStringToDuration(tenantConfigurationManagement
            .getGlobalConfigurationValue(TenantConfigurationKey.POLLING_TIME_INTERVAL, String.class));
    final Duration globalOverdueTime = DurationHelper.formattedStringToDuration(tenantConfigurationManagement
            .getGlobalConfigurationValue(TenantConfigurationKey.POLLING_OVERDUE_TIME_INTERVAL, String.class));

    final TenantConfigurationValue<String> pollTimeConfValue = tenantConfigurationManagement
            .getConfigurationValue(TenantConfigurationKey.POLLING_TIME_INTERVAL, String.class);
    if (!pollTimeConfValue.isGlobal()) {
        tenantPollTime = DurationHelper.formattedStringToDuration(pollTimeConfValue.getValue());
    }

    final TenantConfigurationValue<String> overdueTimeConfValue = tenantConfigurationManagement
            .getConfigurationValue(TenantConfigurationKey.POLLING_OVERDUE_TIME_INTERVAL, String.class);
    if (!overdueTimeConfValue.isGlobal()) {
        tenantOverdueTime = DurationHelper.formattedStringToDuration(overdueTimeConfValue.getValue());
    }

    final Panel rootPanel = new Panel();
    rootPanel.setSizeFull();
    rootPanel.addStyleName("config-panel");

    final VerticalLayout vLayout = new VerticalLayout();
    vLayout.setMargin(true);

    final Label headerDisSetType = new Label(i18n.getMessage("configuration.polling.title"));
    headerDisSetType.addStyleName("config-panel-header");
    vLayout.addComponent(headerDisSetType);

    fieldPollTime = DurationConfigField.builder(UIComponentIdProvider.SYSTEM_CONFIGURATION_POLLING)
            .caption(i18n.getMessage("configuration.polling.time"))
            .checkBoxTooltip(i18n.getMessage("configuration.polling.custom.value")).range(minDuration, maxDuration)
            .globalDuration(globalPollTime).tenantDuration(tenantPollTime).build();
    fieldPollTime.addChangeListener(this);
    vLayout.addComponent(fieldPollTime);

    fieldPollingOverdueTime = DurationConfigField.builder(UIComponentIdProvider.SYSTEM_CONFIGURATION_OVERDUE)
            .caption(i18n.getMessage("configuration.polling.overduetime"))
            .checkBoxTooltip(i18n.getMessage("configuration.polling.custom.value")).range(minDuration, maxDuration)
            .globalDuration(globalOverdueTime).tenantDuration(tenantOverdueTime).build();
    fieldPollingOverdueTime.addChangeListener(this);
    vLayout.addComponent(fieldPollingOverdueTime);

    rootPanel.setContent(vLayout);
    setCompositionRoot(rootPanel);
}
 
Example 7
Source File: DefaultDistributionSetTypeLayout.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
DefaultDistributionSetTypeLayout(final SystemManagement systemManagement,
        final DistributionSetTypeManagement distributionSetTypeManagement, final VaadinMessageSource i18n,
        final SpPermissionChecker permChecker) {
    this.systemManagement = systemManagement;
    combobox = SPUIComponentProvider.getComboBox(null, "330", null, null, false, "", "label.combobox.tag");
    changeIcon = new Label();

    if (!permChecker.hasReadRepositoryPermission()) {
        return;
    }

    final Panel rootPanel = new Panel();
    rootPanel.setSizeFull();
    rootPanel.addStyleName("config-panel");
    final VerticalLayout vlayout = new VerticalLayout();
    vlayout.setMargin(true);
    vlayout.setSizeFull();

    final Label header = new Label(i18n.getMessage("configuration.defaultdistributionset.title"));
    header.addStyleName("config-panel-header");
    vlayout.addComponent(header);

    final DistributionSetType currentDistributionSetType = getCurrentDistributionSetType();
    currentDefaultDisSetType = currentDistributionSetType.getId();

    final HorizontalLayout hlayout = new HorizontalLayout();
    hlayout.setSpacing(true);
    hlayout.setImmediate(true);

    final Label configurationLabel = new LabelBuilder()
            .name(i18n.getMessage("configuration.defaultdistributionset.select.label")).buildLabel();
    hlayout.addComponent(configurationLabel);

    final Iterable<DistributionSetType> distributionSetTypeCollection = distributionSetTypeManagement
            .findAll(PageRequest.of(0, 100));

    combobox.setId(UIComponentIdProvider.SYSTEM_CONFIGURATION_DEFAULTDIS_COMBOBOX);
    combobox.setNullSelectionAllowed(false);
    for (final DistributionSetType distributionSetType : distributionSetTypeCollection) {
        combobox.addItem(distributionSetType.getId());
        combobox.setItemCaption(distributionSetType.getId(),
                distributionSetType.getKey() + " (" + distributionSetType.getName() + ")");

        if (distributionSetType.getId().equals(currentDistributionSetType.getId())) {
            combobox.select(distributionSetType.getId());
        }
    }
    combobox.setImmediate(true);
    combobox.addValueChangeListener(event -> selectDistributionSetValue());
    hlayout.addComponent(combobox);

    changeIcon.setIcon(FontAwesome.CHECK);
    hlayout.addComponent(changeIcon);
    changeIcon.setVisible(false);

    vlayout.addComponent(hlayout);
    rootPanel.setContent(vlayout);
    setCompositionRoot(rootPanel);
}
 
Example 8
Source File: AddUpdateRolloutWindowLayout.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
private String getValue(final VaadinMessageSource i18n) {
    return i18n.getMessage(value);
}
 
Example 9
Source File: AbstractTableLayout.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
private TableShortCutHandler(final VaadinMessageSource i18n) {
    selectAllText = i18n.getMessage("action.target.table.selectall");
    selectAllAction = new ShortcutAction(selectAllText, ShortcutAction.KeyCode.A,
            new int[] { ShortCutModifierUtils.getCtrlOrMetaModifier() });
}
 
Example 10
Source File: HawkbitUIErrorHandler.java    From hawkbit with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * Method to build a notification based on an exception.
 * 
 * @param ex
 *            the throwable
 * @return a hawkbit error notification message
 */
protected HawkbitErrorNotificationMessage buildNotification(final Throwable ex) {

    LOG.error("Error in UI: ", ex);

    final String errorMessage = extractMessageFrom(ex);
    final VaadinMessageSource i18n = SpringContextHelper.getBean(VaadinMessageSource.class);

    return new HawkbitErrorNotificationMessage(STYLE, i18n.getMessage("caption.error"), errorMessage, true);
}
 
Example 11
Source File: UploadViewClientCriterion.java    From hawkbit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Constructor.
 * 
 * @param i18n
 *            VaadinMessageSource
 */
@Autowired
public UploadViewClientCriterion(final VaadinMessageSource i18n) {
    super(i18n.getMessage(UIMessageIdProvider.MESSAGE_ACTION_NOT_ALLOWED), COMPONENT_CRITERIA);
}
 
Example 12
Source File: ManagementViewClientCriterion.java    From hawkbit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Constructor.
 * 
 * @param i18n
 *            VaadinMessageSource
 */
@Autowired
public ManagementViewClientCriterion(final VaadinMessageSource i18n) {
    super(i18n.getMessage(UIMessageIdProvider.MESSAGE_ACTION_NOT_ALLOWED), COMPONENT_CRITERIA);
}
 
Example 13
Source File: DistributionsViewClientCriterion.java    From hawkbit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Constructor.
 * 
 * @param i18n
 *            VaadinMessageSource
 */
@Autowired
public DistributionsViewClientCriterion(final VaadinMessageSource i18n) {
    super(i18n.getMessage(UIMessageIdProvider.MESSAGE_ACTION_NOT_ALLOWED), COMPONENT_CRITERIA);
}
 
Example 14
Source File: ActionStatusMsgGrid.java    From hawkbit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Creates the default text when no message is available for action-status
 *
 * @param i18n
 * @return default text
 */
private static String createNoMessageProxy(final VaadinMessageSource i18n) {
    return i18n.getMessage("message.no.available");
}
 
Example 15
Source File: EmptyStringValidator.java    From hawkbit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Constructor for EmptyStringValidator
 * 
 * @param i18n
 *            {@link VaadinMessageSource}
 * @param maxLength
 *            max length of the textfield
 */
public EmptyStringValidator(final VaadinMessageSource i18n, final int maxLength) {
    super(i18n.getMessage(MESSAGE_KEY, maxLength), 1, maxLength, false);
}