optimize CommonDialogWindow

Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com>
This commit is contained in:
Melanie Retter
2016-05-25 18:55:43 +02:00
parent 6c7f0482b4
commit 3abfe388a4
6 changed files with 10 additions and 38 deletions

View File

@@ -44,10 +44,10 @@ public final class SPUIWindowDecorator {
*/ */
public static CommonDialogWindow getDeocratedWindow(final String caption, final String id, final String type, public static CommonDialogWindow getDeocratedWindow(final String caption, final String id, final String type,
final Component content, final ClickListener saveButtonClickListener, final Component content, final ClickListener saveButtonClickListener,
final ClickListener CancelButtonClickListener, final String helpLink) { final ClickListener cancelButtonClickListener, final String helpLink) {
// TODO helpLink
final CommonDialogWindow window = new CommonDialogWindow(caption, content, helpLink, saveButtonClickListener, final CommonDialogWindow window = new CommonDialogWindow(caption, content, helpLink, saveButtonClickListener,
CancelButtonClickListener); cancelButtonClickListener);
if (null != id) { if (null != id) {
window.setId(id); window.setId(id);
} }

View File

@@ -335,7 +335,7 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout
* Create new DistSet Type tag. * Create new DistSet Type tag.
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private void crateNewDistributionSetType() { private void createNewDistributionSetType() {
final String colorPicked = ColorPickerHelper.getColorPickedString(getColorPickerLayout().getSelPreview()); final String colorPicked = ColorPickerHelper.getColorPickedString(getColorPickerLayout().getSelPreview());
final String typeNameValue = HawkbitCommonUtil.trimAndNullIfEmpty(tagName.getValue()); final String typeNameValue = HawkbitCommonUtil.trimAndNullIfEmpty(tagName.getValue());
@@ -611,7 +611,7 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout
.findDistributionSetTypeByName(tagName.getValue()); .findDistributionSetTypeByName(tagName.getValue());
if (optiongroup.getValue().equals(createTypeStr)) { if (optiongroup.getValue().equals(createTypeStr)) {
if (!checkIsDuplicateByKey(existingDistTypeByKey) && !checkIsDuplicate(existingDistTypeByName)) { if (!checkIsDuplicateByKey(existingDistTypeByKey) && !checkIsDuplicate(existingDistTypeByName)) {
crateNewDistributionSetType(); createNewDistributionSetType();
} }
} else { } else {
updateDistributionSetType(existingDistTypeByKey); updateDistributionSetType(existingDistTypeByKey);

View File

@@ -327,8 +327,6 @@ public abstract class CreateUpdateTagLayout extends CustomComponent implements C
getPreviewButtonColor(ColorPickerConstants.DEFAULT_COLOR); getPreviewButtonColor(ColorPickerConstants.DEFAULT_COLOR);
colorPickerLayout.getSelPreview() colorPickerLayout.getSelPreview()
.setColor(ColorPickerHelper.rgbToColorConverter(ColorPickerConstants.DEFAULT_COLOR)); .setColor(ColorPickerHelper.rgbToColorConverter(ColorPickerConstants.DEFAULT_COLOR));
// remove the sliders and color picker layout
// fieldLayout.removeComponent(colorPickerLayout.getSliders());
mainLayout.removeComponent(colorPickerLayout); mainLayout.removeComponent(colorPickerLayout);
} }

View File

@@ -247,7 +247,7 @@ public class TargetAddUpdateWindowLayout extends CustomComponent {
public Window getWindow() { public Window getWindow() {
eventBus.publish(this, DragEvent.HIDE_DROP_HINT); eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
addTargetWindow = SPUIComponentProvider.getWindow(i18n.get("caption.add.new.target"), null, addTargetWindow = SPUIComponentProvider.getWindow(i18n.get("caption.add.new.target"), null,
SPUIDefinitions.CREATE_UPDATE_WINDOW, this, event -> saveTargetListner(),event -> discardTargetListner(), null); SPUIDefinitions.CREATE_UPDATE_WINDOW, this, event -> saveTargetListner(), event -> discardTargetListner(), null);
return addTargetWindow; return addTargetWindow;
} }

View File

@@ -56,10 +56,8 @@ import com.vaadin.data.validator.IntegerRangeValidator;
import com.vaadin.data.validator.RegexpValidator; import com.vaadin.data.validator.RegexpValidator;
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.Alignment;
import com.vaadin.ui.ComboBox; import com.vaadin.ui.ComboBox;
import com.vaadin.ui.GridLayout; import com.vaadin.ui.GridLayout;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label; import com.vaadin.ui.Label;
import com.vaadin.ui.OptionGroup; import com.vaadin.ui.OptionGroup;
import com.vaadin.ui.TextArea; import com.vaadin.ui.TextArea;
@@ -204,9 +202,11 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
addComponent(getLabel("prompt.distribution.set"), 0, 2); addComponent(getLabel("prompt.distribution.set"), 0, 2);
addComponent(distributionSet, 1, 2); addComponent(distributionSet, 1, 2);
addComponent(getLabel("prompt.target.filter"), 0, 3); addComponent(getLabel("prompt.target.filter"), 0, 3);
addComponent(getTargetFilterLayout(), 1, 3); addComponent(targetFilterQueryCombo, 1, 3);
addComponent(totalTargetsLabel, 2, 3);
addComponent(getLabel("prompt.number.of.groups"), 0, 4); addComponent(getLabel("prompt.number.of.groups"), 0, 4);
addComponent(getGroupDetailsLayout(), 1, 4); addComponent(noOfGroups, 1, 4);
addComponent(groupSizeLabel, 2, 4);
addComponent(getLabel("prompt.tigger.threshold"), 0, 5); addComponent(getLabel("prompt.tigger.threshold"), 0, 5);
addComponent(triggerThreshold, 1, 5); addComponent(triggerThreshold, 1, 5);
addComponent(getPercentHintLabel(), 2, 5); addComponent(getPercentHintLabel(), 2, 5);
@@ -220,26 +220,6 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
rolloutName.focus(); rolloutName.focus();
} }
private HorizontalLayout getTargetFilterLayout() {
final HorizontalLayout targetFilterLayout = new HorizontalLayout();
targetFilterLayout.setSizeUndefined();
targetFilterLayout.addComponents(targetFilterQueryCombo, targetFilterQuery, totalTargetsLabel);
targetFilterLayout.setExpandRatio(targetFilterQueryCombo, 0.71F);
targetFilterLayout.setExpandRatio(targetFilterQuery, 0.70F);
targetFilterLayout.setExpandRatio(totalTargetsLabel, 0.29F);
targetFilterLayout.setComponentAlignment(totalTargetsLabel, Alignment.MIDDLE_LEFT);
return targetFilterLayout;
}
private HorizontalLayout getGroupDetailsLayout() {
final HorizontalLayout groupLayout = new HorizontalLayout();
groupLayout.setSizeUndefined();
groupLayout.addComponents(noOfGroups, groupSizeLabel);
groupLayout.setExpandRatio(noOfGroups, 1.0F);
groupLayout.setComponentAlignment(groupSizeLabel, Alignment.MIDDLE_LEFT);
return groupLayout;
}
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);
} }

View File

@@ -15,7 +15,6 @@ import javax.annotation.PostConstruct;
import org.eclipse.hawkbit.ui.HawkbitUI; import org.eclipse.hawkbit.ui.HawkbitUI;
import org.eclipse.hawkbit.ui.UiProperties; import org.eclipse.hawkbit.ui.UiProperties;
import org.eclipse.hawkbit.ui.common.PopupWindowHelp;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider; import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder; import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
import org.eclipse.hawkbit.ui.tenantconfiguration.ConfigurationItem.ConfigurationItemChangeListener; import org.eclipse.hawkbit.ui.tenantconfiguration.ConfigurationItem.ConfigurationItemChangeListener;
@@ -90,11 +89,6 @@ public class TenantConfigurationDashboardView extends CustomComponent implements
rootLayout.setMargin(true); rootLayout.setMargin(true);
rootLayout.setSpacing(true); rootLayout.setSpacing(true);
final PopupWindowHelp help = new PopupWindowHelp(uiProperties.getLinks().getDocumentation().getRolloutView());
help.setSpacing(true);
rootLayout.addComponent(help);
rootLayout.setComponentAlignment(help, Alignment.BOTTOM_RIGHT);
configurationViews.forEach(view -> rootLayout.addComponent(view)); configurationViews.forEach(view -> rootLayout.addComponent(view));
final HorizontalLayout buttonContent = saveConfigurationButtonsLayout(); final HorizontalLayout buttonContent = saveConfigurationButtonsLayout();