Merge branch 'master' into feature_enable_push_in_deployment_view

Conflicts:
	hawkbit-core/src/main/java/org/eclipse/hawkbit/eventbus/event/TargetDeletedEvent.java
	hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/detailslayout/SoftwareModuleMetadatadetailslayout.java
	hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/distributions/dstable/DistributionSetDetails.java
	hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionDetails.java
	hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionTable.java


Signed-off-by: Gaurav <gaurav.sahay@in.bosch.com>
This commit is contained in:
Gaurav
2016-08-10 11:44:23 +02:00
136 changed files with 1129 additions and 1105 deletions

View File

@@ -50,13 +50,11 @@ import com.vaadin.ui.themes.ValoTheme;
/**
* Vaadin management UI.
*
*
*
*
*/
@SuppressWarnings("serial")
@Title("hawkBit Update Server")
public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
private static final long serialVersionUID = 1L;
private static final Logger LOG = LoggerFactory.getLogger(HawkbitUI.class);
private static final String EMPTY_VIEW = "";
@@ -139,7 +137,7 @@ public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
contentVerticalLayout.addComponent(content);
content.setStyleName("view-content");
content.setSizeFull();
rootLayout.setExpandRatio(contentVerticalLayout, 1.0f);
rootLayout.setExpandRatio(contentVerticalLayout, 1.0F);
contentVerticalLayout.setStyleName("main-content");
contentVerticalLayout.setExpandRatio(content, 1.0F);
setContent(rootLayout);
@@ -154,6 +152,8 @@ public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
}
final Navigator navigator = new Navigator(this, content);
navigator.addViewChangeListener(new ViewChangeListener() {
private static final long serialVersionUID = 1L;
@Override
public boolean beforeViewChange(final ViewChangeEvent event) {
return true;
@@ -200,7 +200,7 @@ public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
* as set
* @return String as preferred locale
*/
private String getLocaleId(final Set<String> availableLocalesInApp) {
private static String getLocaleId(final Set<String> availableLocalesInApp) {
final String[] localeChain = getLocaleChain();
String spLocale = SPUIDefinitions.DEFAULT_LOCALE;
if (null != localeChain) {
@@ -220,16 +220,18 @@ public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
*
* @return String as locales
*/
private String[] getLocaleChain() {
private static String[] getLocaleChain() {
String[] localeChain = null;
// Fetch all cookies from the request
final Cookie[] cookies = VaadinService.getCurrentRequest().getCookies();
if (cookies != null) {
for (final Cookie c : cookies) {
if (c.getName().equals(SPUIDefinitions.COOKIE_NAME) && !c.getValue().isEmpty()) {
localeChain = c.getValue().split("#");
break;
}
if (cookies == null) {
return localeChain;
}
for (final Cookie c : cookies) {
if (c.getName().equals(SPUIDefinitions.COOKIE_NAME) && !c.getValue().isEmpty()) {
localeChain = c.getValue().split("#");
break;
}
}
return localeChain;
@@ -237,6 +239,8 @@ public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
private class ManagementViewProvider implements ViewProvider {
private static final long serialVersionUID = 1L;
@Override
public String getViewName(final String viewAndParameters) {
return viewProvider.getViewName(getStartView(viewAndParameters));

View File

@@ -158,7 +158,7 @@ public class UploadArtifactView extends VerticalLayout implements View, BrowserW
detailAndUploadLayout.setComponentAlignment(dadw, Alignment.MIDDLE_CENTER);
}
detailAndUploadLayout.setExpandRatio(artifactDetailsLayout, 1.0f);
detailAndUploadLayout.setExpandRatio(artifactDetailsLayout, 1.0F);
detailAndUploadLayout.setSizeFull();
detailAndUploadLayout.addStyleName("group");
detailAndUploadLayout.setSpacing(true);
@@ -177,9 +177,9 @@ public class UploadArtifactView extends VerticalLayout implements View, BrowserW
mainLayout.addComponent(detailAndUploadLayout, 2, 0);
mainLayout.addComponent(deleteActionsLayout, 1, 1);
mainLayout.addComponent(uplaodButtonsLayout, 2, 1);
mainLayout.setRowExpandRatio(0, 1.0f);
mainLayout.setColumnExpandRatio(1, 0.5f);
mainLayout.setColumnExpandRatio(2, 0.5f);
mainLayout.setRowExpandRatio(0, 1.0F);
mainLayout.setColumnExpandRatio(1, 0.5F);
mainLayout.setColumnExpandRatio(2, 0.5F);
mainLayout.setComponentAlignment(deleteActionsLayout, Alignment.BOTTOM_CENTER);
mainLayout.setComponentAlignment(uplaodButtonsLayout, Alignment.BOTTOM_CENTER);
return mainLayout;
@@ -201,8 +201,8 @@ public class UploadArtifactView extends VerticalLayout implements View, BrowserW
private void maximizeSwTable() {
mainLayout.removeComponent(detailAndUploadLayout);
removeOtherComponents();
mainLayout.setColumnExpandRatio(1, 1f);
mainLayout.setColumnExpandRatio(2, 0f);
mainLayout.setColumnExpandRatio(1, 1F);
mainLayout.setColumnExpandRatio(2, 0F);
}
private void minimizeArtifactoryDetails() {
@@ -219,15 +219,15 @@ public class UploadArtifactView extends VerticalLayout implements View, BrowserW
mainLayout.removeComponent(smTableLayout);
detailAndUploadLayout.removeComponent(dadw);
removeOtherComponents();
mainLayout.setColumnExpandRatio(1, 0f);
mainLayout.setColumnExpandRatio(2, 1f);
mainLayout.setColumnExpandRatio(1, 0F);
mainLayout.setColumnExpandRatio(2, 1F);
}
private void addOtherComponents() {
mainLayout.addComponent(deleteActionsLayout, 1, 1);
mainLayout.addComponent(uplaodButtonsLayout, 2, 1);
mainLayout.setColumnExpandRatio(1, 0.5f);
mainLayout.setColumnExpandRatio(2, 0.5f);
mainLayout.setColumnExpandRatio(1, 0.5F);
mainLayout.setColumnExpandRatio(2, 0.5F);
mainLayout.setComponentAlignment(deleteActionsLayout, Alignment.BOTTOM_CENTER);
mainLayout.setComponentAlignment(uplaodButtonsLayout, Alignment.BOTTOM_CENTER);
}
@@ -240,6 +240,8 @@ public class UploadArtifactView extends VerticalLayout implements View, BrowserW
private void hideDropHints() {
UI.getCurrent().addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
@Override
public void click(final com.vaadin.event.MouseEvents.ClickEvent event) {
eventBus.publish(this, DragEvent.HIDE_DROP_HINT);

View File

@@ -28,11 +28,6 @@ import org.vaadin.addons.lazyquerycontainer.QueryDefinition;
/**
* Simple implementation of generics bean query which dynamically loads artifact
* beans.
*
*
*
*
*
*/
public class ArtifactBeanQuery extends AbstractBeanQuery<LocalArtifact> {
private static final long serialVersionUID = -333786310371208962L;
@@ -74,7 +69,7 @@ public class ArtifactBeanQuery extends AbstractBeanQuery<LocalArtifact> {
@Override
protected LocalArtifact constructBean() {
return entityFactory.generateLocalArtifact();
return getEntityFactory().generateLocalArtifact();
}
@Override

View File

@@ -53,42 +53,42 @@ public class SoftwareModuleDetails extends AbstractNamedVersionedEntityTableDeta
@Autowired
private transient SoftwareManagement softwareManagement;
@Autowired
private SwMetadataPopupLayout swMetadataPopupLayout;
@Autowired
private EntityFactory entityFactory;
private transient EntityFactory entityFactory;
private SoftwareModuleMetadatadetailslayout swmMetadataTable;
/**
* softwareLayout Initialize the component.
*/
@Override
protected void init() {
swmMetadataTable = new SoftwareModuleMetadatadetailslayout();
swmMetadataTable.init(getI18n(), getPermissionChecker(),softwareManagement,swMetadataPopupLayout,entityFactory);
swmMetadataTable.init(getI18n(), getPermissionChecker(), softwareManagement, swMetadataPopupLayout,
entityFactory);
super.init();
}
@EventBusListenerMethod(scope = EventScope.SESSION)
void onEvent(final MetadataEvent event) {
UI.getCurrent()
.access(() -> {
SoftwareModuleMetadata softwareModuleMetadata = event.getSoftwareModuleMetadata();
if (softwareModuleMetadata != null
&& isSoftwareModuleSelected(softwareModuleMetadata.getSoftwareModule())) {
if (event.getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.CREATE_SOFTWARE_MODULE_METADATA) {
swmMetadataTable.createMetadata(event.getSoftwareModuleMetadata().getKey());
} else if (event.getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.DELETE_SOFTWARE_MODULE_METADATA) {
swmMetadataTable.deleteMetadata(event.getSoftwareModuleMetadata().getKey());
}
}
});
UI.getCurrent().access(() -> {
final SoftwareModuleMetadata softwareModuleMetadata = event.getSoftwareModuleMetadata();
if (softwareModuleMetadata != null
&& isSoftwareModuleSelected(softwareModuleMetadata.getSoftwareModule())) {
if (event.getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.CREATE_SOFTWARE_MODULE_METADATA) {
swmMetadataTable.createMetadata(event.getSoftwareModuleMetadata().getKey());
} else if (event
.getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.DELETE_SOFTWARE_MODULE_METADATA) {
swmMetadataTable.deleteMetadata(event.getSoftwareModuleMetadata().getKey());
}
}
});
}
@Override
protected String getEditButtonId() {
return SPUIComponentIdProvider.UPLOAD_SW_MODULE_EDIT_BUTTON;
@@ -101,7 +101,7 @@ public class SoftwareModuleDetails extends AbstractNamedVersionedEntityTableDeta
detailsTab.addTab(createLogLayout(), getI18n().get("caption.logs.tab"), null);
detailsTab.addTab(swmMetadataTable, getI18n().get("caption.metadata"), null);
}
@Override
protected void onEdit(final ClickEvent event) {
final Window addSoftwareModule = softwareModuleAddUpdateWindow
@@ -126,7 +126,7 @@ public class SoftwareModuleDetails extends AbstractNamedVersionedEntityTableDeta
updateSoftwareModuleDetailsLayout(HawkbitCommonUtil.SP_STRING_EMPTY, HawkbitCommonUtil.SP_STRING_EMPTY,
maxAssign);
}
populateMetadataDetails();
}
@@ -188,38 +188,30 @@ public class SoftwareModuleDetails extends AbstractNamedVersionedEntityTableDeta
protected String getDetailsHeaderCaptionId() {
return SPUIComponentIdProvider.TARGET_DETAILS_HEADER_LABEL_ID;
}
@Override
protected void populateMetadataDetails(){
protected void populateMetadataDetails() {
swmMetadataTable.populateSMMetadata(getSelectedBaseEntity());
}
private boolean isSoftwareModuleSelected(SoftwareModule softwareModule) {
final SoftwareModule selectedUploadSWModule = artifactUploadState.getSelectedBaseSoftwareModule().isPresent() ? artifactUploadState
.getSelectedBaseSoftwareModule().get() : null;
}
private boolean isSoftwareModuleSelected(final SoftwareModule softwareModule) {
final SoftwareModule selectedUploadSWModule = artifactUploadState.getSelectedBaseSoftwareModule().isPresent()
? artifactUploadState.getSelectedBaseSoftwareModule().get() : null;
return softwareModule != null && selectedUploadSWModule != null
&& selectedUploadSWModule.getName().equals(softwareModule.getName())
&& selectedUploadSWModule.getVersion().equals(softwareModule.getVersion());
}
@Override
protected Boolean isMetadataIconToBeDisplayed() {
return true;
}
@Override
protected String getShowMetadataButtonId() {
SoftwareModule selectedBaseEntity = getSelectedBaseEntity();
return SPUIComponentIdProvider.SW_TABLE_MANAGE_METADATA_ID + "." + selectedBaseEntity.getName() + "."
+ selectedBaseEntity.getVersion();
}
@Override
protected void showMetadata(ClickEvent event) {
SoftwareModule swmodule = softwareManagement.findSoftwareModuleWithDetails(getSelectedBaseEntityId());
/* display the window */
UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule,null));
protected void showMetadata(final ClickEvent event) {
final SoftwareModule swmodule = softwareManagement.findSoftwareModuleWithDetails(getSelectedBaseEntityId());
/* display the window */
UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null));
}
}

View File

@@ -8,7 +8,10 @@
*/
package org.eclipse.hawkbit.ui.artifacts.smtype;
import java.util.EnumSet;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleTypeEvent;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleTypeEvent.SoftwareModuleTypeEnum;
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
import org.eclipse.hawkbit.ui.artifacts.event.UploadViewAcceptCriteria;
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
@@ -46,12 +49,11 @@ public class SMTypeFilterButtons extends AbstractFilterButtons {
@EventBusListenerMethod(scope = EventScope.SESSION)
void onEvent(final SoftwareModuleTypeEvent event) {
if (event.getSoftwareModuleTypeEnum() == SoftwareModuleTypeEvent.SoftwareModuleTypeEnum.ADD_SOFTWARE_MODULE_TYPE
|| event.getSoftwareModuleTypeEnum() == SoftwareModuleTypeEvent.SoftwareModuleTypeEnum.UPDATE_SOFTWARE_MODULE_TYPE
|| event.getSoftwareModuleTypeEnum() == SoftwareModuleTypeEvent.SoftwareModuleTypeEnum.DELETE_SOFTWARE_MODULE_TYPE
&& event.getSoftwareModuleType() != null) {
if (event.getSoftwareModuleType() != null
&& EnumSet.allOf(SoftwareModuleTypeEnum.class).contains(event.getSoftwareModuleTypeEnum())) {
refreshTable();
}
}
@EventBusListenerMethod(scope = EventScope.SESSION)

View File

@@ -108,7 +108,7 @@ public class UploadConfirmationwindow implements Button.ClickListener {
private UploadResultWindow currentUploadResultWindow;
private int redErrorLabelCount = 0;
private int redErrorLabelCount;
private final ArtifactUploadState artifactUploadState;
@@ -353,11 +353,8 @@ public class UploadConfirmationwindow implements Button.ClickListener {
* label
* @return Boolean
*/
private Boolean isWarningIcon(final Label icon) {
if (icon.isVisible() && !icon.getStyleName().contains(SPUIStyleDefinitions.ERROR_LABEL)) {
return true;
}
return false;
private static Boolean isWarningIcon(final Label icon) {
return !isErrorIcon(icon);
}
/**
@@ -367,14 +364,11 @@ public class UploadConfirmationwindow implements Button.ClickListener {
* label
* @return Boolean
*/
private Boolean isErrorIcon(final Label icon) {
if (icon.isVisible() && icon.getStyleName().contains(SPUIStyleDefinitions.ERROR_LABEL)) {
return true;
}
return false;
private static Boolean isErrorIcon(final Label icon) {
return icon.isVisible() && icon.getStyleName().contains(SPUIStyleDefinitions.ERROR_LABEL);
}
private Label getWarningLabel() {
private static Label getWarningLabel() {
final Label warningIconLabel = new Label();
warningIconLabel.addStyleName(ValoTheme.LABEL_SMALL);
warningIconLabel.setHeightUndefined();
@@ -436,7 +430,7 @@ public class UploadConfirmationwindow implements Button.ClickListener {
private void hideErrorIcon(final Label warningLabel, final int errorLabelCount, final int duplicateCount,
final Label errorLabel, final String oldFileName, final Long currentSwId) {
if (warningLabel == null && (errorLabelCount > 1 || duplicateCount == 1 && errorLabelCount == 1)) {
if (warningLabel == null && (errorLabelCount > 1 || (duplicateCount == 1 && errorLabelCount == 1))) {
final ArtifactManagement artifactManagement = SpringContextHelper.getBean(ArtifactManagement.class);
final List<LocalArtifact> artifactList = artifactManagement.findByFilenameAndSoftwareModule(oldFileName,
currentSwId);
@@ -486,12 +480,12 @@ public class UploadConfirmationwindow implements Button.ClickListener {
uploadDetailsTable.setColumnHeader(SIZE, i18n.get("upload.size"));
uploadDetailsTable.setColumnHeader(ACTION, i18n.get("upload.action"));
uploadDetailsTable.setColumnExpandRatio(FILE_NAME_LAYOUT, 0.25f);
uploadDetailsTable.setColumnExpandRatio(SW_MODULE_NAME, 0.17f);
uploadDetailsTable.setColumnExpandRatio(SHA1_CHECKSUM, 0.2f);
uploadDetailsTable.setColumnExpandRatio(MD5_CHECKSUM, 0.2f);
uploadDetailsTable.setColumnExpandRatio(SIZE, 0.12f);
uploadDetailsTable.setColumnExpandRatio(ACTION, 0.06f);
uploadDetailsTable.setColumnExpandRatio(FILE_NAME_LAYOUT, 0.25F);
uploadDetailsTable.setColumnExpandRatio(SW_MODULE_NAME, 0.17F);
uploadDetailsTable.setColumnExpandRatio(SHA1_CHECKSUM, 0.2F);
uploadDetailsTable.setColumnExpandRatio(MD5_CHECKSUM, 0.2F);
uploadDetailsTable.setColumnExpandRatio(SIZE, 0.12F);
uploadDetailsTable.setColumnExpandRatio(ACTION, 0.06F);
final Object[] visibileColumn = { FILE_NAME_LAYOUT, SW_MODULE_NAME, SHA1_CHECKSUM, MD5_CHECKSUM, SIZE, ACTION };
uploadDetailsTable.setVisibleColumns(visibileColumn);
@@ -548,9 +542,7 @@ public class UploadConfirmationwindow implements Button.ClickListener {
uploadConfrimationWindow.close();
} else if (event.getComponent().getId().equals(SPUIComponentIdProvider.UPLOAD_BUTTON)) {
processArtifactUpload();
}
else if (event.getComponent().getId().startsWith(SPUIComponentIdProvider.UPLOAD_DELETE_ICON)) {
} else if (event.getComponent().getId().startsWith(SPUIComponentIdProvider.UPLOAD_DELETE_ICON)) {
final String itemId = ((Button) event.getComponent()).getData().toString();
final Item item = uploadDetailsTable.getItem(((Button) event.getComponent()).getData());
final Long swId = (Long) item.getItemProperty(BASE_SOFTWARE_ID).getValue();
@@ -667,7 +659,7 @@ public class UploadConfirmationwindow implements Button.ClickListener {
}
private void closeFileStream(final FileInputStream fis, final File newFile) {
private static void closeFileStream(final FileInputStream fis, final File newFile) {
if (fis != null) {
try {

View File

@@ -76,6 +76,11 @@ import com.vaadin.ui.VerticalLayout;
@SpringComponent
public class UploadLayout extends VerticalLayout {
/**
*
*/
private static final String HTML_DIV = "</div>";
private static final long serialVersionUID = -566164756606779220L;
private static final Logger LOG = LoggerFactory.getLogger(UploadLayout.class);
@@ -248,7 +253,7 @@ public class UploadLayout extends VerticalLayout {
final Html5File[] files = ((WrapperTransferable) event.getTransferable()).getFiles();
// selected software module at the time of file drop is
// considered for upload
SoftwareModule selectedSw = artifactUploadState.getSelectedBaseSoftwareModule().get();
final SoftwareModule selectedSw = artifactUploadState.getSelectedBaseSoftwareModule().get();
// reset the flag
hasDirectory = Boolean.FALSE;
for (final Html5File file : files) {
@@ -265,7 +270,7 @@ public class UploadLayout extends VerticalLayout {
}
}
private void processFile(final Html5File file, SoftwareModule selectedSw) {
private void processFile(final Html5File file, final SoftwareModule selectedSw) {
if (!isDirectory(file)) {
if (!checkForDuplicate(file.getFileName(), selectedSw)) {
artifactUploadState.getNumberOfFileUploadsExpected().incrementAndGet();
@@ -276,7 +281,7 @@ public class UploadLayout extends VerticalLayout {
}
}
private StreamVariable createStreamVariable(final Html5File file, SoftwareModule selectedSw) {
private StreamVariable createStreamVariable(final Html5File file, final SoftwareModule selectedSw) {
return new UploadHandler(file.getFileName(), file.getFileSize(), UploadLayout.this,
spInfo.getMaxArtifactFileSize(), null, file.getType(), selectedSw);
}
@@ -366,11 +371,13 @@ public class UploadLayout extends VerticalLayout {
* in case of upload errors
*/
OutputStream saveUploadedFileDetails(final String name, final long size, final String mimeType,
SoftwareModule selectedSw) {
final SoftwareModule selectedSw) {
File tempFile = null;
try {
tempFile = File.createTempFile("spUiArtifactUpload", null);
// we return the outputstream so we cannot close it here
@SuppressWarnings("squid:S2095")
final OutputStream out = new FileOutputStream(tempFile);
final String currentBaseSoftwareModuleKey = HawkbitCommonUtil.getFormattedNameVersion(selectedSw.getName(),
@@ -406,18 +413,12 @@ public class UploadLayout extends VerticalLayout {
return checkIfSoftwareModuleIsSelected();
}
private boolean isFilesDropped(final DragAndDropEvent event) {
private static boolean isFilesDropped(final DragAndDropEvent event) {
if (event.getTransferable() instanceof WrapperTransferable) {
final Html5File[] files = ((WrapperTransferable) event.getTransferable()).getFiles();
// other components can also be wrapped in WrapperTransferable , so
// additional check on files
if (files == null) {
return false;
}
return true;
} else {
return false;
return files != null;
}
return false;
}
Boolean checkIfSoftwareModuleIsSelected() {
@@ -441,12 +442,14 @@ public class UploadLayout extends VerticalLayout {
*
* @param name
* file name
* @param selectedSoftwareModule
* the current selected sm module
* @return Boolean
*/
public Boolean checkIfFileIsDuplicate(final String name, final SoftwareModule selectedSoftwareModule) {
Boolean isDuplicate = false;
final String currentBaseSoftwareModuleKey = HawkbitCommonUtil.getFormattedNameVersion(
selectedSoftwareModule.getName(), selectedSoftwareModule.getVersion());
final String currentBaseSoftwareModuleKey = HawkbitCommonUtil
.getFormattedNameVersion(selectedSoftwareModule.getName(), selectedSoftwareModule.getVersion());
for (final CustomFile customFile : artifactUploadState.getFileSelected()) {
final String fileSoftwareModuleKey = HawkbitCommonUtil.getFormattedNameVersion(
@@ -473,7 +476,7 @@ public class UploadLayout extends VerticalLayout {
void updateActionCount() {
if (!artifactUploadState.getFileSelected().isEmpty()) {
processBtn.setCaption(SPUILabelDefinitions.PROCESS + "<div class='unread'>"
+ artifactUploadState.getFileSelected().size() + "</div>");
+ artifactUploadState.getFileSelected().size() + HTML_DIV);
} else {
processBtn.setCaption(SPUILabelDefinitions.PROCESS);
}
@@ -502,6 +505,9 @@ public class UploadLayout extends VerticalLayout {
return message.toString();
}
/**
* Show the duplicated message.
*/
public void showDuplicateMessage() {
uiNotification.displayValidationError(getDuplicateFileValidationMessage());
}
@@ -510,9 +516,9 @@ public class UploadLayout extends VerticalLayout {
artifactUploadState.getNumberOfFileUploadsExpected().incrementAndGet();
}
void updateFileSize(final String name, final long size, SoftwareModule selectedSoftwareModule) {
final String currentBaseSoftwareModuleKey = HawkbitCommonUtil.getFormattedNameVersion(
selectedSoftwareModule.getName(), selectedSoftwareModule.getVersion());
void updateFileSize(final String name, final long size, final SoftwareModule selectedSoftwareModule) {
final String currentBaseSoftwareModuleKey = HawkbitCommonUtil
.getFormattedNameVersion(selectedSoftwareModule.getName(), selectedSoftwareModule.getVersion());
for (final CustomFile customFile : artifactUploadState.getFileSelected()) {
final String fileSoftwareModuleKey = HawkbitCommonUtil.getFormattedNameVersion(
@@ -594,12 +600,12 @@ public class UploadLayout extends VerticalLayout {
private void setConfirmationPopupHeightWidth(final float newWidth, final float newHeight) {
if (currentUploadConfirmationwindow != null) {
currentUploadConfirmationwindow.getUploadArtifactDetails().setWidth(
HawkbitCommonUtil.getArtifactUploadPopupWidth(newWidth,
SPUIDefinitions.MIN_UPLOAD_CONFIRMATION_POPUP_WIDTH), Unit.PIXELS);
currentUploadConfirmationwindow.getUploadDetailsTable().setHeight(
HawkbitCommonUtil.getArtifactUploadPopupHeight(newHeight,
SPUIDefinitions.MIN_UPLOAD_CONFIRMATION_POPUP_HEIGHT), Unit.PIXELS);
currentUploadConfirmationwindow.getUploadArtifactDetails().setWidth(HawkbitCommonUtil
.getArtifactUploadPopupWidth(newWidth, SPUIDefinitions.MIN_UPLOAD_CONFIRMATION_POPUP_WIDTH),
Unit.PIXELS);
currentUploadConfirmationwindow.getUploadDetailsTable().setHeight(HawkbitCommonUtil
.getArtifactUploadPopupHeight(newHeight, SPUIDefinitions.MIN_UPLOAD_CONFIRMATION_POPUP_HEIGHT),
Unit.PIXELS);
}
}
@@ -616,12 +622,10 @@ public class UploadLayout extends VerticalLayout {
&& currentUploadConfirmationwindow.getCurrentUploadResultWindow() != null) {
final UploadResultWindow uploadResultWindow = currentUploadConfirmationwindow
.getCurrentUploadResultWindow();
uploadResultWindow.getUploadResultsWindow().setWidth(
HawkbitCommonUtil.getArtifactUploadPopupWidth(newWidth,
SPUIDefinitions.MIN_UPLOAD_CONFIRMATION_POPUP_WIDTH), Unit.PIXELS);
uploadResultWindow.getUploadResultTable().setHeight(
HawkbitCommonUtil.getArtifactUploadPopupHeight(newHeight,
SPUIDefinitions.MIN_UPLOAD_CONFIRMATION_POPUP_HEIGHT), Unit.PIXELS);
uploadResultWindow.getUploadResultsWindow().setWidth(HawkbitCommonUtil.getArtifactUploadPopupWidth(newWidth,
SPUIDefinitions.MIN_UPLOAD_CONFIRMATION_POPUP_WIDTH), Unit.PIXELS);
uploadResultWindow.getUploadResultTable().setHeight(HawkbitCommonUtil.getArtifactUploadPopupHeight(
newHeight, SPUIDefinitions.MIN_UPLOAD_CONFIRMATION_POPUP_HEIGHT), Unit.PIXELS);
}
}
@@ -632,8 +636,8 @@ public class UploadLayout extends VerticalLayout {
} else {
currentUploadConfirmationwindow = new UploadConfirmationwindow(this, artifactUploadState);
UI.getCurrent().addWindow(currentUploadConfirmationwindow.getUploadConfrimationWindow());
setConfirmationPopupHeightWidth(Page.getCurrent().getBrowserWindowWidth(), Page.getCurrent()
.getBrowserWindowHeight());
setConfirmationPopupHeightWidth(Page.getCurrent().getBrowserWindowWidth(),
Page.getCurrent().getBrowserWindowHeight());
}
}
}
@@ -682,7 +686,7 @@ public class UploadLayout extends VerticalLayout {
displayDuplicateValidationMessage();
}
private void onUploadStreamingFailure(UploadStatusEvent event) {
private void onUploadStreamingFailure(final UploadStatusEvent event) {
/**
* If upload interrupted because of duplicate file,do not remove the
* file already in upload list
@@ -691,13 +695,13 @@ public class UploadLayout extends VerticalLayout {
|| !getDuplicateFileNamesList().contains(event.getUploadStatus().getFileName())) {
final SoftwareModule sw = event.getUploadStatus().getSoftwareModule();
if (sw != null) {
getFileSelected().remove(
new CustomFile(event.getUploadStatus().getFileName(), sw.getName(), sw.getVersion()));
getFileSelected()
.remove(new CustomFile(event.getUploadStatus().getFileName(), sw.getName(), sw.getVersion()));
}
// failed reason to be updated only if there is error other than
// duplicate file error
uploadInfoWindow.uploadFailed(event.getUploadStatus().getFileName(), event.getUploadStatus()
.getFailureReason(), event.getUploadStatus().getSoftwareModule());
uploadInfoWindow.uploadFailed(event.getUploadStatus().getFileName(),
event.getUploadStatus().getFailureReason(), event.getUploadStatus().getSoftwareModule());
increaseNumberOfFileUploadsFailed();
}
decreaseNumberOfFileUploadsExpected();
@@ -711,9 +715,9 @@ public class UploadLayout extends VerticalLayout {
displayDuplicateValidationMessage();
}
private void onUploadSuccess(UploadStatusEvent event) {
updateFileSize(event.getUploadStatus().getFileName(), event.getUploadStatus().getContentLength(), event
.getUploadStatus().getSoftwareModule());
private void onUploadSuccess(final UploadStatusEvent event) {
updateFileSize(event.getUploadStatus().getFileName(), event.getUploadStatus().getContentLength(),
event.getUploadStatus().getSoftwareModule());
// recorded that we now one more uploaded
increaseNumberOfFilesActuallyUpload();
}
@@ -730,8 +734,8 @@ public class UploadLayout extends VerticalLayout {
}
private boolean isUploadComplete() {
int uploadedCount = artifactUploadState.getNumberOfFilesActuallyUpload().intValue();
int expectedUploadsCount = artifactUploadState.getNumberOfFileUploadsExpected().intValue();
final int uploadedCount = artifactUploadState.getNumberOfFilesActuallyUpload().intValue();
final int expectedUploadsCount = artifactUploadState.getNumberOfFileUploadsExpected().intValue();
return uploadedCount == expectedUploadsCount;
}
@@ -744,13 +748,13 @@ public class UploadLayout extends VerticalLayout {
|| !getDuplicateFileNamesList().contains(event.getUploadStatus().getFileName())) {
final SoftwareModule sw = event.getUploadStatus().getSoftwareModule();
if (sw != null) {
getFileSelected().remove(
new CustomFile(event.getUploadStatus().getFileName(), sw.getName(), sw.getVersion()));
getFileSelected()
.remove(new CustomFile(event.getUploadStatus().getFileName(), sw.getName(), sw.getVersion()));
}
// failed reason to be updated only if there is error other than
// duplicate file error
uploadInfoWindow.uploadFailed(event.getUploadStatus().getFileName(), event.getUploadStatus()
.getFailureReason(), event.getUploadStatus().getSoftwareModule());
uploadInfoWindow.uploadFailed(event.getUploadStatus().getFileName(),
event.getUploadStatus().getFailureReason(), event.getUploadStatus().getSoftwareModule());
increaseNumberOfFileUploadsFailed();
decreaseNumberOfFileUploadsExpected();
}
@@ -773,8 +777,8 @@ public class UploadLayout extends VerticalLayout {
* @param selectedBaseSoftwareModule
*/
public void refreshArtifactDetailsLayout(final SoftwareModule selectedBaseSoftwareModule) {
eventBus.publish(this, new SoftwareModuleEvent(SoftwareModuleEventType.ARTIFACTS_CHANGED,
selectedBaseSoftwareModule));
eventBus.publish(this,
new SoftwareModuleEvent(SoftwareModuleEventType.ARTIFACTS_CHANGED, selectedBaseSoftwareModule));
}
/**
@@ -804,19 +808,19 @@ public class UploadLayout extends VerticalLayout {
}
void updateStatusButtonCount() {
int uploadsPending = artifactUploadState.getNumberOfFileUploadsExpected().get()
final int uploadsPending = artifactUploadState.getNumberOfFileUploadsExpected().get()
- artifactUploadState.getNumberOfFilesActuallyUpload().get();
int uploadsFailed = artifactUploadState.getNumberOfFileUploadsFailed().get();
StringBuilder builder = new StringBuilder("");
final int uploadsFailed = artifactUploadState.getNumberOfFileUploadsFailed().get();
final StringBuilder builder = new StringBuilder("");
if (uploadsFailed != 0) {
if (uploadsPending != 0) {
builder.append("<div class='error-count error-count-color'>" + uploadsFailed + "</div>");
builder.append("<div class='error-count error-count-color'>" + uploadsFailed + HTML_DIV);
} else {
builder.append("<div class='unread error-count-color'>" + uploadsFailed + "</div>");
builder.append("<div class='unread error-count-color'>" + uploadsFailed + HTML_DIV);
}
}
if (uploadsPending != 0) {
builder.append("<div class='unread'>" + uploadsPending + "</div>");
builder.append("<div class='unread'>" + uploadsPending + HTML_DIV);
}
uploadStatusButton.setCaption(builder.toString());
}

View File

@@ -14,7 +14,7 @@ import com.vaadin.shared.ui.colorpicker.Color;
* Provides color constants for the ColorPickerLayout
*
*/
public class ColorPickerConstants {
public final class ColorPickerConstants {
public static final String DEFAULT_COLOR = "rgb(44,151,32)";
public static final Color START_COLOR = new Color(0, 146, 58);

View File

@@ -20,7 +20,7 @@ import com.vaadin.ui.Slider.ValueOutOfBoundsException;
* Contains helper methods for the ColorPickerLayout to handle the ColorPicker
*
*/
public class ColorPickerHelper {
public final class ColorPickerHelper {
private static final Logger LOG = LoggerFactory.getLogger(ColorPickerHelper.class);
@@ -30,7 +30,9 @@ public class ColorPickerHelper {
/**
* Get color picked value as string.
*
*
* @param preview
* the color picker preview
* @return String of color picked value.
*/
public static String getColorPickedString(final SpColorPickerPreview preview) {
@@ -59,7 +61,7 @@ public class ColorPickerHelper {
final int green = Integer.parseInt(colors[1]);
final int blue = Integer.parseInt(colors[2]);
if (colors.length > 3) {
final int alpha = (int) (Double.parseDouble(colors[3]) * 255d);
final int alpha = (int) (Double.parseDouble(colors[3]) * 255D);
return new Color(red, green, blue, alpha);
}
return new Color(red, green, blue);

View File

@@ -38,7 +38,6 @@ import com.vaadin.server.FontAwesome;
import com.vaadin.ui.AbstractTextField.TextChangeEventMode;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Grid;
import com.vaadin.ui.Grid.SelectionMode;
@@ -98,7 +97,7 @@ public abstract class AbstractMetadataPopupLayout<E extends NamedVersionedEntity
private HorizontalLayout mainLayout;
@PostConstruct
private void init() {
void init() {
createComponents();
buildLayout();
@@ -170,7 +169,6 @@ public abstract class AbstractMetadataPopupLayout<E extends NamedVersionedEntity
headerLayout.setComponentAlignment(addIcon, Alignment.MIDDLE_RIGHT);
}
headerLayout.setExpandRatio(headerCaption, 1.0F);
final HorizontalLayout headerWrapperLayout = new HorizontalLayout();
headerWrapperLayout.addStyleName("bordered-layout" + " " + "no-border-bottom" + " " + "metadata-table-margin");
@@ -257,50 +255,56 @@ public abstract class AbstractMetadataPopupLayout<E extends NamedVersionedEntity
i18n.get("caption.metadata.delete.action.confirmbox"), i18n.get("message.confirm.delete.metadata", key),
i18n.get("button.ok"), i18n.get("button.cancel"), ok -> {
if (ok) {
deleteMetadata(getSelectedEntity(), key, value);
uiNotification.displaySuccess(i18n.get("message.metadata.deleted.successfully", key));
final Object selectedRow = metaDataGrid.getSelectedRow();
metaDataGrid.getContainerDataSource().removeItem(event.getItemId());
// force grid to refresh
metaDataGrid.clearSortOrder();
if (!metaDataGrid.getContainerDataSource().getItemIds().isEmpty()) {
if (selectedRow != null) {
if (selectedRow.equals(event.getItemId())) {
metaDataGrid.select(metaDataGrid.getContainerDataSource().getIdByIndex(0));
} else {
metaDataGrid.select(selectedRow);
}
}
} else {
keyTextField.clear();
valueTextArea.clear();
metaDataGrid.select(null);
if (hasCreatePermission()) {
keyTextField.setEnabled(true);
valueTextArea.setEnabled(true);
addIcon.setEnabled(false);
}
}
handleOkDeleteMetadata(event, key, value);
}
});
UI.getCurrent().addWindow(confirmDialog.getWindow());
confirmDialog.getWindow().bringToFront();
}
private void handleOkDeleteMetadata(final RendererClickEvent event, final String key, final String value) {
deleteMetadata(getSelectedEntity(), key, value);
uiNotification.displaySuccess(i18n.get("message.metadata.deleted.successfully", key));
final Object selectedRow = metaDataGrid.getSelectedRow();
metaDataGrid.getContainerDataSource().removeItem(event.getItemId());
// force grid to refresh
metaDataGrid.clearSortOrder();
if (!metaDataGrid.getContainerDataSource().getItemIds().isEmpty()) {
if (selectedRow != null) {
if (selectedRow.equals(event.getItemId())) {
metaDataGrid.select(metaDataGrid.getContainerDataSource().getIdByIndex(0));
} else {
metaDataGrid.select(selectedRow);
}
}
} else {
clearTextFields();
}
}
private void clearTextFields() {
keyTextField.clear();
valueTextArea.clear();
metaDataGrid.select(null);
if (hasCreatePermission()) {
keyTextField.setEnabled(true);
valueTextArea.setEnabled(true);
addIcon.setEnabled(false);
}
}
private Button createAddIcon() {
addIcon = SPUIComponentProvider.getButton(SPUIComponentIdProvider.METADTA_ADD_ICON_ID, i18n.get("button.save"),
null, null, false, FontAwesome.PLUS, SPUIButtonStyleSmallNoBorder.class);
addIcon.addClickListener(event -> onAdd(event));
addIcon.addClickListener(event -> onAdd());
return addIcon;
}
private Label createHeaderCaption() {
final Label captionLabel = SPUIComponentProvider.getLabel(i18n.get("caption.metadata"),
SPUILabelDefinitions.SP_WIDGET_CAPTION);
return captionLabel;
return SPUIComponentProvider.getLabel(i18n.get("caption.metadata"), SPUILabelDefinitions.SP_WIDGET_CAPTION);
}
private IndexedContainer getMetadataContainer() {
private static IndexedContainer getMetadataContainer() {
final IndexedContainer swcontactContainer = new IndexedContainer();
swcontactContainer.addContainerProperty(KEY, String.class, "");
swcontactContainer.addContainerProperty(VALUE, String.class, "");
@@ -340,7 +344,7 @@ public abstract class AbstractMetadataPopupLayout<E extends NamedVersionedEntity
item.getItemProperty(VALUE).setValue(valueTextArea.getValue());
}
private void onAdd(final ClickEvent event) {
private void onAdd() {
metaDataGrid.deselect(metaDataGrid.getSelectedRow());
valueTextArea.clear();
keyTextField.clear();
@@ -393,7 +397,8 @@ public abstract class AbstractMetadataPopupLayout<E extends NamedVersionedEntity
private boolean duplicateCheck(final E entity) {
try {
checkForDuplicate(entity, keyTextField.getValue());
} catch (final EntityNotFoundException exception) {
// we do not want to log the exception here, does not make sense
} catch (@SuppressWarnings("squid:S1166") final EntityNotFoundException exception) {
return false;
}
uiNotification.displayValidationError(i18n.get("message.metadata.duplicate.check", keyTextField.getValue()));
@@ -484,4 +489,4 @@ public abstract class AbstractMetadataPopupLayout<E extends NamedVersionedEntity
addIcon.setEnabled(true);
}
}
}

View File

@@ -94,7 +94,7 @@ public class CommonDialogWindow extends Window implements Serializable {
private final ClickListener cancelButtonClickListener;
private final ClickListener close = event -> close();
private final ClickListener closeClickListener = event -> close();
private final transient Map<Component, Object> orginalValues;
@@ -115,6 +115,10 @@ public class CommonDialogWindow extends Window implements Serializable {
* the saveButtonClickListener
* @param cancelButtonClickListener
* the cancelButtonClickListener
* @param layout
* the abstract layout
* @param i18n
* the i18n service
*/
public CommonDialogWindow(final String caption, final Component content, final String helpLink,
final ClickListener saveButtonClickListener, final ClickListener cancelButtonClickListener,
@@ -233,11 +237,11 @@ public class CommonDialogWindow extends Window implements Serializable {
}
protected void addCloseListenerForSaveButton() {
saveButton.addClickListener(close);
saveButton.addClickListener(closeClickListener);
}
protected void addCloseListenerForCancelButton() {
cancelButton.addClickListener(close);
cancelButton.addClickListener(closeClickListener);
}
protected void addComponenetListeners() {
@@ -275,7 +279,8 @@ public class CommonDialogWindow extends Window implements Serializable {
return false;
}
private boolean isValueEquals(final AbstractField<?> field, final Object orginalValue, final Object currentValue) {
private static boolean isValueEquals(final AbstractField<?> field, final Object orginalValue,
final Object currentValue) {
if (Set.class.equals(field.getType())) {
return CollectionUtils.isEqualCollection(CollectionUtils.emptyIfNull((Collection<?>) orginalValue),
CollectionUtils.emptyIfNull((Collection<?>) currentValue));
@@ -289,7 +294,7 @@ public class CommonDialogWindow extends Window implements Serializable {
return Objects.equals(orginalValue, currentValue);
}
private Object getCurrentVaue(final Component currentChangedComponent, final Object newValue,
private static Object getCurrentVaue(final Component currentChangedComponent, final Object newValue,
final AbstractField<?> field) {
Object currentValue = field.getValue();
if (field instanceof Table) {
@@ -365,7 +370,7 @@ public class CommonDialogWindow extends Window implements Serializable {
return false;
}
private List<AbstractField<?>> getAllComponents(final AbstractLayout abstractLayout) {
private static List<AbstractField<?>> getAllComponents(final AbstractLayout abstractLayout) {
final List<AbstractField<?>> components = new ArrayList<>();
final Iterator<Component> iterate = abstractLayout.iterator();
@@ -464,6 +469,7 @@ public class CommonDialogWindow extends Window implements Serializable {
private class ChangeListener implements ValueChangeListener, TextChangeListener, ItemSetChangeListener {
private static final long serialVersionUID = 1L;
private final Field<?> field;
public ChangeListener(final Field<?> field) {

View File

@@ -64,7 +64,7 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
private Button editButton;
private Button manageMetadataBtn;
private TabSheet detailsTab;
private VerticalLayout detailsLayout;
@@ -140,11 +140,11 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
editButton.addClickListener(this::onEdit);
editButton.setEnabled(false);
manageMetadataBtn = SPUIComponentProvider.getButton("", "", "", null, false,
FontAwesome.LIST_ALT, SPUIButtonStyleSmallNoBorder.class);
manageMetadataBtn = SPUIComponentProvider.getButton("", "", "", null, false, FontAwesome.LIST_ALT,
SPUIButtonStyleSmallNoBorder.class);
manageMetadataBtn.setId(getEditButtonId());
manageMetadataBtn.setDescription(i18n.get("tooltip.metadata.icon"));
manageMetadataBtn.addClickListener(this::showMetadata);
manageMetadataBtn.addClickListener(this::showMetadata);
manageMetadataBtn.setEnabled(false);
detailsTab = SPUIComponentProvider.getDetailsTabSheet();
@@ -294,8 +294,8 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
descriptionLayout = getTabLayout();
return descriptionLayout;
}
/**
/**
* Default caption of header to be displayed when no data row selected in
* table.
*
@@ -340,7 +340,7 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
}
protected abstract void populateDetailsWidget();
protected abstract void populateMetadataDetails();
protected Long getSelectedBaseEntityId() {
@@ -351,10 +351,8 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
protected abstract String getName();
protected abstract String getShowMetadataButtonId();
protected abstract Boolean isMetadataIconToBeDisplayed();
protected abstract void showMetadata(Button.ClickEvent event);
}

View File

@@ -47,7 +47,7 @@ public class SoftwareModuleMetadatadetailslayout extends Table {
private SpPermissionChecker permissionChecker;
private SoftwareManagement softwareManagement;
private transient SoftwareManagement softwareManagement;
private SwMetadataPopupLayout swMetadataPopupLayout;
@@ -55,19 +55,33 @@ public class SoftwareModuleMetadatadetailslayout extends Table {
private Long selectedSWModuleId;
private transient EntityFactory entityFactory;
private transient EntityFactory entityFactory;
public void init(final I18N i18n, final SpPermissionChecker permissionChecker,
final SoftwareManagement softwareManagement, final SwMetadataPopupLayout swMetadataPopupLayout,
final EntityFactory entityFactory) {
this.i18n = i18n;
this.permissionChecker = permissionChecker;
this.softwareManagement = softwareManagement;
this.swMetadataPopupLayout = swMetadataPopupLayout;
this.entityFactory = entityFactory;
createSWMMetadataTable();
addCustomGeneratedColumns();
}
/**
* Initialize the layout.
*
* @param i18n
* the i18n service
* @param permissionChecker
* the permission checker service
* @param softwareManagement
* the software management service
* @param swMetadataPopupLayout
* the software module metadata popup layout
* @param entityFactory
* the entity factory service
*/
public void init(final I18N i18n, final SpPermissionChecker permissionChecker,
final SoftwareManagement softwareManagement, final SwMetadataPopupLayout swMetadataPopupLayout,
final EntityFactory entityFactory) {
this.i18n = i18n;
this.permissionChecker = permissionChecker;
this.softwareManagement = softwareManagement;
this.swMetadataPopupLayout = swMetadataPopupLayout;
this.entityFactory = entityFactory;
createSWMMetadataTable();
addCustomGeneratedColumns();
}
/**
* Populate software module metadata table.

View File

@@ -26,8 +26,6 @@ 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.TableColumn;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus;
@@ -49,9 +47,9 @@ import com.vaadin.ui.themes.ValoTheme;
*/
public abstract class AbstractTable<E extends NamedEntity, I> extends Table {
private static final long serialVersionUID = 4856562746502217630L;
private static final float DEFAULT_COLUMN_NAME_MIN_SIZE = 0.8F;
private static final Logger LOG = LoggerFactory.getLogger(AbstractTable.class);
private static final long serialVersionUID = 4856562746502217630L;
@Autowired
protected transient EventBus.SessionEventBus eventBus;
@@ -89,6 +87,13 @@ public abstract class AbstractTable<E extends NamedEntity, I> extends Table {
eventBus.unsubscribe(this);
}
/**
* Gets the selected item id or in multiselect mode a set of selected ids.
*
* @param table
* the table to retrieve the selected ID(s)
* @return the ID(s) which are selected in the table
*/
public static <T> Set<T> getTableValue(final Table table) {
@SuppressWarnings("unchecked")
Set<T> values = (Set<T>) table.getValue();
@@ -351,7 +356,7 @@ public abstract class AbstractTable<E extends NamedEntity, I> extends Table {
}
protected float getColumnNameMinimizedSize() {
return 0.8F;
return DEFAULT_COLUMN_NAME_MIN_SIZE;
}
/**

View File

@@ -44,6 +44,9 @@ import com.vaadin.ui.themes.ValoTheme;
/**
* Abstract class for target/ds tag token layout.
*
* @param <T>
* the special entity
*/
public abstract class AbstractTagToken<T extends BaseEntity> implements Serializable {
@@ -76,6 +79,9 @@ public abstract class AbstractTagToken<T extends BaseEntity> implements Serializ
@Autowired
protected ManagementUIState managementUIState;
// BaseEntity implements Serializable so this entity is serializable. Maybe
// a sonar bug
@SuppressWarnings("squid:S1948")
protected T selectedEntity;
@PostConstruct
@@ -214,11 +220,11 @@ public abstract class AbstractTagToken<T extends BaseEntity> implements Serializ
unassignTag(tagDetails.get(tokenId).getName());
}
}
private Property getItemNameProperty(final Object tokenId) {
final Item item = tokenField.getContainerDataSource().getItem(tokenId);
return item.getItemProperty("name");
}
private Property getItemNameProperty(final Object tokenId) {
final Item item = tokenField.getContainerDataSource().getItem(tokenId);
return item.getItemProperty("name");
}
private String getColor(final Object tokenId) {

View File

@@ -18,7 +18,10 @@ import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
/**
* Abstract class for target tag token layout.
* /** Abstract class for target tag token layout.
*
* @param <T>
* the entity type
*/
public abstract class AbstractTargetTagToken<T extends BaseEntity> extends AbstractTagToken<T> {

View File

@@ -8,7 +8,6 @@
*/
package org.eclipse.hawkbit.ui.common.tagdetails;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -86,23 +85,11 @@ public class DistributionTagToken extends AbstractTagToken<DistributionSet> {
@Override
protected void unassignTag(final String tagName) {
final DistributionSetTagAssignmentResult result = toggleAssignment(tagName);
if (result.getUnassigned() >= 1 && (isClickedTagListEmpty() || getClickedTagList().contains(tagName))) {
if (result.getUnassigned() >= 1) {
eventBus.publish(this, ManagementUIEvent.UNASSIGN_DISTRIBUTION_TAG);
}
}
private Boolean isClickedTagListEmpty() {
if (getClickedTagList() == null || getClickedTagList() != null && !getClickedTagList().isEmpty()) {
return true;
}
return false;
}
/* To Be Done : this implementation will vary in views */
private List<String> getClickedTagList() {
return new ArrayList<>();
}
@Override
protected Boolean isToggleTagAssignmentAllowed() {
return checker.hasUpdateDistributionPermission();

View File

@@ -8,7 +8,6 @@
*/
package org.eclipse.hawkbit.ui.common.tagdetails;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -23,7 +22,6 @@ import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult;
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
@@ -46,9 +44,6 @@ public class TargetTagToken extends AbstractTargetTagToken<Target> {
// To Be Done : have to set this value based on view???
private static final Boolean NOTAGS_SELECTED = Boolean.FALSE;
@Autowired
private UINotification uinotification;
@Autowired
private transient TargetManagement targetManagement;
@@ -85,23 +80,11 @@ public class TargetTagToken extends AbstractTargetTagToken<Target> {
@Override
protected void unassignTag(final String tagName) {
final TargetTagAssignmentResult result = toggleAssignment(tagName);
if (result.getUnassigned() >= 1 && (isClickedTagListEmpty() || getClickedTagList().contains(tagName))) {
if (result.getUnassigned() >= 1) {
eventBus.publish(this, ManagementUIEvent.UNASSIGN_TARGET_TAG);
}
}
private Boolean isClickedTagListEmpty() {
if (getClickedTagList() == null || getClickedTagList() != null && !getClickedTagList().isEmpty()) {
return true;
}
return false;
}
/* To Be Done : this implementation will vary in views */
private List<String> getClickedTagList() {
return new ArrayList<>();
}
@Override
protected Boolean isToggleTagAssignmentAllowed() {
return checker.hasUpdateTargetPermission();

View File

@@ -17,7 +17,7 @@ import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonDecorator;
import org.eclipse.hawkbit.ui.decorators.SPUIComboBoxDecorator;
import org.eclipse.hawkbit.ui.decorators.SPUIHeaderLayoutDecorator;
import org.eclipse.hawkbit.ui.decorators.HeaderLayoutDecorator;
import org.eclipse.hawkbit.ui.decorators.SPUILabelDecorator;
import org.eclipse.hawkbit.ui.decorators.SPUITextAreaDecorator;
import org.eclipse.hawkbit.ui.decorators.SPUITextFieldDecorator;
@@ -104,7 +104,7 @@ public final class SPUIComponentProvider {
* @return
*/
public static HorizontalLayout getHeaderLayout(
final Class<? extends SPUIHeaderLayoutDecorator> tableHeaderLayoutDecorator) {
final Class<? extends HeaderLayoutDecorator> tableHeaderLayoutDecorator) {
// Do we really need this???
HorizontalLayout hLayout = getHorizontalLayout(new SPUIHorizontalLayout().getUiHorizontalLayout().getClass());
@@ -113,11 +113,11 @@ public final class SPUIComponentProvider {
}
try {
final SPUIHeaderLayoutDecorator layoutDecorator = tableHeaderLayoutDecorator.newInstance();
final HeaderLayoutDecorator layoutDecorator = tableHeaderLayoutDecorator.newInstance();
hLayout = layoutDecorator.decorate(hLayout);
} catch (final InstantiationException | IllegalAccessException exception) {
LOG.error("Error occured while creating horizontal decorator " + SPUIHeaderLayoutDecorator.class,
LOG.error("Error occured while creating horizontal decorator " + HeaderLayoutDecorator.class,
exception);
}

View File

@@ -13,13 +13,17 @@ import com.vaadin.ui.HorizontalLayout;
/**
*
*
*
* Ui header layout decorater.
*/
public interface SPUIHeaderLayoutDecorator {
@FunctionalInterface
public interface HeaderLayoutDecorator {
/**
* decorate the header
*
* @param layout
* @return
* the layout
* @return the decorated layout
*/
HorizontalLayout decorate(HorizontalLayout layout);
}

View File

@@ -17,6 +17,7 @@ import com.vaadin.ui.Button;
*
*
*/
@FunctionalInterface
public interface SPUIButtonDecorator {
/**

View File

@@ -9,7 +9,6 @@
package org.eclipse.hawkbit.ui.distributions.disttype;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
@@ -27,8 +26,6 @@ import org.eclipse.hawkbit.ui.layouts.CreateUpdateTypeLayout;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
@@ -59,8 +56,6 @@ import com.vaadin.ui.themes.ValoTheme;
public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout {
private static final long serialVersionUID = -5169398523815877767L;
private static final Logger LOG = LoggerFactory.getLogger(CreateUpdateDistSetTypeLayout.class);
private static final String DIST_TYPE_NAME = "name";
private static final String DIST_TYPE_DESCRIPTION = "description";
private static final String DIST_TYPE_MANDATORY = "mandatory";
@@ -84,8 +79,6 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout {
private IndexedContainer originalSelectedTableContainer;
private Map<CheckBox, Boolean> mandatoryCheckboxMap;
@Override
protected void createRequiredComponents() {
@@ -152,9 +145,9 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout {
twinColumnLayout.setComponentAlignment(sourceTable, Alignment.MIDDLE_LEFT);
twinColumnLayout.setComponentAlignment(selectButtonLayout, Alignment.MIDDLE_CENTER);
twinColumnLayout.setComponentAlignment(selectedTable, Alignment.MIDDLE_RIGHT);
twinColumnLayout.setExpandRatio(sourceTable, 0.45f);
twinColumnLayout.setExpandRatio(selectButtonLayout, 0.07f);
twinColumnLayout.setExpandRatio(selectedTable, 0.48f);
twinColumnLayout.setExpandRatio(sourceTable, 0.45F);
twinColumnLayout.setExpandRatio(selectButtonLayout, 0.07F);
twinColumnLayout.setExpandRatio(selectedTable, 0.48F);
sourceTable.setVisibleColumns(new Object[] { DIST_TYPE_NAME });
return twinColumnLayout;
}
@@ -226,7 +219,7 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout {
sourceTable.setVisibleColumns(new Object[] { DIST_TYPE_NAME });
sourceTable.setColumnHeaders(i18n.get("header.dist.twintable.available"));
sourceTable.setColumnExpandRatio(DIST_TYPE_NAME, 1.0f);
sourceTable.setColumnExpandRatio(DIST_TYPE_NAME, 1.0F);
getSourceTableData();
addTooltip();
sourceTable.select(sourceTable.firstItemId());
@@ -413,7 +406,7 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout {
}
}
private void checkMandatoryAndAddMandatoryModuleType(final DistributionSetType updateDistSetType,
private static void checkMandatoryAndAddMandatoryModuleType(final DistributionSetType updateDistSetType,
final Boolean isMandatory, final SoftwareModuleType swModuleType) {
if (isMandatory) {
updateDistSetType.addMandatoryModuleType(swModuleType);
@@ -488,7 +481,7 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout {
*
* @return
*/
private LazyQueryContainer getDistSetTypeLazyQueryContainer() {
private static LazyQueryContainer getDistSetTypeLazyQueryContainer() {
final LazyQueryContainer disttypeContainer = HawkbitCommonUtil.createLazyQueryContainer(
new BeanQueryFactory<DistributionSetTypeBeanQuery>(DistributionSetTypeBeanQuery.class));

View File

@@ -65,7 +65,6 @@ public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDet
private static final long serialVersionUID = -4595004466943546669L;
private static final String SOFT_MODULE = "softwareModule";
@Autowired
private ManageDistUIState manageDistUIState;
@@ -86,7 +85,7 @@ public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDet
private DsMetadataPopupLayout dsMetadataPopupLayout;
@Autowired
private EntityFactory entityFactory;
private transient EntityFactory entityFactory;
private SoftwareModuleDetailsTable softwareModuleTable;
@@ -181,7 +180,7 @@ public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDet
return null;
}
private String getUnsavedAssigedSwModule(final String name, final String version) {
private static String getUnsavedAssigedSwModule(final String name, final String version) {
return HawkbitCommonUtil.getFormattedNameVersion(name, version);
}
@@ -396,14 +395,6 @@ public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDet
return true;
}
@Override
protected String getShowMetadataButtonId() {
final DistributionSetIdName lastselectedDistDS = manageDistUIState.getLastSelectedDistribution().isPresent()
? manageDistUIState.getLastSelectedDistribution().get() : null;
return SPUIComponentIdProvider.DS_TABLE_MANAGE_METADATA_ID + "." + lastselectedDistDS.getName() + "."
+ lastselectedDistDS.getVersion();
}
private boolean isDistributionSetSelected(final DistributionSet ds) {
final DistributionSetIdName lastselectedDistDS = manageDistUIState.getLastSelectedDistribution().isPresent()
? manageDistUIState.getLastSelectedDistribution().get() : null;

View File

@@ -34,7 +34,7 @@ public class DsMetadataPopupLayout extends AbstractMetadataPopupLayout<Distribut
private transient DistributionSetManagement distributionSetManagement;
@Autowired
private EntityFactory entityFactory;
private transient EntityFactory entityFactory;
@Autowired
protected SpPermissionChecker permChecker;

View File

@@ -49,49 +49,50 @@ public class SwModuleDetails extends AbstractNamedVersionedEntityTableDetailsLay
@Autowired
private ManageDistUIState manageDistUIState;
@Autowired
private transient SoftwareManagement softwareManagement;
@Autowired
private SwMetadataPopupLayout swMetadataPopupLayout;
@Autowired
private EntityFactory entityFactory;
private transient EntityFactory entityFactory;
private SoftwareModuleMetadatadetailslayout swmMetadataTable;
/**
/**
* softwareLayout Initialize the component.
*/
@Override
protected void init() {
swmMetadataTable = new SoftwareModuleMetadatadetailslayout();
swmMetadataTable.init(getI18n(), getPermissionChecker(),softwareManagement,swMetadataPopupLayout,entityFactory);
swmMetadataTable.init(getI18n(), getPermissionChecker(), softwareManagement, swMetadataPopupLayout,
entityFactory);
super.init();
}
/**
* MetadataEvent.
*
* @param event
* as instance of {@link MetadataEvent}
*/
@EventBusListenerMethod(scope = EventScope.SESSION)
void onEvent(final MetadataEvent event) {
UI.getCurrent()
.access(() -> {
SoftwareModuleMetadata softwareModuleMetadata = event.getSoftwareModuleMetadata();
if (softwareModuleMetadata != null
&& isSoftwareModuleSelected(softwareModuleMetadata.getSoftwareModule())) {
if (event.getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.CREATE_SOFTWARE_MODULE_METADATA) {
swmMetadataTable.createMetadata(event.getSoftwareModuleMetadata().getKey());
} else if (event.getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.DELETE_SOFTWARE_MODULE_METADATA) {
swmMetadataTable.deleteMetadata(event.getSoftwareModuleMetadata().getKey());
}
}
});
UI.getCurrent().access(() -> {
final SoftwareModuleMetadata softwareModuleMetadata = event.getSoftwareModuleMetadata();
if (softwareModuleMetadata != null
&& isSoftwareModuleSelected(softwareModuleMetadata.getSoftwareModule())) {
if (event.getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.CREATE_SOFTWARE_MODULE_METADATA) {
swmMetadataTable.createMetadata(event.getSoftwareModuleMetadata().getKey());
} else if (event
.getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.DELETE_SOFTWARE_MODULE_METADATA) {
swmMetadataTable.deleteMetadata(event.getSoftwareModuleMetadata().getKey());
}
}
});
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@@ -119,7 +120,7 @@ public class SwModuleDetails extends AbstractNamedVersionedEntityTableDetailsLay
detailsTab.addTab(createDescriptionLayout(), getI18n().get("caption.tab.description"), null);
detailsTab.addTab(createLogLayout(), getI18n().get("caption.logs.tab"), null);
detailsTab.addTab(swmMetadataTable, getI18n().get("caption.metadata"), null);
}
}
@Override
protected String getDefaultCaption() {
@@ -196,15 +197,15 @@ public class SwModuleDetails extends AbstractNamedVersionedEntityTableDetailsLay
protected String getDetailsHeaderCaptionId() {
return SPUIComponentIdProvider.TARGET_DETAILS_HEADER_LABEL_ID;
}
@Override
protected void populateMetadataDetails() {
swmMetadataTable.populateSMMetadata(getSelectedBaseEntity());
}
private boolean isSoftwareModuleSelected(SoftwareModule softwareModule) {
final Long selectedDistSWModuleId = manageDistUIState.getSelectedBaseSwModuleId().isPresent() ? manageDistUIState
.getSelectedBaseSwModuleId().get() : null;
private boolean isSoftwareModuleSelected(final SoftwareModule softwareModule) {
final Long selectedDistSWModuleId = manageDistUIState.getSelectedBaseSwModuleId().isPresent()
? manageDistUIState.getSelectedBaseSwModuleId().get() : null;
return softwareModule != null && selectedDistSWModuleId != null
&& selectedDistSWModuleId.equals(softwareModule.getId());
}
@@ -213,17 +214,10 @@ public class SwModuleDetails extends AbstractNamedVersionedEntityTableDetailsLay
protected Boolean isMetadataIconToBeDisplayed() {
return true;
}
@Override
protected String getShowMetadataButtonId() {
SoftwareModule selectedBaseEntity = getSelectedBaseEntity();
return SPUIComponentIdProvider.SW_TABLE_MANAGE_METADATA_ID + "." + selectedBaseEntity.getName() + "."
+ selectedBaseEntity.getVersion();
}
@Override
protected void showMetadata(ClickEvent event) {
SoftwareModule swmodule = softwareManagement.findSoftwareModuleWithDetails(getSelectedBaseEntityId());
protected void showMetadata(final ClickEvent event) {
final SoftwareModule swmodule = softwareManagement.findSoftwareModuleWithDetails(getSelectedBaseEntityId());
UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null));
}
}

View File

@@ -13,11 +13,9 @@ package org.eclipse.hawkbit.ui.filter;
* mechanism. The filter expression can evaluate if e.g. Targets should
* currently be added to the target list or if the current enabled filtered will
* filter the target and not show the newly created target.
*
*
*
*
*/
@FunctionalInterface
public interface FilterExpression {
/**

View File

@@ -60,8 +60,7 @@ import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.themes.ValoTheme;
/**
*
*
* A Vaadin layout for create or update the target filter.
*/
@SpringComponent
@ViewScope
@@ -494,11 +493,7 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
if (filterManagementUIState.isCreateFilterViewDisplayed() && !doesAlreadyExists()) {
createTargetFilterQuery();
} else {
if (!nameTextField.getValue().equals(oldFilterName) && !doesAlreadyExists()) {
updateCustomFilter();
} else {
updateCustomFilter();
}
updateCustomFilter();
}
}
}

View File

@@ -59,7 +59,7 @@ public class DistributionDetails extends AbstractNamedVersionedEntityTableDetail
private DsMetadataPopupLayout dsMetadataPopupLayout;
@Autowired
private EntityFactory entityFactory;
private transient EntityFactory entityFactory;
private SoftwareModuleDetailsTable softwareModuleTable;
@@ -193,15 +193,6 @@ public class DistributionDetails extends AbstractNamedVersionedEntityTableDetail
return true;
}
@Override
protected String getShowMetadataButtonId() {
final DistributionSetIdName lastselectedDistDS = managementUIState.getLastSelectedDistribution().isPresent()
? managementUIState.getLastSelectedDistribution().get() : null;
return SPUIComponentIdProvider.DS_TABLE_MANAGE_METADATA_ID + "." + lastselectedDistDS.getName() + "."
+ lastselectedDistDS.getVersion();
}
private boolean isDistributionSetSelected(final DistributionSet ds) {
final DistributionSetIdName lastselectedManageDS = managementUIState.getLastSelectedDistribution().isPresent()
? managementUIState.getLastSelectedDistribution().get() : null;

View File

@@ -104,7 +104,7 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
private transient DistributionSetManagement distributionSetManagement;
@Autowired
private EntityFactory entityFactory;
private transient EntityFactory entityFactory;
private String notAllowedMsg;
@@ -577,8 +577,8 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
}
}
private String getPinnedDistributionStyle(final Long installedDistItemIds, final Long assignedDistTableItemIds,
final Object itemId) {
private static String getPinnedDistributionStyle(final Long installedDistItemIds,
final Long assignedDistTableItemIds, final Object itemId) {
final Long distId = ((DistributionSetIdName) itemId).getId();
if (distId != null && distId.equals(installedDistItemIds)) {
return SPUIDefinitions.HIGHTLIGHT_GREEN;
@@ -645,7 +645,7 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
resetPinStyle(eventBtn);
}
private void resetPinStyle(final Button pinBtn) {
private static void resetPinStyle(final Button pinBtn) {
pinBtn.setStyleName(getPinStyle());
}
@@ -681,14 +681,14 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
});
}
private void applyPinStyle(final Button eventBtn) {
private static void applyPinStyle(final Button eventBtn) {
final StringBuilder style = new StringBuilder(SPUIComponentProvider.getPinButtonStyle());
style.append(' ').append(SPUIStyleDefinitions.DIST_PIN).append(' ').append("tablePin").append(' ')
.append("pin-icon-red");
eventBtn.setStyleName(style.toString());
}
private String getPinButtonId(final String distName, final String distVersion) {
private static String getPinButtonId(final String distName, final String distVersion) {
final StringBuilder pinBtnId = new StringBuilder(SPUIComponentIdProvider.DIST_PIN_BUTTON);
pinBtnId.append('.');
pinBtnId.append(distName);
@@ -697,7 +697,7 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
return pinBtnId.toString();
}
private Button getPinBtn(final Object itemId, final String distName, final String distVersion) {
private static Button getPinBtn(final Object itemId, final String distName, final String distVersion) {
final Button pinBtn = new Button();
pinBtn.setIcon(FontAwesome.THUMB_TACK);
pinBtn.setHeightUndefined();
@@ -708,7 +708,7 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
return pinBtn;
}
private String getPinStyle() {
private static String getPinStyle() {
final StringBuilder pinBtnStyle = new StringBuilder(SPUIComponentProvider.getPinButtonStyle());
pinBtnStyle.append(' ');
pinBtnStyle.append(SPUIStyleDefinitions.DIST_PIN);

View File

@@ -83,7 +83,7 @@ public class BulkUploadHandler extends CustomComponent
private final transient DeploymentManagement deploymentManagement;
private final transient DistributionSetManagement distributionSetManagement;
protected File tempFile = null;
protected File tempFile;
private Upload upload;
private final ProgressBar progressBar;
@@ -91,8 +91,8 @@ public class BulkUploadHandler extends CustomComponent
private final TargetBulkTokenTags targetBulkTokenTags;
private final Label targetsCountLabel;
private long failedTargetCount = 0;
private long successfullTargetCount = 0;
private long failedTargetCount;
private long successfullTargetCount;
private final transient Executor executor;
private transient EventBus.SessionEventBus eventBus;
@@ -409,7 +409,7 @@ public class BulkUploadHandler extends CustomComponent
}
private void setTargetValues(final Target target, final String name, final String description) {
private static void setTargetValues(final Target target, final String name, final String description) {
if (null == name) {
target.setName(target.getControllerId());
} else {

View File

@@ -107,7 +107,6 @@ public class TargetDetails extends AbstractTableDetailsLayout<Target> {
return;
}
targetAddUpdateWindowLayout.getWindow(getSelectedBaseEntity().getControllerId());
// targetAddUpdateWindowLayout.populateValuesOfTarget(getSelectedBaseEntity().getControllerId());
openWindow();
}
@@ -229,7 +228,7 @@ public class TargetDetails extends AbstractTableDetailsLayout<Target> {
* as Module (JVM|OS|AH)
* @return Label as UI
*/
private Label getSWModlabel(final String labelName, final SoftwareModule swModule) {
private static Label getSWModlabel(final String labelName, final SoftwareModule swModule) {
return SPUIComponentProvider.createNameValueLabel(labelName + " : ", swModule.getName(), swModule.getVersion());
}
@@ -253,24 +252,19 @@ public class TargetDetails extends AbstractTableDetailsLayout<Target> {
return SPUIComponentIdProvider.TARGET_DETAILS_HEADER_LABEL_ID;
}
@Override
protected String getShowMetadataButtonId() {
return null;
}
@Override
protected Boolean isMetadataIconToBeDisplayed() {
return false;
}
@Override
protected void showMetadata(ClickEvent event) {
//No implementation required
protected void showMetadata(final ClickEvent event) {
// No implementation required
}
@Override
protected void populateMetadataDetails() {
//No implementation required
// No implementation required
}
}

View File

@@ -933,6 +933,7 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
/**
* Select all rows in the table.
*/
@Override
public void selectAll() {
// As Vaadin Table only returns the current ItemIds which are visible
@@ -1033,4 +1034,4 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
private boolean isFilteredByTags() {
return !managementUIState.getTargetTableFilters().getClickedTargetTags().isEmpty();
}
}
}

View File

@@ -56,6 +56,11 @@ import com.vaadin.ui.themes.ValoTheme;
@UIScope
public final class DashboardMenu extends CustomComponent {
private static final String STYLE_VISIBLE = "valo-menu-visible";
public static final String ID = "dashboard-menu";
public static final String REPORTS_BADGE_ID = "dashboard-menu-reports-badge";
public static final String NOTIFICATIONS_BADGE_ID = "dashboard-menu-notifications-badge";
@Autowired
private I18N i18n;
@@ -67,11 +72,6 @@ public final class DashboardMenu extends CustomComponent {
private static final long serialVersionUID = 5394474618559481462L;
public static final String ID = "dashboard-menu";
public static final String REPORTS_BADGE_ID = "dashboard-menu-reports-badge";
public static final String NOTIFICATIONS_BADGE_ID = "dashboard-menu-notifications-badge";
private static final String STYLE_VISIBLE = "valo-menu-visible";
// this should be resolved when we introduce event bus on UI to just inform
// the buttons directly via events
private final List<ValoMenuItemButton> menuButtons = new ArrayList<>();

View File

@@ -44,8 +44,6 @@ import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
@@ -80,8 +78,6 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
private static final long serialVersionUID = 2999293468801479916L;
private static final Logger LOG = LoggerFactory.getLogger(AddUpdateRolloutWindowLayout.class);
private static final String MESSAGE_ROLLOUT_FIELD_VALUE_RANGE = "message.rollout.field.value.range";
private static final String MESSAGE_ENTER_NUMBER = "message.enter.number";
@@ -154,6 +150,13 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
buildLayout();
}
/**
* Get the window.
*
* @param rolloutId
* the rollout id
* @return the window
*/
public CommonDialogWindow getWindow(final Long rolloutId) {
window = getWindow();
populateData(rolloutId);

View File

@@ -443,7 +443,7 @@ public class RolloutListGrid extends AbstractGrid {
return null;
}
private String getDSDetails(final Item rolloutItem) {
private static String getDSDetails(final Item rolloutItem) {
final StringBuilder swModuleNames = new StringBuilder();
final StringBuilder swModuleVendors = new StringBuilder();
final Set<SoftwareModule> swModules = (Set<SoftwareModule>) rolloutItem.getItemProperty(SW_MODULES).getValue();

View File

@@ -24,7 +24,7 @@ import com.vaadin.ui.GridLayout;
* duration in the DurationField or he can configure using the global duration
* by changing the CheckBox.
*/
public class DurationConfigField extends GridLayout implements ConfigurationItem {
public final class DurationConfigField extends GridLayout implements ConfigurationItem {
private static final long serialVersionUID = 1L;
@@ -130,45 +130,96 @@ public class DurationConfigField extends GridLayout implements ConfigurationItem
configurationChangeListeners.add(listener);
}
/**
* Create a DurationConfigFieldBuilder.
*
* @return the builder
*/
public static DurationConfigFieldBuilder builder() {
return new DurationConfigFieldBuilder();
}
public static class DurationConfigFieldBuilder {
/**
* Builder for the calendar widget.
*
*/
public static final class DurationConfigFieldBuilder {
private final DurationConfigField field;
private Duration globalDuration = null;
private Duration tenantDuration = null;
private Duration globalDuration;
private Duration tenantDuration;
private DurationConfigFieldBuilder() {
field = new DurationConfigField();
};
}
/**
* set the checkbox tooltip.
*
* @param label
* the tooltip
* @return the builder
*/
public DurationConfigFieldBuilder checkBoxTooltip(final String label) {
field.setCheckBoxTooltip(label);
return this;
}
/**
* set the global duration.
*
* @param globalDuration
* the global duration
* @return the builder
*/
public DurationConfigFieldBuilder globalDuration(final Duration globalDuration) {
this.globalDuration = globalDuration;
return this;
}
/**
* set the caption.
*
* @param caption
* the caption
* @return the builder
*/
public DurationConfigFieldBuilder caption(final String caption) {
field.setCaption(caption);
return this;
}
/**
* set the range.
*
* @param minDuration
* min duration
* @param maxDuration
* max duration
* @return the builder
*/
public DurationConfigFieldBuilder range(final Duration minDuration, final Duration maxDuration) {
field.setAllowedRange(minDuration, maxDuration);
return this;
}
/**
* set the tenant duration.
*
* @param tenantDuration
* the duration
* @return the builder
*/
public DurationConfigFieldBuilder tenantDuration(final Duration tenantDuration) {
this.tenantDuration = tenantDuration;
return this;
}
/**
* Create the {@link DurationConfigField}.
*
* @return the {@link DurationConfigField}
*/
public DurationConfigField build() {
if (globalDuration == null) {
throw new IllegalStateException(
@@ -178,5 +229,5 @@ public class DurationConfigField extends GridLayout implements ConfigurationItem
field.init(globalDuration, tenantDuration);
return field;
}
};
}
}