Optimize layout Configure new Rollout

Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com>
This commit is contained in:
Melanie Retter
2016-06-10 09:40:05 +02:00
parent bbaa6baa72
commit 72940d854a
4 changed files with 42 additions and 21 deletions

View File

@@ -208,6 +208,7 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent implements Se
addStyleName("lay-color"); addStyleName("lay-color");
final FormLayout formLayout = new FormLayout(); final FormLayout formLayout = new FormLayout();
formLayout.setCaption(null);
formLayout.addComponent(typeComboBox); formLayout.addComponent(typeComboBox);
formLayout.addComponent(nameTextField); formLayout.addComponent(nameTextField);
formLayout.addComponent(versionTextField); formLayout.addComponent(versionTextField);

View File

@@ -197,7 +197,7 @@ public class CommonDialogWindow extends Window implements Serializable {
setCaption(caption); setCaption(caption);
setContent(mainLayout); setContent(mainLayout);
setResizable(true); setResizable(false);
center(); center();
setModal(true); setModal(true);
addStyleName("fontsize"); addStyleName("fontsize");

View File

@@ -14,6 +14,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.hawkbit.repository.DistributionSetManagement; import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.EntityFactory; import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.RolloutManagement; 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.IntegerRangeValidator;
import com.vaadin.data.validator.RegexpValidator; import com.vaadin.data.validator.RegexpValidator;
import com.vaadin.event.FieldEvents.TextChangeEvent; import com.vaadin.event.FieldEvents.TextChangeEvent;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.spring.annotation.SpringComponent; import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope; import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.ComboBox; import com.vaadin.ui.ComboBox;
@@ -224,21 +226,22 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
setSizeUndefined(); setSizeUndefined();
setRows(9); setRows(9);
setColumns(3); setColumns(3);
setStyleName("marginTop");
addComponent(getLabel("textfield.name"), 0, 0); addComponent(getMandatoryLabel("textfield.name"), 0, 0);
addComponent(rolloutName, 1, 0); addComponent(rolloutName, 1, 0);
addComponent(getLabel("prompt.distribution.set"), 0, 1); addComponent(getMandatoryLabel("prompt.distribution.set"), 0, 1);
addComponent(distributionSet, 1, 1); addComponent(distributionSet, 1, 1);
addComponent(getLabel("prompt.target.filter"), 0, 2); addComponent(getMandatoryLabel("prompt.target.filter"), 0, 2);
addComponent(targetFilterQueryCombo, 1, 2); addComponent(targetFilterQueryCombo, 1, 2);
addComponent(totalTargetsLabel, 2, 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(noOfGroups, 1, 3);
addComponent(groupSizeLabel, 2, 3); addComponent(groupSizeLabel, 2, 3);
addComponent(getLabel("prompt.tigger.threshold"), 0, 4); addComponent(getMandatoryLabel("prompt.tigger.threshold"), 0, 4);
addComponent(triggerThreshold, 1, 4); addComponent(triggerThreshold, 1, 4);
addComponent(getPercentHintLabel(), 2, 4); addComponent(getPercentHintLabel(), 2, 4);
addComponent(getLabel("prompt.error.threshold"), 0, 5); addComponent(getMandatoryLabel("prompt.error.threshold"), 0, 5);
addComponent(errorThreshold, 1, 5); addComponent(errorThreshold, 1, 5);
addComponent(errorThresholdOptionGroup, 2, 5); addComponent(errorThresholdOptionGroup, 2, 5);
addComponent(getLabel("textfield.description"), 0, 6); addComponent(getLabel("textfield.description"), 0, 6);
@@ -248,12 +251,19 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
rolloutName.focus(); rolloutName.focus();
} }
private Label getMandatoryLabel(final String key) {
final Label mandatoryLabel = getLabel(i18n.get(key));
mandatoryLabel.setContentMode(ContentMode.HTML);
mandatoryLabel.setValue(mandatoryLabel.getValue().concat(" <span style='color:#ed473b'>*</span>"));
return mandatoryLabel;
}
private Label getLabel(final String key) { private Label getLabel(final String key) {
return SPUIComponentProvider.getLabel(i18n.get(key), SPUILabelDefinitions.SP_LABEL_SIMPLE); return SPUIComponentProvider.getLabel(i18n.get(key), SPUILabelDefinitions.SP_LABEL_SIMPLE);
} }
private TextField getTextfield(final String key) { 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); SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
} }
@@ -340,7 +350,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
private ComboBox createTargetFilterQueryCombo() { private ComboBox createTargetFilterQueryCombo() {
final ComboBox targetFilter = SPUIComponentProvider.getComboBox(null, "", "", null, ValoTheme.COMBOBOX_SMALL, 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.setImmediate(true);
targetFilter.setPageLength(7); targetFilter.setPageLength(7);
targetFilter.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME); targetFilter.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME);
@@ -625,8 +635,8 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
} }
private ComboBox createDistributionSetCombo() { private ComboBox createDistributionSetCombo() {
final ComboBox dsSet = SPUIComponentProvider.getComboBox(null, "", "", null, ValoTheme.COMBOBOX_SMALL, true, "", final ComboBox dsSet = SPUIComponentProvider.getComboBox(null, "", "", null, ValoTheme.COMBOBOX_SMALL, false,
i18n.get("prompt.distribution.set")); "", i18n.get("prompt.distribution.set"));
dsSet.setImmediate(true); dsSet.setImmediate(true);
dsSet.setPageLength(7); dsSet.setPageLength(7);
dsSet.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME); dsSet.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME);
@@ -685,10 +695,12 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
uiNotification uiNotification
.displayValidationError(i18n.get("message.rollout.noofgroups.or.targetfilter.missing")); .displayValidationError(i18n.get("message.rollout.noofgroups.or.targetfilter.missing"));
} else { } else {
new RegexpValidator(NUMBER_REGEXP, i18n.get(MESSAGE_ENTER_NUMBER)).validate(value); if (StringUtils.isNotBlank(value.toString())) {
final int groupSize = getGroupSize(); new RegexpValidator(NUMBER_REGEXP, i18n.get(MESSAGE_ENTER_NUMBER)).validate(value);
new IntegerRangeValidator(i18n.get(MESSAGE_ROLLOUT_FIELD_VALUE_RANGE, 0, groupSize), 0, groupSize) final int groupSize = getGroupSize();
.validate(Integer.valueOf(value.toString())); 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 // suppress the need of preserve original exception, will blow
@@ -710,9 +722,11 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
@Override @Override
public void validate(final Object value) { public void validate(final Object value) {
try { try {
new RegexpValidator(NUMBER_REGEXP, i18n.get(MESSAGE_ENTER_NUMBER)).validate(value); if (StringUtils.isNotBlank(value.toString())) {
new IntegerRangeValidator(i18n.get(MESSAGE_ROLLOUT_FIELD_VALUE_RANGE, 0, 100), 0, 100) new RegexpValidator(NUMBER_REGEXP, i18n.get(MESSAGE_ENTER_NUMBER)).validate(value);
.validate(Integer.valueOf(value.toString())); 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 // suppress the need of preserve original exception, will blow
// up the // up the
@@ -729,9 +743,11 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
@Override @Override
public void validate(final Object value) { public void validate(final Object value) {
try { try {
new RegexpValidator(NUMBER_REGEXP, i18n.get(MESSAGE_ENTER_NUMBER)).validate(value); if (StringUtils.isNotBlank(value.toString())) {
new IntegerRangeValidator(i18n.get(MESSAGE_ROLLOUT_FIELD_VALUE_RANGE, 0, 500), 0, 500) new RegexpValidator(NUMBER_REGEXP, i18n.get(MESSAGE_ENTER_NUMBER)).validate(value);
.validate(Integer.valueOf(value.toString())); 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 // suppress the need of preserve original exception, will blow
// up the // up the

View File

@@ -53,4 +53,8 @@
font-size: 16px; font-size: 16px;
} }
.v-gridlayout .v-gridlayout-marginTop {
padding-top: 20px !important;
}
} }