Remove hard-coded Strings to allow internationalization (#706)

* Use i18n and add text in messages.properties for all hardcoded strings

Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com>

* Fix sonar issues

Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com>

* Provide constants for message keys

Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com>

* Remove hard-coded Strings of HawkbitCommonUtil

Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com>

* Fix PR findings

Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com>

* Add Java Doc

Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com>
This commit is contained in:
Melanie Retter
2018-07-18 18:55:52 +02:00
committed by Dominic Schabel
parent b4fc7c8929
commit 7bd6b41b72
53 changed files with 352 additions and 376 deletions

View File

@@ -13,6 +13,7 @@ package org.eclipse.hawkbit.exception;
*/
public enum SpServerError {
/**
*
*/
@@ -21,92 +22,77 @@ public enum SpServerError {
/**
*
*/
SP_REPO_ENTITY_ALRREADY_EXISTS("hawkbit.server.error.repo.entitiyAlreayExists",
"The given entity already exists in database"),
SP_REPO_ENTITY_ALRREADY_EXISTS("hawkbit.server.error.repo.entitiyAlreayExists", "The given entity already exists in database"),
/**
*
*/
SP_REPO_CONSTRAINT_VIOLATION("hawkbit.server.error.repo.constraintViolation",
"The given entity cannot be saved due to Constraint Violation"),
SP_REPO_CONSTRAINT_VIOLATION("hawkbit.server.error.repo.constraintViolation", "The given entity cannot be saved due to Constraint Violation"),
/**
*
*/
SP_REPO_INVALID_TARGET_ADDRESS("hawkbit.server.error.repo.invalidTargetAddress",
"The target address is not well formed"),
SP_REPO_INVALID_TARGET_ADDRESS("hawkbit.server.error.repo.invalidTargetAddress", "The target address is not well formed"),
/**
*
*/
SP_REPO_ENTITY_NOT_EXISTS("hawkbit.server.error.repo.entitiyNotFound",
"The given entity does not exist in the repository"),
SP_REPO_ENTITY_NOT_EXISTS("hawkbit.server.error.repo.entitiyNotFound", "The given entity does not exist in the repository"),
/**
*
*/
SP_REPO_CONCURRENT_MODIFICATION("hawkbit.server.error.repo.concurrentModification",
"The given entity has been changed by another user/session"),
SP_REPO_CONCURRENT_MODIFICATION("hawkbit.server.error.repo.concurrentModification", "The given entity has been changed by another user/session"),
/**
*
*/
SP_REST_SORT_PARAM_SYNTAX("hawkbit.server.error.rest.param.sortParamSyntax",
"The given sort paramter is not well formed"),
SP_REST_SORT_PARAM_SYNTAX("hawkbit.server.error.rest.param.sortParamSyntax", "The given sort paramter is not well formed"),
/**
*
*/
SP_REST_RSQL_SEARCH_PARAM_SYNTAX("hawkbit.server.error.rest.param.rsqlParamSyntax",
"The given search paramter is not well formed"),
SP_REST_RSQL_SEARCH_PARAM_SYNTAX("hawkbit.server.error.rest.param.rsqlParamSyntax", "The given search paramter is not well formed"),
/**
*
*/
SP_REST_RSQL_PARAM_INVALID_FIELD("hawkbit.server.error.rest.param.rsqlInvalidField",
"The given search parameter field does not exist"),
SP_REST_RSQL_PARAM_INVALID_FIELD("hawkbit.server.error.rest.param.rsqlInvalidField", "The given search parameter field does not exist"),
/**
*
*/
SP_REST_SORT_PARAM_INVALID_FIELD("hawkbit.server.error.rest.param.invalidField",
"The given sort parameter field does not exist"),
SP_REST_SORT_PARAM_INVALID_FIELD("hawkbit.server.error.rest.param.invalidField", "The given sort parameter field does not exist"),
/**
*
*/
SP_REST_SORT_PARAM_INVALID_DIRECTION("hawkbit.server.error.rest.param.invalidDirection",
"The given sort parameter direction does not exist"),
SP_REST_SORT_PARAM_INVALID_DIRECTION("hawkbit.server.error.rest.param.invalidDirection", "The given sort parameter direction does not exist"),
/**
*
*/
SP_REST_BODY_NOT_READABLE("hawkbit.server.error.rest.body.notReadable",
"The given request body is not well formed"),
SP_REST_BODY_NOT_READABLE("hawkbit.server.error.rest.body.notReadable", "The given request body is not well formed"),
/**
*
*/
SP_ARTIFACT_UPLOAD_FAILED("hawkbit.server.error.artifact.uploadFailed",
"Upload of artifact failed with internal server error."),
SP_ARTIFACT_UPLOAD_FAILED("hawkbit.server.error.artifact.uploadFailed", "Upload of artifact failed with internal server error."),
/**
*
*/
SP_ARTIFACT_UPLOAD_FAILED_MD5_MATCH("hawkbit.server.error.artifact.uploadFailed.checksum.md5.match",
"Upload of artifact failed as the provided MD5 checksum did not match with the provided artifact."),
SP_ARTIFACT_UPLOAD_FAILED_MD5_MATCH("hawkbit.server.error.artifact.uploadFailed.checksum.md5.match", "Upload of artifact failed as the provided MD5 checksum did not match with the provided artifact."),
/**
*
*/
SP_ARTIFACT_UPLOAD_FAILED_SHA1_MATCH("hawkbit.server.error.artifact.uploadFailed.checksum.sha1.match",
"Upload of artifact failed as the provided SHA1 checksum did not match with the provided artifact."),
SP_ARTIFACT_UPLOAD_FAILED_SHA1_MATCH("hawkbit.server.error.artifact.uploadFailed.checksum.sha1.match", "Upload of artifact failed as the provided SHA1 checksum did not match with the provided artifact."),
/**
*
*/
SP_DS_CREATION_FAILED_MISSING_MODULE("hawkbit.server.error.distributionset.creationFailed.missingModule",
"Creation if Distribution Set failed as module is missing that is configured as mandatory."),
SP_DS_CREATION_FAILED_MISSING_MODULE("hawkbit.server.error.distributionset.creationFailed.missingModule", "Creation if Distribution Set failed as module is missing that is configured as mandatory."),
/**
*
@@ -116,14 +102,12 @@ public enum SpServerError {
/**
*
*/
SP_ARTIFACT_DELETE_FAILED("hawkbit.server.error.artifact.deleteFailed",
"Deletion of artifact failed with internal server error."),
SP_ARTIFACT_DELETE_FAILED("hawkbit.server.error.artifact.deleteFailed", "Deletion of artifact failed with internal server error."),
/**
*
*/
SP_ARTIFACT_LOAD_FAILED("hawkbit.server.error.artifact.loadFailed",
"Load of artifact failed with internal server error."),
SP_ARTIFACT_LOAD_FAILED("hawkbit.server.error.artifact.loadFailed", "Load of artifact failed with internal server error."),
/**
*
@@ -134,39 +118,33 @@ public enum SpServerError {
* error message, which describes that the action can not be canceled cause
* the action is inactive.
*/
SP_ACTION_NOT_CANCELABLE("hawkbit.server.error.action.notcancelable",
"Only active actions which are in status pending are canceable."),
SP_ACTION_NOT_CANCELABLE("hawkbit.server.error.action.notcancelable", "Only active actions which are in status pending are canceable."),
/**
* error message, which describes that the action can not be force quit
* cause the action is inactive.
*/
SP_ACTION_NOT_FORCE_QUITABLE("hawkbit.server.error.action.notforcequitable",
"Only active actions which are in status pending can be force quit."),
SP_ACTION_NOT_FORCE_QUITABLE("hawkbit.server.error.action.notforcequitable", "Only active actions which are in status pending can be force quit."),
/**
*
*/
SP_DS_INCOMPLETE("hawkbit.server.error.distributionset.incomplete",
"Distribution set is assigned to a a target that is incomplete (i.e. mandatory modules are missing)"),
SP_DS_INCOMPLETE("hawkbit.server.error.distributionset.incomplete", "Distribution set is assigned to a a target that is incomplete (i.e. mandatory modules are missing)"),
/**
*
*/
SP_DS_TYPE_UNDEFINED("hawkbit.server.error.distributionset.type.undefined",
"Distribution set type is not yet defined. Modules cannot be added until definition."),
SP_DS_TYPE_UNDEFINED("hawkbit.server.error.distributionset.type.undefined", "Distribution set type is not yet defined. Modules cannot be added until definition."),
/**
*
*/
SP_DS_MODULE_UNSUPPORTED("hawkbit.server.error.distributionset.modules.unsupported",
"Distribution set type does not contain the given module, i.e. is incompatible."),
SP_DS_MODULE_UNSUPPORTED("hawkbit.server.error.distributionset.modules.unsupported", "Distribution set type does not contain the given module, i.e. is incompatible."),
/**
*
*/
SP_REPO_TENANT_NOT_EXISTS("hawkbit.server.error.repo.tenantNotExists",
"The entity cannot be inserted due the tenant does not exists"),
SP_REPO_TENANT_NOT_EXISTS("hawkbit.server.error.repo.tenantNotExists", "The entity cannot be inserted due the tenant does not exists"),
/**
*
@@ -176,14 +154,12 @@ public enum SpServerError {
/**
*
*/
SP_REPO_ENTITY_READ_ONLY("hawkbit.server.error.entityreadonly",
"The given entity is read only and the change cannot be completed."),
SP_REPO_ENTITY_READ_ONLY("hawkbit.server.error.entityreadonly", "The given entity is read only and the change cannot be completed."),
/**
*
*/
SP_CONFIGURATION_VALUE_INVALID("hawkbit.server.error.configValueInvalid",
"The given configuration value is invalid."),
SP_CONFIGURATION_VALUE_INVALID("hawkbit.server.error.configValueInvalid", "The given configuration value is invalid."),
/**
*
*/
@@ -192,26 +168,22 @@ public enum SpServerError {
/**
*
*/
SP_ROLLOUT_ILLEGAL_STATE("hawkbit.server.error.rollout.illegalstate",
"The rollout is in the wrong state for the requested operation"),
SP_ROLLOUT_ILLEGAL_STATE("hawkbit.server.error.rollout.illegalstate", "The rollout is in the wrong state for the requested operation"),
/**
*
*/
SP_ROLLOUT_VERIFICATION_FAILED("hawkbit.server.error.rollout.verificationFailed",
"The rollout configuration could not be verified successfully"),
SP_ROLLOUT_VERIFICATION_FAILED("hawkbit.server.error.rollout.verificationFailed", "The rollout configuration could not be verified successfully"),
/**
*
*/
SP_REPO_OPERATION_NOT_SUPPORTED("hawkbit.server.error.operation.notSupported",
"Operation or method is (no longer) supported by service."),
SP_REPO_OPERATION_NOT_SUPPORTED("hawkbit.server.error.operation.notSupported", "Operation or method is (no longer) supported by service."),
/**
* Error message informing that the maintenance schedule is invalid.
*/
SP_MAINTENANCE_SCHEDULE_INVALID("hawkbit.server.error.maintenanceScheduleInvalid",
"Information for schedule, duration or timezone is missing; or there is no valid maintenance window available in future.");
SP_MAINTENANCE_SCHEDULE_INVALID("hawkbit.server.error.maintenanceScheduleInvalid", "Information for schedule, duration or timezone is missing; or there is no valid maintenance window available in future.");
private final String key;
private final String message;

View File

@@ -16,6 +16,7 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
*
*/
public final class Constants {
/**
* {@link SoftwareModuleType#getKey()} of a {@link SoftwareModuleType}
* generated by repository for every new account for Firmware/Operating

View File

@@ -32,7 +32,6 @@ import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleNoBorder;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UIMessageIdProvider;
import org.eclipse.hawkbit.ui.utils.UINotification;
@@ -164,7 +163,7 @@ public class ArtifactDetailsLayout extends VerticalLayout {
private void createComponents(final String labelSoftwareModule) {
titleOfArtifactDetails = new LabelBuilder().id(UIComponentIdProvider.ARTIFACT_DETAILS_HEADER_LABEL_ID)
.name(HawkbitCommonUtil.getArtifactoryDetailsLabelId(labelSoftwareModule)).buildCaptionLabel();
.name(HawkbitCommonUtil.getArtifactoryDetailsLabelId(labelSoftwareModule, i18n)).buildCaptionLabel();
titleOfArtifactDetails.setContentMode(ContentMode.HTML);
titleOfArtifactDetails.setSizeFull();
titleOfArtifactDetails.setImmediate(true);
@@ -269,8 +268,8 @@ public class ArtifactDetailsLayout extends VerticalLayout {
.getItemProperty(PROVIDED_FILE_NAME).getValue();
final Button deleteIcon = SPUIComponentProvider.getButton(
fileName + "-" + UIComponentIdProvider.UPLOAD_FILE_DELETE_ICON, "",
SPUILabelDefinitions.DISCARD, ValoTheme.BUTTON_TINY + " " + "blueicon", true,
FontAwesome.TRASH_O, SPUIButtonStyleNoBorder.class);
i18n.getMessage(UIMessageIdProvider.CAPTION_DISCARD), ValoTheme.BUTTON_TINY + " " + "blueicon",
true, FontAwesome.TRASH_O, SPUIButtonStyleNoBorder.class);
deleteIcon.setData(itemId);
deleteIcon.addClickListener(event -> confirmAndDeleteArtifact((Long) itemId, fileName));
return deleteIcon;
@@ -306,7 +305,7 @@ public class ArtifactDetailsLayout extends VerticalLayout {
}
table.setColumnHeader(CREATE_MODIFIED_DATE_UPLOAD, i18n.getMessage("upload.last.modified.date"));
if (!readOnly) {
table.setColumnHeader(ACTION, i18n.getMessage("upload.action"));
table.setColumnHeader(ACTION, i18n.getMessage(UIMessageIdProvider.MESSAGE_UPLOAD_ACTION));
}
table.setColumnExpandRatio(PROVIDED_FILE_NAME, 3.5F);
@@ -430,7 +429,7 @@ public class ArtifactDetailsLayout extends VerticalLayout {
if (StringUtils.isEmpty(swModuleName)) {
setTitleOfLayoutHeader();
} else {
titleOfArtifactDetails.setValue(HawkbitCommonUtil.getArtifactoryDetailsLabelId(swModuleName));
titleOfArtifactDetails.setValue(HawkbitCommonUtil.getArtifactoryDetailsLabelId(swModuleName, i18n));
titleOfArtifactDetails.setContentMode(ContentMode.HTML);
}
}
@@ -453,7 +452,7 @@ public class ArtifactDetailsLayout extends VerticalLayout {
* Set title of artifact details header layout.
*/
private void setTitleOfLayoutHeader() {
titleOfArtifactDetails.setValue(HawkbitCommonUtil.getArtifactoryDetailsLabelId(""));
titleOfArtifactDetails.setValue(HawkbitCommonUtil.getArtifactoryDetailsLabelId("", i18n));
titleOfArtifactDetails.setContentMode(ContentMode.HTML);
}
@@ -517,4 +516,5 @@ public class ArtifactDetailsLayout extends VerticalLayout {
private boolean isMaximized() {
return artifactUploadState.isArtifactDetailsMaximized();
}
}

View File

@@ -44,7 +44,7 @@ public class SoftwareModuleTableLayout extends AbstractTableLayout<SoftwareModul
uiNotification, eventBus, softwareModuleManagement, softwareModuleTypeManagement, entityFactory,
softwareModuleTable);
super.init(
super.init(i18n,
new SoftwareModuleTableHeader(i18n, permChecker, eventBus, artifactUploadState,
softwareModuleAddUpdateWindow),
softwareModuleTable,

View File

@@ -17,8 +17,8 @@ import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
import org.eclipse.hawkbit.ui.common.event.FilterHeaderEvent.FilterHeaderEnum;
import org.eclipse.hawkbit.ui.common.event.SoftwareModuleTypeFilterHeaderEvent;
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterHeader;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UIMessageIdProvider;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.vaadin.spring.events.EventBus.UIEventBus;
@@ -59,7 +59,7 @@ public class SMTypeFilterHeader extends AbstractFilterHeader {
@Override
protected String getTitle() {
return SPUILabelDefinitions.TYPE;
return getI18n().getMessage(UIMessageIdProvider.CAPTION_FILTER_BY_TYPE);
}
@Override

View File

@@ -20,6 +20,7 @@ import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
import org.eclipse.hawkbit.ui.dd.criteria.ServerItemIdClientCriterion;
import org.eclipse.hawkbit.ui.dd.criteria.ServerItemIdClientCriterion.Mode;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UIMessageIdProvider;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.vaadin.spring.events.EventBus;
@@ -128,7 +129,7 @@ public class UploadDropAreaLayout extends AbstractComponent {
private VerticalLayout createDropAreaLayout() {
final VerticalLayout dropAreaLayout = new VerticalLayout();
final Label dropHereLabel = new Label("Drop Files to upload");
final Label dropHereLabel = new Label(i18n.getMessage(UIMessageIdProvider.LABEL_DROP_AREA_UPLOAD));
dropHereLabel.setWidth(null);
final Label dropIcon = new Label(FontAwesome.ARROW_DOWN.getHtml(), ContentMode.HTML);
@@ -210,7 +211,7 @@ public class UploadDropAreaLayout extends AbstractComponent {
// check if drop is valid.If valid ,check if software module is
// selected.
if (!isFilesDropped(event)) {
uiNotification.displayValidationError(i18n.getMessage("message.action.not.allowed"));
uiNotification.displayValidationError(i18n.getMessage(UIMessageIdProvider.MESSAGE_ACTION_NOT_ALLOWED));
return false;
}
return validateSoftwareModuleSelection();

View File

@@ -25,6 +25,7 @@ import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleNoBorderWithIcon;
import org.eclipse.hawkbit.ui.management.targettable.TargetAddUpdateWindowLayout;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UIMessageIdProvider;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
@@ -444,8 +445,9 @@ public class CommonDialogWindow extends Window {
}
private void createCancelButton() {
cancelButton = SPUIComponentProvider.getButton(UIComponentIdProvider.CANCEL_BUTTON, "Cancel", "", "", true,
FontAwesome.TIMES, SPUIButtonStyleNoBorderWithIcon.class);
cancelButton = SPUIComponentProvider.getButton(UIComponentIdProvider.CANCEL_BUTTON,
i18n.getMessage(UIMessageIdProvider.BUTTON_CANCEL), "", "", true, FontAwesome.TIMES,
SPUIButtonStyleNoBorderWithIcon.class);
cancelButton.setSizeUndefined();
cancelButton.addStyleName("default-color");
addCloseListenerForCancelButton();
@@ -459,8 +461,9 @@ public class CommonDialogWindow extends Window {
}
private void createSaveButton() {
saveButton = SPUIComponentProvider.getButton(UIComponentIdProvider.SAVE_BUTTON, "Save", "", "", true,
FontAwesome.SAVE, SPUIButtonStyleNoBorderWithIcon.class);
saveButton = SPUIComponentProvider.getButton(UIComponentIdProvider.SAVE_BUTTON,
i18n.getMessage(UIMessageIdProvider.BUTTON_SAVE), "", "", true, FontAwesome.SAVE,
SPUIButtonStyleNoBorderWithIcon.class);
saveButton.setSizeUndefined();
saveButton.addStyleName("default-color");
addCloseListenerForSaveButton();

View File

@@ -62,12 +62,15 @@ public abstract class AbstractFilterButtons extends Table {
private final VaadinMessageSource i18n;
private final String noTagLabel;
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);
}
@@ -168,7 +171,7 @@ public abstract class AbstractFilterButtons extends Table {
}
private Object addDeleteCell(final Object itemId) {
if (itemId instanceof TagIdName && SPUIDefinitions.NO_TAG.equals(((TagIdName) itemId).getName())) {
if (itemId instanceof TagIdName && noTagLabel.equals(((TagIdName) itemId).getName())) {
return null;
}
@@ -185,7 +188,7 @@ public abstract class AbstractFilterButtons extends Table {
}
private Button addUpdateCell(final Object itemId) {
if (itemId instanceof TagIdName && SPUIDefinitions.NO_TAG.equals(((TagIdName) itemId).getName())) {
if (itemId instanceof TagIdName && noTagLabel.equals(((TagIdName) itemId).getName())) {
return null;
}
@@ -411,4 +414,8 @@ public abstract class AbstractFilterButtons extends Table {
return filterButtonClickBehaviour;
}
protected String getNoTagLabel() {
return noTagLabel;
}
}

View File

@@ -145,7 +145,7 @@ public abstract class AbstractGrid<T extends Indexed> extends Grid implements Re
}
if (indexedContainer != null && indexedContainer.size() == 0) {
setData(SPUIDefinitions.NO_DATA);
setData(i18n.getMessage(UIMessageIdProvider.MESSAGE_NO_DATA));
}
}
@@ -704,4 +704,8 @@ public abstract class AbstractGrid<T extends Indexed> extends Grid implements Re
return String.class;
}
}
protected String getActionLabeltext() {
return i18n.getMessage(UIMessageIdProvider.MESSAGE_UPLOAD_ACTION);
}
}

View File

@@ -33,7 +33,6 @@ public abstract class AbstractGridComponentLayout extends VerticalLayout {
private final VaadinMessageSource i18n;
private AbstractOrderedLayout gridHeader;
private Grid grid;
private transient AbstractFooterSupport footerSupport;

View File

@@ -78,8 +78,6 @@ public abstract class AbstractTable<E extends NamedEntity> extends Table impleme
private static final float DEFAULT_COLUMN_NAME_MIN_SIZE = 0.8F;
protected static final String ACTION_NOT_ALLOWED_MSG = "message.action.not.allowed";
private final transient EventBus.UIEventBus eventBus;
private final VaadinMessageSource i18n;
@@ -185,7 +183,7 @@ public abstract class AbstractTable<E extends NamedEntity> extends Table impleme
setContainerDataSource(container);
final int size = container.size();
if (size == 0) {
setData(SPUIDefinitions.NO_DATA);
setData(i18n.getMessage(UIMessageIdProvider.MESSAGE_NO_DATA));
}
}
@@ -574,13 +572,13 @@ public abstract class AbstractTable<E extends NamedEntity> extends Table impleme
return validateDragAndDropWrapper((DragAndDropWrapper) compsource)
&& validateDropList(getDraggedTargetList(dragEvent));
}
notification.displayValidationError(i18n.getMessage(ACTION_NOT_ALLOWED_MSG));
notification.displayValidationError(i18n.getMessage(UIMessageIdProvider.MESSAGE_ACTION_NOT_ALLOWED));
return false;
}
private boolean validateTable(final Table compsource) {
if (!compsource.getId().equals(getDropTableId())) {
notification.displayValidationError(ACTION_NOT_ALLOWED_MSG);
notification.displayValidationError(UIMessageIdProvider.MESSAGE_ACTION_NOT_ALLOWED);
return false;
}
return true;

View File

@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.ui.common.table;
import org.eclipse.hawkbit.ui.common.detailslayout.AbstractTableDetailsLayout;
import org.eclipse.hawkbit.ui.components.RefreshableContainer;
import org.eclipse.hawkbit.ui.utils.ShortCutModifierUtils;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import com.vaadin.event.Action;
import com.vaadin.event.Action.Handler;
@@ -37,8 +38,11 @@ public abstract class AbstractTableLayout<T extends AbstractTable<?>> extends Ve
private AbstractTableDetailsLayout<?> detailsLayout;
protected void init(final AbstractTableHeader tableHeader, final T table,
private VaadinMessageSource i18n;
protected void init(final VaadinMessageSource i18n, final AbstractTableHeader tableHeader, final T table,
final AbstractTableDetailsLayout<?> detailsLayout) {
this.i18n = i18n;
this.tableHeader = tableHeader;
this.table = table;
this.detailsLayout = detailsLayout;
@@ -66,7 +70,7 @@ public abstract class AbstractTableLayout<T extends AbstractTable<?>> extends Ve
tablePanel.setStyleName("table-panel");
tablePanel.setHeight(100.0F, Unit.PERCENTAGE);
tablePanel.setContent(table);
tablePanel.addActionHandler(getShortCutKeysHandler());
tablePanel.addActionHandler(getShortCutKeysHandler(i18n));
tablePanel.addStyleName(ValoTheme.PANEL_BORDERLESS);
tableHeaderLayout.addComponent(tablePanel);
tableHeaderLayout.setComponentAlignment(tablePanel, Alignment.TOP_CENTER);
@@ -99,8 +103,8 @@ public abstract class AbstractTableLayout<T extends AbstractTable<?>> extends Ve
* @return reference of {@link Handler} to handler the short cut keys.
* Default is null.
*/
protected Handler getShortCutKeysHandler() {
return new TableShortCutHandler();
protected Handler getShortCutKeysHandler(final VaadinMessageSource i18n) {
return new TableShortCutHandler(i18n);
}
protected void publishEvent() {
@@ -115,14 +119,20 @@ public abstract class AbstractTableLayout<T extends AbstractTable<?>> extends Ve
return table;
}
private class TableShortCutHandler implements Handler {
private static final String SELECT_ALL_TEXT = "Select All";
private final ShortcutAction selectAllAction = new ShortcutAction(SELECT_ALL_TEXT, ShortcutAction.KeyCode.A,
new int[] { ShortCutModifierUtils.getCtrlOrMetaModifier() });
private final class TableShortCutHandler implements Handler {
private static final long serialVersionUID = 1L;
private final String selectAllText;
private final ShortcutAction selectAllAction;
private TableShortCutHandler(final VaadinMessageSource i18n) {
selectAllText = i18n.getMessage("action.target.table.selectall");
selectAllAction = new ShortcutAction(selectAllText, ShortcutAction.KeyCode.A,
new int[] { ShortCutModifierUtils.getCtrlOrMetaModifier() });
}
@Override
public void handleAction(final Action action, final Object sender, final Object target) {
if (!selectAllAction.equals(action)) {

View File

@@ -10,6 +10,7 @@ package org.eclipse.hawkbit.ui.dd.client.criteria;
import static org.eclipse.hawkbit.ui.dd.criteria.AcceptCriteriaConstants.DROP_AREA_CONFIG;
import static org.eclipse.hawkbit.ui.dd.criteria.AcceptCriteriaConstants.DROP_AREA_CONFIG_COUNT;
import static org.eclipse.hawkbit.ui.dd.criteria.AcceptCriteriaConstants.ERROR_MESSAGE;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -70,6 +71,8 @@ public final class ViewClientCriterion extends VAcceptCriterion implements VAcce
private HandlerRegistration nativeEventHandlerRegistration;
private String errorMessage;
/**
* This interface is used to compile string templates in the GWT context (as
* other approaches like <code>MessageFormat</code> would fail).
@@ -153,6 +156,8 @@ public final class ViewClientCriterion extends VAcceptCriterion implements VAcce
if (Event.ONMOUSEUP == Event.getTypeInt(drag.getCurrentGwtEvent().getType())) {
showErrorNotification(drag);
}
errorMessage = configuration.getStringAttribute(ERROR_MESSAGE);
}
@Override
@@ -269,8 +274,8 @@ public final class ViewClientCriterion extends VAcceptCriterion implements VAcce
private void showErrorNotification(final VDragEvent drag) {
final VNotification n = VNotification.createNotification(SPUILabelDefinitions.SP_DELAY,
drag.getTransferable().getDragSource().getWidget());
n.show(getDraggableTemplate().notificationMsg(SPUILabelDefinitions.ACTION_NOT_ALLOWED).asString(),
Position.BOTTOM_RIGHT, SPUIStyleDefinitions.SP_NOTIFICATION_ERROR_MESSAGE_STYLE);
n.show(getDraggableTemplate().notificationMsg(errorMessage).asString(), Position.BOTTOM_RIGHT,
SPUIStyleDefinitions.SP_NOTIFICATION_ERROR_MESSAGE_STYLE);
}
/**

View File

@@ -76,6 +76,11 @@ public final class AcceptCriteriaConstants {
*/
public static final String PREFIX_MODE = "p";
/**
* Key for the error message to be displayed in error case.
*/
public static final String ERROR_MESSAGE = "errM";
/**
* Constants class.
*/

View File

@@ -9,6 +9,9 @@
package org.eclipse.hawkbit.ui.dd.criteria;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UIMessageIdProvider;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.springframework.beans.factory.annotation.Autowired;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.UIScope;
@@ -27,9 +30,13 @@ public final class DistributionsViewClientCriterion extends ServerViewClientCrit
/**
* Constructor.
*
* @param i18n
* VaadinMessageSource
*/
public DistributionsViewClientCriterion() {
super(COMPONENT_CRITERIA);
@Autowired
public DistributionsViewClientCriterion(final VaadinMessageSource i18n) {
super(i18n.getMessage(UIMessageIdProvider.MESSAGE_ACTION_NOT_ALLOWED), COMPONENT_CRITERIA);
}
/**

View File

@@ -10,6 +10,9 @@ package org.eclipse.hawkbit.ui.dd.criteria;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UIMessageIdProvider;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.springframework.beans.factory.annotation.Autowired;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.UIScope;
@@ -22,18 +25,19 @@ import com.vaadin.spring.annotation.UIScope;
@UIScope
public final class ManagementViewClientCriterion extends ServerViewClientCriterion {
/**
* serialVersionUID.
*/
private static final long serialVersionUID = 927303094996626180L;
private static final ServerViewComponentClientCriterion[] COMPONENT_CRITERIA = createViewComponentClientCriteria();
/**
* Constructor.
*
* @param i18n
* VaadinMessageSource
*/
public ManagementViewClientCriterion() {
super(COMPONENT_CRITERIA);
@Autowired
public ManagementViewClientCriterion(final VaadinMessageSource i18n) {
super(i18n.getMessage(UIMessageIdProvider.MESSAGE_ACTION_NOT_ALLOWED), COMPONENT_CRITERIA);
}
/**

View File

@@ -10,6 +10,7 @@ package org.eclipse.hawkbit.ui.dd.criteria;
import static org.eclipse.hawkbit.ui.dd.criteria.AcceptCriteriaConstants.DROP_AREA_CONFIG;
import static org.eclipse.hawkbit.ui.dd.criteria.AcceptCriteriaConstants.DROP_AREA_CONFIG_COUNT;
import static org.eclipse.hawkbit.ui.dd.criteria.AcceptCriteriaConstants.ERROR_MESSAGE;
import java.util.Arrays;
import java.util.Set;
@@ -47,28 +48,35 @@ public class ServerViewClientCriterion extends Or {
private final Set<String> dropAreaHints;
private final String errorMessage;
/**
* Constructor for the server part of the client-side accept criterion.
*
* @param errorMessage
* the message to display if the drag and drop action is not
* successful
* @param criteria
* elements the composite consists of.
*/
public ServerViewClientCriterion(ServerViewComponentClientCriterion... criteria) {
public ServerViewClientCriterion(final String errorMessage, final ServerViewComponentClientCriterion... criteria) {
super(criteria);
this.errorMessage = errorMessage;
dropAreaHints = Sets.newHashSet();
for (ServerViewComponentClientCriterion criterion : criteria) {
for (final ServerViewComponentClientCriterion criterion : criteria) {
dropAreaHints.addAll(Arrays.asList(criterion.getValidDropAreaIds()));
}
}
@Override
public void paintContent(PaintTarget target) throws PaintException {
public void paintContent(final PaintTarget target) throws PaintException {
int dropAreaStylesConfigCount = 0;
for (String dropAreaEntry : dropAreaHints) {
for (final String dropAreaEntry : dropAreaHints) {
target.addAttribute(DROP_AREA_CONFIG + dropAreaStylesConfigCount, dropAreaEntry);
dropAreaStylesConfigCount++;
}
target.addAttribute(DROP_AREA_CONFIG_COUNT, dropAreaStylesConfigCount);
target.addAttribute(ERROR_MESSAGE, errorMessage);
super.paintContent(target);
}

View File

@@ -8,6 +8,10 @@
*/
package org.eclipse.hawkbit.ui.dd.criteria;
import org.eclipse.hawkbit.ui.utils.UIMessageIdProvider;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.springframework.beans.factory.annotation.Autowired;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.UIScope;
@@ -19,18 +23,19 @@ import com.vaadin.spring.annotation.UIScope;
@UIScope
public final class UploadViewClientCriterion extends ServerViewClientCriterion {
/**
* serialVersionUID.
*/
private static final long serialVersionUID = 6271501901430079353L;
private static final ServerViewComponentClientCriterion[] COMPONENT_CRITERIA = createViewComponentClientCriteria();
/**
* Constructor.
*
* @param i18n
* VaadinMessageSource
*/
public UploadViewClientCriterion() {
super(COMPONENT_CRITERIA);
@Autowired
public UploadViewClientCriterion(final VaadinMessageSource i18n) {
super(i18n.getMessage(UIMessageIdProvider.MESSAGE_ACTION_NOT_ALLOWED), COMPONENT_CRITERIA);
}
/**

View File

@@ -18,8 +18,8 @@ import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterHeader;
import org.eclipse.hawkbit.ui.distributions.disttype.CreateDistributionSetTypeLayout;
import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UIMessageIdProvider;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.vaadin.spring.events.EventBus.UIEventBus;
@@ -86,7 +86,7 @@ public class DSTypeFilterHeader extends AbstractFilterHeader {
@Override
protected String getTitle() {
return SPUILabelDefinitions.TYPE;
return getI18n().getMessage(UIMessageIdProvider.CAPTION_FILTER_BY_TYPE);
}
@Override

View File

@@ -223,7 +223,8 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
protected boolean isDropValid(final DragAndDropEvent dragEvent) {
final Component compsource = dragEvent.getTransferable().getSourceComponent();
if (!(compsource instanceof Table)) {
getNotification().displayValidationError(getI18n().getMessage(ACTION_NOT_ALLOWED_MSG));
getNotification()
.displayValidationError(getI18n().getMessage(UIMessageIdProvider.MESSAGE_ACTION_NOT_ALLOWED));
return false;
}
return super.isDropValid(dragEvent);

View File

@@ -54,7 +54,7 @@ public class DistributionSetTableLayout extends AbstractTableLayout<Distribution
final DsMetadataPopupLayout popupLayout = new DsMetadataPopupLayout(i18n, uiNotification, eventBus,
distributionSetManagement, entityFactory, permissionChecker);
super.init(
super.init(i18n,
new DistributionSetTableHeader(i18n, permissionChecker, eventBus, manageDistUIState,
distributionAddUpdateWindowLayout),
distributionSetTable,

View File

@@ -97,7 +97,7 @@ public class SwModuleDetails extends AbstractSoftwareModuleDetails {
private void showArtifactDetailsWindow(final SoftwareModule softwareModule) {
final Window artifactDtlsWindow = new Window();
artifactDtlsWindow.setCaption(HawkbitCommonUtil
.getArtifactoryDetailsLabelId(softwareModule.getName() + "." + softwareModule.getVersion()));
.getArtifactoryDetailsLabelId(softwareModule.getName() + "." + softwareModule.getVersion(), getI18n()));
artifactDtlsWindow.setCaptionAsHtml(true);
artifactDtlsWindow.setClosable(true);
artifactDtlsWindow.setResizable(true);

View File

@@ -51,7 +51,7 @@ public class SwModuleTableLayout extends AbstractTableLayout<SwModuleTable> {
final ArtifactDetailsLayout artifactDetailsLayout = new ArtifactDetailsLayout(i18n, eventBus,
artifactUploadState, uiNotification, artifactManagement, softwareModuleManagement);
super.init(
super.init(i18n,
new SwModuleTableHeader(i18n, permChecker, eventBus, manageDistUIState, softwareModuleAddUpdateWindow),
swModuleTable, new SwModuleDetails(i18n, eventBus, permChecker, softwareModuleAddUpdateWindow,
manageDistUIState, softwareModuleManagement, swMetadataPopupLayout, artifactDetailsLayout));

View File

@@ -17,8 +17,8 @@ import org.eclipse.hawkbit.ui.common.event.SoftwareModuleTypeFilterHeaderEvent;
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterHeader;
import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UIMessageIdProvider;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.vaadin.spring.events.EventBus.UIEventBus;
@@ -64,7 +64,7 @@ public class DistSMTypeFilterHeader extends AbstractFilterHeader {
@Override
protected String getTitle() {
return SPUILabelDefinitions.TYPE;
return getI18n().getMessage(UIMessageIdProvider.CAPTION_FILTER_BY_TYPE);
}
@Override

View File

@@ -23,7 +23,6 @@ import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleNoBorder;
import org.eclipse.hawkbit.ui.filtermanagement.event.CustomFilterUIEvent;
import org.eclipse.hawkbit.ui.filtermanagement.state.FilterManagementUIState;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UIMessageIdProvider;
@@ -175,7 +174,8 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
breadcrumbButton = createBreadcrumbButton();
headerCaption = new LabelBuilder().name(SPUILabelDefinitions.VAR_CREATE_FILTER).buildCaptionLabel();
headerCaption = new LabelBuilder().name(i18n.getMessage(UIMessageIdProvider.LABEL_CREATE_FILTER))
.buildCaptionLabel();
nameLabel = new LabelBuilder().name("").buildLabel();
nameLabel.setId(UIComponentIdProvider.TARGET_FILTER_QUERY_NAME_LABEL_ID);

View File

@@ -21,6 +21,7 @@ import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.TableColumn;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UIMessageIdProvider;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
@@ -135,7 +136,7 @@ public class DistributionSetSelectTable extends Table {
refreshTablecontainer();
}
if (size != 0) {
setData(SPUIDefinitions.DATA_AVAILABLE);
setData(i18n.getMessage(UIMessageIdProvider.MESSAGE_DATA_AVAILABLE));
}
}

View File

@@ -172,8 +172,8 @@ public class TargetFilterTable extends Table {
final Item row = getItem(itemId);
final String tfName = (String) row.getItemProperty(SPUILabelDefinitions.NAME).getValue();
final Button deleteIcon = SPUIComponentProvider.getButton(getDeleteIconId(tfName), "",
SPUILabelDefinitions.DELETE_CUSTOM_FILTER, ValoTheme.BUTTON_TINY + " " + "blueicon", true,
FontAwesome.TRASH_O, SPUIButtonStyleNoBorder.class);
i18n.getMessage(UIMessageIdProvider.TOOLTIP_DELETE_CUSTOM_FILTER),
ValoTheme.BUTTON_TINY + " " + "blueicon", true, FontAwesome.TRASH_O, SPUIButtonStyleNoBorder.class);
deleteIcon.setData(itemId);
deleteIcon.addClickListener(this::onDelete);
return deleteIcon;
@@ -225,7 +225,8 @@ public class TargetFilterTable extends Table {
final String tfName = (String) row1.getItemProperty(SPUILabelDefinitions.NAME).getValue();
final Button updateIcon = SPUIComponentProvider.getButton(getDetailLinkId(tfName), tfName,
SPUILabelDefinitions.UPDATE_CUSTOM_FILTER, null, false, null, SPUIButtonStyleNoBorder.class);
i18n.getMessage(UIMessageIdProvider.TOOLTIP_UPDATE_CUSTOM_FILTER), null, false, null,
SPUIButtonStyleNoBorder.class);
updateIcon.setData(tfName);
updateIcon.addStyleName(ValoTheme.LINK_SMALL + " " + "on-focus-no-border link");
updateIcon.addClickListener(this::onClickOfDetailButton);

View File

@@ -453,18 +453,20 @@ public class ActionHistoryGrid extends AbstractGrid<LazyQueryContainer> {
protected void setColumnHeaderNames() {
final HeaderRow newHeaderRow = resetHeaderDefaultRow();
getColumn(ProxyAction.PXY_ACTION_IS_ACTIVE_DECO).setHeaderCaption(SPUIDefinitions.ACTION_HIS_TBL_ACTIVE);
getColumn(ProxyAction.PXY_ACTION_DS_NAME_VERSION).setHeaderCaption(SPUIDefinitions.ACTION_HIS_TBL_DIST);
getColumn(ProxyAction.PXY_ACTION_LAST_MODIFIED_AT).setHeaderCaption(SPUIDefinitions.ACTION_HIS_TBL_DATETIME);
getColumn(ProxyAction.PXY_ACTION_STATUS).setHeaderCaption(SPUIDefinitions.ACTION_HIS_TBL_STATUS);
getColumn(ProxyAction.PXY_ACTION_IS_ACTIVE_DECO).setHeaderCaption(i18n.getMessage("label.active"));
getColumn(ProxyAction.PXY_ACTION_DS_NAME_VERSION)
.setHeaderCaption(i18n.getMessage("distribution.details.header"));
getColumn(ProxyAction.PXY_ACTION_LAST_MODIFIED_AT)
.setHeaderCaption(i18n.getMessage("header.rolloutgroup.target.date"));
getColumn(ProxyAction.PXY_ACTION_STATUS).setHeaderCaption(i18n.getMessage("header.status"));
getColumn(ProxyAction.PXY_ACTION_MAINTENANCE_WINDOW)
.setHeaderCaption(SPUIDefinitions.ACTION_HIS_TBL_MAINTENANCE_WINDOW);
getColumn(VIRT_PROP_FORCED).setHeaderCaption(String.valueOf(forceClientRefreshToggle));
forceClientRefreshToggle = !forceClientRefreshToggle;
newHeaderRow.join(VIRT_PROP_FORCED, VIRT_PROP_TIMEFORCED).setText(SPUIDefinitions.ACTION_HIS_TBL_FORCED);
newHeaderRow.join(VIRT_PROP_FORCED, VIRT_PROP_TIMEFORCED).setText(i18n.getMessage("label.action.forced"));
newHeaderRow.join(VIRT_PROP_ACTION_CANCEL, VIRT_PROP_ACTION_FORCE, VIRT_PROP_ACTION_FORCE_QUIT)
.setText(SPUIDefinitions.ACTIONS_COLUMN);
.setText(i18n.getMessage("header.action"));
}
@Override
@@ -596,9 +598,8 @@ public class ActionHistoryGrid extends AbstractGrid<LazyQueryContainer> {
*/
@Override
protected void setMaximizedHeaders() {
getColumn(ProxyAction.PXY_ACTION_ID).setHeaderCaption(SPUIDefinitions.ACTION_HIS_TBL_ACTION_ID);
getColumn(ProxyAction.PXY_ACTION_ROLLOUT_NAME)
.setHeaderCaption(SPUIDefinitions.ACTION_HIS_TBL_ROLLOUT_NAME);
getColumn(ProxyAction.PXY_ACTION_ID).setHeaderCaption(i18n.getMessage("label.action.id"));
getColumn(ProxyAction.PXY_ACTION_ROLLOUT_NAME).setHeaderCaption(i18n.getMessage("caption.rollout.name"));
}
/**

View File

@@ -22,6 +22,7 @@ import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.UIMessageIdProvider;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.springframework.util.StringUtils;
@@ -72,12 +73,13 @@ public class ActionHistoryLayout extends AbstractGridComponentLayout {
private String getActionHistoryCaption(final String targetName) {
final String caption;
if (StringUtils.hasText(targetName)) {
caption = getI18n().getMessage("caption.action.history.for", HawkbitCommonUtil.getBoldHTMLText(targetName));
caption = getI18n().getMessage(UIMessageIdProvider.CAPTION_ACTION_HISTORY_FOR,
HawkbitCommonUtil.getBoldHTMLText(targetName));
} else {
caption = getI18n().getMessage("caption.action.history");
caption = getI18n().getMessage(UIMessageIdProvider.CAPTION_ACTION_HISTORY);
}
return HawkbitCommonUtil.DIV_DESCRIPTION_START + caption + HawkbitCommonUtil.DIV_DESCRIPTION_END;
return HawkbitCommonUtil.getCaptionText(caption);
}
@Override
@@ -94,11 +96,11 @@ public class ActionHistoryLayout extends AbstractGridComponentLayout {
void onEvent(final TargetTableEvent targetUIEvent) {
final Optional<Long> targetId = managementUIState.getLastSelectedTargetId();
if (BaseEntityEventType.SELECTED_ENTITY == targetUIEvent.getEventType()) {
setData(SPUIDefinitions.DATA_AVAILABLE);
setData(getI18n().getMessage(UIMessageIdProvider.MESSAGE_DATA_AVAILABLE));
UI.getCurrent().access(() -> populateActionHistoryDetails(targetUIEvent.getEntity()));
} else if (BaseEntityEventType.REMOVE_ENTITY == targetUIEvent.getEventType() && targetId.isPresent()
&& targetUIEvent.getEntityIds().contains(targetId.get())) {
setData(SPUIDefinitions.NO_DATA);
setData(getI18n().getMessage(UIMessageIdProvider.MESSAGE_NO_DATA));
UI.getCurrent().access(this::populateActionHistoryDetails);
}
}

View File

@@ -115,8 +115,9 @@ public class ActionStatusGrid extends AbstractGrid<LazyQueryContainer> {
@Override
protected void setColumnHeaderNames() {
getColumn(ProxyActionStatus.PXY_AS_STATUS).setHeaderCaption(SPUIDefinitions.ACTION_HIS_TBL_STATUS);
getColumn(ProxyActionStatus.PXY_AS_CREATED_AT).setHeaderCaption(SPUIDefinitions.ACTION_HIS_TBL_DATETIME);
getColumn(ProxyActionStatus.PXY_AS_STATUS).setHeaderCaption(i18n.getMessage("header.status"));
getColumn(ProxyActionStatus.PXY_AS_CREATED_AT)
.setHeaderCaption(i18n.getMessage("header.rolloutgroup.target.date"));
}
@Override

View File

@@ -43,7 +43,7 @@ public class ActionStatusLayout extends AbstractGridComponentLayout {
@Override
public DefaultGridHeader createGridHeader() {
return new DefaultGridHeader(managementUIState, "Action States", getI18n()).init();
return new DefaultGridHeader(managementUIState, getI18n().getMessage("caption.action.states"), getI18n()).init();
}
@Override

View File

@@ -14,6 +14,7 @@ import org.eclipse.hawkbit.ui.common.grid.AbstractGrid;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UIMessageIdProvider;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
@@ -127,7 +128,8 @@ public class ActionStatusMsgGrid extends AbstractGrid<LazyQueryContainer> {
@Override
protected void setColumnHeaderNames() {
getColumn(ProxyMessage.PXY_MSG_ID).setHeaderCaption("##");
getColumn(ProxyMessage.PXY_MSG_VALUE).setHeaderCaption(SPUIDefinitions.ACTION_HIS_TBL_MSGS);
getColumn(ProxyMessage.PXY_MSG_VALUE)
.setHeaderCaption(i18n.getMessage(UIMessageIdProvider.CAPTION_ACTION_MESSAGES));
}
@Override

View File

@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.ui.management.actionhistory;
import org.eclipse.hawkbit.ui.common.grid.AbstractGridComponentLayout;
import org.eclipse.hawkbit.ui.common.grid.DefaultGridHeader;
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
import org.eclipse.hawkbit.ui.utils.UIMessageIdProvider;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.vaadin.spring.events.EventBus.UIEventBus;
@@ -43,7 +44,8 @@ public class ActionStatusMsgLayout extends AbstractGridComponentLayout {
@Override
public DefaultGridHeader createGridHeader() {
return new DefaultGridHeader(managementUIState, "Messages", getI18n()).init();
return new DefaultGridHeader(managementUIState,
getI18n().getMessage(UIMessageIdProvider.CAPTION_ACTION_MESSAGES), getI18n()).init();
}
@Override

View File

@@ -148,7 +148,7 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
this.actionTypeOptionGroupLayout = new ActionTypeOptionGroupLayout(i18n);
this.maintenanceWindowLayout = new MaintenanceWindowLayout(i18n);
this.uiProperties = uiProperties;
notAllowedMsg = i18n.getMessage("message.action.not.allowed");
notAllowedMsg = i18n.getMessage(UIMessageIdProvider.MESSAGE_ACTION_NOT_ALLOWED);
addNewContainerDS();
setColumnProperties();
@@ -643,9 +643,9 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
protected boolean validateDragAndDropWrapper(final DragAndDropWrapper wrapperSource) {
final String tagData = wrapperSource.getData().toString();
if (wrapperSource.getId().startsWith(SPUIDefinitions.DISTRIBUTION_TAG_ID_PREFIXS)) {
return !isNoTagButton(tagData, SPUIDefinitions.DISTRIBUTION_TAG_BUTTON);
return !isNoTagButton(tagData, getI18n().getMessage(UIMessageIdProvider.CAPTION_DISTRIBUTION_TAG));
} else if (wrapperSource.getId().startsWith(SPUIDefinitions.TARGET_TAG_ID_PREFIXS)) {
return !isNoTagButton(tagData, SPUIDefinitions.TARGET_TAG_BUTTON);
return !isNoTagButton(tagData, getI18n().getMessage(UIMessageIdProvider.CAPTION_TARGET_TAG));
}
getNotification().displayValidationError(notAllowedMsg);
return false;

View File

@@ -56,7 +56,8 @@ public class DistributionTableLayout extends AbstractTableLayout<DistributionTab
managementUIState, managementViewClientCriterion, targetManagement, distributionSetManagement,
deploymentManagement, targetTagManagement, uiProperties);
super.init(new DistributionTableHeader(i18n, permissionChecker, eventBus, managementUIState), distributionTable,
super.init(i18n, new DistributionTableHeader(i18n, permissionChecker, eventBus, managementUIState),
distributionTable,
new DistributionDetails(i18n, eventBus, permissionChecker, managementUIState, distributionSetManagement,
dsMetadataPopupLayout, notification, distributionSetTagManagement,
distributionAddUpdateWindowLayout));

View File

@@ -32,6 +32,7 @@ import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UIMessageIdProvider;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
@@ -56,8 +57,6 @@ public class DistributionTagButtons extends AbstractFilterButtons {
private final transient EntityFactory entityFactory;
private final VaadinMessageSource i18n;
private final SpPermissionChecker permChecker;
private final UINotification uiNotification;
@@ -75,13 +74,12 @@ public class DistributionTagButtons extends AbstractFilterButtons {
distributionSetManagement, eventBus, managementViewClientCriterion);
this.managementUIState = managementUIState;
this.entityFactory = entityFactory;
this.i18n = i18n;
this.permChecker = permChecker;
this.uiNotification = uiNotification;
this.distributionSetTagManagement = distributionSetTagManagement;
if (permChecker.hasReadRepositoryPermission()) {
addNewTag(entityFactory.tag().create().name(SPUIDefinitions.NO_TAG).build());
addNewTag(entityFactory.tag().create().name(getNoTagLabel()).build());
}
}
@@ -104,7 +102,7 @@ public class DistributionTagButtons extends AbstractFilterButtons {
@Override
protected String getButtonWrapperData() {
return SPUIDefinitions.DISTRIBUTION_TAG_BUTTON;
return getI18n().getMessage(UIMessageIdProvider.CAPTION_DISTRIBUTION_TAG);
}
@Override
@@ -120,7 +118,7 @@ public class DistributionTagButtons extends AbstractFilterButtons {
@Override
protected String createButtonId(final String name) {
if (SPUIDefinitions.NO_TAG.equals(name)) {
if (getNoTagLabel().equals(name)) {
return UIComponentIdProvider.NO_TAG_DISTRIBUTION_SET;
}
return name;
@@ -153,20 +151,21 @@ public class DistributionTagButtons extends AbstractFilterButtons {
((LazyQueryContainer) getContainerDataSource()).refresh();
removeGeneratedColumn(FILTER_BUTTON_COLUMN);
removeUpdateAndDeleteColumn();
addNewTag(entityFactory.tag().create().name(SPUIDefinitions.NO_TAG).build());
addNewTag(entityFactory.tag().create().name(getNoTagLabel()).build());
addColumn();
}
@Override
protected void addEditButtonClickListener(final ClickEvent event) {
new UpdateDistributionSetTagLayout(i18n, distributionSetTagManagement, entityFactory, getEventBus(),
new UpdateDistributionSetTagLayout(getI18n(), distributionSetTagManagement, entityFactory, getEventBus(),
permChecker, uiNotification, getEntityId(event), getCloseListenerForEditAndDeleteTag(
new DistributionSetTagFilterHeaderEvent(FilterHeaderEnum.SHOW_MENUBAR)));
}
@Override
protected void addDeleteButtonClickListener(final ClickEvent event) {
openConfirmationWindowForDeletion(getEntityId(event), i18n.getMessage("caption.entity.distribution.tag"),
openConfirmationWindowForDeletion(getEntityId(event),
getI18n().getMessage(UIMessageIdProvider.CAPTION_DISTRIBUTION_TAG),
new DistributionSetTagFilterHeaderEvent(FilterHeaderEnum.SHOW_MENUBAR));
}
@@ -180,7 +179,7 @@ public class DistributionTagButtons extends AbstractFilterButtons {
} else {
distributionSetTagManagement.delete(entityToDelete);
getEventBus().publish(this, new DistributionSetTagTableEvent(BaseEntityEventType.REMOVE_ENTITY, tag));
uiNotification.displaySuccess(i18n.getMessage("message.delete.success", entityToDelete));
uiNotification.displaySuccess(getI18n().getMessage("message.delete.success", entityToDelete));
}
});
}

View File

@@ -20,8 +20,8 @@ import org.eclipse.hawkbit.ui.dd.criteria.ManagementViewClientCriterion;
import org.eclipse.hawkbit.ui.management.state.DistributionTableFilters;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UIMessageIdProvider;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.vaadin.spring.events.EventBus;
@@ -41,7 +41,7 @@ import com.vaadin.ui.Table.TableTransferable;
*/
public class DistributionTagDropEvent implements DropHandler {
private static final long serialVersionUID = 7338133229709850212L;
private static final long serialVersionUID = 1L;
private final VaadinMessageSource i18n;
@@ -79,13 +79,12 @@ public class DistributionTagDropEvent implements DropHandler {
if (source.getId().equals(UIComponentIdProvider.DIST_TABLE_ID)) {
processDistributionDrop(event);
}
}
}
private Boolean isNoTagAssigned(final DragAndDropEvent event) {
final String tagName = ((DragAndDropWrapper) (event.getTargetDetails().getTarget())).getData().toString();
if (tagName.equals(SPUIDefinitions.DISTRIBUTION_TAG_BUTTON)) {
if (tagName.equals(i18n.getMessage(UIMessageIdProvider.CAPTION_DISTRIBUTION_TAG))) {
notification.displayValidationError(i18n.getMessage("message.tag.cannot.be.assigned",
new Object[] { i18n.getMessage("label.no.tag.assigned") }));
return false;
@@ -97,7 +96,7 @@ public class DistributionTagDropEvent implements DropHandler {
final Component compsource = event.getTransferable().getSourceComponent();
if (!(compsource instanceof Table)) {
notification.displayValidationError(i18n.getMessage(SPUILabelDefinitions.ACTION_NOT_ALLOWED));
notification.displayValidationError(i18n.getMessage(getActionNotAllowedMessage()));
return false;
} else {
final Table source = ((TableTransferable) event.getTransferable()).getSourceComponent();
@@ -122,7 +121,7 @@ public class DistributionTagDropEvent implements DropHandler {
private boolean validateIfSourceIsDs(final Table source) {
if (!source.getId().equals(UIComponentIdProvider.DIST_TABLE_ID)) {
notification.displayValidationError(i18n.getMessage(SPUILabelDefinitions.ACTION_NOT_ALLOWED));
notification.displayValidationError(i18n.getMessage(getActionNotAllowedMessage()));
return false;
}
return true;
@@ -158,6 +157,9 @@ public class DistributionTagDropEvent implements DropHandler {
@Override
public AcceptCriterion getAcceptCriterion() {
return managementViewClientCriterion;
}
private String getActionNotAllowedMessage() {
return i18n.getMessage(UIMessageIdProvider.MESSAGE_ACTION_NOT_ALLOWED);
}
}

View File

@@ -87,12 +87,12 @@ public class ActionTypeOptionGroupLayout extends HorizontalLayout {
final FlexibleOptionGroupItemComponent forceItem = actionTypeOptionGroup
.getItemComponent(ActionTypeOption.FORCED);
forceItem.setStyleName(STYLE_DIST_WINDOW_ACTIONTYPE);
forceItem.setId("save.action.radio.forced");
forceItem.setId(UIComponentIdProvider.SAVE_ACTION_RADIO_FORCED);
addComponent(forceItem);
final Label forceLabel = new Label();
forceLabel.setStyleName("statusIconPending");
forceLabel.setIcon(FontAwesome.BOLT);
forceLabel.setCaption("Forced");
forceLabel.setCaption(i18n.getMessage(UIMessageIdProvider.CAPTION_ACTION_FORCED));
forceLabel.setDescription(i18n.getMessage(UIMessageIdProvider.TOOLTIP_FORCED_ITEM));
forceLabel.setStyleName("padding-right-style");
addComponent(forceLabel);
@@ -103,7 +103,7 @@ public class ActionTypeOptionGroupLayout extends HorizontalLayout {
addComponent(softItem);
final Label softLabel = new Label();
softLabel.setSizeFull();
softLabel.setCaption("Soft");
softLabel.setCaption(i18n.getMessage(UIMessageIdProvider.CAPTION_ACTION_SOFT));
softLabel.setDescription(i18n.getMessage(UIMessageIdProvider.TOOLTIP_SOFT_ITEM));
softLabel.setStyleName("padding-right-style");
addComponent(softLabel);
@@ -116,7 +116,7 @@ public class ActionTypeOptionGroupLayout extends HorizontalLayout {
final Label autoForceLabel = new Label();
autoForceLabel.setStyleName("statusIconPending");
autoForceLabel.setIcon(FontAwesome.HISTORY);
autoForceLabel.setCaption("Time Forced");
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);

View File

@@ -130,7 +130,7 @@ public class BulkUploadHandler extends CustomComponent
final HorizontalLayout horizontalLayout = new HorizontalLayout();
upload = new Upload();
upload.setEnabled(false);
upload.setButtonCaption("Bulk Upload");
upload.setButtonCaption(i18n.getMessage("caption.bulk.upload"));
upload.setReceiver(this);
upload.setImmediate(true);
upload.setWidthUndefined();

View File

@@ -515,7 +515,7 @@ public class TargetTable extends AbstractTable<Target> {
private Boolean isNoTagAssigned(final DragAndDropEvent event) {
final String tagName = ((DragAndDropWrapper) (event.getTransferable().getSourceComponent())).getData()
.toString();
if (tagName.equals(SPUIDefinitions.TARGET_TAG_BUTTON)) {
if (tagName.equals(getI18n().getMessage(UIMessageIdProvider.CAPTION_TARGET_TAG))) {
getNotification().displayValidationError(getI18n().getMessage("message.tag.cannot.be.assigned",
getI18n().getMessage("label.no.tag.assigned")));
return false;
@@ -583,11 +583,13 @@ public class TargetTable extends AbstractTable<Target> {
SPUIDefinitions.TARGET_TAG_ID_PREFIXS);
if (wrapperSource.getId().startsWith(SPUIDefinitions.TARGET_TAG_ID_PREFIXS)) {
if ("NO TAG".equals(tagName)) {
getNotification().displayValidationError(getI18n().getMessage(ACTION_NOT_ALLOWED_MSG));
getNotification()
.displayValidationError(getI18n().getMessage(UIMessageIdProvider.MESSAGE_ACTION_NOT_ALLOWED));
return false;
}
} else {
getNotification().displayValidationError(getI18n().getMessage(ACTION_NOT_ALLOWED_MSG));
getNotification()
.displayValidationError(getI18n().getMessage(UIMessageIdProvider.MESSAGE_ACTION_NOT_ALLOWED));
return false;
}
@@ -723,7 +725,7 @@ public class TargetTable extends AbstractTable<Target> {
}
if (size != 0) {
setData(SPUIDefinitions.DATA_AVAILABLE);
setData(getI18n().getMessage(UIMessageIdProvider.MESSAGE_DATA_AVAILABLE));
}
getEventBus().publish(this, new TargetTableEvent(TargetComponentEvent.REFRESH_TARGETS));
}

View File

@@ -37,6 +37,7 @@ import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.SPUITargetDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UIMessageIdProvider;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.springframework.util.CollectionUtils;
@@ -360,7 +361,7 @@ public class TargetTableHeader extends AbstractTableHeader {
final Table source = transferable.getSourceComponent();
if (!source.getId().equals(UIComponentIdProvider.DIST_TABLE_ID)) {
notification.displayValidationError(i18n.getMessage("message.action.not.allowed"));
notification.displayValidationError(i18n.getMessage(UIMessageIdProvider.MESSAGE_ACTION_NOT_ALLOWED));
isValid = Boolean.FALSE;
} else {
if (getDropppedDistributionDetails(transferable).size() > 1) {
@@ -369,7 +370,7 @@ public class TargetTableHeader extends AbstractTableHeader {
}
}
} else {
notification.displayValidationError(i18n.getMessage("message.action.not.allowed"));
notification.displayValidationError(i18n.getMessage(UIMessageIdProvider.MESSAGE_ACTION_NOT_ALLOWED));
isValid = Boolean.FALSE;
}
return isValid;

View File

@@ -54,7 +54,7 @@ public class TargetTableLayout extends AbstractTableLayout<TargetTable> {
managementUIState, managementViewClientCriterion, targetManagement, deploymentManagement, uiProperties,
entityFactory, uiNotification, tagManagement, distributionSetManagement, uiExecutor, targetTable);
super.init(targetTableHeader, targetTable, targetDetails);
super.init(i18n, targetTableHeader, targetTable, targetDetails);
}
@Override

View File

@@ -35,6 +35,7 @@ import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UIMessageIdProvider;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
@@ -85,7 +86,7 @@ public class TargetTagFilterButtons extends AbstractFilterButtons {
this.entityFactory = entityFactory;
this.targetTagManagement = targetTagManagement;
addNewTargetTag(entityFactory.tag().create().name(SPUIDefinitions.NO_TAG).build());
addNewTargetTag(entityFactory.tag().create().name(getNoTagLabel()).build());
}
@Override
@@ -112,7 +113,7 @@ public class TargetTagFilterButtons extends AbstractFilterButtons {
@Override
protected String createButtonId(final String name) {
if (SPUIDefinitions.NO_TAG.equals(name)) {
if (getNoTagLabel().equals(name)) {
return UIComponentIdProvider.NO_TAG_TARGET;
}
return name;
@@ -144,7 +145,7 @@ public class TargetTagFilterButtons extends AbstractFilterButtons {
private Boolean isNoTagAssigned(final DragAndDropEvent event) {
final String tagName = ((DragAndDropWrapper) (event.getTargetDetails().getTarget())).getData().toString();
if (tagName.equals(SPUIDefinitions.TARGET_TAG_BUTTON)) {
if (tagName.equals(getTargetTagCaption())) {
uiNotification.displayValidationError(getI18n().getMessage("message.tag.cannot.be.assigned",
getI18n().getMessage("label.no.tag.assigned")));
return false;
@@ -163,7 +164,7 @@ public class TargetTagFilterButtons extends AbstractFilterButtons {
final Transferable transferable = event.getTransferable();
final Component compsource = transferable.getSourceComponent();
if (!(compsource instanceof AbstractTable)) {
uiNotification.displayValidationError(getI18n().getMessage(SPUILabelDefinitions.ACTION_NOT_ALLOWED));
uiNotification.displayValidationError(getI18n().getMessage(getActionNotAllowedMessage()));
return false;
}
@@ -242,7 +243,7 @@ public class TargetTagFilterButtons extends AbstractFilterButtons {
private boolean validateIfSourceIsTargetTable(final Table source) {
if (!source.getId().equals(UIComponentIdProvider.TARGET_TABLE_ID)) {
uiNotification.displayValidationError(getI18n().getMessage(SPUILabelDefinitions.ACTION_NOT_ALLOWED));
uiNotification.displayValidationError(getI18n().getMessage(getActionNotAllowedMessage()));
return false;
}
return true;
@@ -258,7 +259,7 @@ public class TargetTagFilterButtons extends AbstractFilterButtons {
removeGeneratedColumn(FILTER_BUTTON_COLUMN);
((LazyQueryContainer) getContainerDataSource()).refresh();
removeUpdateAndDeleteColumn();
addNewTargetTag(entityFactory.tag().create().name(SPUIDefinitions.NO_TAG).build());
addNewTargetTag(entityFactory.tag().create().name(getNoTagLabel()).build());
addColumn();
}
@@ -284,7 +285,11 @@ public class TargetTagFilterButtons extends AbstractFilterButtons {
@Override
protected String getButtonWrapperData() {
return SPUIDefinitions.TARGET_TAG_BUTTON;
return getTargetTagCaption();
}
private String getTargetTagCaption() {
return getI18n().getMessage(UIMessageIdProvider.CAPTION_TARGET_TAG);
}
@Override
@@ -297,7 +302,7 @@ public class TargetTagFilterButtons extends AbstractFilterButtons {
@Override
protected void addDeleteButtonClickListener(final ClickEvent event) {
final String entityName = getEntityId(event);
openConfirmationWindowForDeletion(entityName, getI18n().getMessage("caption.entity.target.tag"),
openConfirmationWindowForDeletion(entityName, getTargetTagCaption(),
new TargetTagFilterHeaderEvent(FilterHeaderEnum.SHOW_MENUBAR));
}
@@ -317,4 +322,8 @@ public class TargetTagFilterButtons extends AbstractFilterButtons {
});
}
private String getActionNotAllowedMessage() {
return getI18n().getMessage(UIMessageIdProvider.MESSAGE_ACTION_NOT_ALLOWED);
}
}

View File

@@ -211,7 +211,8 @@ public final class DashboardMenu extends CustomComponent {
final String logoutUrl = generateLogoutUrl();
settingsItem.addItem("Sign Out", selectedItem -> Page.getCurrent().setLocation(logoutUrl));
settingsItem.addItem(i18n.getMessage("label.sign.out"),
selectedItem -> Page.getCurrent().setLocation(logoutUrl));
return settings;
}
@@ -225,7 +226,8 @@ public final class DashboardMenu extends CustomComponent {
}
private Component buildToggleButton() {
final Button valoMenuToggleButton = new Button("Menu", new MenuToggleClickListenerMyClickListener());
final Button valoMenuToggleButton = new Button(i18n.getMessage("label.menu"),
new MenuToggleClickListenerMyClickListener());
valoMenuToggleButton.setIcon(FontAwesome.LIST);
valoMenuToggleButton.addStyleName("valo-menu-toggle");
valoMenuToggleButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);

View File

@@ -621,8 +621,8 @@ public class RolloutListGrid extends AbstractGrid<LazyQueryContainer> {
if (SPUILabelDefinitions.VAR_STATUS.equals(cell.getPropertyId())) {
description = cell.getProperty().getValue().toString().toLowerCase().replace("_", " ");
} else if (SPUILabelDefinitions.ACTION.equals(cell.getPropertyId())) {
description = SPUILabelDefinitions.ACTION.toLowerCase();
} else if (getActionLabeltext().equals(cell.getPropertyId())) {
description = getActionLabeltext().toLowerCase();
} else if (ROLLOUT_RENDERER_DATA.equals(cell.getPropertyId())) {
description = ((RolloutRendererData) cell.getProperty().getValue()).getName();
} else if (SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS.equals(cell.getPropertyId())) {

View File

@@ -20,7 +20,6 @@ import org.eclipse.hawkbit.ui.common.builder.LabelBuilder;
import org.eclipse.hawkbit.ui.common.grid.AbstractGridHeader;
import org.eclipse.hawkbit.ui.rollout.event.RolloutEvent;
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
@@ -63,7 +62,7 @@ public class RolloutListHeader extends AbstractGridHeader {
}
protected String getHeaderCaption() {
return SPUIDefinitions.ROLLOUT_LIST_HEADER_CAPTION;
return i18n.getMessage("message.rollouts");
}
@Override

View File

@@ -53,7 +53,8 @@ import com.vaadin.ui.renderers.HtmlRenderer;
* Rollout group list grid component.
*/
public class RolloutGroupListGrid extends AbstractGrid<LazyQueryContainer> {
private static final long serialVersionUID = 4060904914954370524L;
private static final long serialVersionUID = 1L;
private static final String ROLLOUT_RENDERER_DATA = "rolloutRendererData";
@@ -264,8 +265,8 @@ public class RolloutGroupListGrid extends AbstractGrid<LazyQueryContainer> {
private String getDescription(final CellReference cell) {
if (SPUILabelDefinitions.VAR_STATUS.equals(cell.getPropertyId())) {
return cell.getProperty().getValue().toString().toLowerCase();
} else if (SPUILabelDefinitions.ACTION.equals(cell.getPropertyId())) {
return SPUILabelDefinitions.ACTION.toLowerCase();
} else if (getActionLabeltext().equals(cell.getPropertyId())) {
return getActionLabeltext().toLowerCase();
} else if (ROLLOUT_RENDERER_DATA.equals(cell.getPropertyId())) {
return ((RolloutRendererData) cell.getProperty().getValue()).getName();
} else if (SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS.equals(cell.getPropertyId())) {

View File

@@ -137,19 +137,6 @@ public final class HawkbitCommonUtil {
return boldStr;
}
/**
* Get Label for Artifact Details.
*
* @param name
* artifact name
* @return ArtifactoryDetailsLabelId
*/
public static String getArtifactoryDetailsLabelId(final String name) {
return new StringBuilder()
.append(DIV_DESCRIPTION_START + "Artifact Details of " + getBoldHTMLText(getFormattedName(name)))
.append(DIV_DESCRIPTION_END).toString();
}
/**
* Get Label for Artifact Details.
*
@@ -175,10 +162,10 @@ public final class HawkbitCommonUtil {
public static String getPollStatusToolTip(final PollStatus pollStatus, final VaadinMessageSource i18N) {
if (pollStatus != null && pollStatus.getLastPollDate() != null && pollStatus.isOverdue()) {
final TimeZone tz = SPDateTimeUtil.getBrowserTimeZone();
return "Overdue for " + SPDateTimeUtil.getDurationFormattedString(
return i18N.getMessage(UIMessageIdProvider.TOOLTIP_OVERDUE, SPDateTimeUtil.getDurationFormattedString(
pollStatus.getOverdueDate().atZone(SPDateTimeUtil.getTimeZoneId(tz)).toInstant().toEpochMilli(),
pollStatus.getCurrentDate().atZone(SPDateTimeUtil.getTimeZoneId(tz)).toInstant().toEpochMilli(),
i18N);
i18N));
}
return null;
}
@@ -534,4 +521,35 @@ public final class HawkbitCommonUtil {
final UI currentUI = UI.getCurrent();
return currentUI == null ? Locale.getDefault() : currentUI.getLocale();
}
/**
* Creates caption for table headers
*
* @param caption
* @return formatted text for table caption
*/
public static String getCaptionText(final String caption) {
return DIV_DESCRIPTION_START + caption + DIV_DESCRIPTION_END;
}
/**
* Creates the caption of the Artifact Details table
*
* @param name
* name of the software module, if one is selected
* @param i18n
* VaadinMessageSource
* @return complete caption text of the table
*/
public static String getArtifactoryDetailsLabelId(final String name, final VaadinMessageSource i18n) {
String caption;
if (StringUtils.hasText(name)) {
caption = i18n.getMessage(UIMessageIdProvider.CAPTION_ARTIFACT_DETAILS_OF,
HawkbitCommonUtil.getBoldHTMLText(name));
} else {
caption = i18n.getMessage(UIMessageIdProvider.CAPTION_ARTIFACT_DETAILS);
}
return getCaptionText(caption);
}
}

View File

@@ -41,107 +41,28 @@ public final class SPUIDefinitions {
*/
public static final int DIST_TYPE_SIZE = 8;
/**
* Action history active column.
*/
public static final String ACTION_HIS_TBL_ACTIVE = "Active";
/**
* Action history action id column.
*/
public static final String ACTION_HIS_TBL_ACTION_ID = "Action Id";
/**
* Action history active hidden column. This is using to generate active
* icons under active column.
*/
public static final String ACTION_HIS_TBL_ACTIVE_HIDDEN = "Active_Hidden";
/**
* Action history distribution set column.
*/
public static final String ACTION_HIS_TBL_DIST = "Distribution set";
/**
* Action history Action Id hidden column.
*/
public static final String ACTION_HIS_TBL_ACTION_ID_HIDDEN = "DistributionsetId";
/**
* Action history date & time column.
*/
public static final String ACTION_HIS_TBL_DATETIME = "Date and time";
/**
* Action history status column.
*/
public static final String ACTION_HIS_TBL_STATUS = "Status";
/**
* Actions column.
*/
public static final String ACTIONS_COLUMN = "Actions";
/**
* Action history messages of particular action update.
*/
public static final String ACTION_HIS_TBL_MSGS = "Messages";
/**
* Action history hidden column of messages of particular action update.
*/
public static final String ACTION_HIS_TBL_MSGS_HIDDEN = "Messages_Hidden";
/**
* Action history layout - rollout name column.
*/
public static final String ACTION_HIS_TBL_ROLLOUT_NAME = "Rollout name";
/**
* /** Action history status hidden column. This is using to generate status
* icons under status coloumn.
*/
public static final String ACTION_HIS_TBL_STATUS_HIDDEN = "Status_Hidden";
/**
* Action history action type column.
*/
public static final String ACTION_HIS_TBL_FORCED = "Forced";
/**
* Action history action type column.
*/
public static final String ACTION_HIS_TBL_TIMEFORCED = "Time-Forced";
/**
* Action history helping constant.
*/
public static final String ACTIVE = "active";
/**
* Action history helping constant.
*/
public static final String IN_ACTIVE = "inactive";
/**
* Action history helping constant.
*/
public static final String SCHEDULED = "scheduled";
public static final String TARGET_TAG_BUTTON = "Target Tag";
public static final String DISTRIBUTION_TAG_BUTTON = "Distribution Tag";
/**
* No data.
*/
public static final String NO_DATA = "No Data";
/**
* No Available.
*/
public static final String DATA_AVAILABLE = "Data available";
/**
* Filter by status key.
*/
@@ -445,11 +366,6 @@ public final class SPUIDefinitions {
*/
public static final Direction TARGET_TABLE_CREATE_AT_SORT_ORDER = Direction.ASC;
/**
* Rollout list view - header caption .
*/
public static final String ROLLOUT_LIST_HEADER_CAPTION = "Rollouts";
/**
* BUTTON- STATUS.
*/
@@ -466,8 +382,6 @@ public final class SPUIDefinitions {
public static final String DELETE_FILTER_BUTTON_COLUMN = "deleteFilterButton";
public static final String NO_TAG = "NO TAG";
/**
* /** Constructor.
*/

View File

@@ -18,11 +18,6 @@ public final class SPUILabelDefinitions {
*/
public static final int SP_DELAY = 1000;
/**
* Cannot be deleted message.
*/
public static final String ACTION_NOT_ALLOWED = "Action not allowed";
/**
* NAME.
*/
@@ -162,100 +157,31 @@ public final class SPUILabelDefinitions {
*/
public static final String VAR_TARGET_STATUS = "updateStatus";
/**
* Discard all label.
*/
public static final String DISCARD_ALL = "Discard All";
/**
* Discard label.
*/
public static final String DISCARD = "Discard";
/**
* Delete Custom Filter.
*/
public static final String DELETE_CUSTOM_FILTER = "Delete Custom Filter";
/**
* Update Custom Filter.
*/
public static final String UPDATE_CUSTOM_FILTER = "Update Custom Filter";
/**
* HTML space.
*/
public static final String HTML_SPACE = "&nbsp;";
/**
* Type.
*/
public static final String TYPE = "Filter by type";
/**
* Name.
*/
public static final String NAME = "name";
/**
* Upload - process button caption.
*/
public static final String PROCESS = "Process";
/**
* Upload results - label.
*/
public static final String UPLOAD_RESULT = "Upload result";
/**
* Upload - close button caption.
*/
public static final String CLOSE = "Close";
/**
* Success.
*/
public static final String SUCCESS = "Success";
/**
* Failed.
*/
public static final String FAILED = "Failed";
/**
* Name and description label.
*/
public static final String NAME_VERSION = "nameAndVersion";
/**
* Submit button label.
*/
public static final String SUBMIT = "Submit";
/**
* Artifact Details Icon.
*/
public static final String ARTIFACT_ICON = "artifactDtls";
/**
* Confirmation popup - Delete all button caption.
*/
public static final String BUTTON_DELETE_ALL = "button.delete.all";
/**
* Confirmation popup - Discard all button caption.
*/
public static final String BUTTON_DISCARD_ALL = "button.discard.all";
/**
* Created User.
*/
public static final String VAR_CREATED_USER = "createdBy";
/**
* Create Filter.
*/
public static final String VAR_CREATE_FILTER = "Create Filter";
/**
* Target filter query - target table status icon column name.
*/
@@ -276,11 +202,6 @@ public final class SPUILabelDefinitions {
*/
public static final String VAR_NUMBER_OF_GROUPS = "numberOfGroups";
/**
* Rollout action button description.
*/
public static final String ACTION = "Action";
/**
* Total target coulmn property name.
*/

View File

@@ -1231,6 +1231,8 @@ public final class UIComponentIdProvider {
*/
public static final String UPLOAD_STATUS_POPUP_MINIMIZE_BUTTON_ID = "artifact.upload.minimize.button.id";
public static final String SAVE_ACTION_RADIO_FORCED = "save.action.radio.forced";
/**
* /* Private Constructor.
*/

View File

@@ -19,6 +19,48 @@ public final class UIMessageIdProvider {
public static final String BUTTON_OK = "button.ok";
public static final String BUTTON_SAVE = "button.save";
public static final String CAPTION_ACTION_FORCED = "label.action.forced";
public static final String CAPTION_ACTION_SOFT = "label.action.soft";
public static final String CAPTION_ACTION_TIME_FORCED = "label.action.time.forced";
public static final String CAPTION_ACTION_MESSAGES = "caption.action.messages";
public static final String CAPTION_ACTION_HISTORY = "caption.action.history";
public static final String CAPTION_ACTION_HISTORY_FOR = "caption.action.history.for";
public static final String CAPTION_DISCARD = "button.discard";
public static final String CAPTION_FILTER_BY_TYPE = "caption.filter.by.type";
public static final String CAPTION_DISTRIBUTION_TAG = "caption.entity.distribution.tag";
public static final String CAPTION_TARGET_TAG = "caption.entity.target.tag";
public static final String CAPTION_ARTIFACT_DETAILS = "caption.artifact.details";
public static final String CAPTION_ARTIFACT_DETAILS_OF = "caption.artifact.details.of";
public static final String LABEL_DROP_AREA_UPLOAD = "label.drop.area.upload";
public static final String LABEL_NO_TAG = "label.no.tag";
public static final String LABEL_CREATE_FILTER = "label.create.filter";
public static final String MESSAGE_NO_DATA = "message.no.data";
public static final String MESSAGE_DATA_AVAILABLE = "message.data.available";
public static final String MESSAGE_UPLOAD_ACTION = "upload.action";
public static final String MESSAGE_ACTION_NOT_ALLOWED = "message.action.not.allowed";
public static final String TOOLTIP_OVERDUE = "tooltip.overdue";
public static final String TOOLTIP_MAXIMIZE = "tooltip.maximize";
public static final String TOOLTIP_MINIMIZE = "tooltip.minimize";
@@ -85,6 +127,10 @@ public final class UIMessageIdProvider {
public static final String TOOLTIP_IN_TIME = "tooltip.in.time";
public static final String TOOLTIP_DELETE_CUSTOM_FILTER = "tooltip.delete.custom.filter";
public static final String TOOLTIP_UPDATE_CUSTOM_FILTER = "tooltip.update.custom.filter";
/**
* Private Constructor.
*/

View File

@@ -28,7 +28,6 @@ dashboard.rollouts.caption-long = Rollout Management
# Button names prefix with - button
button.save = Save
button.delete = Delete
button.discard.all = Discard All
button.delete.all = Delete All
button.assign.all = Save Assign
button.actions = You have actions
@@ -97,8 +96,14 @@ distribution.set.tag.deleted.event.container.notifcation.message=distribution se
distribution.set.tag.updated.event.container.notifcation.message=distribution set tags changed
# Captions prefix with - caption
caption.filter.by.type = Filter by type
caption.bulk.upload = Bulk Upload
caption.action.history = Action history
caption.action.history.for = Action history for {0}
caption.artifact.details = Artifact Details
caption.artifact.details.of = Artifact Details of {0}
caption.action.states= Action States
caption.action.messages = Messages
caption.error = Error
caption.new.softwaremodule.application = Configure New Application
caption.new.softwaremodule.jvm = Configure New Runtime
@@ -106,6 +111,7 @@ caption.new.softwaremodule.os = Configure New OS
caption.filter.simple = Simple Filter
caption.filter.custom = Custom Filter
caption.metadata = Metadata
caption.rollout.name = Rollout name
caption.target = Target
caption.distribution = Distribution
@@ -150,6 +156,15 @@ caption.maintenancewindow.duration = Duration
caption.maintenancewindow.timezone = Time Zone (from GMT)
# Labels prefix with - label
label.create.filter = Create Filter
label.sign.out = Sign Out
label.menu = Menu
label.active = Active
label.action.id = Action Id
label.no.tag = NO TAG
label.action.forced = Forced
label.action.soft = Soft
label.action.time.forced = Time Forced
label.dist.details.type = Type :
label.dist.details.name = Name :
label.dist.details.version = Version :
@@ -223,6 +238,7 @@ label.auto.assign.enable=Enable auto assignment
label.scheduled=Scheduled
label.approval.decision = Approval decision
label.approval.remark = Remark (optional)
label.drop.area.upload = Drop Files to upload
# Checkbox label prefix with - checkbox
checkbox.dist.migration.required = Required Migration Step :
@@ -240,6 +256,8 @@ prompt.target.id = Controller ID
#Tooltips prefix with - tooltip
tooltip.delete.custom.filter = Delete Custom Filter
tooltip.update.custom.filter = Edit Custom Filter
tooltip.add.module = Add Software Module
tooltip.status.unknown = Unknown
tooltip.status.registered = Registered
@@ -263,6 +281,7 @@ tooltip.rollout.pause = Pause
tooltip.rollout.update = Edit..
tooltip.rollout.copy = Copy..
tooltip.delete = Delete..
tooltip.overdue = Overdue for {0}
tooltip.close = Close
tooltip.search = Search
@@ -324,7 +343,8 @@ message.dist.update.success = {0} - {1} updated successfully
message.duplicate.dist = Distribution set [{0}] or version [{1}] must be unique, entered value already exists.
message.error.view = No such view: {0}
message.accessdenied.view = No access to view: {0}
message.no.data = No data available
message.no.data = No Data
message.data.available = Data available
message.target.assignment = {0} Assignment(s) done
message.target.deleted = {0} Target(s) deleted
message.dist.deleted = {0} Distribution set(s) deleted
@@ -529,7 +549,7 @@ header.assigned.ds = Assigned DS
header.installed.ds = Installed DS
header.target.status = Status
header.target.tags = Tags
header.total.targets = Targets
header.total.targets = Targets
header.key = Key
header.value = Value
metadata.targetvisible = Visible for targets
@@ -647,7 +667,6 @@ caption.entity.software.module.type = Software Module Type
validator.textfield.min.length = Please enter a text consisting of at least one and a maximum of {0} characters.
caption.entity.delete.action.confirmbox = Confirm Deletion
message.confirm.delete.entity = Are you sure you want to delete {0} {1}{2}?
caption.entity.assign.action.confirmbox = Confirm Assignment