Minor code improvements

Signed-off-by: Dominic Schabel dominic.schabel@bosch-si.com
This commit is contained in:
Dominic Schabel
2016-08-15 11:30:21 +02:00
parent 7f156f05a4
commit 3accac9ade
50 changed files with 639 additions and 696 deletions

View File

@@ -52,8 +52,8 @@ import com.vaadin.ui.UI;
/**
* Header of Software module table.
*/
@SpringComponent
@ViewScope
@SpringComponent
public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModule, Long> {
private static final long serialVersionUID = 6469417305487144809L;
@@ -66,7 +66,7 @@ public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModul
@Autowired
private UploadViewAcceptCriteria uploadViewAcceptCriteria;
@Autowired
private SwMetadataPopupLayout swMetadataPopupLayout;
@@ -162,7 +162,7 @@ public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModul
@EventBusListenerMethod(scope = EventScope.SESSION)
void onEvent(final UploadArtifactUIEvent event) {
if (event == UploadArtifactUIEvent.DELETED_ALL_SOFWARE) {
UI.getCurrent().access(() -> refreshFilter());
UI.getCurrent().access(this::refreshFilter);
}
}
@@ -197,12 +197,12 @@ public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModul
public Object generateCell(final Table source, final Object itemId, final Object columnId) {
final String nameVersionStr = getNameAndVerion(itemId);
final Button manageMetaDataBtn = createManageMetadataButton(nameVersionStr);
manageMetaDataBtn.addClickListener(event -> showMetadataDetails((Long) itemId, nameVersionStr));
manageMetaDataBtn.addClickListener(event -> showMetadataDetails((Long) itemId));
return manageMetaDataBtn;
}
});
}
@Override
protected List<TableColumn> getTableVisibleColumns() {
final List<TableColumn> columnList = super.getTableVisibleColumns();
@@ -237,8 +237,7 @@ public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModul
artifactUploadState.setNoDataAvilableSoftwareModule(!available);
}
private Button createManageMetadataButton(String nameVersionStr) {
private Button createManageMetadataButton(final String nameVersionStr) {
final Button manageMetadataBtn = SPUIComponentProvider.getButton(
SPUIComponentIdProvider.SW_TABLE_MANAGE_METADATA_ID + "." + nameVersionStr, "", "", null, false,
FontAwesome.LIST_ALT, SPUIButtonStyleSmallNoBorder.class);
@@ -246,17 +245,17 @@ public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModul
manageMetadataBtn.setDescription(i18n.get("tooltip.metadata.icon"));
return manageMetadataBtn;
}
private String getNameAndVerion(final Object itemId) {
final Item item = getItem(itemId);
final String name = (String) item.getItemProperty(SPUILabelDefinitions.VAR_NAME).getValue();
final String version = (String) item.getItemProperty(SPUILabelDefinitions.VAR_VERSION).getValue();
return name + "." + version;
}
private void showMetadataDetails(Long itemId, String nameVersionStr) {
SoftwareModule swmodule = softwareManagement.findSoftwareModuleWithDetails(itemId);
/* display the window */
UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule,null));
private void showMetadataDetails(final Long itemId) {
final SoftwareModule swmodule = softwareManagement.findSoftwareModuleWithDetails(itemId);
/* display the window */
UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null));
}
}

View File

@@ -8,6 +8,9 @@
*/
package org.eclipse.hawkbit.ui.artifacts.upload;
import static org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions.FAILED;
import static org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions.SUCCESS;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -56,13 +59,13 @@ import com.vaadin.ui.themes.ValoTheme;
/**
* Artifact upload confirmation popup.
*
*
*/
public class UploadConfirmationwindow implements Button.ClickListener {
public class UploadConfirmationWindow implements Button.ClickListener {
private static final long serialVersionUID = -1679035890140031740L;
private static final Logger LOG = LoggerFactory.getLogger(UploadConfirmationwindow.class);
private static final Logger LOG = LoggerFactory.getLogger(UploadConfirmationWindow.class);
private static final String MD5_CHECKSUM = "md5Checksum";
@@ -114,13 +117,13 @@ public class UploadConfirmationwindow implements Button.ClickListener {
/**
* Initialize the upload confirmation window.
*
*
* @param artifactUploadView
* reference of upload layout.
* @param artifactUploadState
* reference of session variable {@link ArtifactUploadState}.
*/
public UploadConfirmationwindow(final UploadLayout artifactUploadView,
public UploadConfirmationWindow(final UploadLayout artifactUploadView,
final ArtifactUploadState artifactUploadState) {
this.uploadLayout = artifactUploadView;
this.artifactUploadState = artifactUploadState;
@@ -615,6 +618,7 @@ public class UploadConfirmationwindow implements Button.ClickListener {
private void createLocalArtifact(final String itemId, final String filePath,
final ArtifactManagement artifactManagement, final SoftwareModule baseSw) {
final File newFile = new File(filePath);
final Item item = tabelContainer.getItem(itemId);
final String sha1Checksum = ((TextField) item.getItemProperty(SHA1_CHECKSUM).getValue()).getValue();
@@ -624,27 +628,25 @@ public class UploadConfirmationwindow implements Button.ClickListener {
final String[] itemDet = itemId.split("/");
final String swModuleNameVersion = itemDet[0];
FileInputStream fis = null;
try {
fis = new FileInputStream(newFile);
try (FileInputStream fis = new FileInputStream(newFile)) {
artifactManagement.createLocalArtifact(fis, baseSw.getId(), providedFileName,
HawkbitCommonUtil.trimAndNullIfEmpty(md5Checksum),
HawkbitCommonUtil.trimAndNullIfEmpty(sha1Checksum), true, customFile.getMimeType());
saveUploadStatus(providedFileName, swModuleNameVersion, SPUILabelDefinitions.SUCCESS, "");
} catch (final FileNotFoundException e) {
saveUploadStatus(providedFileName, swModuleNameVersion, SPUILabelDefinitions.FAILED, e.getMessage());
LOG.error(ARTIFACT_UPLOAD_EXCEPTION, e);
} catch (final ArtifactUploadFailedException e) {
saveUploadStatus(providedFileName, swModuleNameVersion, SPUILabelDefinitions.FAILED, e.getMessage());
LOG.error(ARTIFACT_UPLOAD_EXCEPTION, e);
} catch (final InvalidSHA1HashException e) {
saveUploadStatus(providedFileName, swModuleNameVersion, SPUILabelDefinitions.FAILED, e.getMessage());
LOG.error(ARTIFACT_UPLOAD_EXCEPTION, e);
} catch (final InvalidMD5HashException e) {
saveUploadStatus(providedFileName, swModuleNameVersion, SPUILabelDefinitions.FAILED, e.getMessage());
saveUploadStatus(providedFileName, swModuleNameVersion, SUCCESS, "");
} catch (final ArtifactUploadFailedException | InvalidSHA1HashException | InvalidMD5HashException
| FileNotFoundException e) {
saveUploadStatus(providedFileName, swModuleNameVersion, FAILED, e.getMessage());
LOG.error(ARTIFACT_UPLOAD_EXCEPTION, e);
} catch (final IOException ex) {
LOG.error(ARTIFACT_UPLOAD_EXCEPTION, ex);
} finally {
closeFileStream(fis, newFile);
if (newFile.exists() && !newFile.delete()) {
LOG.error("Could not delete temporary file: {}", newFile);
}
}
}
@@ -659,21 +661,6 @@ public class UploadConfirmationwindow implements Button.ClickListener {
}
private static void closeFileStream(final FileInputStream fis, final File newFile) {
if (fis != null) {
try {
fis.close();
} catch (final IOException e) {
LOG.error(ARTIFACT_UPLOAD_EXCEPTION, e);
}
}
if (newFile.exists() && !newFile.delete()) {
LOG.error("Could not delete temporary file: {}", newFile);
}
}
public Table getUploadDetailsTable() {
return uploadDetailsTable;
}

View File

@@ -109,7 +109,7 @@ public class UploadLayout extends VerticalLayout {
private Button discardBtn;
private UploadConfirmationwindow currentUploadConfirmationwindow;
private UploadConfirmationWindow currentUploadConfirmationwindow;
private VerticalLayout dropAreaLayout;
@@ -634,7 +634,7 @@ public class UploadLayout extends VerticalLayout {
if (artifactUploadState.getFileSelected().isEmpty()) {
uiNotification.displayValidationError(i18n.get("message.error.noFileSelected"));
} else {
currentUploadConfirmationwindow = new UploadConfirmationwindow(this, artifactUploadState);
currentUploadConfirmationwindow = new UploadConfirmationWindow(this, artifactUploadState);
UI.getCurrent().addWindow(currentUploadConfirmationwindow.getUploadConfrimationWindow());
setConfirmationPopupHeightWidth(Page.getCurrent().getBrowserWindowWidth(),
Page.getCurrent().getBrowserWindowHeight());
@@ -656,7 +656,7 @@ public class UploadLayout extends VerticalLayout {
return spInfo;
}
void setCurrentUploadConfirmationwindow(final UploadConfirmationwindow currentUploadConfirmationwindow) {
void setCurrentUploadConfirmationwindow(final UploadConfirmationWindow currentUploadConfirmationwindow) {
this.currentUploadConfirmationwindow = currentUploadConfirmationwindow;
}

View File

@@ -136,25 +136,25 @@ public class UploadStatusInfoWindow extends Window {
@EventBusListenerMethod(scope = EventScope.SESSION)
void onEvent(final UploadStatusEvent event) {
if (event.getUploadProgressEventType() == UploadStatusEventType.UPLOAD_IN_PROGRESS) {
UI.getCurrent().access(
() -> updateProgress(event.getUploadStatus().getFileName(), event.getUploadStatus().getBytesRead(),
event.getUploadStatus().getContentLength(), event.getUploadStatus().getSoftwareModule()));
UI.getCurrent()
.access(() -> updateProgress(event.getUploadStatus().getFileName(),
event.getUploadStatus().getBytesRead(), event.getUploadStatus().getContentLength(),
event.getUploadStatus().getSoftwareModule()));
} else if (event.getUploadProgressEventType() == UploadStatusEventType.UPLOAD_STARTED) {
UI.getCurrent().access(() -> onStartOfUpload(event));
} else if (event.getUploadProgressEventType() == UploadStatusEventType.UPLOAD_STREAMING_FAILED) {
ui.access(() -> uploadFailed(event.getUploadStatus().getFileName(), event.getUploadStatus()
.getFailureReason(), event.getUploadStatus().getSoftwareModule()));
ui.access(() -> uploadFailed(event.getUploadStatus().getFileName(),
event.getUploadStatus().getFailureReason(), event.getUploadStatus().getSoftwareModule()));
} else if (event.getUploadProgressEventType() == UploadStatusEventType.UPLOAD_SUCCESSFUL) {
UI.getCurrent().access(
() -> uploadSucceeded(event.getUploadStatus().getFileName(), event.getUploadStatus()
.getSoftwareModule()));
UI.getCurrent().access(() -> uploadSucceeded(event.getUploadStatus().getFileName(),
event.getUploadStatus().getSoftwareModule()));
} else if (event.getUploadProgressEventType() == UploadStatusEventType.UPLOAD_STREAMING_FINISHED) {
ui.access(() -> uploadSucceeded(event.getUploadStatus().getFileName(), event.getUploadStatus()
.getSoftwareModule()));
ui.access(() -> uploadSucceeded(event.getUploadStatus().getFileName(),
event.getUploadStatus().getSoftwareModule()));
}
}
private void onStartOfUpload(UploadStatusEvent event) {
private void onStartOfUpload(final UploadStatusEvent event) {
uploadSessionStarted();
uploadStarted(event.getUploadStatus().getFileName(), event.getUploadStatus().getSoftwareModule());
}
@@ -169,19 +169,19 @@ public class UploadStatusInfoWindow extends Window {
}
private void restoreState() {
Indexed container = grid.getContainerDataSource();
final Indexed container = grid.getContainerDataSource();
if (container.getItemIds().isEmpty()) {
container.removeAllItems();
for (UploadStatusObject statusObject : artifactUploadState.getUploadedFileStatusList()) {
Item item = container.addItem(getItemid(statusObject.getFilename(),
statusObject.getSelectedSoftwareModule()));
for (final UploadStatusObject statusObject : artifactUploadState.getUploadedFileStatusList()) {
final Item item = container
.addItem(getItemid(statusObject.getFilename(), statusObject.getSelectedSoftwareModule()));
item.getItemProperty(REASON).setValue(statusObject.getReason() != null ? statusObject.getReason() : "");
item.getItemProperty(STATUS).setValue(statusObject.getStatus());
item.getItemProperty(PROGRESS).setValue(statusObject.getProgress());
item.getItemProperty(FILE_NAME).setValue(statusObject.getFilename());
SoftwareModule sw = statusObject.getSelectedSoftwareModule();
item.getItemProperty(SPUILabelDefinitions.NAME_VERSION).setValue(
HawkbitCommonUtil.getFormattedNameVersion(sw.getName(), sw.getVersion()));
final SoftwareModule sw = statusObject.getSelectedSoftwareModule();
item.getItemProperty(SPUILabelDefinitions.NAME_VERSION)
.setValue(HawkbitCommonUtil.getFormattedNameVersion(sw.getName(), sw.getVersion()));
}
if (artifactUploadState.isUploadCompleted()) {
minimizeButton.setEnabled(false);
@@ -209,7 +209,7 @@ public class UploadStatusInfoWindow extends Window {
}
private Grid createGrid() {
Grid statusGrid = new Grid(uploads);
final Grid statusGrid = new Grid(uploads);
statusGrid.addStyleName(SPUIStyleDefinitions.UPLOAD_STATUS_GRID);
statusGrid.setSelectionMode(SelectionMode.NONE);
statusGrid.setHeaderVisible(true);
@@ -219,7 +219,7 @@ public class UploadStatusInfoWindow extends Window {
}
private IndexedContainer getGridContainer() {
IndexedContainer uploadContainer = new IndexedContainer();
final IndexedContainer uploadContainer = new IndexedContainer();
uploadContainer.addContainerProperty(STATUS, String.class, "Active");
uploadContainer.addContainerProperty(FILE_NAME, String.class, null);
uploadContainer.addContainerProperty(PROGRESS, Double.class, 0D);
@@ -329,7 +329,7 @@ public class UploadStatusInfoWindow extends Window {
HawkbitCommonUtil.getFormattedNameVersion(softwareModule.getName(), softwareModule.getVersion()));
}
grid.scrollToEnd();
UploadStatusObject uploadStatus = new UploadStatusObject(filename, softwareModule);
final UploadStatusObject uploadStatus = new UploadStatusObject(filename, softwareModule);
uploadStatus.setStatus("Active");
artifactUploadState.getUploadedFileStatusList().add(uploadStatus);
}
@@ -337,56 +337,53 @@ public class UploadStatusInfoWindow extends Window {
void updateProgress(final String filename, final long readBytes, final long contentLength,
final SoftwareModule softwareModule) {
final Item item = uploads.getItem(getItemid(filename, softwareModule));
double progress = (double) readBytes / (double) contentLength;
final double progress = (double) readBytes / (double) contentLength;
if (item != null) {
item.getItemProperty(PROGRESS).setValue(progress);
}
List<UploadStatusObject> uploadStatusObjectList = (List<UploadStatusObject>) artifactUploadState
.getUploadedFileStatusList().stream().filter(e -> e.getFilename().equals(filename))
.collect(Collectors.toList());
final List<UploadStatusObject> uploadStatusObjectList = artifactUploadState.getUploadedFileStatusList().stream()
.filter(e -> e.getFilename().equals(filename)).collect(Collectors.toList());
if (!uploadStatusObjectList.isEmpty()) {
UploadStatusObject uploadStatusObject = uploadStatusObjectList.get(0);
final UploadStatusObject uploadStatusObject = uploadStatusObjectList.get(0);
uploadStatusObject.setProgress(progress);
}
}
/**
* Called when each file upload is success.
*
*
* @param filename
* of the uploaded file.
* @param softwareModule
* selected software module
*/
public void uploadSucceeded(final String filename, SoftwareModule softwareModule) {
public void uploadSucceeded(final String filename, final SoftwareModule softwareModule) {
final Item item = uploads.getItem(getItemid(filename, softwareModule));
String status = "Finished";
final String status = "Finished";
if (item != null) {
item.getItemProperty(STATUS).setValue(status);
}
List<UploadStatusObject> uploadStatusObjectList = (List<UploadStatusObject>) artifactUploadState
.getUploadedFileStatusList().stream().filter(e -> e.getFilename().equals(filename))
.collect(Collectors.toList());
final List<UploadStatusObject> uploadStatusObjectList = artifactUploadState.getUploadedFileStatusList().stream()
.filter(e -> e.getFilename().equals(filename)).collect(Collectors.toList());
if (!uploadStatusObjectList.isEmpty()) {
UploadStatusObject uploadStatusObject = uploadStatusObjectList.get(0);
final UploadStatusObject uploadStatusObject = uploadStatusObjectList.get(0);
uploadStatusObject.setStatus(status);
uploadStatusObject.setProgress(1d);
}
}
void uploadFailed(final String filename, final String errorReason, SoftwareModule softwareModule) {
void uploadFailed(final String filename, final String errorReason, final SoftwareModule softwareModule) {
errorOccured = true;
String status = "Failed";
final String status = "Failed";
final Item item = uploads.getItem(getItemid(filename, softwareModule));
if (item != null) {
item.getItemProperty(REASON).setValue(errorReason);
item.getItemProperty(STATUS).setValue(status);
}
List<UploadStatusObject> uploadStatusObjectList = (List<UploadStatusObject>) artifactUploadState
.getUploadedFileStatusList().stream().filter(e -> e.getFilename().equals(filename))
.collect(Collectors.toList());
final List<UploadStatusObject> uploadStatusObjectList = artifactUploadState.getUploadedFileStatusList().stream()
.filter(e -> e.getFilename().equals(filename)).collect(Collectors.toList());
if (!uploadStatusObjectList.isEmpty()) {
UploadStatusObject uploadStatusObject = uploadStatusObjectList.get(0);
final UploadStatusObject uploadStatusObject = uploadStatusObjectList.get(0);
uploadStatusObject.setStatus(status);
uploadStatusObject.setReason(errorReason);
}
@@ -428,8 +425,8 @@ public class UploadStatusInfoWindow extends Window {
return resizeBtn;
}
private void resizeWindow(ClickEvent event) {
if (event.getButton().getIcon() == FontAwesome.EXPAND) {
private void resizeWindow(final ClickEvent event) {
if (FontAwesome.EXPAND.equals(event.getButton().getIcon())) {
event.getButton().setIcon(FontAwesome.COMPRESS);
setWindowMode(WindowMode.MAXIMIZED);
resetColumnWidth();

View File

@@ -13,10 +13,6 @@ import com.vaadin.ui.AbstractColorPicker.Coordinates2Color;
/**
* Converts 2d-coordinates to a Color.
*
*
*
*
*/
public class CoordinatesToColor implements Coordinates2Color {
@@ -30,32 +26,31 @@ public class CoordinatesToColor implements Coordinates2Color {
@Override
public int[] calculate(final Color color) {
final float[] hsv = color.getHSV();
final int x = Math.round(hsv[0] * 220f);
int y = 0;
y = calculateYCoordinateOfColor(hsv);
final int x = Math.round(hsv[0] * 220F);
final int y = calculateYCoordinateOfColor(hsv);
return new int[] { x, y };
}
private Color calculateHSVColor(final int x, final int y) {
final float h = x / 220f;
float s = 1f;
float v = 1f;
private static Color calculateHSVColor(final int x, final int y) {
final float h = x / 220F;
float s = 1F;
float v = 1F;
if (y < 110) {
s = y / 110f;
s = y / 110F;
} else if (y > 110) {
v = 1f - (y - 110f) / 110f;
v = 1F - (y - 110F) / 110F;
}
return new Color(Color.HSVtoRGB(h, s, v));
}
private int calculateYCoordinateOfColor(final float[] hsv) {
private static int calculateYCoordinateOfColor(final float[] hsv) {
int y;
// lower half
/* Assuming hsv[] array value will have in the range of 0 to 1 */
if (hsv[1] < 1f) {
y = Math.round(hsv[1] * 110f);
if (hsv[1] < 1F) {
y = Math.round(hsv[1] * 110F);
} else {
y = Math.round(110f - (hsv[1] + hsv[2]) * 110f);
y = Math.round(110F - (hsv[1] + hsv[2]) * 110F);
}
return y;
}

View File

@@ -33,45 +33,43 @@ import com.vaadin.ui.UI;
import com.vaadin.ui.themes.ValoTheme;
/**
*
*
* DistributionSet Metadata details layout.
*
*/
@SpringComponent
@VaadinSessionScope
public class DistributionSetMetadatadetailslayout extends Table{
public class DistributionSetMetadatadetailslayout extends Table {
private static final long serialVersionUID = 2913758299611837718L;
private DistributionSetManagement distributionSetManagement;
private DsMetadataPopupLayout dsMetadataPopupLayout;
private static final String METADATA_KEY = "Key";
private static final String VIEW ="view";
private static final String VIEW = "view";
private transient DistributionSetManagement distributionSetManagement;
private DsMetadataPopupLayout dsMetadataPopupLayout;
private SpPermissionChecker permissionChecker;
private transient EntityFactory entityFactory;
private I18N i18n;
private Long selectedDistSetId;
/**
*
* @param i18n
* @param permissionChecker
* @param distributionSetManagement
* @param dsMetadataPopupLayout
*/
private Long selectedDistSetId;
/**
*
* @param i18n
* @param permissionChecker
* @param distributionSetManagement
* @param dsMetadataPopupLayout
*/
public void init(final I18N i18n, final SpPermissionChecker permissionChecker,
final DistributionSetManagement distributionSetManagement,
final DsMetadataPopupLayout dsMetadataPopupLayout,
final EntityFactory entityFactory) {
final DistributionSetManagement distributionSetManagement,
final DsMetadataPopupLayout dsMetadataPopupLayout, final EntityFactory entityFactory) {
this.i18n = i18n;
this.permissionChecker = permissionChecker;
this.distributionSetManagement = distributionSetManagement;
@@ -80,45 +78,44 @@ public class DistributionSetMetadatadetailslayout extends Table{
createDSMetadataTable();
addCustomGeneratedColumns();
}
/**
* Populate software module metadata.
*
*
* @param distributionSet
*/
public void populateDSMetadata(final DistributionSet distributionSet) {
removeAllItems();
if (null == distributionSet) {
return;
return;
}
selectedDistSetId = distributionSet.getId();
final List<DistributionSetMetadata> dsMetadataList = distributionSet.getMetadata();
if (null != dsMetadataList && !dsMetadataList.isEmpty()) {
dsMetadataList.forEach(dsMetadata -> setDSMetadataProperties(dsMetadata));
}
}
/**
* Create metadata .
*
* Create metadata.
*
* @param metadataKeyName
*/
public void createMetadata(final String metadataKeyName){
public void createMetadata(final String metadataKeyName) {
final IndexedContainer metadataContainer = (IndexedContainer) getContainerDataSource();
final Item item = metadataContainer.addItem(metadataKeyName);
item.getItemProperty(METADATA_KEY).setValue(metadataKeyName);
}
/**
* Delete metadata.
*
*
* @param metadataKeyName
*/
public void deleteMetadata(final String metadataKeyName){
public void deleteMetadata(final String metadataKeyName) {
final IndexedContainer metadataContainer = (IndexedContainer) getContainerDataSource();
metadataContainer.removeItem(metadataKeyName);
metadataContainer.removeItem(metadataKeyName);
}
private void createDSMetadataTable() {
@@ -131,9 +128,9 @@ public class DistributionSetMetadatadetailslayout extends Table{
setContainerDataSource(getDistSetContainer());
setColumnHeaderMode(ColumnHeaderMode.EXPLICIT);
addDSMetadataTableHeader();
setSizeFull();
//same as height of other tabs in details tabsheet
setHeight(116,Unit.PIXELS);
setSizeFull();
// same as height of other tabs in details tabsheet
setHeight(116, Unit.PIXELS);
}
private IndexedContainer getDistSetContainer() {
@@ -141,7 +138,7 @@ public class DistributionSetMetadatadetailslayout extends Table{
container.addContainerProperty(METADATA_KEY, String.class, "");
setColumnExpandRatio(METADATA_KEY, 0.7f);
setColumnAlignment(METADATA_KEY, Align.LEFT);
if (permissionChecker.hasUpdateDistributionPermission()) {
container.addContainerProperty(VIEW, Label.class, "");
setColumnExpandRatio(VIEW, 0.2F);
@@ -154,39 +151,36 @@ public class DistributionSetMetadatadetailslayout extends Table{
setColumnHeader(METADATA_KEY, i18n.get("header.key"));
}
private void setDSMetadataProperties(final DistributionSetMetadata dsMetadata){
private void setDSMetadataProperties(final DistributionSetMetadata dsMetadata) {
final Item item = getContainerDataSource().addItem(dsMetadata.getKey());
item.getItemProperty(METADATA_KEY).setValue(dsMetadata.getKey());
}
private void addCustomGeneratedColumns() {
addGeneratedColumn(METADATA_KEY,
(source, itemId, columnId) -> customMetadataDetailButton((String) itemId));
private void addCustomGeneratedColumns() {
addGeneratedColumn(METADATA_KEY, (source, itemId, columnId) -> customMetadataDetailButton((String) itemId));
}
private Button customMetadataDetailButton(final String metadataKey) {
final Button viewIcon = SPUIComponentProvider.getButton(getDetailLinkId(metadataKey), metadataKey, "View "
+ metadataKey + " Metadata details", null, false, null, SPUIButtonStyleSmallNoBorder.class);
final Button viewIcon = SPUIComponentProvider.getButton(getDetailLinkId(metadataKey), metadataKey,
"View " + metadataKey + " Metadata details", null, false, null, SPUIButtonStyleSmallNoBorder.class);
viewIcon.setData(metadataKey);
viewIcon.addStyleName(ValoTheme.BUTTON_TINY + " " + ValoTheme.BUTTON_LINK + " " + "on-focus-no-border link"
+ " " + "text-style");
viewIcon.addClickListener(event -> showMetadataDetails(selectedDistSetId, metadataKey));
return viewIcon;
}
private static String getDetailLinkId(final String name) {
return new StringBuilder(SPUIComponentIdProvider.DS_METADATA_DETAIL_LINK).append('.').append(name)
.toString();
return new StringBuilder(SPUIComponentIdProvider.DS_METADATA_DETAIL_LINK).append('.').append(name).toString();
}
private void showMetadataDetails(final Long selectedDistSetId , final String metadataKey) {
DistributionSet distSet = distributionSetManagement.findDistributionSetById(selectedDistSetId);
private void showMetadataDetails(final Long selectedDistSetId, final String metadataKey) {
final DistributionSet distSet = distributionSetManagement.findDistributionSetById(selectedDistSetId);
/* display the window */
UI.getCurrent().addWindow(dsMetadataPopupLayout.getWindow(distSet,
entityFactory.generateDistributionSetMetadata(distSet, metadataKey, "") ));
entityFactory.generateDistributionSetMetadata(distSet, metadataKey, "")));
}
}

View File

@@ -8,6 +8,8 @@
*/
package org.eclipse.hawkbit.ui.common.filterlayout;
import static org.eclipse.hawkbit.ui.utils.SPUIDefinitions.NO_TAG_BUTTON_ID;
import java.util.ArrayList;
import java.util.List;
@@ -50,7 +52,7 @@ public abstract class AbstractFilterButtons extends Table {
/**
* Initialize layout of filter buttons.
*
*
* @param filterButtonClickBehaviour
* click behaviour of filter buttons.
*/
@@ -95,16 +97,12 @@ public abstract class AbstractFilterButtons extends Table {
container.addContainerProperty(SPUILabelDefinitions.VAR_NAME, String.class, null, true, true);
}
@SuppressWarnings("serial")
protected void addColumn() {
addGeneratedColumn(FILTER_BUTTON_COLUMN, (source, itemId, columnId) -> addGeneratedCell(itemId));
}
/**
* @param itemId
* @return
*/
private DragAndDropWrapper addGeneratedCell(final Object itemId) {
final Item item = getItem(itemId);
final Long id = (Long) item.getItemProperty(SPUILabelDefinitions.VAR_ID).getValue();
final String name = (String) item.getItemProperty(SPUILabelDefinitions.VAR_NAME).getValue();
@@ -116,16 +114,18 @@ public abstract class AbstractFilterButtons extends Table {
? item.getItemProperty(SPUILabelDefinitions.VAR_COLOR).getValue().toString() : DEFAULT_GREEN;
final Button typeButton = createFilterButton(id, name, desc, color, itemId);
typeButton.addClickListener(event -> filterButtonClickBehaviour.processFilterButtonClick(event));
if (typeButton.getData().equals(SPUIDefinitions.NO_TAG_BUTTON_ID) && isNoTagSateSelected()) {
filterButtonClickBehaviour.setDefaultClickedButton(typeButton);
} else if (id != null && isClickedByDefault(name)) {
if ((NO_TAG_BUTTON_ID.equals(typeButton.getData()) && isNoTagStateSelected())
|| (id != null && isClickedByDefault(name))) {
filterButtonClickBehaviour.setDefaultClickedButton(typeButton);
}
return createDragAndDropWrapper(typeButton, name, id);
}
protected boolean isNoTagSateSelected() {
return Boolean.FALSE;
protected boolean isNoTagStateSelected() {
return false;
}
private DragAndDropWrapper createDragAndDropWrapper(final Button tagButton, final String name, final Long id) {
@@ -195,21 +195,21 @@ public abstract class AbstractFilterButtons extends Table {
/**
* Id of the buttons table to be used in test cases.
*
*
* @return Id of the Button table.
*/
protected abstract String getButtonsTableId();
/**
* create new lazyquery container to display the buttons.
*
*
* @return reference of {@link LazyQueryContainer}
*/
protected abstract LazyQueryContainer createButtonsLazyQueryContainer();
/**
* Check if button should be displayed as clicked by default.
*
*
* @param buttonCaption
* button caption
* @return true if button is clicked
@@ -218,7 +218,7 @@ public abstract class AbstractFilterButtons extends Table {
/**
* Get filter button Id.
*
*
* @param name
* @return
*/
@@ -226,7 +226,7 @@ public abstract class AbstractFilterButtons extends Table {
/**
* Get Drop Handler for Filter Buttons.
*
*
* @return
*/
protected abstract DropHandler getFilterButtonDropHandler();
@@ -234,14 +234,14 @@ public abstract class AbstractFilterButtons extends Table {
/**
* Get prefix Id of Button Wrapper to be used for drag and drop, delete and
* test cases.
*
*
* @return prefix Id of Button Wrapper
*/
protected abstract String getButttonWrapperIdPrefix();
/**
* Get info to be set for the button wrapper.
*
*
* @return button wrapper info.
*/
protected abstract String getButtonWrapperData();

View File

@@ -15,9 +15,9 @@ import org.apache.commons.lang3.StringUtils;
import org.eclipse.hawkbit.repository.model.BaseEntity;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
import org.eclipse.hawkbit.ui.decorators.HeaderLayoutDecorator;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonDecorator;
import org.eclipse.hawkbit.ui.decorators.SPUIComboBoxDecorator;
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;
@@ -82,8 +82,6 @@ public final class SPUIComponentProvider {
/**
* Get HorizontalLayout UI component.
*
* @param className
* as Layout
* @return HorizontalLayout as UI
*/
public static HorizontalLayout getHorizontalLayout() {
@@ -117,8 +115,7 @@ public final class SPUIComponentProvider {
hLayout = layoutDecorator.decorate(hLayout);
} catch (final InstantiationException | IllegalAccessException exception) {
LOG.error("Error occured while creating horizontal decorator " + HeaderLayoutDecorator.class,
exception);
LOG.error("Error occured while creating horizontal decorator " + HeaderLayoutDecorator.class, exception);
}
return hLayout;
@@ -139,7 +136,7 @@ public final class SPUIComponentProvider {
/**
* Get window component.
*
*
* @param caption
* window caption
* @param id
@@ -154,7 +151,7 @@ public final class SPUIComponentProvider {
/**
* Get Label UI component.
*
*
* @param caption
* set the caption of the textfield
* @param style
@@ -182,7 +179,7 @@ public final class SPUIComponentProvider {
/**
* Get Label UI component. *
*
*
* @param caption
* set the caption of the textArea
* @param style
@@ -206,7 +203,7 @@ public final class SPUIComponentProvider {
/**
* Get Label UI component.
*
*
* @param caption
* caption of the combo box
* @param height
@@ -252,7 +249,7 @@ public final class SPUIComponentProvider {
/**
* Get Button - Factory Approach for decoration.
*
*
* @param id
* as string
* @param buttonName
@@ -289,7 +286,7 @@ public final class SPUIComponentProvider {
/**
* Get the style required.
*
*
* @return String
*/
public static String getPinButtonStyle() {
@@ -305,7 +302,7 @@ public final class SPUIComponentProvider {
/**
* Get DistributionSet Info Panel.
*
*
* @param distributionSet
* as DistributionSet
* @param caption
@@ -323,7 +320,7 @@ public final class SPUIComponentProvider {
/**
* Method to CreateName value labels.
*
*
* @param label
* as string
* @param values
@@ -356,7 +353,7 @@ public final class SPUIComponentProvider {
/**
* Create label which represents the {@link BaseEntity#getCreatedBy()} by
* user name
*
*
* @param i18n
* the i18n
* @param baseEntity
@@ -371,7 +368,7 @@ public final class SPUIComponentProvider {
/**
* Create label which represents the
* {@link BaseEntity#getLastModifiedBy()()} by user name
*
*
* @param i18n
* the i18n
* @param baseEntity
@@ -385,7 +382,7 @@ public final class SPUIComponentProvider {
/**
* Get Bold Text.
*
*
* @param text
* as String
* @return String as bold
@@ -396,7 +393,7 @@ public final class SPUIComponentProvider {
/**
* Get the layout for Target:Controller Attributes.
*
*
* @param controllerAttibs
* as Map
* @return VerticalLayout
@@ -407,7 +404,7 @@ public final class SPUIComponentProvider {
/**
* Get Tabsheet.
*
*
* @return SPUITabSheet
*/
public static TabSheet getDetailsTabSheet() {
@@ -416,7 +413,7 @@ public final class SPUIComponentProvider {
/**
* Layout of tabs in detail tabsheet.
*
*
* @return VerticalLayout
*/
public static VerticalLayout getDetailTabLayout() {
@@ -429,7 +426,7 @@ public final class SPUIComponentProvider {
/**
* Method to create a link.
*
*
* @param id
* of the link
* @param name
@@ -465,10 +462,10 @@ public final class SPUIComponentProvider {
/**
* Generates help/documentation links from within management UI.
*
*
* @param uri
* to documentation site
*
*
* @return generated link
*/
public static Link getHelpLink(final String uri) {

View File

@@ -17,21 +17,22 @@ import com.vaadin.client.renderers.ClickableRenderer.RendererClickHandler;
import com.vaadin.shared.ui.Connect;
import elemental.json.JsonObject;
/**
* A connector for {@link CustomObjectRenderer }.
*
*/
@Connect(org.eclipse.hawkbit.ui.customrenderers.renderers.RolloutRenderer.class)
public class RolloutRendererConnector extends ClickableRendererConnector<RolloutRendererData> {
private static final long serialVersionUID = 7734682321931830566L;
private static final long serialVersionUID = 7734682321931830566L;
public org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRenderer getRenderer() {
return (org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRenderer) super.getRenderer();
}
@Override
public org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRenderer getRenderer() {
return (org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRenderer) super.getRenderer();
}
@Override
protected HandlerRegistration addClickHandler(
RendererClickHandler<JsonObject> handler) {
@Override
protected HandlerRegistration addClickHandler(final RendererClickHandler<JsonObject> handler) {
return getRenderer().addClickHandler(handler);
}
}
}

View File

@@ -11,52 +11,42 @@ package org.eclipse.hawkbit.ui.customrenderers.client.renderers;
import java.io.Serializable;
/**
* RendererData class with Name and Status.
*
* RendererData class with name and status.
*/
public class RolloutRendererData implements Serializable {
private static final long serialVersionUID = -5018181529953620263L;
private String name;
private static final long serialVersionUID = -5018181529953620263L;
private String status;
private String name;
/**
* Initialize the RendererData.
*/
public RolloutRendererData() {
private String status;
}
/**
* Initialize the RendererData.
*
* @param name
* Name of the Rollout.
* @param status
* Status of Rollout.
*/
public RolloutRendererData(final String name, final String status) {
this.name = name;
this.status = status;
}
/**
* Initialize the RendererData.
*
* @param name
* Name of the Rollout.
* @param status
* Status of Rollout.
*/
public RolloutRendererData(String name, String status) {
super();
this.name = name;
this.status = status;
}
public String getName() {
return name;
}
public String getName() {
return name;
}
public void setName(final String name) {
this.name = name;
}
public void setName(String name) {
this.name = name;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getStatus() {
return status;
}
public void setStatus(final String status) {
this.status = status;
}
}

View File

@@ -16,46 +16,44 @@ import com.vaadin.ui.renderers.ClickableRenderer;
import elemental.json.JsonValue;
/**
* Renders button with provided CustomObject.
* Used to display button with link.
*
* Renders button with provided CustomObject. Used to display button with link.
*/
public class RolloutRenderer extends ClickableRenderer<RolloutRendererData> {
private static final long serialVersionUID = -8754180585906263554L;
private static final long serialVersionUID = -8754180585906263554L;
/**
* Creates a new custom object renderer.
*/
public RolloutRenderer() {
super(RolloutRendererData.class, null);
}
/**
* Initialize custom object renderer with {@link Class<CustomObject>}
*
* @param presentationType
* Class<CustomObject>
*/
/**
* Creates a new custom object renderer.
*/
public RolloutRenderer() {
super(RolloutRendererData.class, null);
}
public RolloutRenderer(Class<RolloutRendererData> presentationType) {
super(presentationType);
}
/**
* Initialize custom object renderer with the given type.
*
* @param presentationType
* Class<CustomObject>
*/
/**
* Creates a new custom object renderer and adds the given click listener to it.
*
* @param listener
* the click listener to register
*/
public RolloutRenderer(RendererClickListener listener) {
this();
addClickListener(listener);
}
public RolloutRenderer(final Class<RolloutRendererData> presentationType) {
super(presentationType);
}
@Override
public JsonValue encode(RolloutRendererData resource) {
return super.encode(resource, RolloutRendererData.class);
}
/**
* Creates a new custom object renderer and adds the given click listener to
* it.
*
* @param listener
* the click listener to register
*/
public RolloutRenderer(final RendererClickListener listener) {
this();
addClickListener(listener);
}
@Override
public JsonValue encode(final RolloutRendererData resource) {
return super.encode(resource, RolloutRendererData.class);
}
}

View File

@@ -21,9 +21,6 @@ import com.vaadin.ui.Window;
/**
* Decorator for Window.
*
*
*
*/
public final class SPUIWindowDecorator {
@@ -36,7 +33,7 @@ public final class SPUIWindowDecorator {
/**
* Decorates window based on type.
*
*
* @param caption
* window caption
* @param id
@@ -48,36 +45,38 @@ public final class SPUIWindowDecorator {
public static CommonDialogWindow getWindow(final String caption, final String id, final String type,
final Component content, final ClickListener saveButtonClickListener,
final ClickListener cancelButtonClickListener, final String helpLink, final AbstractLayout layout,
final I18N i18n) {
CommonDialogWindow window = null;
if (SPUIDefinitions.CUSTOM_METADATA_WINDOW.equals(type)) {
window = new CustomCommonDialogWindow(caption, content, helpLink, saveButtonClickListener,
cancelButtonClickListener, layout, i18n);
window.setDraggable(true);
window.setClosable(true);
} else {
window = new CommonDialogWindow(caption, content, helpLink, saveButtonClickListener,
cancelButtonClickListener, layout, i18n);
if (null != id) {
window.setId(id);
}
if (SPUIDefinitions.CONFIRMATION_WINDOW.equals(type)) {
window.setDraggable(false);
window.setClosable(true);
window.addStyleName(SPUIStyleDefinitions.CONFIRMATION_WINDOW_CAPTION);
final I18N i18n) {
} else if (SPUIDefinitions.CREATE_UPDATE_WINDOW.equals(type)) {
window.setDraggable(true);
window.setClosable(true);
}
}
return window;
}
CommonDialogWindow window;
if (SPUIDefinitions.CUSTOM_METADATA_WINDOW.equals(type)) {
window = new CustomCommonDialogWindow(caption, content, helpLink, saveButtonClickListener,
cancelButtonClickListener, layout, i18n);
window.setDraggable(true);
window.setClosable(true);
} else {
window = new CommonDialogWindow(caption, content, helpLink, saveButtonClickListener,
cancelButtonClickListener, layout, i18n);
if (null != id) {
window.setId(id);
}
if (SPUIDefinitions.CONFIRMATION_WINDOW.equals(type)) {
window.setDraggable(false);
window.setClosable(true);
window.addStyleName(SPUIStyleDefinitions.CONFIRMATION_WINDOW_CAPTION);
} else if (SPUIDefinitions.CREATE_UPDATE_WINDOW.equals(type)) {
window.setDraggable(true);
window.setClosable(true);
}
}
return window;
}
/**
* Decorates window based on type.
*
*
* @param caption
* window caption
* @param id

View File

@@ -117,5 +117,4 @@ public class DSTypeFilterButtons extends AbstractFilterButtons {
private void refreshTypeTable() {
setContainerDataSource(createButtonsLazyQueryContainer());
}
}

View File

@@ -15,11 +15,9 @@ import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
import org.eclipse.hawkbit.ui.common.AbstractMetadataPopupLayout;
import org.eclipse.hawkbit.ui.distributions.event.MetadataEvent;
import org.eclipse.hawkbit.ui.distributions.event.MetadataEvent.MetadataUIEvent;
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
import org.springframework.beans.factory.annotation.Autowired;
import com.vaadin.spring.annotation.SpringComponent;
@@ -27,7 +25,6 @@ import com.vaadin.spring.annotation.ViewScope;
/**
* Pop up layout to display software module metadata.
*
*/
@SpringComponent
@ViewScope
@@ -39,39 +36,35 @@ public class SwMetadataPopupLayout extends AbstractMetadataPopupLayout<SoftwareM
private transient SoftwareManagement softwareManagement;
@Autowired
private ArtifactUploadState artifactUploadState;
@Autowired
private EntityFactory entityFactory;
@Autowired
private ManageDistUIState manageDistUIState;
private transient EntityFactory entityFactory;
@Autowired
protected SpPermissionChecker permChecker;
@Override
protected void checkForDuplicate(SoftwareModule entity, String value) {
protected void checkForDuplicate(final SoftwareModule entity, final String value) {
softwareManagement.findSoftwareModuleMetadata(entity, value);
}
/**
* Create metadata for SWModule.
*/
* Create metadata for SWModule.
*/
@Override
protected SoftwareModuleMetadata createMetadata(SoftwareModule entity, String key, String value) {
SoftwareModuleMetadata swMetadata = softwareManagement.createSoftwareModuleMetadata(entityFactory
.generateSoftwareModuleMetadata(entity, key, value));
protected SoftwareModuleMetadata createMetadata(final SoftwareModule entity, final String key, final String value) {
final SoftwareModuleMetadata swMetadata = softwareManagement
.createSoftwareModuleMetadata(entityFactory.generateSoftwareModuleMetadata(entity, key, value));
setSelectedEntity(swMetadata.getSoftwareModule());
eventBus.publish(this, new MetadataEvent(MetadataUIEvent.CREATE_SOFTWARE_MODULE_METADATA, swMetadata));
return swMetadata;
}
/**
* Update metadata for SWModule.
* Update metadata for SWModule.
*/
@Override
protected SoftwareModuleMetadata updateMetadata(SoftwareModule entity, String key, String value) {
SoftwareModuleMetadata swMetadata = softwareManagement.updateSoftwareModuleMetadata(entityFactory
.generateSoftwareModuleMetadata(entity, key, value));
protected SoftwareModuleMetadata updateMetadata(final SoftwareModule entity, final String key, final String value) {
final SoftwareModuleMetadata swMetadata = softwareManagement
.updateSoftwareModuleMetadata(entityFactory.generateSoftwareModuleMetadata(entity, key, value));
setSelectedEntity(swMetadata.getSoftwareModule());
return swMetadata;
}
@@ -80,25 +73,24 @@ public class SwMetadataPopupLayout extends AbstractMetadataPopupLayout<SoftwareM
protected List<SoftwareModuleMetadata> getMetadataList() {
return getSelectedEntity().getMetadata();
}
/**
* delete metadata for SWModule.
*/
@Override
protected void deleteMetadata(SoftwareModule entity, String key, String value) {
SoftwareModuleMetadata swMetadata = entityFactory.generateSoftwareModuleMetadata(entity, key, value);
protected void deleteMetadata(final SoftwareModule entity, final String key, final String value) {
final SoftwareModuleMetadata swMetadata = entityFactory.generateSoftwareModuleMetadata(entity, key, value);
softwareManagement.deleteSoftwareModuleMetadata(entity, key);
eventBus.publish(this, new MetadataEvent(MetadataUIEvent.DELETE_SOFTWARE_MODULE_METADATA, swMetadata));
}
@Override
protected boolean hasCreatePermission() {
return permChecker.hasCreateDistributionPermission();
}
@Override
protected boolean hasUpdatePermission() {
return permChecker.hasUpdateDistributionPermission();
}
}

View File

@@ -8,6 +8,11 @@
*/
package org.eclipse.hawkbit.ui.distributions.smtype;
import static org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleTypeEvent.SoftwareModuleTypeEnum.ADD_SOFTWARE_MODULE_TYPE;
import static org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleTypeEvent.SoftwareModuleTypeEnum.UPDATE_SOFTWARE_MODULE_TYPE;
import static org.eclipse.hawkbit.ui.utils.SPUIComponentIdProvider.SW_MODULE_TYPE_TABLE_ID;
import static org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions.VAR_NAME;
import java.util.HashMap;
import java.util.Map;
@@ -19,7 +24,6 @@ import org.eclipse.hawkbit.ui.distributions.event.SaveActionWindowEvent;
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
import org.eclipse.hawkbit.ui.utils.SPUIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
@@ -35,10 +39,9 @@ import com.vaadin.spring.annotation.ViewScope;
/**
* Software Module Type filter buttons.
*
*/
@SpringComponent
@ViewScope
@SpringComponent
public class DistSMTypeFilterButtons extends AbstractFilterButtons {
private static final long serialVersionUID = 6804534533362387433L;
@@ -51,7 +54,7 @@ public class DistSMTypeFilterButtons extends AbstractFilterButtons {
@Override
protected String getButtonsTableId() {
return SPUIComponentIdProvider.SW_MODULE_TYPE_TABLE_ID;
return SW_MODULE_TYPE_TABLE_ID;
}
@Override
@@ -60,7 +63,7 @@ public class DistSMTypeFilterButtons extends AbstractFilterButtons {
final BeanQueryFactory<SoftwareModuleTypeBeanQuery> typeQF = new BeanQueryFactory<>(
SoftwareModuleTypeBeanQuery.class);
typeQF.setQueryConfiguration(queryConfig);
return new LazyQueryContainer(new LazyQueryDefinition(true, 20, SPUILabelDefinitions.VAR_NAME), typeQF);
return new LazyQueryContainer(new LazyQueryDefinition(true, 20, VAR_NAME), typeQF);
}
@Override
@@ -70,8 +73,8 @@ public class DistSMTypeFilterButtons extends AbstractFilterButtons {
@Override
protected boolean isClickedByDefault(final String typeName) {
return manageDistUIState.getSoftwareModuleFilters().getSoftwareModuleType().isPresent()
&& manageDistUIState.getSoftwareModuleFilters().getSoftwareModuleType().get().getName().equals(typeName);
return manageDistUIState.getSoftwareModuleFilters().getSoftwareModuleType().isPresent() && manageDistUIState
.getSoftwareModuleFilters().getSoftwareModuleType().get().getName().equals(typeName);
}
@Override
@@ -104,13 +107,16 @@ public class DistSMTypeFilterButtons 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.getSoftwareModuleType() != null) {
if (isCreateOrUpdate(event) && event.getSoftwareModuleType() != null) {
refreshTypeTable();
}
}
private boolean isCreateOrUpdate(final SoftwareModuleTypeEvent event) {
return event.getSoftwareModuleTypeEnum() == ADD_SOFTWARE_MODULE_TYPE
|| event.getSoftwareModuleTypeEnum() == UPDATE_SOFTWARE_MODULE_TYPE;
}
@EventBusListenerMethod(scope = EventScope.SESSION)
void onEvent(final SaveActionWindowEvent event) {
if (event == SaveActionWindowEvent.SAVED_DELETE_SW_MODULE_TYPES) {
@@ -121,6 +127,4 @@ public class DistSMTypeFilterButtons extends AbstractFilterButtons {
private void refreshTypeTable() {
setContainerDataSource(createButtonsLazyQueryContainer());
}
}

View File

@@ -8,8 +8,9 @@
*/
package org.eclipse.hawkbit.ui.distributions.state;
import static java.util.Collections.emptySet;
import java.io.Serializable;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@@ -49,7 +50,7 @@ public class ManageDistUIState implements ManagmentEntityState<DistributionSetId
private DistributionSetIdName lastSelectedDistribution;
private Set<Long> selectedSoftwareModules = Collections.emptySet();
private Set<Long> selectedSoftwareModules = emptySet();
private Set<String> selectedDeleteDistSetTypes = new HashSet<>();
@@ -57,23 +58,23 @@ public class ManageDistUIState implements ManagmentEntityState<DistributionSetId
private Long selectedBaseSwModuleId;
private boolean distTypeFilterClosed = Boolean.FALSE;
private boolean distTypeFilterClosed;
private boolean swTypeFilterClosed = Boolean.FALSE;
private boolean swTypeFilterClosed;
private final Map<Long, String> deleteSofwareModulesList = new HashMap<>();
private boolean swModuleTableMaximized = Boolean.FALSE;
private boolean swModuleTableMaximized;
private boolean dsTableMaximized = Boolean.FALSE;
private boolean dsTableMaximized;
private final Map<String, SoftwareModuleIdName> assignedSoftwareModuleDetails = new HashMap<>();
private final Map<DistributionSetIdName, HashMap<Long, HashSet<SoftwareModuleIdName>>> consolidatedDistSoftwarewList = new HashMap<>();
private boolean noDataAvilableSwModule = Boolean.FALSE;
private boolean noDataAvilableSwModule;
private boolean noDataAvailableDist = Boolean.FALSE;
private boolean noDataAvailableDist;
/**
* @return the manageDistFilters
@@ -117,6 +118,7 @@ public class ManageDistUIState implements ManagmentEntityState<DistributionSetId
this.lastSelectedDistribution = value;
}
@Override
public void setSelectedEnitities(final Set<DistributionSetIdName> values) {
selectedDistributions = values;
}
@@ -223,7 +225,7 @@ public class ManageDistUIState implements ManagmentEntityState<DistributionSetId
/***
* Set isDsModuleTableMaximized.
*
* @param isDsModuleTableMaximized
* @param dsModuleTableMaximized
*/
public void setDsTableMaximized(final boolean dsModuleTableMaximized) {
dsTableMaximized = dsModuleTableMaximized;
@@ -241,7 +243,7 @@ public class ManageDistUIState implements ManagmentEntityState<DistributionSetId
}
/**
* @param isSwModuleTableMaximized
* @param swModuleTableMaximized
* the isSwModuleTableMaximized to set
*/
public void setSwModuleTableMaximized(final boolean swModuleTableMaximized) {
@@ -271,8 +273,8 @@ public class ManageDistUIState implements ManagmentEntityState<DistributionSetId
}
/**
* @param noDilableDist
* the noDataAvailableDist to set
* @param noDataAvailableDist
* the isNoDataAvailableDist to set
*/
public void setNoDataAvailableDist(final boolean noDataAvailableDist) {
this.noDataAvailableDist = noDataAvailableDist;

View File

@@ -114,10 +114,8 @@ public abstract class AbstractCreateUpdateTagLayout extends CustomComponent
/**
* Discard the changes and close the popup.
*
* @param event
*/
protected void discard(final Button.ClickEvent event) {
protected void discard() {
UI.getCurrent().removeWindow(window);
}
@@ -463,7 +461,7 @@ public abstract class AbstractCreateUpdateTagLayout extends CustomComponent
public CommonDialogWindow getWindow() {
reset();
window = SPUIWindowDecorator.getWindow(getWindowCaption(), null, SPUIDefinitions.CREATE_UPDATE_WINDOW, this,
this::save, this::discard, null, mainLayout, i18n);
this::save, cancleEvent -> discard(), null, mainLayout, i18n);
return window;
}

View File

@@ -118,12 +118,10 @@ public class CreateUpdateDistributionTagLayoutWindow extends AbstractCreateUpdat
/**
* RESET.
*
* @param event
*/
@Override
public void discard(final ClickEvent event) {
super.discard(event);
public void discard() {
super.discard();
resetDistTagValues();
}
@@ -144,7 +142,7 @@ public class CreateUpdateDistributionTagLayoutWindow extends AbstractCreateUpdat
/**
* Select tag & set tag name & tag desc values corresponding to selected
* tag.
*
*
* @param distTagSelected
* as the selected tag from combo
*/

View File

@@ -121,7 +121,7 @@ public class DistributionTagButtons extends AbstractFilterButtons {
}
@Override
protected boolean isNoTagSateSelected() {
protected boolean isNoTagStateSelected() {
return managementUIState.getDistributionTableFilters().isNoTagSelected();
}

View File

@@ -391,22 +391,22 @@ public class BulkUploadHandler extends CustomComponent
eventBus.publish(this, new BulkUploadValidationMessageEvent(errorMessage.toString()));
}
}
}
private void addNewTarget(final String controllerId, final String name) {
final String newControllerId = HawkbitCommonUtil.trimAndNullIfEmpty(controllerId);
if (mandatoryCheck(newControllerId) && duplicateCheck(newControllerId)) {
final String newName = HawkbitCommonUtil.trimAndNullIfEmpty(name);
final String newDesc = HawkbitCommonUtil.trimAndNullIfEmpty(descTextArea.getValue());
private void addNewTarget(final String controllerId, final String name) {
final String newControllerId = HawkbitCommonUtil.trimAndNullIfEmpty(controllerId);
if (mandatoryCheck(newControllerId) && duplicateCheck(newControllerId)) {
final String newName = HawkbitCommonUtil.trimAndNullIfEmpty(name);
final String newDesc = HawkbitCommonUtil.trimAndNullIfEmpty(descTextArea.getValue());
/* create new target entity */
final Target newTarget = entityFactory.generateTarget(newControllerId);
setTargetValues(newTarget, newName, newDesc);
targetManagement.createTarget(newTarget);
managementUIState.getTargetTableFilters().getBulkUpload().getTargetsCreated().add(newControllerId);
successfullTargetCount++;
}
/* create new target entity */
final Target newTarget = entityFactory.generateTarget(newControllerId);
setTargetValues(newTarget, newName, newDesc);
targetManagement.createTarget(newTarget);
managementUIState.getTargetTableFilters().getBulkUpload().getTargetsCreated().add(newControllerId);
successfullTargetCount++;
}
}
private static void setTargetValues(final Target target, final String name, final String description) {

View File

@@ -131,7 +131,7 @@ public class TargetTagFilterButtons extends AbstractFilterButtons {
}
@Override
protected boolean isNoTagSateSelected() {
protected boolean isNoTagStateSelected() {
return managementUIState.getTargetTableFilters().isNoTagSelected();
}

View File

@@ -37,6 +37,7 @@ import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.UIScope;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Component;
import com.vaadin.ui.CustomComponent;
@@ -52,14 +53,11 @@ import com.vaadin.ui.themes.ValoTheme;
* A responsive menu component providing user information and the controls for
* primary navigation between the views.
*/
@SpringComponent
@UIScope
@SpringComponent
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";
private static final String ID = "dashboard-menu";
@Autowired
private I18N i18n;
@@ -208,13 +206,7 @@ public final class DashboardMenu extends CustomComponent {
}
private Component buildToggleButton() {
final Button valoMenuToggleButton = new Button("Menu", (ClickListener) event -> {
if (getCompositionRoot().getStyleName().contains(STYLE_VISIBLE)) {
getCompositionRoot().removeStyleName(STYLE_VISIBLE);
} else {
getCompositionRoot().addStyleName(STYLE_VISIBLE);
}
});
final Button valoMenuToggleButton = new Button("Menu", new MenuToggleClickListenerMyClickListener());
valoMenuToggleButton.setIcon(FontAwesome.LIST);
valoMenuToggleButton.addStyleName("valo-menu-toggle");
valoMenuToggleButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
@@ -244,7 +236,7 @@ public final class DashboardMenu extends CustomComponent {
/**
* Returns all views which are currently accessible by the current logged in
* user.
*
*
* @return a list of all views which are currently visible and accessible
* for the current logged in user
*/
@@ -264,7 +256,7 @@ public final class DashboardMenu extends CustomComponent {
/**
* Returns the view name for the start page after login.
*
*
* @return the initialViewName of the start page
*/
public String getInitialViewName() {
@@ -273,7 +265,7 @@ public final class DashboardMenu extends CustomComponent {
/**
* Is a View available.
*
*
* @return the accessibleViewsEmpty <true> no rights for any view <false> a
* view is available
*/
@@ -284,7 +276,7 @@ public final class DashboardMenu extends CustomComponent {
/**
* notifies the dashboard that the view has been changed and the button
* needs to be re-styled.
*
*
* @param event
* the post view change event
*/
@@ -294,7 +286,7 @@ public final class DashboardMenu extends CustomComponent {
/**
* Returns the dashboard view type by a given view name.
*
*
* @param viewName
* the name of the view to retrieve
* @return the dashboard view for a given viewname or {@code null} if view
@@ -313,7 +305,7 @@ public final class DashboardMenu extends CustomComponent {
/**
* Is the given view accessible.
*
*
* @param viewName
* the view name
* @return <true> = denied, <false> = accessible
@@ -329,15 +321,28 @@ public final class DashboardMenu extends CustomComponent {
return accessDeined;
}
private class MenuToggleClickListenerMyClickListener implements ClickListener {
private static final long serialVersionUID = 1L;
private static final String STYLE_VISIBLE = "valo-menu-visible";
@Override
public void buttonClick(final ClickEvent event) {
if (getCompositionRoot().getStyleName().contains(STYLE_VISIBLE)) {
getCompositionRoot().removeStyleName(STYLE_VISIBLE);
} else {
getCompositionRoot().addStyleName(STYLE_VISIBLE);
}
}
}
/**
* An menu item button wrapper for the dashboard menu item.
*
*
*
*
*/
public static final class ValoMenuItemButton extends Button {
private static final long serialVersionUID = 1L;
private static final String STYLE_SELECTED = "selected";
private final DashboardMenuItem view;
@@ -345,7 +350,7 @@ public final class DashboardMenu extends CustomComponent {
/**
* creates a new button in case of pressed switches to the given
* {@code view}.
*
*
* @param view
* the view to switch to in case the button is pressed
*/
@@ -358,12 +363,11 @@ public final class DashboardMenu extends CustomComponent {
/* Avoid double click */
setDisableOnClick(true);
addClickListener(event -> event.getComponent().getUI().getNavigator().navigateTo(view.getViewName()));
}
/**
* notifies the button to change his style.
*
*
* @param event
* the post view change event
*/

View File

@@ -20,6 +20,7 @@ import org.vaadin.alump.distributionbar.gwt.client.GwtDistributionBar;
*
*/
public final class DistributionBarHelper {
private static final String HTML_DIV_END = "</div>";
private static final int PARENT_SIZE_IN_PCT = 100;
private static final double MINIMUM_PART_SIZE = 10;
private static final String DISTRIBUTION_BAR_PART_MAIN_STYLE = GwtDistributionBar.CLASSNAME + "-part";
@@ -38,23 +39,23 @@ public final class DistributionBarHelper {
*
* @return string of format "status1:count,status2:count"
*/
public static String getDistributionBarAsHTMLString(Map<Status, Long> statusTotalCountMap) {
StringBuilder htmlString = new StringBuilder();
Map<Status, Long> statusMapWithNonZeroValues = getStatusMapWithNonZeroValues(statusTotalCountMap);
Long totalValue = getTotalSizes(statusTotalCountMap);
public static String getDistributionBarAsHTMLString(final Map<Status, Long> statusTotalCountMap) {
final StringBuilder htmlString = new StringBuilder();
final Map<Status, Long> statusMapWithNonZeroValues = getStatusMapWithNonZeroValues(statusTotalCountMap);
final Long totalValue = getTotalSizes(statusTotalCountMap);
if (statusMapWithNonZeroValues.size() <= 0) {
return getUnintialisedBar();
}
int partIndex = 1;
htmlString.append(getParentDivStart());
for (Map.Entry<Status, Long> entry : statusMapWithNonZeroValues.entrySet()) {
for (final Map.Entry<Status, Long> entry : statusMapWithNonZeroValues.entrySet()) {
if (entry.getValue() > 0) {
htmlString.append(getPart(partIndex, entry.getKey(), entry.getValue(), totalValue,
statusMapWithNonZeroValues.size()));
partIndex++;
}
}
htmlString.append(getParentDivEnd());
htmlString.append(HTML_DIV_END);
return htmlString.toString();
}
@@ -65,7 +66,7 @@ public final class DistributionBarHelper {
* map with status and count
* @return map with non zero values
*/
public static Map<Status, Long> getStatusMapWithNonZeroValues(Map<Status, Long> statusTotalCountMap) {
public static Map<Status, Long> getStatusMapWithNonZeroValues(final Map<Status, Long> statusTotalCountMap) {
return statusTotalCountMap.entrySet().stream().filter(p -> p.getValue() > 0)
.collect(Collectors.toMap(p -> p.getKey(), p -> p.getValue()));
}
@@ -77,19 +78,20 @@ public final class DistributionBarHelper {
* map with status and count details
* @return tool tip
*/
public static String getTooltip(Map<Status, Long> statusCountMap) {
Map<Status, Long> nonZeroStatusCountMap = DistributionBarHelper.getStatusMapWithNonZeroValues(statusCountMap);
StringBuilder tooltip = new StringBuilder();
for (Entry<Status, Long> entry : nonZeroStatusCountMap.entrySet()) {
public static String getTooltip(final Map<Status, Long> statusCountMap) {
final Map<Status, Long> nonZeroStatusCountMap = DistributionBarHelper
.getStatusMapWithNonZeroValues(statusCountMap);
final StringBuilder tooltip = new StringBuilder();
for (final Entry<Status, Long> entry : nonZeroStatusCountMap.entrySet()) {
tooltip.append(entry.getKey().toString().toLowerCase()).append(" : ").append(entry.getValue())
.append("<br>");
}
return tooltip.toString();
}
private static String getPartStyle(int partIndex, int noOfParts, String customStyle) {
StringBuilder mainStyle = new StringBuilder();
StringBuilder styleName = new StringBuilder(GwtDistributionBar.CLASSNAME);
private static String getPartStyle(final int partIndex, final int noOfParts, final String customStyle) {
final StringBuilder mainStyle = new StringBuilder();
final StringBuilder styleName = new StringBuilder(GwtDistributionBar.CLASSNAME);
if (noOfParts == 1) {
styleName.append("-only");
} else if (partIndex == 1) {
@@ -108,15 +110,16 @@ public final class DistributionBarHelper {
return mainStyle.toString();
}
private static String getPartWidth(Long value, Long totalValue, int noOfParts) {
private static String getPartWidth(final Long value, final Long totalValue, final int noOfParts) {
final double minTotalSize = MINIMUM_PART_SIZE * noOfParts;
final double availableSize = PARENT_SIZE_IN_PCT - minTotalSize;
double val = MINIMUM_PART_SIZE + (double) value / totalValue * availableSize;
final double val = MINIMUM_PART_SIZE + (double) value / totalValue * availableSize;
return String.format("%.3f", val) + "%";
}
private static String getPart(int partIndex, Status status, Long value, Long totalValue, int noOfParts) {
String partValue = status.toString().toLowerCase();
private static String getPart(final int partIndex, final Status status, final Long value, final Long totalValue,
final int noOfParts) {
final String partValue = status.toString().toLowerCase();
return "<div class=\"" + getPartStyle(partIndex, noOfParts, partValue) + "\" style=\"width: "
+ getPartWidth(value, totalValue, noOfParts) + ";\"><span class=\""
+ DISTRIBUTION_BAR_PART_VALUE_CLASSNAME + "\">" + value + "</span></div>";
@@ -127,9 +130,9 @@ public final class DistributionBarHelper {
+ DISTRIBUTION_BAR_PART_VALUE_CLASSNAME + "\">uninitialized</span></div>";
}
private static Long getTotalSizes(Map<Status, Long> statusTotalCountMap) {
private static Long getTotalSizes(final Map<Status, Long> statusTotalCountMap) {
Long total = 0L;
for (Long value : statusTotalCountMap.values()) {
for (final Long value : statusTotalCountMap.values()) {
total = total + value;
}
return total;
@@ -139,8 +142,4 @@ public final class DistributionBarHelper {
return "<div class=\"" + GwtDistributionBar.CLASSNAME
+ "\" style=\"width: 100%; height: 100%;\" id=\"rollout.status.progress.bar.id\">";
}
private static String getParentDivEnd() {
return "</div>";
}
}

View File

@@ -152,7 +152,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
/**
* Get the window.
*
*
* @param rolloutId
* the rollout id
* @return the window
@@ -499,14 +499,6 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
return errorThresoldPercent;
}
private boolean validateFields() {
if (!noOfGroups.isValid() || !errorThreshold.isValid() || !triggerThreshold.isValid()) {
uiNotification.displayValidationError(i18n.get("message.correct.invalid.value"));
return false;
}
return true;
}
private boolean duplicateCheck() {
if (rolloutManagement.findRolloutByName(getRolloutName()) != null) {
uiNotification.displayValidationError(
@@ -694,9 +686,9 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
}
/**
*
*
* Populate rollout details.
*
*
* @param rolloutId
* rollout id
*/

View File

@@ -52,7 +52,7 @@ import com.vaadin.ui.renderers.ClickableRenderer.RendererClickEvent;
import com.vaadin.ui.renderers.HtmlRenderer;
/**
*
*
* Rollout group list grid component.
*
*/
@@ -86,10 +86,10 @@ public class RolloutGroupListGrid extends AbstractGrid {
}
/**
*
*
* Handles the RolloutGroupChangeEvent to refresh the item in the grid.
*
*
*
*
* @param rolloutGroupChangeEvent
* the event which contains the rollout group which has been
* change
@@ -242,6 +242,12 @@ public class RolloutGroupListGrid extends AbstractGrid {
}
}
private void onClickOfRolloutGroupName(final RendererClickEvent event) {
rolloutUIState
.setRolloutGroup(rolloutGroupManagement.findRolloutGroupWithDetailedStatus((Long) event.getItemId()));
eventBus.publish(this, RolloutEvent.SHOW_ROLLOUT_GROUP_TARGETS);
}
@Override
protected void setHiddenColumns() {
final List<Object> columnsToBeHidden = new ArrayList<>();
@@ -261,12 +267,6 @@ public class RolloutGroupListGrid extends AbstractGrid {
return this::getDescription;
}
private void onClickOfRolloutGroupName(final RendererClickEvent event) {
rolloutUIState
.setRolloutGroup(rolloutGroupManagement.findRolloutGroupWithDetailedStatus((Long) event.getItemId()));
eventBus.publish(this, RolloutEvent.SHOW_ROLLOUT_GROUP_TARGETS);
}
private void createRolloutGroupStatusToFontMap() {
statusIconMap.put(RolloutGroupStatus.FINISHED,
new StatusFontIcon(FontAwesome.CHECK_CIRCLE, SPUIStyleDefinitions.STATUS_ICON_GREEN));
@@ -311,7 +311,7 @@ public class RolloutGroupListGrid extends AbstractGrid {
}
/**
*
*
* Converts {@link TotalTargetCountStatus} into formatted string with status
* and count details.
*
@@ -346,7 +346,7 @@ public class RolloutGroupListGrid extends AbstractGrid {
}
/**
*
*
* Converts {@link RolloutGroupStatus} to string.
*
*/

View File

@@ -161,13 +161,13 @@ public class AuthenticationConfigurationView extends BaseConfigurationView
final CheckBox checkBox = (CheckBox) event.getProperty();
AuthenticationConfigurationItem configurationItem;
if (checkBox == gatewaySecTokenCheckBox) {
if (gatewaySecTokenCheckBox.equals(checkBox)) {
configurationItem = gatewaySecurityTokenAuthenticationConfigurationItem;
} else if (checkBox == targetSecTokenCheckBox) {
} else if (targetSecTokenCheckBox.equals(checkBox)) {
configurationItem = targetSecurityTokenAuthenticationConfigurationItem;
} else if (checkBox == certificateAuthCheckbox) {
} else if (certificateAuthCheckbox.equals(checkBox)) {
configurationItem = certificateAuthenticationConfigurationItem;
} else if (checkBox == downloadAnonymousCheckBox) {
} else if (downloadAnonymousCheckBox.equals(checkBox)) {
configurationItem = anonymousDownloadAuthenticationConfigurationItem;
} else {
return;

View File

@@ -441,7 +441,7 @@ public final class HawkbitCommonUtil {
*/
public static float findRequiredExtraHeight(final float newBrowserHeight) {
return newBrowserHeight > SPUIDefinitions.REQ_MIN_BROWSER_HEIGHT
? newBrowserHeight - SPUIDefinitions.REQ_MIN_BROWSER_HEIGHT : 0;
? (newBrowserHeight - SPUIDefinitions.REQ_MIN_BROWSER_HEIGHT) : 0;
}
/**
@@ -453,7 +453,7 @@ public final class HawkbitCommonUtil {
*/
public static float findRequiredSwModuleExtraHeight(final float newBrowserHeight) {
return newBrowserHeight > SPUIDefinitions.REQ_MIN_UPLOAD_BROWSER_HEIGHT
? newBrowserHeight - SPUIDefinitions.REQ_MIN_UPLOAD_BROWSER_HEIGHT : 0;
? (newBrowserHeight - SPUIDefinitions.REQ_MIN_UPLOAD_BROWSER_HEIGHT) : 0;
}
/**
@@ -465,7 +465,7 @@ public final class HawkbitCommonUtil {
*/
public static float findRequiredSwModuleExtraWidth(final float newBrowserWidth) {
return newBrowserWidth > SPUIDefinitions.REQ_MIN_UPLOAD_BROWSER_WIDTH
? newBrowserWidth - SPUIDefinitions.REQ_MIN_UPLOAD_BROWSER_WIDTH : 0;
? (newBrowserWidth - SPUIDefinitions.REQ_MIN_UPLOAD_BROWSER_WIDTH) : 0;
}
/**
@@ -528,7 +528,7 @@ public final class HawkbitCommonUtil {
*/
public static float findExtraWidth(final float newBrowserWidth) {
return newBrowserWidth > SPUIDefinitions.REQ_MIN_BROWSER_WIDTH
? newBrowserWidth - SPUIDefinitions.REQ_MIN_BROWSER_WIDTH : 0;
? (newBrowserWidth - SPUIDefinitions.REQ_MIN_BROWSER_WIDTH) : 0;
}
/**
@@ -570,7 +570,7 @@ public final class HawkbitCommonUtil {
final float requiredExtraWidth = findExtraWidth(newBrowserWidth);
float expectedDistWidth = minTableWidth;
if (requiredExtraWidth > 0) {
expectedDistWidth = expectedDistWidth + Math.round(requiredExtraWidth * 0.5f);
expectedDistWidth = expectedDistWidth + Math.round(requiredExtraWidth * 0.5F);
}
return expectedDistWidth;
}
@@ -741,6 +741,8 @@ public final class HawkbitCommonUtil {
* base software module type
* @param description
* base software module description
* @param entityFactory
* the entity factory to create new entity instances
* @return BaseSoftwareModule new base software module
*/
public static SoftwareModule addNewBaseSoftware(final EntityFactory entityFactory, final String bsname,

View File

@@ -273,10 +273,6 @@ public final class SPUIDefinitions {
* New Target save icon id.
*/
public static final String NEW_TARGET_SAVE = "target.add.save";
/**
* New Target discard icon id.
*/
// public static final String NEW_TARGET_DISCARD = "target.add.discard";
/**
* New Target add icon id.
*/
@@ -1017,12 +1013,12 @@ public final class SPUIDefinitions {
* Rollout action column property.
*/
public static final String ROLLOUT_ACTION = "rollout-action";
/**
* DistributionSet Metadata tab Id
*/
public static final String DISTRIBUTIONSET_METADATA_TAB_ID = "distSet.metadata.tab.id";
/**
* SoftwareModule Metadata tab Id
*/
@@ -1031,7 +1027,7 @@ public final class SPUIDefinitions {
/***
* Custom window for metadata.
*/
public static final String CUSTOM_METADATA_WINDOW = "custom.metadata.window";
public static final String CUSTOM_METADATA_WINDOW = "custom.metadata.window";
/**
* /** Constructor.