diff --git a/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/builder/TargetBuilder.java b/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/builder/TargetBuilder.java index 0b33d6458..2e8099f31 100644 --- a/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/builder/TargetBuilder.java +++ b/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/builder/TargetBuilder.java @@ -86,8 +86,6 @@ public class TargetBuilder { * * @param count * the amount of target bodies which should be created - * @param offset - * for * @return a list of {@link MgmtSoftwareModuleTypeRequestBodyPost} */ public List buildAsList(final int count) { diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaSoftwareModule.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaSoftwareModule.java index 3f6f86d92..1a1f4876e 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaSoftwareModule.java +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaSoftwareModule.java @@ -144,7 +144,7 @@ public class JpaSoftwareModule extends AbstractJpaNamedVersionedEntity implement /** * @param artifact - * is removed from the assigned {@link LocalArtifact}s. + * is removed from the assigned {@link Artifact}s. */ public void removeArtifact(final Artifact artifact) { if (artifacts != null) { diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/smtable/SoftwareModuleAddUpdateWindow.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/smtable/SoftwareModuleAddUpdateWindow.java index 92452196a..626258670 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/smtable/SoftwareModuleAddUpdateWindow.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/smtable/SoftwareModuleAddUpdateWindow.java @@ -8,6 +8,7 @@ */ package org.eclipse.hawkbit.ui.artifacts.smtable; +import org.apache.commons.lang3.StringUtils; import org.eclipse.hawkbit.repository.EntityFactory; import org.eclipse.hawkbit.repository.SoftwareManagement; import org.eclipse.hawkbit.repository.builder.SoftwareModuleCreate; @@ -73,6 +74,20 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent { private FormLayout formLayout; + /** + * Constructor for SoftwareModuleAddUpdateWindow + * + * @param i18n + * I18N + * @param uiNotifcation + * UINotification + * @param eventBus + * UIEventBus + * @param softwareManagement + * SoftwareManagement + * @param entityFactory + * EntityFactory + */ public SoftwareModuleAddUpdateWindow(final I18N i18n, final UINotification uiNotifcation, final UIEventBus eventBus, final SoftwareManagement softwareManagement, final EntityFactory entityFactory) { this.i18n = i18n; @@ -137,10 +152,12 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent { vendorTextField = createTextField("textfield.vendor", UIComponentIdProvider.SOFT_MODULE_VENDOR); vendorTextField.setRequired(false); + vendorTextField.setNullRepresentation(StringUtils.EMPTY); descTextArea = new TextAreaBuilder().caption(i18n.get("textfield.description")).style("text-area-style") .prompt(i18n.get("textfield.description")).id(UIComponentIdProvider.ADD_SW_MODULE_DESCRIPTION) .buildTextComponent(); + descTextArea.setNullRepresentation(StringUtils.EMPTY); typeComboBox = SPUIComponentProvider.getComboBox(i18n.get("upload.swmodule.type"), "", null, null, true, null, i18n.get("upload.swmodule.type")); @@ -259,18 +276,16 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent { return; } editSwModule = Boolean.TRUE; - final SoftwareModule swModle = softwareManagement.findSoftwareModuleById(baseSwModuleId); - nameTextField.setValue(swModle.getName()); - versionTextField.setValue(swModle.getVersion()); - vendorTextField.setValue(swModle.getVendor() == null ? HawkbitCommonUtil.SP_STRING_EMPTY - : HawkbitCommonUtil.trimAndNullIfEmpty(swModle.getVendor())); - descTextArea.setValue(swModle.getDescription() == null ? HawkbitCommonUtil.SP_STRING_EMPTY - : HawkbitCommonUtil.trimAndNullIfEmpty(swModle.getDescription())); + final SoftwareModule swModule = softwareManagement.findSoftwareModuleById(baseSwModuleId); + nameTextField.setValue(swModule.getName()); + versionTextField.setValue(swModule.getVersion()); + vendorTextField.setValue(HawkbitCommonUtil.trimAndNullIfEmpty(swModule.getVendor())); + descTextArea.setValue(HawkbitCommonUtil.trimAndNullIfEmpty(swModule.getDescription())); - if (swModle.getType().isDeleted()) { - typeComboBox.addItem(swModle.getType().getName()); + if (swModule.getType().isDeleted()) { + typeComboBox.addItem(swModule.getType().getName()); } - typeComboBox.setValue(swModle.getType().getName()); + typeComboBox.setValue(swModule.getType().getName()); } public FormLayout getFormLayout() { diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/smtable/SoftwareModuleDetails.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/smtable/SoftwareModuleDetails.java index d9a749367..61dfd6aca 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/smtable/SoftwareModuleDetails.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/smtable/SoftwareModuleDetails.java @@ -8,6 +8,7 @@ */ package org.eclipse.hawkbit.ui.artifacts.smtable; +import org.apache.commons.lang3.StringUtils; import org.eclipse.hawkbit.repository.EntityFactory; import org.eclipse.hawkbit.repository.SoftwareManagement; import org.eclipse.hawkbit.repository.model.MetaData; @@ -107,8 +108,8 @@ public class SoftwareModuleDetails extends AbstractNamedVersionedEntityTableDeta @Override protected void populateDetailsWidget() { - String maxAssign = HawkbitCommonUtil.SP_STRING_EMPTY; if (getSelectedBaseEntity() != null) { + String maxAssign; if (getSelectedBaseEntity().getType().getMaxAssignments() == 1) { maxAssign = getI18n().get("label.singleAssign.type"); } else { @@ -117,10 +118,8 @@ public class SoftwareModuleDetails extends AbstractNamedVersionedEntityTableDeta updateSoftwareModuleDetailsLayout(getSelectedBaseEntity().getType().getName(), getSelectedBaseEntity().getVendor(), maxAssign); } else { - updateSoftwareModuleDetailsLayout(HawkbitCommonUtil.SP_STRING_EMPTY, HawkbitCommonUtil.SP_STRING_EMPTY, - maxAssign); + updateSoftwareModuleDetailsLayout(StringUtils.EMPTY, StringUtils.EMPTY, StringUtils.EMPTY); } - populateMetadataDetails(); } diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/smtype/CreateUpdateSoftwareTypeLayout.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/smtype/CreateUpdateSoftwareTypeLayout.java index 94671636e..53ad366b4 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/smtype/CreateUpdateSoftwareTypeLayout.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/smtype/CreateUpdateSoftwareTypeLayout.java @@ -11,6 +11,7 @@ package org.eclipse.hawkbit.ui.artifacts.smtype; import java.util.ArrayList; import java.util.List; +import org.apache.commons.lang3.StringUtils; import org.eclipse.hawkbit.repository.EntityFactory; import org.eclipse.hawkbit.repository.SoftwareManagement; import org.eclipse.hawkbit.repository.TagManagement; @@ -60,6 +61,24 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout onKeyChange(event)); + keyField.addTextChangeListener(this::onKeyChange); keyField.setTextChangeEventMode(TextChangeEventMode.EAGER); keyField.setWidth("100%"); return keyField; @@ -243,10 +244,10 @@ public abstract class AbstractMetadataPopupLayout onValueChange(event)); + valueTextArea.addTextChangeListener(this::onValueChange); valueTextArea.setTextChangeEventMode(TextChangeEventMode.EAGER); return valueTextArea; } @@ -264,9 +265,9 @@ public abstract class AbstractMetadataPopupLayout onRowClick(event)); + metadataGrid.addSelectionListener(this::onRowClick); metadataGrid.getColumn(DELETE_BUTTON).setHeaderCaption(""); - metadataGrid.getColumn(DELETE_BUTTON).setRenderer(new HtmlButtonRenderer(event -> onDelete(event))); + metadataGrid.getColumn(DELETE_BUTTON).setRenderer(new HtmlButtonRenderer(this::onDelete)); metadataGrid.getColumn(DELETE_BUTTON).setWidth(50); metadataGrid.getColumn(KEY).setExpandRatio(1); return metadataGrid; diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/builder/TextAreaBuilder.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/builder/TextAreaBuilder.java index d75b408d4..9bd2e3830 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/builder/TextAreaBuilder.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/builder/TextAreaBuilder.java @@ -24,7 +24,7 @@ public class TextAreaBuilder extends AbstractTextFieldBuilder