Code cleanup (#427)

* Removed dead code.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Fix sonar issues.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
Kai Zimmermann
2017-01-30 11:10:46 +01:00
committed by GitHub
parent d553716cda
commit 59f218e841
54 changed files with 141 additions and 1137 deletions

View File

@@ -9,6 +9,7 @@
package org.eclipse.hawkbit.ui;
import java.io.IOException;
import java.io.InputStream;
import java.util.Locale;
import java.util.Set;
@@ -156,13 +157,14 @@ public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
setContent(rootLayout);
final Resource resource = context
.getResource("classpath:/VAADIN/themes/" + UI.getCurrent().getTheme() + "/layouts/footer.html");
try {
final CustomLayout customLayout = new CustomLayout(resource.getInputStream());
try (InputStream resourceStream = resource.getInputStream()) {
final CustomLayout customLayout = new CustomLayout(resourceStream);
customLayout.setSizeUndefined();
contentVerticalLayout.addComponent(customLayout);
} catch (final IOException ex) {
LOG.error("Footer file is missing", ex);
LOG.error("Footer file cannot be loaded", ex);
}
final Navigator navigator = new Navigator(this, content);
navigator.addViewChangeListener(new ViewChangeListener() {
private static final long serialVersionUID = 1L;

View File

@@ -424,19 +424,11 @@ public class ArtifactDetailsLayout extends VerticalLayout {
/**
* Set title of artifact details header layout.
*/
public void setTitleOfLayoutHeader() {
private void setTitleOfLayoutHeader() {
titleOfArtifactDetails.setValue(HawkbitCommonUtil.getArtifactoryDetailsLabelId(""));
titleOfArtifactDetails.setContentMode(ContentMode.HTML);
}
/**
* Close artifact details layout.
*/
public void closeArtifactDetails() {
removeAllComponents();
setVisible(false);
}
@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final SoftwareModuleEvent softwareModuleEvent) {
if (BaseEntityEventType.SELECTED_ENTITY == softwareModuleEvent.getEventType()) {

View File

@@ -100,8 +100,6 @@ public class UploadLayout extends VerticalLayout {
private UploadConfirmationWindow currentUploadConfirmationwindow;
private VerticalLayout dropAreaLayout;
private final UI ui;
private HorizontalLayout fileUploadLayout;
@@ -309,7 +307,7 @@ public class UploadLayout extends VerticalLayout {
}
private VerticalLayout createDropAreaLayout() {
dropAreaLayout = new VerticalLayout();
final VerticalLayout dropAreaLayout = new VerticalLayout();
final Label dropHereLabel = new Label("Drop files to upload");
dropHereLabel.setWidth(null);
@@ -403,7 +401,7 @@ public class UploadLayout extends VerticalLayout {
}
Boolean validate(final DragAndDropEvent event) {
private Boolean validate(final DragAndDropEvent event) {
// check if drop is valid.If valid ,check if software module is
// selected.
if (!isFilesDropped(event)) {
@@ -446,7 +444,7 @@ public class UploadLayout extends VerticalLayout {
* the current selected sm module
* @return Boolean
*/
public Boolean checkIfFileIsDuplicate(final String name, final SoftwareModule selectedSoftwareModule) {
Boolean checkIfFileIsDuplicate(final String name, final SoftwareModule selectedSoftwareModule) {
Boolean isDuplicate = false;
final String currentBaseSoftwareModuleKey = HawkbitCommonUtil
.getFormattedNameVersion(selectedSoftwareModule.getName(), selectedSoftwareModule.getVersion());
@@ -462,18 +460,18 @@ public class UploadLayout extends VerticalLayout {
return isDuplicate;
}
void decreaseNumberOfFileUploadsExpected() {
private void decreaseNumberOfFileUploadsExpected() {
artifactUploadState.getNumberOfFileUploadsExpected().decrementAndGet();
}
List<String> getDuplicateFileNamesList() {
private List<String> getDuplicateFileNamesList() {
return duplicateFileNamesList;
}
/**
* Update pending action count.
*/
void updateActionCount() {
private void updateActionCount() {
if (!artifactUploadState.getFileSelected().isEmpty()) {
processBtn.setCaption(SPUILabelDefinitions.PROCESS + "<div class='unread'>"
+ artifactUploadState.getFileSelected().size() + HTML_DIV);
@@ -482,7 +480,7 @@ public class UploadLayout extends VerticalLayout {
}
}
void displayDuplicateValidationMessage() {
private void displayDuplicateValidationMessage() {
// check if streaming of all dropped files are completed
if (artifactUploadState.getNumberOfFilesActuallyUpload().intValue() == artifactUploadState
.getNumberOfFileUploadsExpected().intValue()) {
@@ -505,18 +503,11 @@ public class UploadLayout extends VerticalLayout {
return message.toString();
}
/**
* Show the duplicated message.
*/
public void showDuplicateMessage() {
uiNotification.displayValidationError(getDuplicateFileValidationMessage());
}
void increaseNumberOfFileUploadsExpected() {
artifactUploadState.getNumberOfFileUploadsExpected().incrementAndGet();
}
void updateFileSize(final String name, final long size, final SoftwareModule selectedSoftwareModule) {
private void updateFileSize(final String name, final long size, final SoftwareModule selectedSoftwareModule) {
final String currentBaseSoftwareModuleKey = HawkbitCommonUtil
.getFormattedNameVersion(selectedSoftwareModule.getName(), selectedSoftwareModule.getVersion());
@@ -530,18 +521,18 @@ public class UploadLayout extends VerticalLayout {
}
}
void increaseNumberOfFilesActuallyUpload() {
private void increaseNumberOfFilesActuallyUpload() {
artifactUploadState.getNumberOfFilesActuallyUpload().incrementAndGet();
}
void increaseNumberOfFileUploadsFailed() {
private void increaseNumberOfFileUploadsFailed() {
artifactUploadState.getNumberOfFileUploadsFailed().incrementAndGet();
}
/**
* Enable process button once upload is completed.
*/
boolean enableProcessBtn() {
private boolean enableProcessBtn() {
if (artifactUploadState.getNumberOfFilesActuallyUpload().intValue() >= artifactUploadState
.getNumberOfFileUploadsExpected().intValue() && !getFileSelected().isEmpty()) {
processBtn.setEnabled(true);
@@ -652,13 +643,6 @@ public class UploadLayout extends VerticalLayout {
this.currentUploadConfirmationwindow = currentUploadConfirmationwindow;
}
/**
* @return
*/
VerticalLayout getDropAreaLayout() {
return dropAreaLayout;
}
private void onStartOfUpload() {
setUploadStatusButtonIconToInProgress();
if (artifactUploadState.isStatusPopupMinimized()) {
@@ -752,23 +736,10 @@ public class UploadLayout extends VerticalLayout {
}
}
/**
* set upload status and confirmation window.
*
* @param newWidth
* browser width
* @param newHeight
* browser height
*/
public void setUploadPopupSize(final float newWidth, final float newHeight) {
setConfirmationPopupHeightWidth(newWidth, newHeight);
setResultPopupHeightWidth(newWidth, newHeight);
}
/**
* @param selectedBaseSoftwareModule
*/
public void refreshArtifactDetailsLayout(final SoftwareModule selectedBaseSoftwareModule) {
void refreshArtifactDetailsLayout(final SoftwareModule selectedBaseSoftwareModule) {
eventBus.publish(this,
new SoftwareModuleEvent(SoftwareModuleEventType.ARTIFACTS_CHANGED, selectedBaseSoftwareModule));
}
@@ -799,7 +770,7 @@ public class UploadLayout extends VerticalLayout {
uploadStatusButton.setVisible(false);
}
void updateStatusButtonCount() {
private void updateStatusButtonCount() {
final int uploadsPending = artifactUploadState.getNumberOfFileUploadsExpected().get()
- artifactUploadState.getNumberOfFilesActuallyUpload().get();
final int uploadsFailed = artifactUploadState.getNumberOfFileUploadsFailed().get();
@@ -830,7 +801,7 @@ public class UploadLayout extends VerticalLayout {
updateStatusButtonCount();
}
protected void hideUploadStatusButton() {
private void hideUploadStatusButton() {
if (uploadStatusButton == null) {
return;
}

View File

@@ -1,20 +0,0 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.ui.common.confirmwindow.layout;
/**
* Confirm window action events.
*
*
*
*
*/
public enum ConfirmationWindowEvents {
DISCARD_DELETE_SOFTWARE_TYPE, DISCARD_ALL_DELETE_SOFTWARE_TYPE, DELETE_ALL_SOFWARE_TYPE, DISCARD_DELETE_DIST_TYPE, DISCARD_ALL_DELETE_DIST_TYPE, DELETE_ALL_DIST_TYPE, DISCARD_DELETE_SOFTWARE_MODULE, DISCARD_ALL_DELETE_SOFTWARE_MODULE, DELETE_ALL_SOFTWARE_MODULE, DISCARD_DELETE_DISTRIBUTION, DISCARD_ALL_DELETE_DISTRIBUTION, DELETE_ALL_DISTRIBUTION, DISCARD_DELETE_TARGET, DISCARD_ALL_DELETE_TARGET, DELETE_ALL_TARGET, SAVED_ASSIGNMENTS, DISCARD_ALL_ASSIGNMENTS, DISCARD_ASSIGNMENTS
}

View File

@@ -25,7 +25,6 @@ import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventBus.UIEventBus;
import com.vaadin.server.FontAwesome;
@@ -48,8 +47,6 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
private final I18N i18n;
private final transient EventBus.UIEventBus eventBus;
private final SpPermissionChecker permissionChecker;
private T selectedBaseEntity;
@@ -75,7 +72,6 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
protected AbstractTableDetailsLayout(final I18N i18n, final UIEventBus eventBus,
final SpPermissionChecker permissionChecker, final ManagementUIState managementUIState) {
this.i18n = i18n;
this.eventBus = eventBus;
this.permissionChecker = permissionChecker;
this.managementUIState = managementUIState;
detailsLayout = getTabLayout();
@@ -91,10 +87,6 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
return permissionChecker;
}
protected EventBus.UIEventBus getEventBus() {
return eventBus;
}
protected I18N getI18n() {
return i18n;
}

View File

@@ -183,7 +183,7 @@ public abstract class AbstractTable<E extends NamedEntity, I> extends Table impl
}
}
protected void applyMaxTableSettings() {
private void applyMaxTableSettings() {
setColumnProperties();
setValue(null);
setSelectable(false);
@@ -192,7 +192,7 @@ public abstract class AbstractTable<E extends NamedEntity, I> extends Table impl
setColumnCollapsingAllowed(true);
}
protected void applyMinTableSettings() {
private void applyMinTableSettings() {
setDefault();
setColumnProperties();
selectRow();

View File

@@ -57,7 +57,7 @@ public class NotificationUnreadButton extends Button {
* i18n
*/
@Autowired
public NotificationUnreadButton(final I18N i18n) {
NotificationUnreadButton(final I18N i18n) {
this.i18n = i18n;
this.unreadNotifications = new ConcurrentHashMap<>();
setIcon(FontAwesome.BELL);

View File

@@ -1,29 +0,0 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.ui.decorators;
import com.vaadin.ui.HorizontalLayout;
/**
*
*
* Ui header layout decorater.
*/
@FunctionalInterface
public interface HeaderLayoutDecorator {
/**
* decorate the header
*
* @param layout
* the layout
* @return the decorated layout
*/
HorizontalLayout decorate(HorizontalLayout layout);
}

View File

@@ -1,46 +0,0 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.ui.decorators;
import com.vaadin.server.Resource;
import com.vaadin.ui.Button;
import com.vaadin.ui.themes.ValoTheme;
/**
*
* Large icon button created to show or hide button.
*
*
*
*
*
*/
public class SPUIButtonStyleLargeIconNoBorder implements SPUIButtonDecorator {
/**
* {@inheritDoc}
*/
@Override
public Button decorate(Button button, String style, boolean setStyle, Resource icon) {
button.addStyleName(ValoTheme.BUTTON_LARGE);
button.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
button.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
if (setStyle && style != null) {
button.addStyleName(style);
}
button.setWidthUndefined();
// Set icon
if (null != icon) {
button.setIcon(icon);
}
return button;
}
}

View File

@@ -1,40 +0,0 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.ui.decorators;
import com.vaadin.server.Resource;
import com.vaadin.ui.Button;
import com.vaadin.ui.themes.ValoTheme;
/**
* Style for button: Primary.
*/
public class SPUIButtonStylePrimarySmall implements SPUIButtonDecorator {
@Override
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
button.addStyleName(ValoTheme.BUTTON_PRIMARY + " " + ValoTheme.BUTTON_SMALL);
// Set Style
if (null != style) {
if (setStyle) {
button.setStyleName(style);
} else {
button.addStyleName(style);
}
}
// Set icon
if (null != icon) {
button.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
button.setIcon(icon);
}
return button;
}
}

View File

@@ -1,43 +0,0 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.ui.decorators;
import com.vaadin.server.Resource;
import com.vaadin.ui.Button;
import com.vaadin.ui.themes.ValoTheme;
/**
* Style for button: Small NoBorder Height and size UnDefined.
*
*/
public class SPUIButtonStyleSmallNoBorderUHS implements SPUIButtonDecorator {
@Override
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
button.addStyleName(ValoTheme.BUTTON_SMALL);
button.addStyleName(ValoTheme.BUTTON_BORDERLESS);
button.setHeightUndefined();
button.setSizeUndefined();
// Set Style
if (null != style) {
if (setStyle) {
button.setStyleName(style);
} else {
button.addStyleName(style);
}
}
// Set icon
if (null != icon) {
button.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
button.setIcon(icon);
}
return button;
}
}

View File

@@ -1,68 +0,0 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.ui.decorators;
import com.vaadin.server.ThemeResource;
import com.vaadin.ui.Embedded;
/**
* Embedded with required style.
*
*
*
*/
public final class SPUIEmbedDecorator {
/**
* Private Constructor.
*/
private SPUIEmbedDecorator() {
}
/**
* Decorate.
*
* @param spUIEmbdValue
* as DTO
* @return Embedded as UI
*/
public static Embedded decorate(final SPUIEmbedValue spUIEmbdValue) {
final Embedded spUIEmbd = new Embedded();
spUIEmbd.setImmediate(spUIEmbdValue.isImmediate());
spUIEmbd.setType(spUIEmbdValue.getType());
if (null != spUIEmbdValue.getId()) {
spUIEmbd.setId(spUIEmbdValue.getId());
}
if (null != spUIEmbdValue.getData()) {
spUIEmbd.setData(spUIEmbdValue.getData());
}
if (null != spUIEmbdValue.getStyleName()) {
spUIEmbd.setStyleName(spUIEmbdValue.getStyleName());
}
if (null != spUIEmbdValue.getSource()) {
spUIEmbd.setSource(new ThemeResource(spUIEmbdValue.getSource()));
}
if (null != spUIEmbdValue.getMimeType()) {
spUIEmbd.setMimeType(spUIEmbdValue.getMimeType());
}
if (null != spUIEmbdValue.getDescription()) {
spUIEmbd.setDescription(spUIEmbdValue.getDescription());
}
return spUIEmbd;
}
}

View File

@@ -42,7 +42,7 @@ public abstract class CreateUpdateTypeLayout<E extends NamedEntity> extends Abst
protected TextField typeKey;
public static final String TYPE_NAME_DYNAMIC_STYLE = "new-tag-name";
private static final String TYPE_NAME_DYNAMIC_STYLE = "new-tag-name";
private static final String TYPE_DESC_DYNAMIC_STYLE = "new-tag-desc";
public CreateUpdateTypeLayout(final I18N i18n, final TagManagement tagManagement, final EntityFactory entityFactory,
@@ -94,7 +94,7 @@ public abstract class CreateUpdateTypeLayout<E extends NamedEntity> extends Abst
* @param tagDesc
* @param taregtTagColor
*/
protected void createDynamicStyleForComponents(final TextField tagName, final TextField typeKey,
private void createDynamicStyleForComponents(final TextField tagName, final TextField typeKey,
final TextArea typeDesc, final String typeTagColor) {
tagName.removeStyleName(SPUIDefinitions.TYPE_NAME);

View File

@@ -9,6 +9,7 @@
package org.eclipse.hawkbit.ui.login;
import java.io.IOException;
import java.io.InputStream;
import org.eclipse.hawkbit.ui.DefaultHawkbitUI;
import org.eclipse.hawkbit.ui.HawkbitUI;
@@ -70,12 +71,13 @@ public class HawkbitLoginUI extends DefaultHawkbitUI {
rootLayout.setExpandRatio(content, 2.0F);
final Resource resource = context
.getResource("classpath:/VAADIN/themes/" + UI.getCurrent().getTheme() + "/layouts/footer.html");
try {
final CustomLayout customLayout = new CustomLayout(resource.getInputStream());
try (InputStream resourceStream = resource.getInputStream()) {
final CustomLayout customLayout = new CustomLayout(resourceStream);
customLayout.setSizeUndefined();
rootLayout.addComponent(customLayout);
} catch (final IOException ex) {
LOG.error("Footer file is missing", ex);
LOG.error("Footer file cannot be loaded", ex);
}
setContent(rootLayout);

View File

@@ -24,14 +24,7 @@ public final class DeleteActionsLayoutHelper {
}
/**
* Checks if component is a target tag.
*
* @param source
* Component dropped
* @return true if it component is target tag
*/
public static boolean isTargetTag(final Component source) {
static boolean isTargetTag(final Component source) {
if (source instanceof DragAndDropWrapper) {
final String wrapperData = ((DragAndDropWrapper) source).getData().toString();
final String id = wrapperData.replace(SPUIDefinitions.TARGET_TAG_BUTTON, "");
@@ -42,14 +35,7 @@ public final class DeleteActionsLayoutHelper {
return false;
}
/**
* Checks if component is distribution tag.
*
* @param source
* component dropped
* @return true if it component is distribution tag
*/
public static boolean isDistributionTag(final Component source) {
static boolean isDistributionTag(final Component source) {
if (source instanceof DragAndDropWrapper) {
final String wrapperData = ((DragAndDropWrapper) source).getData().toString();
final String id = wrapperData.replace(SPUIDefinitions.DISTRIBUTION_TAG_BUTTON, "");
@@ -58,62 +44,27 @@ public final class DeleteActionsLayoutHelper {
return false;
}
/**
* Extract the ds tag id by the drag and drop component
*
* @param source
* the source
* @return the ds tag id
*/
public static Long getDistributionTagId(final DragAndDropWrapper source) {
static Long getDistributionTagId(final DragAndDropWrapper source) {
final String wrapperData = source.getData().toString();
final String id = wrapperData.replace(SPUIDefinitions.DISTRIBUTION_TAG_BUTTON, "");
return Long.valueOf(id.trim());
}
/**
* Extract the target tag id by the drag and drop component
*
* @param source
* the source
* @return the target tag id
*/
public static Long getTargetTagId(final DragAndDropWrapper source) {
static Long getTargetTagId(final DragAndDropWrapper source) {
final String wrapperData = source.getData().toString();
final String id = wrapperData.replace(SPUIDefinitions.TARGET_TAG_BUTTON, "");
return Long.valueOf(id.trim());
}
/**
* Checks if component is target table.
*
* @param source
* component dropped
* @return true if it component is target table
*/
public static boolean isTargetTable(final Component source) {
static boolean isTargetTable(final Component source) {
return UIComponentIdProvider.TARGET_TABLE_ID.equalsIgnoreCase(source.getId());
}
/**
* Checks id component is distribution table.
*
* @param source
* component dropped
* @return true if it component is distribution table
*/
public static boolean isDistributionTable(final Component source) {
static boolean isDistributionTable(final Component source) {
return UIComponentIdProvider.DIST_TABLE_ID.equalsIgnoreCase(source.getId());
}
/**
* Check if dropped component can be deleted.
*
* @param source
* component dropped
* @return true if component can be deleted
*/
public static Boolean isComponentDeletable(final Component source) {
static Boolean isComponentDeletable(final Component source) {
return isTargetTable(source) || isDistributionTable(source) || isTargetTag(source) || isDistributionTag(source);
}

View File

@@ -256,23 +256,6 @@ public class ManagementUIState implements ManagmentEntityState<DistributionSetId
this.targetsCountAll.set(targetsCountAll);
}
/**
* increments the targets all counter.
*/
public void incrementTargetsCountAll() {
targetsCountAll.incrementAndGet();
}
/**
* decrement the targets all counter.
*/
public void decrementTargetsCountAll() {
final long decrementAndGet = targetsCountAll.decrementAndGet();
if (decrementAndGet < 0) {
targetsCountAll.set(0);
}
}
public boolean isDsTableMaximized() {
return dsTableMaximized;
}

View File

@@ -1,142 +0,0 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.ui.management.state;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.VaadinSessionScope;
/**
* Holds the filter parameters for target table.
*
*
*/
@SpringComponent
@VaadinSessionScope
public class TargetFilterParameters implements Serializable {
private static final long serialVersionUID = 3929484222793744883L;
private String searchText;
private final List<TargetUpdateStatus> status = new ArrayList<>();
private List<String> targetTags = new ArrayList<>();
private Long distributionSetId;
private Long pinnedDistId;
/**
* Get search Text.
*
* @return string as search text
*/
public String getSearchText() {
return searchText;
}
/**
* Set Search Text.
*
* @param searchText
* as string
*/
public void setSearchText(final String searchText) {
this.searchText = searchText;
}
/**
* Get update status.
*
* @return TargetUpdateStatus
*/
public List<TargetUpdateStatus> getStatus() {
return status;
}
/**
* Adds Target update status.
*
* @param status
* as Target update
*/
public void addStatus(final TargetUpdateStatus status) {
this.status.add(status);
}
/**
* Remoces Target update status.
*
* @param status
* as Target update
*/
public void removeStatus(final TargetUpdateStatus status) {
this.status.remove(status);
}
/**
* Get Target Tags.
*
* @return List of Tags
*/
public List<String> getTargetTags() {
return targetTags;
}
/**
* Set Target Tags.
*
* @param targetTags
* as tags
*/
public void setTargetTags(final List<String> targetTags) {
this.targetTags = targetTags;
}
/**
* Get Distribution ID.
*
* @return Dist ID
*/
public Long getDistributionSetId() {
return distributionSetId;
}
/**
* Set distribution ID.
*
* @param distributionSetId
* as ID
*/
public void setDistributionSetId(final Long distributionSetId) {
this.distributionSetId = distributionSetId;
}
/**
* @return Returns the pinnedDistId.
*/
public Long getPinnedDistId() {
return pinnedDistId;
}
/**
* @param pinnedDistId
* The pinned distribution set Id to set.
*/
public void setPinnedDistId(final Long pinnedDistId) {
this.pinnedDistId = pinnedDistId;
}
}

View File

@@ -84,7 +84,7 @@ public class BulkUploadHandler extends CustomComponent
private final transient DeploymentManagement deploymentManagement;
private final transient DistributionSetManagement distributionSetManagement;
protected File tempFile;
private File tempFile;
private Upload upload;
private final ProgressBar progressBar;
@@ -101,7 +101,7 @@ public class BulkUploadHandler extends CustomComponent
private transient EntityFactory entityFactory;
private final UI uiInstance;
BulkUploadHandler(final TargetBulkUpdateWindowLayout targetBulkUpdateWindowLayout,
public BulkUploadHandler(final TargetBulkUpdateWindowLayout targetBulkUpdateWindowLayout,
final TargetManagement targetManagement, final ManagementUIState managementUIState,
final DeploymentManagement deploymentManagement, final I18N i18n, final UI uiInstance) {
this.uiInstance = uiInstance;
@@ -121,10 +121,7 @@ public class BulkUploadHandler extends CustomComponent
entityFactory = SpringContextHelper.getBean(EntityFactory.class);
}
/**
* Intialize layout.
*/
public void buildLayout() {
void buildLayout() {
final HorizontalLayout horizontalLayout = new HorizontalLayout();
upload = new Upload();
upload.setEnabled(false);
@@ -162,21 +159,11 @@ public class BulkUploadHandler extends CustomComponent
@Override
public void uploadSucceeded(final SucceededEvent event) {
executor.execute(new UploadAsync(event));
executor.execute(new UploadAsync());
}
class UploadAsync implements Runnable {
final SucceededEvent event;
/**
*
* @param event
*/
public UploadAsync(final SucceededEvent event) {
this.event = event;
}
@Override
public void run() {
if (tempFile == null) {

View File

@@ -16,7 +16,7 @@ import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
import org.eclipse.hawkbit.ui.management.event.TargetFilterEvent;
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIButtonDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventBus.UIEventBus;
@@ -70,13 +70,13 @@ public class FilterByStatusLayout extends VerticalLayout implements Button.Click
/**
* Initialize the Status Layout Component.
*/
public void init() {
void init() {
getFilterTargetsStatusLayout();
restorePreviousState();
eventBus.subscribe(this);
}
public void getFilterTargetsStatusLayout() {
private void getFilterTargetsStatusLayout() {
getTargetFilterStatuses();
@@ -150,22 +150,22 @@ public class FilterByStatusLayout extends VerticalLayout implements Button.Click
private void getTargetFilterStatuses() {
unknown = SPUIComponentProvider.getButton(UIComponentIdProvider.UNKNOWN_STATUS_ICON,
TargetUpdateStatus.UNKNOWN.toString(), i18n.get("tooltip.status.unknown"),
SPUIButtonDefinitions.SP_BUTTON_STATUS_STYLE, false, FontAwesome.SQUARE, SPUIButtonStyleSmall.class);
SPUIDefinitions.SP_BUTTON_STATUS_STYLE, false, FontAwesome.SQUARE, SPUIButtonStyleSmall.class);
inSync = SPUIComponentProvider.getButton(UIComponentIdProvider.INSYNCH_STATUS_ICON,
TargetUpdateStatus.IN_SYNC.toString(), i18n.get("tooltip.status.insync"),
SPUIButtonDefinitions.SP_BUTTON_STATUS_STYLE, false, FontAwesome.SQUARE, SPUIButtonStyleSmall.class);
SPUIDefinitions.SP_BUTTON_STATUS_STYLE, false, FontAwesome.SQUARE, SPUIButtonStyleSmall.class);
pending = SPUIComponentProvider.getButton(UIComponentIdProvider.PENDING_STATUS_ICON,
TargetUpdateStatus.PENDING.toString(), i18n.get("tooltip.status.pending"),
SPUIButtonDefinitions.SP_BUTTON_STATUS_STYLE, false, FontAwesome.SQUARE, SPUIButtonStyleSmall.class);
SPUIDefinitions.SP_BUTTON_STATUS_STYLE, false, FontAwesome.SQUARE, SPUIButtonStyleSmall.class);
error = SPUIComponentProvider.getButton(UIComponentIdProvider.ERROR_STATUS_ICON,
TargetUpdateStatus.ERROR.toString(), i18n.get("tooltip.status.error"),
SPUIButtonDefinitions.SP_BUTTON_STATUS_STYLE, false, FontAwesome.SQUARE, SPUIButtonStyleSmall.class);
SPUIDefinitions.SP_BUTTON_STATUS_STYLE, false, FontAwesome.SQUARE, SPUIButtonStyleSmall.class);
registered = SPUIComponentProvider.getButton(UIComponentIdProvider.REGISTERED_STATUS_ICON,
TargetUpdateStatus.REGISTERED.toString(), i18n.get("tooltip.status.registered"),
SPUIButtonDefinitions.SP_BUTTON_STATUS_STYLE, false, FontAwesome.SQUARE, SPUIButtonStyleSmall.class);
SPUIDefinitions.SP_BUTTON_STATUS_STYLE, false, FontAwesome.SQUARE, SPUIButtonStyleSmall.class);
overdue = SPUIComponentProvider.getButton(UIComponentIdProvider.OVERDUE_STATUS_ICON, OVERDUE_CAPTION,
i18n.get("tooltip.status.overdue"), SPUIButtonDefinitions.SP_BUTTON_STATUS_STYLE, false,
FontAwesome.SQUARE, SPUIButtonStyleSmall.class);
i18n.get("tooltip.status.overdue"), SPUIDefinitions.SP_BUTTON_STATUS_STYLE, false, FontAwesome.SQUARE,
SPUIButtonStyleSmall.class);
applyStatusBtnStyle();
unknown.setData("filterStatusOne");
inSync.setData("filterStatusTwo");

View File

@@ -204,16 +204,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
}
}
/**
* Get the window.
*
* @param rolloutId
* the rollout id
* @param copy
* whether the rollout should be copied
* @return the window
*/
public CommonDialogWindow getWindow(final Long rolloutId, final boolean copy) {
CommonDialogWindow getWindow(final Long rolloutId, final boolean copy) {
resetComponents();
window = createWindow();
populateData(rolloutId, copy);
@@ -239,7 +230,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
/**
* Reset the field values.
*/
public void resetComponents() {
private void resetComponents() {
defineGroupsLayout.resetComponents();
editRolloutEnabled = false;
rolloutName.clear();
@@ -378,8 +369,8 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
}
private void displayValidationStatus(DefineGroupsLayout.ValidationStatus status) {
if(status == DefineGroupsLayout.ValidationStatus.LOADING) {
private void displayValidationStatus(final DefineGroupsLayout.ValidationStatus status) {
if (status == DefineGroupsLayout.ValidationStatus.LOADING) {
groupsLegendLayout.displayLoading();
} else {
validateGroups();
@@ -387,17 +378,17 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
}
private TabSheet createGroupDefinitionTabs() {
TabSheet tabSheet = new TabSheet();
final TabSheet tabSheet = new TabSheet();
tabSheet.setId(UIComponentIdProvider.ROLLOUT_GROUPS);
tabSheet.setWidth(850, Unit.PIXELS);
tabSheet.setHeight(300, Unit.PIXELS);
tabSheet.setStyleName(SPUIStyleDefinitions.ROLLOUT_GROUPS);
TabSheet.Tab simpleTab = tabSheet.addTab(createSimpleGroupDefinitionTab(),
final TabSheet.Tab simpleTab = tabSheet.addTab(createSimpleGroupDefinitionTab(),
i18n.get("caption.rollout.tabs.simple"));
simpleTab.setId(UIComponentIdProvider.ROLLOUT_SIMPLE_TAB);
TabSheet.Tab advancedTab = tabSheet.addTab(defineGroupsLayout, i18n.get("caption.rollout.tabs.advanced"));
final TabSheet.Tab advancedTab = tabSheet.addTab(defineGroupsLayout, i18n.get("caption.rollout.tabs.advanced"));
advancedTab.setId(UIComponentIdProvider.ROLLOUT_ADVANCED_TAB);
tabSheet.addSelectedTabChangeListener(event -> validateGroups());
@@ -418,7 +409,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
}
private GridLayout createSimpleGroupDefinitionTab() {
GridLayout layout = new GridLayout();
final GridLayout layout = new GridLayout();
layout.setSpacing(true);
layout.setColumns(3);
layout.setRows(4);
@@ -489,20 +480,20 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
}
private void validateGroups() {
if(editRolloutEnabled) {
if (editRolloutEnabled) {
return;
}
if(isGroupsDefinition()) {
List<RolloutGroupCreate> savedRolloutGroups = defineGroupsLayout.getSavedRolloutGroups();
if(!defineGroupsLayout.isValid() || savedRolloutGroups == null || savedRolloutGroups.isEmpty()) {
if (isGroupsDefinition()) {
final List<RolloutGroupCreate> savedRolloutGroups = defineGroupsLayout.getSavedRolloutGroups();
if (!defineGroupsLayout.isValid() || savedRolloutGroups == null || savedRolloutGroups.isEmpty()) {
noOfGroups.clear();
} else {
noOfGroups.setValue(String.valueOf(savedRolloutGroups.size()));
}
updateGroupsChart(defineGroupsLayout.getGroupsValidation());
}
if(isNumberOfGroups()) {
if(noOfGroups.isValid() && !noOfGroups.getValue().isEmpty()) {
if (isNumberOfGroups()) {
if (noOfGroups.isValid() && !noOfGroups.getValue().isEmpty()) {
updateGroupsChart(Integer.parseInt(noOfGroups.getValue()));
} else {
updateGroupsChart(0);
@@ -512,12 +503,12 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
}
private void updateGroupsChart(final RolloutGroupsValidation validation) {
if(validation == null) {
if (validation == null) {
groupsPieChart.setChartState(null, null);
return;
}
List<Long> targetsPerGroup = validation.getTargetsPerGroup();
if(validation.getTotalTargets() == 0L || targetsPerGroup.isEmpty()) {
final List<Long> targetsPerGroup = validation.getTargetsPerGroup();
if (validation.getTotalTargets() == 0L || targetsPerGroup.isEmpty()) {
groupsPieChart.setChartState(null, null);
} else {
groupsPieChart.setChartState(targetsPerGroup, validation.getTotalTargets());
@@ -529,8 +520,8 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
}
private void updateGroupsChart(final List<RolloutGroup> savedGroups, long totalTargetsCount) {
List<Long> targetsPerGroup = savedGroups.stream().map(group -> (long) group.getTotalTargets())
private void updateGroupsChart(final List<RolloutGroup> savedGroups, final long totalTargetsCount) {
final List<Long> targetsPerGroup = savedGroups.stream().map(group -> (long) group.getTotalTargets())
.collect(Collectors.toList());
groupsPieChart.setChartState(targetsPerGroup, totalTargetsCount);
@@ -545,8 +536,8 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
final List<Long> groups = new ArrayList<>(amountOfGroups);
long leftTargets = totalTargetsCount;
for (int i = 0; i < amountOfGroups; i++) {
float percentage = 1.0F / (amountOfGroups - i);
long targetsInGroup = Math.round(percentage * (double) leftTargets);
final float percentage = 1.0F / (amountOfGroups - i);
final long targetsInGroup = Math.round(percentage * (double) leftTargets);
leftTargets -= targetsInGroup;
groups.add(targetsInGroup);
}
@@ -589,7 +580,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
private void populateTargetFilterQuery(final Rollout rollout) {
final Page<TargetFilterQuery> filterQueries = targetFilterQueryManagement
.findTargetFilterQueryByQuery(new PageRequest(0, 1), rollout.getTargetFilterQuery());
if(filterQueries.getTotalElements() > 0) {
if (filterQueries.getTotalElements() > 0) {
final TargetFilterQuery filterQuery = filterQueries.getContent().get(0);
targetFilterQueryCombo.setValue(filterQuery.getName());
}
@@ -611,7 +602,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
final DistributionSetIdName distributionSetIdName = (DistributionSetIdName) distributionSet.getValue();
RolloutUpdate rolloutUpdate = entityFactory.rollout().update(rollout.getId()).name(rolloutName.getValue())
final RolloutUpdate rolloutUpdate = entityFactory.rollout().update(rollout.getId()).name(rolloutName.getValue())
.description(description.getValue()).set(distributionSetIdName.getId()).actionType(getActionType())
.forcedTime(getForcedTimeStamp());
@@ -630,8 +621,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
private boolean duplicateCheckForEdit() {
final String rolloutNameVal = getRolloutName();
if (!rollout.getName().equals(rolloutNameVal)
&& rolloutManagement.findRolloutByName(rolloutNameVal) != null) {
if (!rollout.getName().equals(rolloutNameVal) && rolloutManagement.findRolloutByName(rolloutNameVal) != null) {
uiNotification.displayValidationError(i18n.get("message.rollout.duplicate.check", rolloutNameVal));
return false;
}
@@ -690,7 +680,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
if (isNumberOfGroups()) {
return rolloutManagement.createRollout(rolloutCreate, amountGroup, conditions);
} else if (isGroupsDefinition()) {
List<RolloutGroupCreate> groups = defineGroupsLayout.getSavedRolloutGroups();
final List<RolloutGroupCreate> groups = defineGroupsLayout.getSavedRolloutGroups();
return rolloutManagement.createRollout(rolloutCreate, groups, conditions);
}
@@ -719,8 +709,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
private boolean duplicateCheck() {
if (rolloutManagement.findRolloutByName(getRolloutName()) != null) {
uiNotification.displayValidationError(
i18n.get("message.rollout.duplicate.check", getRolloutName()));
uiNotification.displayValidationError(i18n.get("message.rollout.duplicate.check", getRolloutName()));
return false;
}
return true;
@@ -766,7 +755,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
}
private void onGroupNumberChange(final ValueChangeEvent event) {
if(editRolloutEnabled) {
if (editRolloutEnabled) {
return;
}
if (event.getProperty().getValue() != null && noOfGroups.isValid() && totalTargetsCount != null
@@ -776,7 +765,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
updateGroupsChart(Integer.parseInt(noOfGroups.getValue()));
} else {
groupSizeLabel.setVisible(false);
if(isNumberOfGroups()) {
if (isNumberOfGroups()) {
updateGroupsChart(0);
}
}

View File

@@ -47,7 +47,7 @@ public class AutoStartOptionGroupLayout extends HorizontalLayout {
* @param i18n
* the internationalization helper
*/
public AutoStartOptionGroupLayout(final I18N i18n) {
AutoStartOptionGroupLayout(final I18N i18n) {
this.i18n = i18n;
createOptionGroup();
@@ -138,18 +138,14 @@ public class AutoStartOptionGroupLayout extends HorizontalLayout {
addComponent(startAtDateField);
}
/**
* To Set Default option for save.
*/
public void selectDefaultOption() {
void selectDefaultOption() {
autoStartOptionGroup.select(AutoStartOption.MANUAL);
}
/**
* Rollout start options
*/
public enum AutoStartOption {
enum AutoStartOption {
MANUAL, AUTO_START, SCHEDULED;
}

View File

@@ -36,7 +36,7 @@ public class RolloutGroupTargetsCountLabelMessage extends Label {
private final I18N i18n;
public RolloutGroupTargetsCountLabelMessage(final RolloutUIState rolloutUIState,
RolloutGroupTargetsCountLabelMessage(final RolloutUIState rolloutUIState,
final RolloutGroupTargetsListGrid rolloutGroupTargetsListGrid, final I18N i18n, final UIEventBus eventBus) {
this.rolloutUIState = rolloutUIState;
this.rolloutGroupTargetsListGrid = rolloutGroupTargetsListGrid;
@@ -53,16 +53,12 @@ public class RolloutGroupTargetsCountLabelMessage extends Label {
* @param event
*/
@EventBusListenerMethod(scope = EventScope.UI)
public void onEvent(final RolloutEvent event) {
void onEvent(final RolloutEvent event) {
if (event == RolloutEvent.SHOW_ROLLOUT_GROUP_TARGETS_COUNT) {
displayRolloutGroupTargetMessage();
}
}
/**
*
*/
private void applyStyle() {
/* Create label for Targets count message displaying below the table */
addStyleName(SPUILabelDefinitions.SP_LABEL_MESSAGE_STYLE);

View File

@@ -42,9 +42,9 @@ public class DefaultDistributionSetTypeLayout extends BaseConfigurationView {
private TenantMetaData tenantMetaData;
final ComboBox combobox;
private final ComboBox combobox;
final Label changeIcon;
private final Label changeIcon;
DefaultDistributionSetTypeLayout(final SystemManagement systemManagement,
final DistributionSetManagement distributionSetManagement, final I18N i18n,
@@ -131,7 +131,7 @@ public class DefaultDistributionSetTypeLayout extends BaseConfigurationView {
/**
* Method that is called when combobox event is performed.
*/
public void selectDistributionSetValue() {
private void selectDistributionSetValue() {
selectedDefaultDisSetType = (Long) combobox.getValue();
if (!selectedDefaultDisSetType.equals(currentDefaultDisSetType)) {
changeIcon.setVisible(true);

View File

@@ -22,8 +22,6 @@ public final class HawkbitTheme {
public static final String LOGIN_UI_PATH = "/login";
public static final String HAWKBIT_UI_PATH = "";
/**
* private constructor, utility class.
*/

View File

@@ -42,10 +42,7 @@ import com.vaadin.ui.Table;
*/
public final class HawkbitCommonUtil {
public static final String SP_STRING_PIPE = " | ";
/**
* Html span.
*/
public static final String SPAN_CLOSE = "</span>";
public static final String HTML_LI_CLOSE_TAG = "</li>";
public static final String HTML_LI_OPEN_TAG = "<li>";
public static final String HTML_UL_CLOSE_TAG = "</ul>";
@@ -217,14 +214,7 @@ public final class HawkbitCommonUtil {
return trimAndNullIfEmpty(orgText) == null ? SPUIDefinitions.SPACE : orgText;
}
/**
* Find required extra width of software module.
*
* @param newBrowserWidth
* new browser width
* @return float width of software module table
*/
public static float findRequiredSwModuleExtraWidth(final float newBrowserWidth) {
private static float findRequiredSwModuleExtraWidth(final float newBrowserWidth) {
return newBrowserWidth > SPUIDefinitions.REQ_MIN_UPLOAD_BROWSER_WIDTH
? (newBrowserWidth - SPUIDefinitions.REQ_MIN_UPLOAD_BROWSER_WIDTH) : 0;
}
@@ -520,52 +510,13 @@ public final class HawkbitCommonUtil {
}
}
/**
* Set status progress bar value.
*
* @param bar
* DistributionBar
* @param statusName
* status name
* @param count
* target counts in a status
* @param index
* bar part index
*/
public static void setBarPartSize(final DistributionBar bar, final String statusName, final int count,
private static void setBarPartSize(final DistributionBar bar, final String statusName, final int count,
final int index) {
bar.setPartSize(index, count);
bar.setPartTooltip(index, statusName);
bar.setPartStyleName(index, "status-bar-part-" + statusName);
}
/**
* Initialize status progress bar with values and number of parts on load.
*
* @param bar
* DistributionBar
* @param item
* row of a table
*/
public static void initialiseProgressBar(final DistributionBar bar, final Item item) {
final Long notStartedTargetsCount = getStatusCount(SPUILabelDefinitions.VAR_COUNT_TARGETS_NOT_STARTED, item);
final Long runningTargetsCount = getStatusCount(SPUILabelDefinitions.VAR_COUNT_TARGETS_RUNNING, item);
final Long scheduledTargetsCount = getStatusCount(SPUILabelDefinitions.VAR_COUNT_TARGETS_SCHEDULED, item);
final Long errorTargetsCount = getStatusCount(SPUILabelDefinitions.VAR_COUNT_TARGETS_ERROR, item);
final Long finishedTargetsCount = getStatusCount(SPUILabelDefinitions.VAR_COUNT_TARGETS_FINISHED, item);
final Long cancelledTargetsCount = getStatusCount(SPUILabelDefinitions.VAR_COUNT_TARGETS_CANCELLED, item);
if (isNoTargets(errorTargetsCount, notStartedTargetsCount, runningTargetsCount, scheduledTargetsCount,
finishedTargetsCount, cancelledTargetsCount)) {
HawkbitCommonUtil.setBarPartSize(bar, TotalTargetCountStatus.Status.SCHEDULED.toString().toLowerCase(), 0,
0);
HawkbitCommonUtil.setBarPartSize(bar, TotalTargetCountStatus.Status.FINISHED.toString().toLowerCase(), 0,
1);
} else {
bar.setNumberOfParts(6);
setProgressBarDetails(bar, item);
}
}
/**
* Formats the finished percentage of a rollout group into a string with one
* digit after comma.

View File

@@ -1,49 +0,0 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.ui.utils;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicLong;
/**
* Implementation of {@link ThreadFactory} that sets thread names according to
* given name format. All threads are created by
* {@link Executors#defaultThreadFactory() #newThread(Runnable)}.
*
*
*/
public final class NamingThreadFactory implements ThreadFactory {
static final String SP_PREFIX = "SP-";
private final String nameFormat;
private final AtomicLong counter = new AtomicLong();
/**
* Creates a new {@link NamingThreadFactory}.
*
* @param nameFormat
* a {@link String#format(String, Object...)}-compatible format
* String, to which a unique integer (0, 1, etc.) will be
* supplied as the single parameter. This integer will be
* assigned sequentially. For example, "rpc-pool-%d" will
* generate thread names like "rpc-pool-0", "rpc-pool-1",
* "rpc-pool-2", etc.
*/
public NamingThreadFactory(final String nameFormat) {
this.nameFormat = SP_PREFIX + nameFormat;
}
@Override
public Thread newThread(final Runnable r) {
final Thread thread = Executors.defaultThreadFactory().newThread(r);
thread.setName(String.format(nameFormat, counter.getAndIncrement()));
return thread;
}
}

View File

@@ -42,7 +42,7 @@ public class NotificationMessage extends Notification {
* @param autoClose
* flag to indicate enable close option
*/
public void showNotification(final String styleName, final String caption, final String description,
void showNotification(final String styleName, final String caption, final String description,
final Boolean autoClose) {
decorate(styleName, caption, description, autoClose);
this.show(Page.getCurrent());

View File

@@ -1,72 +0,0 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.ui.utils;
/**
* RepositoryConstants required for Button.
*
*
*
*
*
*/
public final class SPUIButtonDefinitions {
/**
* BUTTON- STATUS.
*/
public static final String SP_BUTTON_STATUS_STYLE = "targetStatusBtn";
/**
* MESSAGE - POPUP-SHOW.
*/
public static final String SP_MESSAGE_HINT_POPUP_SHOW_STYLE = "message-hint-popup" + " "
+ "message-hint-popup-show";
/**
* Button Caption length.
*/
public static final int BUTTON_CAPTION_LENGTH = 12;
/**
* Unknown button description.
*/
public static final String UNKNOWN_BUTTON = "Unknown";
/**
* Registered button description.
*/
public static final String REGISTERED_BUTTON = "Registered";
/**
* Pending button description.
*/
public static final String PENDING_BUTTON = "Pending";
/**
* Error button description.
*/
public static final String ERROR_BUTTON = "Error";
/**
* In sync button description.
*/
public static final String IN_SYNCH_BUTTON = "In-sync";
/**
* Get lighter shade.
*/
public static final int CODE_VALUE = 50;
/**
* Edit Target Tag Style.
*/
public static final String TARGET_TAG_EDIT_STYLE = "edit-target-tag-icon";
/**
* Private Constructor.
*/
private SPUIButtonDefinitions() {
}
}

View File

@@ -338,16 +338,12 @@ public final class SPUIDefinitions {
/**
* Space.
*/
public static final String SPACE = "&nbsp;";
static final String SPACE = "&nbsp;";
/**
* Distribution tag button id prefix.
*/
public static final String SOFTWARE_MODULE_TAG_ID_PREFIXS = "swmodule.type.";
/**
* Distribution tag button id prefix.
*/
public static final String DISTRIBUTION_TYPE_ID_PREFIXS = "dist-type-";
/**
* DistributionSet Type tag button id prefix.
@@ -387,15 +383,15 @@ public final class SPUIDefinitions {
* automatically and also horizontal scroll bars get displayed. Used for
* Responsive UI.
*/
public static final int REQ_MIN_UPLOAD_BROWSER_WIDTH = 1250;
static final int REQ_MIN_UPLOAD_BROWSER_WIDTH = 1250;
public static final int MIN_UPLOAD_CONFIRMATION_POPUP_WIDTH = 1000;
public static final int MIN_UPLOAD_CONFIRMATION_POPUP_HEIGHT = 310;
public static final int MAX_UPLOAD_CONFIRMATION_POPUP_WIDTH = 1050;
static final int MAX_UPLOAD_CONFIRMATION_POPUP_WIDTH = 1050;
public static final int MAX_UPLOAD_CONFIRMATION_POPUP_HEIGHT = 360;
static final int MAX_UPLOAD_CONFIRMATION_POPUP_HEIGHT = 360;
/** Artifact upload related entries - end. **/
@@ -502,6 +498,11 @@ public final class SPUIDefinitions {
*/
public static final String ROLLOUT_LIST_HEADER_CAPTION = "Rollouts";
/**
* BUTTON- STATUS.
*/
public static final String SP_BUTTON_STATUS_STYLE = "targetStatusBtn";
/**
* /** Constructor.
*/

View File

@@ -20,10 +20,6 @@ import com.vaadin.ui.themes.ValoTheme;
*/
public final class SPUILabelDefinitions {
/**
* Label - Message hint.
*/
public static final String SP_LABEL_MESSAGE_HINT = "Label-message-hint";
/**
* Style - Message.
*/

View File

@@ -11,16 +11,8 @@ package org.eclipse.hawkbit.ui.utils;
/**
* RepositoryConstants required for Style.
*
*
*
*
*
*/
public final class SPUIStyleDefinitions {
/**
* TABLE- HORI.
*/
public static final String SP_HORIZONTAL_TABLE_STYLE = "table-horizontal-layout";
/**
* Tag button wrapper style.
*/
@@ -33,36 +25,11 @@ public final class SPUIStyleDefinitions {
public static final String SP_TEXTFIELD_LAYOUT_ERROR_HIGHTLIGHT = "v-textfield-error";
/**
* STYLE to highlight wrong data combo box field.
*/
public static final String SP_COMBOFIELD_ERROR = "combobox-error";
/**
* Style for control buttons in aciton history.
*/
public static final String SP_ACTION_HIS_CTRL_BTN = "action-history-ctl-buttons";
/**
* Style for accordion tab button.
*/
public static final String SP_ACCORDION_TAB_BTN = "accordion-tab-button-style";
/**
* large table style.
*/
public static final String SP_LARGE_TABLE_STYLE = "sp-table-large";
/**
* small table style.
*/
public static final String SP_SMALL_TABLE_STYLE = "sp-table-small";
/**
* Drag highligh layout style.
*/
public static final String DRAG_HIGHLIGHT_LAYOUT = "drag-hightlight-layout";
/**
* Confirm box question label style.
*/
@@ -73,24 +40,6 @@ public final class SPUIStyleDefinitions {
*/
public static final String CONFIRMBOX_WINDOW_SYLE = "confirmbox-window-style";
/**
* Distribution detail layout style.
*/
public static final String DIST_DETAIL_MODULE_TABLE = "dist-details-module-table";
/**
* Artifact upload - software module table layout.
*/
public static final String UPLOAD_SW_MODULE_TABLE_LAYOUT = "swModule-table-layout";
/**
* hide tags layout style.
*/
public static final String SP_HIDE_TYPE = "hide-type";
/**
* style for show type button.
*/
public static final String SP_SHOW_TYPE_ICON_STYLE = "show-type-icon";
/**
* Error label style.
*/
@@ -139,31 +88,16 @@ public final class SPUIStyleDefinitions {
*/
public static final String DS_METADATA_ICON = "ds-metadata-icon";
/**
* Target table style.
*/
public static final String TARGET_TABLE_STYLE = "target-table";
/**
* Details layout style.
*/
public static final String DETAILS_LAYOUT_STYLE = "details-tab";
/**
* Style for table panel to set short cut keys on the table.
*/
public static final String SHORT_CUT_KEY_TABLE_PANEL = "table-panel";
/**
* Confirmation popup - discard style.
*/
public static final String REDICON = "redicon";
/**
* Deployment view - message label style.
*/
public static final String COUNT_MSG_BOX_SHOW = "count-msg-box";
/**
* Action button style- footer buttons.
*/

View File

@@ -10,22 +10,8 @@ package org.eclipse.hawkbit.ui.utils;
/**
* RepositoryConstants required for Target.
*
*
*
*
*
*/
public final class SPUITargetDefinitions {
/**
* Target Table Style.
*/
public static final String TARGET_STYLE = "target-table";
/**
* Assignment tab column content size.
*/
public static final int ACCORDION_TAB_TARGET_NAME_LENGTH = 25;
/**
* Distribution name length .

View File

@@ -31,10 +31,6 @@ public final class SpringContextHelper {
SpringContextHelper.context = context;
}
public static ApplicationContext getContext() {
return context;
}
/**
* method to return a certain bean by its name.
*

View File

@@ -817,16 +817,6 @@ public final class UIComponentIdProvider {
*/
public static final String ROLLOUT_ERROR_THRESOLD_OPTION_ID = "rollout.error.thresold.option.id";
/**
* Rollout groups options id.
*/
public static final String ROLLOUT_GROUPS_OPTION_ID = "rollout.groups.option.id";
/**
* Rollout groups definition button
*/
public static final String ROLLOUT_GROUPS_DEF_BUTTON_ID = "rollout.groups.definition.button.id";
/**
* Rollout target filter query value text area id.
*/
@@ -904,16 +894,6 @@ public final class UIComponentIdProvider {
*/
public static final String METADATA_VALUE_ID = "metadata.value.id";
/**
* Metadata save id.
*/
public static final String METADTA_SAVE_ICON_ID = "metadata.save.icon.id";
/**
* Metadata discard id.
*/
public static final String METADTA_DISCARD_ICON_ID = "metadata.discard.icon.id";
/**
* Metadata add icon id.
*/