Code review, correct font-size of close/minimize button of

commonDialogWindow

Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com>
This commit is contained in:
Melanie Retter
2016-06-03 09:49:36 +02:00
parent 40c7b6f0f7
commit 6c725efd70
26 changed files with 213 additions and 143 deletions

View File

@@ -12,7 +12,6 @@ import java.io.Serializable;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.ui.UiProperties;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
import org.eclipse.hawkbit.ui.common.CommonDialogWindow;
import org.eclipse.hawkbit.ui.common.SoftwareModuleTypeBeanQuery;
@@ -29,6 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
import org.vaadin.spring.events.EventBus;
import com.vaadin.event.FieldEvents.TextChangeEvent;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.ComboBox;
@@ -64,9 +64,6 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent implements Se
@Autowired
private transient SoftwareManagement softwareManagement;
@Autowired
private transient UiProperties uiProperties;
private Label mandatoryLabel;
private TextField nameTextField;
@@ -182,9 +179,8 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent implements Se
}
/**
* Keep UI components on Layout.
* Build the window content and get an instance of customDialogWindow
*
* @return
*/
private void createWindow() {
@@ -215,22 +211,28 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent implements Se
nameTextField.focus();
}
/**
* add a TextChangeListener to the description TextField
*/
private void addDescriptionTextChangeListener() {
descTextArea.addTextChangeListener(event -> {
if (event.getText().equals(oldDescriptionValue) && vendorTextField.getValue().equals(oldVendorValue)) {
window.setSaveButtonEnabled(false);
window.setSaveButtonEnabled(hasDescriptionOrVendorChanged(event));
} else {
window.setSaveButtonEnabled(true);
window.setSaveButtonEnabled(hasDescriptionOrVendorChanged(event));
}
});
}
/**
* add a TextChangeListener to the vendor TextField
*/
private void addVendorTextChangeListener() {
vendorTextField.addTextChangeListener(event -> {
if (event.getText().equals(oldVendorValue) && descTextArea.getValue().equals(oldDescriptionValue)) {
window.setSaveButtonEnabled(false);
window.setSaveButtonEnabled(hasDescriptionOrVendorChanged(event));
} else {
window.setSaveButtonEnabled(true);
window.setSaveButtonEnabled(hasDescriptionOrVendorChanged(event));
}
});
}
@@ -264,6 +266,9 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent implements Se
}
}
/**
* updates a softwareModule
*/
private void updateSwModule() {
final String newDesc = HawkbitCommonUtil.trimAndNullIfEmpty(descTextArea.getValue());
final String newVendor = HawkbitCommonUtil.trimAndNullIfEmpty(vendorTextField.getValue());
@@ -280,6 +285,9 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent implements Se
closeThisWindow();
}
/**
* fill the data of a softwareModule in the content of the window
*/
private void populateValuesOfSwModule() {
final SoftwareModule swModle = softwareManagement.findSoftwareModuleById(baseSwModuleId);
nameTextField.setValue(swModle.getName());
@@ -333,6 +341,10 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent implements Se
return isValid;
}
/**
* saves or updates a softwareModule depending on the information if it is a
* new softwareModule or an existing one
*/
private void save() {
if (editSwModule) {
updateSwModule();
@@ -341,4 +353,17 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent implements Se
addNewBaseSoftware();
}
}
/**
* Checks if the description and vendor have changed and set the button
* enabled/disabled
*
* @param event
* TextChangeEvent
* @return Boolean
*/
private boolean hasDescriptionOrVendorChanged(final TextChangeEvent event) {
return !(event.getText().equals(oldDescriptionValue) && vendorTextField.getValue().equals(oldVendorValue));
}
}

View File

@@ -11,12 +11,13 @@ package org.eclipse.hawkbit.ui.artifacts.smtype;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleTypeEvent;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleTypeEvent.SoftwareModuleTypeEnum;
import org.eclipse.hawkbit.ui.colorPicker.ColorPickerConstants;
import org.eclipse.hawkbit.ui.colorPicker.ColorPickerHelper;
import org.eclipse.hawkbit.ui.colorpicker.ColorPickerConstants;
import org.eclipse.hawkbit.ui.colorpicker.ColorPickerHelper;
import org.eclipse.hawkbit.ui.common.SoftwareModuleTypeBeanQuery;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.layouts.CreateUpdateTypeLayout;
@@ -279,9 +280,8 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout
protected void previewButtonClicked() {
if (!tagPreviewBtnClicked) {
final String selectedOption = (String) optiongroup.getValue();
if (null != selectedOption && selectedOption.equalsIgnoreCase(updateTypeStr)) {
if (StringUtils.isNotEmpty(selectedOption) && selectedOption.equalsIgnoreCase(updateTypeStr)) {
if (null != tagNameComboBox.getValue()) {
final SoftwareModuleType typeSelected = swTypeManagementService
.findSoftwareModuleTypeByName(tagNameComboBox.getValue().toString());
if (null != typeSelected) {

View File

@@ -6,12 +6,20 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.ui.colorPicker;
package org.eclipse.hawkbit.ui.colorpicker;
import com.vaadin.shared.ui.colorpicker.Color;
/**
* Provides color constants for the ColorPickerLayout
*
*/
public class ColorPickerConstants {
public static final String DEFAULT_COLOR = "rgb(44,151,32)";
public static final Color START_COLOR = new Color(0, 146, 58);
private ColorPickerConstants() {
}
}

View File

@@ -6,8 +6,9 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.ui.colorPicker;
package org.eclipse.hawkbit.ui.colorpicker;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.hawkbit.ui.management.tag.SpColorPickerPreview;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -15,19 +16,27 @@ import org.slf4j.LoggerFactory;
import com.vaadin.shared.ui.colorpicker.Color;
import com.vaadin.ui.Slider.ValueOutOfBoundsException;
/**
* Contains helper methods for the ColorPickerLayout to handle the ColorPicker
*
*/
public class ColorPickerHelper {
private static final Logger LOG = LoggerFactory.getLogger(ColorPickerHelper.class);
private ColorPickerHelper() {
}
/**
* Get color picked value in string.
* Get color picked value as string.
*
* @return String of color picked value.
*/
public static String getColorPickedString(final SpColorPickerPreview preview) {
return "rgb(" + preview.getColor().getRed() + "," + preview.getColor().getGreen() + ","
+ preview.getColor().getBlue() + ")";
final Color color = preview.getColor();
return "rgb(" + color.getRed() + "," + color.getGreen() + "," + color.getBlue() + ")";
}
/**
@@ -39,9 +48,11 @@ public class ColorPickerHelper {
*/
public static Color rgbToColorConverter(final String value) {
if (!value.startsWith("rgb")) {
return null;
if (StringUtils.isEmpty(value) || (StringUtils.isNotEmpty(value) && !value.startsWith("rgb"))) {
throw new IllegalArgumentException(
"String to convert is empty or of invalid format - value: '" + value + "'");
}
// RGB color format rgb/rgba(255,255,255,0.1)
final String[] colors = value.substring(value.indexOf('(') + 1, value.length() - 1).split(",");
final int red = Integer.parseInt(colors[0]);
@@ -50,20 +61,27 @@ public class ColorPickerHelper {
if (colors.length > 3) {
final int alpha = (int) (Double.parseDouble(colors[3]) * 255d);
return new Color(red, green, blue, alpha);
} else {
return new Color(red, green, blue);
}
return new Color(red, green, blue);
}
/**
*
* Gets the selectedColor in the ColorPickerLayout and sets the slider
* values
*
* @param colorPickerLayout
* colorPickerLayout
*/
public static void setRgbSliderValues(final ColorPickerLayout colorPickerLayout) {
try {
final double redColorValue = colorPickerLayout.getSelectedColor().getRed();
colorPickerLayout.getRedSlider().setValue(new Double(redColorValue));
colorPickerLayout.getRedSlider().setValue(Double.valueOf(redColorValue));
final double blueColorValue = colorPickerLayout.getSelectedColor().getBlue();
colorPickerLayout.getBlueSlider().setValue(new Double(blueColorValue));
colorPickerLayout.getBlueSlider().setValue(Double.valueOf(blueColorValue));
final double greenColorValue = colorPickerLayout.getSelectedColor().getGreen();
colorPickerLayout.getGreenSlider().setValue(new Double(greenColorValue));
colorPickerLayout.getGreenSlider().setValue(Double.valueOf(greenColorValue));
} catch (final ValueOutOfBoundsException e) {
LOG.error("Unable to set RGB color value to " + colorPickerLayout.getSelectedColor().getRed() + ","
+ colorPickerLayout.getSelectedColor().getGreen() + ","

View File

@@ -6,7 +6,7 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.ui.colorPicker;
package org.eclipse.hawkbit.ui.colorpicker;
import java.util.HashSet;
import java.util.Set;
@@ -21,13 +21,15 @@ import com.vaadin.ui.Slider;
import com.vaadin.ui.components.colorpicker.ColorPickerGradient;
import com.vaadin.ui.components.colorpicker.ColorSelector;
/**
*
* Defines the Layout for the ColorPicker
*
*/
public class ColorPickerLayout extends GridLayout {
private static final long serialVersionUID = -7025970080613796692L;
/**
* Local Instance of ColorPickerPreview.
*/
private SpColorPickerPreview selPreview;
private ColorPickerGradient colorSelect;

View File

@@ -9,11 +9,13 @@
package org.eclipse.hawkbit.ui.common;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.hawkbit.ui.UiProperties;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleBorderWithIcon;
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.server.FontAwesome;
@@ -27,6 +29,12 @@ import com.vaadin.ui.Link;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
/**
*
* Superclass for pop-up-windows including a minimize and close icon in the
* upper right corner and a save and cancel button at the bottom.
*
*/
public class CommonDialogWindow extends Window {
private static final long serialVersionUID = -1321949234316858703L;
@@ -49,6 +57,9 @@ public class CommonDialogWindow extends Window {
protected ValueChangeListener buttonEnableListener;
@Autowired
private transient UiProperties uiProperties;
public CommonDialogWindow() {
init(null, null);
@@ -84,6 +95,7 @@ public class CommonDialogWindow extends Window {
setResizable(true);
center();
setModal(true);
addStyleName("fontsize");
}
private HorizontalLayout createActionButtonsLayout(final ClickListener saveButtonClickListener,
@@ -100,7 +112,7 @@ public class CommonDialogWindow extends Window {
if (null != saveButtonClickListener) {
saveButton.addClickListener(saveButtonClickListener);
} else {
LOG.warn("No ClickListener for saveButton specified");
throw new IllegalArgumentException("no ClickListener for save button specified");
}
buttonsLayout.addComponent(saveButton);
buttonsLayout.setComponentAlignment(saveButton, Alignment.MIDDLE_RIGHT);
@@ -113,7 +125,7 @@ public class CommonDialogWindow extends Window {
if (null != cancelButtonClickListener) {
cancelButton.addClickListener(cancelButtonClickListener);
} else {
LOG.warn("No ClickListener for cancelButton specified");
throw new IllegalArgumentException("no ClickListener for cancel button specified");
}
buttonsLayout.addComponent(cancelButton);
buttonsLayout.setComponentAlignment(cancelButton, Alignment.MIDDLE_LEFT);

View File

@@ -14,6 +14,8 @@ import com.vaadin.ui.themes.ValoTheme;
public class SPUIButtonStyleBorderWithIcon implements SPUIButtonDecorator {
Button button;
/**
* Style for button: Primary.
*/
@@ -21,7 +23,19 @@ public class SPUIButtonStyleBorderWithIcon implements SPUIButtonDecorator {
@Override
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
// Set Style
this.button = button;
setButtonStyle(style, setStyle);
setButtonIcon(icon);
button.addStyleName(ValoTheme.LABEL_SMALL);
button.setSizeFull();
return button;
}
private void setButtonStyle(final String style, final boolean setStyle) {
if (null != style) {
if (setStyle) {
button.setStyleName(style);
@@ -29,14 +43,12 @@ public class SPUIButtonStyleBorderWithIcon implements SPUIButtonDecorator {
button.addStyleName(style);
}
}
button.addStyleName(ValoTheme.LABEL_SMALL);
button.setSizeFull();
}
private void setButtonIcon(final Resource icon) {
// Set icon
if (null != icon) {
button.setIcon(icon);
}
return button;
}
}

View File

@@ -16,8 +16,8 @@ import org.eclipse.hawkbit.repository.DistributionSetRepository;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.ui.colorPicker.ColorPickerConstants;
import org.eclipse.hawkbit.ui.colorPicker.ColorPickerHelper;
import org.eclipse.hawkbit.ui.colorpicker.ColorPickerConstants;
import org.eclipse.hawkbit.ui.colorpicker.ColorPickerHelper;
import org.eclipse.hawkbit.ui.common.DistributionSetTypeBeanQuery;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
@@ -350,12 +350,7 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout
final CheckBox mandatoryCheckBox = (CheckBox) item.getItemProperty(DIST_TYPE_MANDATORY).getValue();
final Boolean isMandatory = mandatoryCheckBox.getValue();
final SoftwareModuleType swModuleType = softwareManagement.findSoftwareModuleTypeByName(distTypeName);
if (isMandatory) {
newDistType.addMandatoryModuleType(swModuleType);
} else {
newDistType.addOptionalModuleType(swModuleType);
}
checkMandatoryAndAddMandatoryModuleType(newDistType, isMandatory, swModuleType);
}
if (null != typeDescValue) {
newDistType.setDescription(typeDescValue);
@@ -400,12 +395,7 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout
final String distTypeName = (String) item.getItemProperty(DIST_TYPE_NAME).getValue();
final SoftwareModuleType swModuleType = softwareManagement
.findSoftwareModuleTypeByName(distTypeName);
if (isMandatory) {
updateDistSetType.addMandatoryModuleType(swModuleType);
} else {
updateDistSetType.addOptionalModuleType(swModuleType);
}
checkMandatoryAndAddMandatoryModuleType(updateDistSetType, isMandatory, swModuleType);
}
}
updateDistSetType.setColour(ColorPickerHelper.getColorPickedString(getColorPickerLayout().getSelPreview()));
@@ -422,6 +412,16 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout
}
private void checkMandatoryAndAddMandatoryModuleType(final DistributionSetType updateDistSetType,
final Boolean isMandatory, final SoftwareModuleType swModuleType) {
if (isMandatory) {
updateDistSetType.addMandatoryModuleType(swModuleType);
} else {
updateDistSetType.addOptionalModuleType(swModuleType);
}
}
private DistributionSetType removeSWModuleTypesFromDistSetType(final String selectedDistSetType) {
final DistributionSetType distSetType = fetchDistributionSetType(selectedDistSetType);
@@ -590,17 +590,6 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout
}
}
/**
* reset the tag name and tag description component border color.
*/
@Override
protected void restoreComponentStyles() {
super.restoreComponentStyles();
typeKey.removeStyleName(TYPE_NAME_DYNAMIC_STYLE);
typeKey.addStyleName(SPUIDefinitions.DIST_SET_TYPE_KEY);
}
@Override
protected void save(final ClickEvent event) {

View File

@@ -68,7 +68,7 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
private static final long serialVersionUID = 7474232427119031474L;
private static final String breadcrumbCustomFilters = "breadcrumb.target.filter.custom.filters";
private static final String BREADCRUMB_CUSTOM_FILTERS = "breadcrumb.target.filter.custom.filters";
@Autowired
private I18N i18n;
@@ -238,8 +238,8 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
final Button createFilterViewLink = SPUIComponentProvider.getButton(null, "", "", null, false, null,
SPUIButtonStyleSmallNoBorder.class);
createFilterViewLink.setStyleName(ValoTheme.LINK_SMALL + " " + "on-focus-no-border link rollout-caption-links");
createFilterViewLink.setDescription(i18n.get(breadcrumbCustomFilters));
createFilterViewLink.setCaption(i18n.get(breadcrumbCustomFilters));
createFilterViewLink.setDescription(i18n.get(BREADCRUMB_CUSTOM_FILTERS));
createFilterViewLink.setCaption(i18n.get(BREADCRUMB_CUSTOM_FILTERS));
createFilterViewLink.addClickListener(value -> showCustomFiltersView());
return createFilterViewLink;
@@ -487,15 +487,11 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
public void buttonClick(final ClickEvent event) {
if (SPUIComponetIdProvider.CUSTOM_FILTER_SAVE_ICON.equals(event.getComponent().getId())
&& manadatoryFieldsPresent()) {
if (filterManagementUIState.isCreateFilterViewDisplayed()) {
if (!doesAlreadyExists()) {
createTargetFilterQuery();
}
if (filterManagementUIState.isCreateFilterViewDisplayed() && !doesAlreadyExists()) {
createTargetFilterQuery();
} else {
if (!nameTextField.getValue().equals(oldFilterName)) {
if (!doesAlreadyExists()) {
updateCustomFilter();
}
if (!nameTextField.getValue().equals(oldFilterName) && !doesAlreadyExists()) {
updateCustomFilter();
} else {
updateCustomFilter();
}

View File

@@ -15,9 +15,9 @@ import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
import org.eclipse.hawkbit.repository.model.Tag;
import org.eclipse.hawkbit.repository.model.TargetTag;
import org.eclipse.hawkbit.ui.colorPicker.ColorPickerConstants;
import org.eclipse.hawkbit.ui.colorPicker.ColorPickerHelper;
import org.eclipse.hawkbit.ui.colorPicker.ColorPickerLayout;
import org.eclipse.hawkbit.ui.colorpicker.ColorPickerConstants;
import org.eclipse.hawkbit.ui.colorpicker.ColorPickerHelper;
import org.eclipse.hawkbit.ui.colorpicker.ColorPickerLayout;
import org.eclipse.hawkbit.ui.common.CommonDialogWindow;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
@@ -27,8 +27,6 @@ import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus;
@@ -58,9 +56,9 @@ import com.vaadin.ui.themes.ValoTheme;
/**
* Abstract class for create/update target tag layout.
*/
public abstract class CreateUpdateTagLayout extends CustomComponent implements ColorChangeListener, ColorSelector {
public abstract class AbstractCreateUpdateTagLayout extends CustomComponent
implements ColorChangeListener, ColorSelector {
private static final long serialVersionUID = 4229177824620576456L;
private static final Logger LOG = LoggerFactory.getLogger(CreateUpdateTagLayout.class);
private static final String TAG_NAME_DYNAMIC_STYLE = "new-tag-name";
private static final String TAG_DESC_DYNAMIC_STYLE = "new-tag-desc";
protected static final String TAG_DYNAMIC_STYLE = "tag-color-preview";
@@ -236,6 +234,7 @@ public abstract class CreateUpdateTagLayout extends CustomComponent implements C
protected void previewButtonClicked() {
if (!tagPreviewBtnClicked) {
setColor();
mainLayout.getComponent(1, 0);
mainLayout.addComponent(colorPickerLayout, 1, 0);
mainLayout.setComponentAlignment(colorPickerLayout, Alignment.MIDDLE_CENTER);
}

View File

@@ -11,8 +11,8 @@ package org.eclipse.hawkbit.ui.layouts;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.eclipse.hawkbit.repository.model.NamedEntity;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.ui.colorPicker.ColorPickerConstants;
import org.eclipse.hawkbit.ui.colorPicker.ColorPickerHelper;
import org.eclipse.hawkbit.ui.colorpicker.ColorPickerConstants;
import org.eclipse.hawkbit.ui.colorpicker.ColorPickerHelper;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
@@ -32,7 +32,13 @@ import com.vaadin.ui.components.colorpicker.ColorChangeEvent;
import com.vaadin.ui.components.colorpicker.ColorSelector;
import com.vaadin.ui.themes.ValoTheme;
public class CreateUpdateTypeLayout extends CreateUpdateTagLayout {
/**
*
* Superclass defining common properties and methods for creating/updating
* types.
*
*/
public class CreateUpdateTypeLayout extends AbstractCreateUpdateTagLayout {
private static final long serialVersionUID = 5732904956185988397L;
@@ -187,6 +193,7 @@ public class CreateUpdateTypeLayout extends CreateUpdateTagLayout {
protected void restoreComponentStyles() {
super.restoreComponentStyles();
typeKey.removeStyleName(TYPE_NAME_DYNAMIC_STYLE);
typeKey.addStyleName(SPUIDefinitions.TYPE_KEY);
}
/**
@@ -298,20 +305,17 @@ public class CreateUpdateTypeLayout extends CreateUpdateTagLayout {
@Override
protected void save(final ClickEvent event) {
// TODO Auto-generated method stub
// is implemented in the inherited class
}
@Override
protected void populateTagNameCombo() {
// TODO Auto-generated method stub
// is implemented in the inherited class
}
@Override
protected void setTagDetails(final String tagSelected) {
// TODO Auto-generated method stub
// is implemented in the inherited class
}
}

View File

@@ -22,7 +22,6 @@ import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.eclipse.hawkbit.repository.model.TenantMetaData;
import org.eclipse.hawkbit.ui.UiProperties;
import org.eclipse.hawkbit.ui.common.CommonDialogWindow;
import org.eclipse.hawkbit.ui.common.DistributionSetTypeBeanQuery;
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
@@ -91,9 +90,6 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
@Autowired
private transient TenantMetaDataRepository tenantMetaDataRepository;
@Autowired
private transient UiProperties uiProperties;
private TextField distNameTextField;
private TextField distVersionTextField;
private Label madatoryLabel;
@@ -537,4 +533,5 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
public void setOriginalDistSetTYpe(final String originalDistSetType) {
this.originalDistSetType = originalDistSetType;
}
}

View File

@@ -16,9 +16,9 @@ import org.eclipse.hawkbit.eventbus.event.DistributionSetTagCreatedBulkEvent;
import org.eclipse.hawkbit.eventbus.event.DistributionSetTagDeletedEvent;
import org.eclipse.hawkbit.eventbus.event.DistributionSetTagUpdateEvent;
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
import org.eclipse.hawkbit.ui.colorPicker.ColorPickerConstants;
import org.eclipse.hawkbit.ui.colorPicker.ColorPickerHelper;
import org.eclipse.hawkbit.ui.layouts.CreateUpdateTagLayout;
import org.eclipse.hawkbit.ui.colorpicker.ColorPickerConstants;
import org.eclipse.hawkbit.ui.colorpicker.ColorPickerHelper;
import org.eclipse.hawkbit.ui.layouts.AbstractCreateUpdateTagLayout;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.vaadin.spring.events.EventScope;
@@ -31,11 +31,12 @@ import com.vaadin.ui.UI;
/**
*
*
* Class for Create/Update Tag Layout of distribution set
*
*/
@SpringComponent
@ViewScope
public class CreateUpdateDistributionTagLayoutWindow extends CreateUpdateTagLayout {
public class CreateUpdateDistributionTagLayoutWindow extends AbstractCreateUpdateTagLayout {
private static final long serialVersionUID = 444276149954167545L;

View File

@@ -354,7 +354,9 @@ public class TargetBulkUpdateWindowLayout extends CustomComponent {
}
/**
* @return
* create and return window
*
* @return Window window
*/
public Window getWindow() {
managementUIState.setBulkUploadWindowMinimised(false);

View File

@@ -16,9 +16,9 @@ import org.eclipse.hawkbit.eventbus.event.TargetTagCreatedBulkEvent;
import org.eclipse.hawkbit.eventbus.event.TargetTagDeletedEvent;
import org.eclipse.hawkbit.eventbus.event.TargetTagUpdateEvent;
import org.eclipse.hawkbit.repository.model.TargetTag;
import org.eclipse.hawkbit.ui.colorPicker.ColorPickerConstants;
import org.eclipse.hawkbit.ui.colorPicker.ColorPickerHelper;
import org.eclipse.hawkbit.ui.layouts.CreateUpdateTagLayout;
import org.eclipse.hawkbit.ui.colorpicker.ColorPickerConstants;
import org.eclipse.hawkbit.ui.colorpicker.ColorPickerHelper;
import org.eclipse.hawkbit.ui.layouts.AbstractCreateUpdateTagLayout;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
@@ -28,11 +28,11 @@ import com.vaadin.ui.Button.ClickEvent;
/**
*
*
* Class for Create / Update Tag Layout of target
*/
@SpringComponent
@ViewScope
public class CreateUpdateTargetTagLayoutWindow extends CreateUpdateTagLayout {
public class CreateUpdateTargetTagLayoutWindow extends AbstractCreateUpdateTagLayout {
private static final long serialVersionUID = 2446682350481560235L;

View File

@@ -170,4 +170,5 @@ public class MultipleTargetFilter extends Accordion implements SelectedTabChange
UI.getCurrent().addWindow(addUpdateWindow);
addUpdateWindow.setVisible(true);
}
}

View File

@@ -41,6 +41,8 @@ import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
@@ -76,6 +78,8 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
private static final long serialVersionUID = 2999293468801479916L;
private static final Logger LOG = LoggerFactory.getLogger(AddUpdateRolloutWindowLayout.class);
private static final String MESSAGE_ROLLOUT_FIELD_VALUE_RANGE = "message.rollout.field.value.range";
private static final String MESSAGE_ENTER_NUMBER = "message.enter.number";
@@ -642,11 +646,14 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
new IntegerRangeValidator(i18n.get(MESSAGE_ROLLOUT_FIELD_VALUE_RANGE, 0, groupSize), 0, groupSize)
.validate(Integer.valueOf(value.toString()));
}
} catch (final InvalidValueException ex) {
throw ex;
}
// suppress the need of preserve original exception, will blow
// up the
// log and not necessary here
catch (@SuppressWarnings("squid:S1166") final InvalidValueException ex) {
LOG.error(ex.getMessage());
}
}
}
private int getGroupSize() {
@@ -662,8 +669,12 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
new RegexpValidator(NUMBER_REGEXP, i18n.get(MESSAGE_ENTER_NUMBER)).validate(value);
new IntegerRangeValidator(i18n.get(MESSAGE_ROLLOUT_FIELD_VALUE_RANGE, 0, 100), 0, 100)
.validate(Integer.valueOf(value.toString()));
} catch (final InvalidValueException ex) {
throw ex;
}
// suppress the need of preserve original exception, will blow
// up the
// log and not necessary here
catch (@SuppressWarnings("squid:S1166") final InvalidValueException ex) {
LOG.error(ex.getMessage());
}
}
}
@@ -677,8 +688,12 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
new RegexpValidator(NUMBER_REGEXP, i18n.get(MESSAGE_ENTER_NUMBER)).validate(value);
new IntegerRangeValidator(i18n.get(MESSAGE_ROLLOUT_FIELD_VALUE_RANGE, 0, 500), 0, 500)
.validate(Integer.valueOf(value.toString()));
} catch (final InvalidValueException ex) {
throw ex;
}
// suppress the need of preserve original exception, will blow
// up the
// log and not necessary here
catch (@SuppressWarnings("squid:S1166") final InvalidValueException ex) {
LOG.error(ex.getMessage());
}
}
}

View File

@@ -632,15 +632,13 @@ public class RolloutListGrid extends AbstractGrid {
@Override
public TotalTargetCountStatus convertToModel(final String value,
final Class<? extends TotalTargetCountStatus> targetType, final Locale locale)
throws com.vaadin.data.util.converter.Converter.ConversionException {
final Class<? extends TotalTargetCountStatus> targetType, final Locale locale) {
return null;
}
@Override
public String convertToPresentation(final TotalTargetCountStatus value,
final Class<? extends String> targetType, final Locale locale)
throws com.vaadin.data.util.converter.Converter.ConversionException {
final Class<? extends String> targetType, final Locale locale) {
return DistributionBarHelper.getDistributionBarAsHTMLString(value.getStatusTotalCountMap());
}
@@ -664,14 +662,13 @@ public class RolloutListGrid extends AbstractGrid {
private static final long serialVersionUID = 6589305227035220369L;
@Override
public Long convertToModel(final String value, final Class<? extends Long> targetType, final Locale locale)
throws com.vaadin.data.util.converter.Converter.ConversionException {
public Long convertToModel(final String value, final Class<? extends Long> targetType, final Locale locale) {
return null;
}
@Override
public String convertToPresentation(final Long value, final Class<? extends String> targetType,
final Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException {
final Locale locale) {
if (value == 0) {
return "";
}

View File

@@ -15,7 +15,6 @@ import org.eclipse.hawkbit.ui.common.grid.AbstractGridHeader;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.rollout.event.RolloutEvent;
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
@@ -49,9 +48,6 @@ public class RolloutListHeader extends AbstractGridHeader {
@Autowired
private transient EventBus.SessionEventBus eventBus;
@Autowired
private I18N i18n;
@Autowired
private AddUpdateRolloutWindowLayout addUpdateRolloutWindow;

View File

@@ -14,7 +14,6 @@ import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.SystemManagement;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.eclipse.hawkbit.repository.model.TenantMetaData;
import org.eclipse.hawkbit.ui.UiProperties;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
@@ -50,9 +49,6 @@ public class DefaultDistributionSetTypeLayout extends BaseConfigurationView impl
@Autowired
private I18N i18n;
@Autowired
private transient UiProperties uiProperties;
private Long currentDefaultDisSetType;
private Long selectedDefaultDisSetType;
@@ -158,4 +154,5 @@ public class DefaultDistributionSetTypeLayout extends BaseConfigurationView impl
changeIcon.setVisible(false);
}
}
}

View File

@@ -32,6 +32,7 @@ import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Link;
import com.vaadin.ui.Panel;
import com.vaadin.ui.VerticalLayout;
@@ -118,9 +119,9 @@ public class TenantConfigurationDashboardView extends CustomComponent implements
undoConfigurationBtn.addClickListener(event -> undoConfiguration());
hlayout.addComponent(undoConfigurationBtn);
// final Link linkToSystemConfigHelp = SPUIComponentProvider
// .getHelpLink(uiProperties.getLinks().getDocumentation().getSystemConfigurationView());
// hlayout.addComponent(linkToSystemConfigHelp);
final Link linkToSystemConfigHelp = SPUIComponentProvider
.getHelpLink(uiProperties.getLinks().getDocumentation().getSystemConfigurationView());
hlayout.addComponent(linkToSystemConfigHelp);
return hlayout;
}
@@ -142,9 +143,7 @@ public class TenantConfigurationDashboardView extends CustomComponent implements
}
private void undoConfiguration() {
configurationViews.forEach(confView -> {
confView.undo();
});
configurationViews.forEach(confView -> confView.undo());
// More methods
saveConfigurationBtn.setEnabled(false);
undoConfigurationBtn.setEnabled(false);

View File

@@ -41,10 +41,6 @@ public class CertificateAuthenticationConfigurationItem extends AbstractAuthenti
private VerticalLayout detailLayout;
private TextField caRootAuthorityTextField;
/**
* @param systemManagement
* the system management to retrie the configuration
*/
@Autowired
public CertificateAuthenticationConfigurationItem(
final TenantConfigurationManagement tenantConfigurationManagement) {
@@ -147,4 +143,5 @@ public class CertificateAuthenticationConfigurationItem extends AbstractAuthenti
configurationCaRootAuthorityChanged = true;
notifyConfigurationChanged();
}
}

View File

@@ -195,4 +195,5 @@ public class GatewaySecurityTokenAuthenticationConfigurationItem extends Abstrac
gatewayTokenNameTextField.setValue(getSecurityTokenName());
gatewayTokenkeyLabel.setValue(getSecurityTokenKey());
}
}

View File

@@ -11,10 +11,6 @@ package org.eclipse.hawkbit.ui.utils;
/**
* Interface to provide the unchanged constants.
*
*
*
*
*
*/
public final class SPUIComponetIdProvider {
/**

View File

@@ -88,7 +88,7 @@
}
.icon-only {
// margin-bottom: 6px !important;
margin-bottom: 6px !important;
}
//Toggle between pin and status icon

View File

@@ -11,7 +11,6 @@
//Color picker layout position adjustment
.rgb-vertical-layout {
// margin-top: 100px !important;
padding-bottom: 12px;
}
@@ -47,4 +46,11 @@
box-shadow: none !important;
height: 75px !important;
}
.v-window-fontsize .v-window-closebox,
.v-window-fontsize .v-window-maximizebox,
.v-window-fontsize .v-window-restorebox {
font-size: 16px;
}
}