From 72940d854aeefff501f8fb2f0cab45fa5578d527 Mon Sep 17 00:00:00 2001 From: Melanie Retter Date: Fri, 10 Jun 2016 09:40:05 +0200 Subject: [PATCH] Optimize layout Configure new Rollout Signed-off-by: Melanie Retter --- .../SoftwareModuleAddUpdateWindow.java | 1 + .../hawkbit/ui/common/CommonDialogWindow.java | 2 +- .../rollout/AddUpdateRolloutWindowLayout.java | 56 ++++++++++++------- .../hawkbit/customstyles/popup-common.scss | 4 ++ 4 files changed, 42 insertions(+), 21 deletions(-) diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/smtable/SoftwareModuleAddUpdateWindow.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/smtable/SoftwareModuleAddUpdateWindow.java index 309c111ea..85b55d69d 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/smtable/SoftwareModuleAddUpdateWindow.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/smtable/SoftwareModuleAddUpdateWindow.java @@ -208,6 +208,7 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent implements Se addStyleName("lay-color"); final FormLayout formLayout = new FormLayout(); + formLayout.setCaption(null); formLayout.addComponent(typeComboBox); formLayout.addComponent(nameTextField); formLayout.addComponent(versionTextField); diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/CommonDialogWindow.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/CommonDialogWindow.java index 7b5df4a8f..754f61ed2 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/CommonDialogWindow.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/CommonDialogWindow.java @@ -197,7 +197,7 @@ public class CommonDialogWindow extends Window implements Serializable { setCaption(caption); setContent(mainLayout); - setResizable(true); + setResizable(false); center(); setModal(true); addStyleName("fontsize"); diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/AddUpdateRolloutWindowLayout.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/AddUpdateRolloutWindowLayout.java index 1226ec5fb..2e419724b 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/AddUpdateRolloutWindowLayout.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/AddUpdateRolloutWindowLayout.java @@ -14,6 +14,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.commons.lang3.StringUtils; import org.eclipse.hawkbit.repository.DistributionSetManagement; import org.eclipse.hawkbit.repository.EntityFactory; import org.eclipse.hawkbit.repository.RolloutManagement; @@ -61,6 +62,7 @@ import com.vaadin.data.Validator; import com.vaadin.data.validator.IntegerRangeValidator; import com.vaadin.data.validator.RegexpValidator; import com.vaadin.event.FieldEvents.TextChangeEvent; +import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.spring.annotation.SpringComponent; import com.vaadin.spring.annotation.ViewScope; import com.vaadin.ui.ComboBox; @@ -224,21 +226,22 @@ public class AddUpdateRolloutWindowLayout extends GridLayout { setSizeUndefined(); setRows(9); setColumns(3); + setStyleName("marginTop"); - addComponent(getLabel("textfield.name"), 0, 0); + addComponent(getMandatoryLabel("textfield.name"), 0, 0); addComponent(rolloutName, 1, 0); - addComponent(getLabel("prompt.distribution.set"), 0, 1); + addComponent(getMandatoryLabel("prompt.distribution.set"), 0, 1); addComponent(distributionSet, 1, 1); - addComponent(getLabel("prompt.target.filter"), 0, 2); + addComponent(getMandatoryLabel("prompt.target.filter"), 0, 2); addComponent(targetFilterQueryCombo, 1, 2); addComponent(totalTargetsLabel, 2, 2); - addComponent(getLabel("prompt.number.of.groups"), 0, 3); + addComponent(getMandatoryLabel("prompt.number.of.groups"), 0, 3); addComponent(noOfGroups, 1, 3); addComponent(groupSizeLabel, 2, 3); - addComponent(getLabel("prompt.tigger.threshold"), 0, 4); + addComponent(getMandatoryLabel("prompt.tigger.threshold"), 0, 4); addComponent(triggerThreshold, 1, 4); addComponent(getPercentHintLabel(), 2, 4); - addComponent(getLabel("prompt.error.threshold"), 0, 5); + addComponent(getMandatoryLabel("prompt.error.threshold"), 0, 5); addComponent(errorThreshold, 1, 5); addComponent(errorThresholdOptionGroup, 2, 5); addComponent(getLabel("textfield.description"), 0, 6); @@ -248,12 +251,19 @@ public class AddUpdateRolloutWindowLayout extends GridLayout { rolloutName.focus(); } + private Label getMandatoryLabel(final String key) { + final Label mandatoryLabel = getLabel(i18n.get(key)); + mandatoryLabel.setContentMode(ContentMode.HTML); + mandatoryLabel.setValue(mandatoryLabel.getValue().concat(" *")); + return mandatoryLabel; + } + private Label getLabel(final String key) { return SPUIComponentProvider.getLabel(i18n.get(key), SPUILabelDefinitions.SP_LABEL_SIMPLE); } private TextField getTextfield(final String key) { - return SPUIComponentProvider.getTextField(null, "", ValoTheme.TEXTFIELD_TINY, true, null, i18n.get(key), true, + return SPUIComponentProvider.getTextField(null, "", ValoTheme.TEXTFIELD_TINY, false, null, i18n.get(key), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH); } @@ -340,7 +350,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout { private ComboBox createTargetFilterQueryCombo() { final ComboBox targetFilter = SPUIComponentProvider.getComboBox(null, "", "", null, ValoTheme.COMBOBOX_SMALL, - true, "", i18n.get("prompt.target.filter")); + false, "", i18n.get("prompt.target.filter")); targetFilter.setImmediate(true); targetFilter.setPageLength(7); targetFilter.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME); @@ -625,8 +635,8 @@ public class AddUpdateRolloutWindowLayout extends GridLayout { } private ComboBox createDistributionSetCombo() { - final ComboBox dsSet = SPUIComponentProvider.getComboBox(null, "", "", null, ValoTheme.COMBOBOX_SMALL, true, "", - i18n.get("prompt.distribution.set")); + final ComboBox dsSet = SPUIComponentProvider.getComboBox(null, "", "", null, ValoTheme.COMBOBOX_SMALL, false, + "", i18n.get("prompt.distribution.set")); dsSet.setImmediate(true); dsSet.setPageLength(7); dsSet.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME); @@ -685,10 +695,12 @@ public class AddUpdateRolloutWindowLayout extends GridLayout { uiNotification .displayValidationError(i18n.get("message.rollout.noofgroups.or.targetfilter.missing")); } else { - new RegexpValidator(NUMBER_REGEXP, i18n.get(MESSAGE_ENTER_NUMBER)).validate(value); - final int groupSize = getGroupSize(); - new IntegerRangeValidator(i18n.get(MESSAGE_ROLLOUT_FIELD_VALUE_RANGE, 0, groupSize), 0, groupSize) - .validate(Integer.valueOf(value.toString())); + if (StringUtils.isNotBlank(value.toString())) { + new RegexpValidator(NUMBER_REGEXP, i18n.get(MESSAGE_ENTER_NUMBER)).validate(value); + final int groupSize = getGroupSize(); + new IntegerRangeValidator(i18n.get(MESSAGE_ROLLOUT_FIELD_VALUE_RANGE, 0, groupSize), 0, + groupSize).validate(Integer.valueOf(value.toString())); + } } } // suppress the need of preserve original exception, will blow @@ -710,9 +722,11 @@ public class AddUpdateRolloutWindowLayout extends GridLayout { @Override public void validate(final Object value) { try { - 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())); + if (StringUtils.isNotBlank(value.toString())) { + 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())); + } } // suppress the need of preserve original exception, will blow // up the @@ -729,9 +743,11 @@ public class AddUpdateRolloutWindowLayout extends GridLayout { @Override public void validate(final Object value) { try { - 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())); + if (StringUtils.isNotBlank(value.toString())) { + 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())); + } } // suppress the need of preserve original exception, will blow // up the diff --git a/hawkbit-ui/src/main/resources/VAADIN/themes/hawkbit/customstyles/popup-common.scss b/hawkbit-ui/src/main/resources/VAADIN/themes/hawkbit/customstyles/popup-common.scss index 457fc266d..602298766 100644 --- a/hawkbit-ui/src/main/resources/VAADIN/themes/hawkbit/customstyles/popup-common.scss +++ b/hawkbit-ui/src/main/resources/VAADIN/themes/hawkbit/customstyles/popup-common.scss @@ -53,4 +53,8 @@ font-size: 16px; } + .v-gridlayout .v-gridlayout-marginTop { + padding-top: 20px !important; + } + }