add default value for optionGroup; optimize UI
Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com>
This commit is contained in:
@@ -38,7 +38,6 @@ import com.vaadin.ui.Label;
|
|||||||
import com.vaadin.ui.TextArea;
|
import com.vaadin.ui.TextArea;
|
||||||
import com.vaadin.ui.TextField;
|
import com.vaadin.ui.TextField;
|
||||||
import com.vaadin.ui.UI;
|
import com.vaadin.ui.UI;
|
||||||
import com.vaadin.ui.VerticalLayout;
|
|
||||||
import com.vaadin.ui.Window;
|
import com.vaadin.ui.Window;
|
||||||
import com.vaadin.ui.themes.ValoTheme;
|
import com.vaadin.ui.themes.ValoTheme;
|
||||||
|
|
||||||
@@ -197,10 +196,7 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent implements Se
|
|||||||
* The main layout of the window contains mandatory info, textboxes
|
* The main layout of the window contains mandatory info, textboxes
|
||||||
* (controller Id, name & description) and action buttons layout
|
* (controller Id, name & description) and action buttons layout
|
||||||
*/
|
*/
|
||||||
final VerticalLayout mainLayout = new VerticalLayout();
|
addStyleName("lay-color");
|
||||||
mainLayout.setSizeUndefined();
|
|
||||||
mainLayout.setSpacing(Boolean.TRUE);
|
|
||||||
mainLayout.addStyleName("lay-color");
|
|
||||||
|
|
||||||
final FormLayout formLayout = new FormLayout();
|
final FormLayout formLayout = new FormLayout();
|
||||||
formLayout.addComponent(typeComboBox);
|
formLayout.addComponent(typeComboBox);
|
||||||
@@ -210,13 +206,12 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent implements Se
|
|||||||
formLayout.addComponent(vendorTextField);
|
formLayout.addComponent(vendorTextField);
|
||||||
formLayout.addComponent(descTextArea);
|
formLayout.addComponent(descTextArea);
|
||||||
|
|
||||||
mainLayout.addComponents(formLayout);
|
setCompositionRoot(formLayout);
|
||||||
setCompositionRoot(mainLayout);
|
|
||||||
|
|
||||||
/* add main layout to the window */
|
/* add main layout to the window */
|
||||||
window = SPUIComponentProvider.getWindow(i18n.get("upload.caption.add.new.swmodule"), null,
|
window = SPUIComponentProvider.getWindow(i18n.get("upload.caption.add.new.swmodule"), null,
|
||||||
SPUIDefinitions.CREATE_UPDATE_WINDOW, this, event -> save(), event -> closeThisWindow(), null);
|
SPUIDefinitions.CREATE_UPDATE_WINDOW, this, event -> save(), event -> closeThisWindow(), null);
|
||||||
window.removeStyleName("actionButtonsMargin");
|
window.getButtonsLayout().removeStyleName("actionButtonsMargin");
|
||||||
nameTextField.focus();
|
nameTextField.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,6 +61,12 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout
|
|||||||
private Label multiAssign;
|
private Label multiAssign;
|
||||||
private OptionGroup assignOptiongroup;
|
private OptionGroup assignOptiongroup;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void addListeners() {
|
||||||
|
super.addListeners();
|
||||||
|
optiongroup.addValueChangeListener(event -> createOptionValueChanged(event));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void createRequiredComponents() {
|
protected void createRequiredComponents() {
|
||||||
|
|
||||||
@@ -119,7 +125,7 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout
|
|||||||
|
|
||||||
super.createOptionValueChanged(event);
|
super.createOptionValueChanged(event);
|
||||||
|
|
||||||
if ("Update Type".equals(event.getProperty().getValue())) {
|
if (updateTypeStr.equals(event.getProperty().getValue())) {
|
||||||
assignOptiongroup.setEnabled(false);
|
assignOptiongroup.setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
assignOptiongroup.setEnabled(true);
|
assignOptiongroup.setEnabled(true);
|
||||||
|
|||||||
@@ -131,4 +131,8 @@ public class CommonDialogWindow extends Window {
|
|||||||
cancelButton.setEnabled(enabled);
|
cancelButton.setEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HorizontalLayout getButtonsLayout() {
|
||||||
|
return buttonsLayout;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -486,7 +486,7 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout
|
|||||||
|
|
||||||
super.createOptionValueChanged(event);
|
super.createOptionValueChanged(event);
|
||||||
|
|
||||||
if ("Update Type".equals(event.getProperty().getValue())) {
|
if (updateTypeStr.equals(event.getProperty().getValue())) {
|
||||||
selectedTable.getContainerDataSource().removeAllItems();
|
selectedTable.getContainerDataSource().removeAllItems();
|
||||||
getSourceTableData();
|
getSourceTableData();
|
||||||
distTypeSelectLayout.setEnabled(false);
|
distTypeSelectLayout.setEnabled(false);
|
||||||
|
|||||||
@@ -66,10 +66,9 @@ public class DistSMTypeFilterHeader extends AbstractFilterHeader {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void settingsIconClicked(final ClickEvent event) {
|
protected void settingsIconClicked(final ClickEvent event) {
|
||||||
final Window addUpdateWindow = createUpdateSWTypeLayout.getWindow();
|
final Window window = createUpdateSWTypeLayout.getWindow();
|
||||||
UI.getCurrent().addWindow(addUpdateWindow);
|
UI.getCurrent().addWindow(window);
|
||||||
addUpdateWindow.setVisible(Boolean.TRUE);
|
window.setVisible(Boolean.TRUE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -221,11 +221,10 @@ public abstract class CreateUpdateTagLayout extends CustomComponent implements C
|
|||||||
tagName.focus();
|
tagName.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addListeners() {
|
protected void addListeners() {
|
||||||
colorPickerLayout.getColorSelect().addColorChangeListener(this);
|
colorPickerLayout.getColorSelect().addColorChangeListener(this);
|
||||||
colorPickerLayout.getSelPreview().addColorChangeListener(this);
|
colorPickerLayout.getSelPreview().addColorChangeListener(this);
|
||||||
tagColorPreviewBtn.addClickListener(event -> previewButtonClicked());
|
tagColorPreviewBtn.addClickListener(event -> previewButtonClicked());
|
||||||
optiongroup.addValueChangeListener(event -> optionValueChanged(event));
|
|
||||||
tagNameComboBox.addValueChangeListener(event -> tagNameChosen(event));
|
tagNameComboBox.addValueChangeListener(event -> tagNameChosen(event));
|
||||||
slidersValueChangeListeners();
|
slidersValueChangeListeners();
|
||||||
}
|
}
|
||||||
@@ -302,9 +301,9 @@ public abstract class CreateUpdateTagLayout extends CustomComponent implements C
|
|||||||
* @param event
|
* @param event
|
||||||
* ValueChangeEvent
|
* ValueChangeEvent
|
||||||
*/
|
*/
|
||||||
private void optionValueChanged(final ValueChangeEvent event) {
|
protected void optionValueChanged(final ValueChangeEvent event) {
|
||||||
|
|
||||||
if ("Update Tag".equals(event.getProperty().getValue())) {
|
if (updateTagStr.equals(event.getProperty().getValue())) {
|
||||||
tagName.clear();
|
tagName.clear();
|
||||||
tagDesc.clear();
|
tagDesc.clear();
|
||||||
tagName.setEnabled(false);
|
tagName.setEnabled(false);
|
||||||
@@ -344,8 +343,6 @@ public abstract class CreateUpdateTagLayout extends CustomComponent implements C
|
|||||||
comboLayout.removeComponent(tagNameComboBox);
|
comboLayout.removeComponent(tagNameComboBox);
|
||||||
mainLayout.removeComponent(colorPickerLayout);
|
mainLayout.removeComponent(colorPickerLayout);
|
||||||
|
|
||||||
optiongroup.select(createTagStr);
|
|
||||||
|
|
||||||
// Default green color
|
// Default green color
|
||||||
colorPickerLayout.setSelectedColor(colorPickerLayout.getDefaultColor());
|
colorPickerLayout.setSelectedColor(colorPickerLayout.getDefaultColor());
|
||||||
colorPickerLayout.getSelPreview().setColor(colorPickerLayout.getSelectedColor());
|
colorPickerLayout.getSelPreview().setColor(colorPickerLayout.getSelectedColor());
|
||||||
@@ -456,13 +453,21 @@ public abstract class CreateUpdateTagLayout extends CustomComponent implements C
|
|||||||
|
|
||||||
if (hasCreatePermission) {
|
if (hasCreatePermission) {
|
||||||
optiongroup.addItem(createTagStr);
|
optiongroup.addItem(createTagStr);
|
||||||
optiongroup.select(createTagStr);
|
|
||||||
}
|
}
|
||||||
if (hasUpdatePermission) {
|
if (hasUpdatePermission) {
|
||||||
optiongroup.addItem(updateTagStr);
|
optiongroup.addItem(updateTagStr);
|
||||||
if (!hasCreatePermission) {
|
}
|
||||||
optiongroup.select(updateTagStr);
|
|
||||||
}
|
setOptionGroupDefaultValue(hasCreatePermission, hasUpdatePermission);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setOptionGroupDefaultValue(final boolean hasCreatePermission, final boolean hasUpdatePermission) {
|
||||||
|
|
||||||
|
if (hasCreatePermission) {
|
||||||
|
optiongroup.select(createTagStr);
|
||||||
|
}
|
||||||
|
if (hasUpdatePermission && !hasCreatePermission) {
|
||||||
|
optiongroup.select(updateTagStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,12 @@ public class CreateUpdateTypeLayout extends CreateUpdateTagLayout {
|
|||||||
public static final String TYPE_NAME_DYNAMIC_STYLE = "new-tag-name";
|
public static final String TYPE_NAME_DYNAMIC_STYLE = "new-tag-name";
|
||||||
private static final String TYPE_DESC_DYNAMIC_STYLE = "new-tag-desc";
|
private static final String TYPE_DESC_DYNAMIC_STYLE = "new-tag-desc";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void addListeners() {
|
||||||
|
super.addListeners();
|
||||||
|
optiongroup.addValueChangeListener(event -> createOptionValueChanged(event));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void createRequiredComponents() {
|
protected void createRequiredComponents() {
|
||||||
|
|
||||||
@@ -107,6 +113,8 @@ public class CreateUpdateTypeLayout extends CreateUpdateTagLayout {
|
|||||||
super.reset();
|
super.reset();
|
||||||
typeKey.clear();
|
typeKey.clear();
|
||||||
restoreComponentStyles();
|
restoreComponentStyles();
|
||||||
|
setOptionGroupDefaultValue(permChecker.hasCreateDistributionPermission(),
|
||||||
|
permChecker.hasUpdateDistributionPermission());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -117,7 +125,7 @@ public class CreateUpdateTypeLayout extends CreateUpdateTagLayout {
|
|||||||
*/
|
*/
|
||||||
protected void createOptionValueChanged(final ValueChangeEvent event) {
|
protected void createOptionValueChanged(final ValueChangeEvent event) {
|
||||||
|
|
||||||
if ("Update Type".equals(event.getProperty().getValue())) {
|
if (updateTypeStr.equals(event.getProperty().getValue())) {
|
||||||
tagName.clear();
|
tagName.clear();
|
||||||
tagDesc.clear();
|
tagDesc.clear();
|
||||||
typeKey.clear();
|
typeKey.clear();
|
||||||
@@ -186,13 +194,21 @@ public class CreateUpdateTypeLayout extends CreateUpdateTagLayout {
|
|||||||
|
|
||||||
if (hasCreatePermission) {
|
if (hasCreatePermission) {
|
||||||
optiongroup.addItem(createTypeStr);
|
optiongroup.addItem(createTypeStr);
|
||||||
optiongroup.select(createTypeStr);
|
|
||||||
}
|
}
|
||||||
if (hasUpdatePermission) {
|
if (hasUpdatePermission) {
|
||||||
optiongroup.addItem(updateTypeStr);
|
optiongroup.addItem(updateTypeStr);
|
||||||
if (!hasCreatePermission) {
|
}
|
||||||
optiongroup.select(updateTypeStr);
|
setOptionGroupDefaultValue(hasCreatePermission, hasUpdatePermission);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setOptionGroupDefaultValue(final boolean hasCreatePermission, final boolean hasUpdatePermission) {
|
||||||
|
|
||||||
|
if (hasCreatePermission) {
|
||||||
|
optiongroup.select(createTypeStr);
|
||||||
|
}
|
||||||
|
if (hasUpdatePermission && !hasCreatePermission) {
|
||||||
|
optiongroup.select(updateTypeStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,12 +53,12 @@ import com.vaadin.spring.annotation.ViewScope;
|
|||||||
import com.vaadin.ui.CheckBox;
|
import com.vaadin.ui.CheckBox;
|
||||||
import com.vaadin.ui.ComboBox;
|
import com.vaadin.ui.ComboBox;
|
||||||
import com.vaadin.ui.Component;
|
import com.vaadin.ui.Component;
|
||||||
|
import com.vaadin.ui.CustomComponent;
|
||||||
import com.vaadin.ui.FormLayout;
|
import com.vaadin.ui.FormLayout;
|
||||||
import com.vaadin.ui.Label;
|
import com.vaadin.ui.Label;
|
||||||
import com.vaadin.ui.TextArea;
|
import com.vaadin.ui.TextArea;
|
||||||
import com.vaadin.ui.TextField;
|
import com.vaadin.ui.TextField;
|
||||||
import com.vaadin.ui.UI;
|
import com.vaadin.ui.UI;
|
||||||
import com.vaadin.ui.VerticalLayout;
|
|
||||||
import com.vaadin.ui.themes.ValoTheme;
|
import com.vaadin.ui.themes.ValoTheme;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,7 +67,7 @@ import com.vaadin.ui.themes.ValoTheme;
|
|||||||
*/
|
*/
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@ViewScope
|
@ViewScope
|
||||||
public class DistributionAddUpdateWindowLayout extends VerticalLayout {
|
public class DistributionAddUpdateWindowLayout extends CustomComponent {
|
||||||
|
|
||||||
private static final long serialVersionUID = -5602182034230568435L;
|
private static final long serialVersionUID = -5602182034230568435L;
|
||||||
|
|
||||||
@@ -132,8 +132,6 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
|
|||||||
* The main layout of the window contains mandatory info, textboxes
|
* The main layout of the window contains mandatory info, textboxes
|
||||||
* (controller Id, name & description) and action buttons layout
|
* (controller Id, name & description) and action buttons layout
|
||||||
*/
|
*/
|
||||||
setSpacing(Boolean.TRUE);
|
|
||||||
setMargin(Boolean.FALSE);
|
|
||||||
addStyleName("lay-color");
|
addStyleName("lay-color");
|
||||||
setSizeUndefined();
|
setSizeUndefined();
|
||||||
|
|
||||||
@@ -145,7 +143,7 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
|
|||||||
formLayout.addComponent(descTextArea);
|
formLayout.addComponent(descTextArea);
|
||||||
formLayout.addComponent(reqMigStepCheckbox);
|
formLayout.addComponent(reqMigStepCheckbox);
|
||||||
|
|
||||||
addComponents(formLayout);
|
setCompositionRoot(formLayout);
|
||||||
|
|
||||||
distNameTextField.focus();
|
distNameTextField.focus();
|
||||||
}
|
}
|
||||||
@@ -518,7 +516,7 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
|
|||||||
addDistributionWindow = SPUIComponentProvider.getWindow(i18n.get("caption.add.new.dist"), null,
|
addDistributionWindow = SPUIComponentProvider.getWindow(i18n.get("caption.add.new.dist"), null,
|
||||||
SPUIDefinitions.CREATE_UPDATE_WINDOW, this, event -> saveDistribution(), event -> discardDistribution(),
|
SPUIDefinitions.CREATE_UPDATE_WINDOW, this, event -> saveDistribution(), event -> discardDistribution(),
|
||||||
null);
|
null);
|
||||||
addDistributionWindow.removeStyleName("actionButtonsMargin");
|
addDistributionWindow.getButtonsLayout().removeStyleName("actionButtonsMargin");
|
||||||
|
|
||||||
return addDistributionWindow;
|
return addDistributionWindow;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,6 +70,12 @@ public class CreateUpdateDistributionTagLayoutWindow extends CreateUpdateTagLayo
|
|||||||
distTagNameList.forEach(value -> tagNameComboBox.addItem(value.getName()));
|
distTagNameList.forEach(value -> tagNameComboBox.addItem(value.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void addListeners() {
|
||||||
|
super.addListeners();
|
||||||
|
optiongroup.addValueChangeListener(event -> optionValueChanged(event));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update DistributionTag.
|
* Update DistributionTag.
|
||||||
*/
|
*/
|
||||||
@@ -164,4 +170,11 @@ public class CreateUpdateDistributionTagLayoutWindow extends CreateUpdateTagLayo
|
|||||||
createOptionGroup(permChecker.hasCreateDistributionPermission(), permChecker.hasUpdateDistributionPermission());
|
createOptionGroup(permChecker.hasCreateDistributionPermission(), permChecker.hasUpdateDistributionPermission());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void reset() {
|
||||||
|
|
||||||
|
super.reset();
|
||||||
|
setOptionGroupDefaultValue(permChecker.hasCreateDistributionPermission(),
|
||||||
|
permChecker.hasUpdateDistributionPermission());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,6 +57,12 @@ public class CreateUpdateTargetTagLayoutWindow extends CreateUpdateTagLayout {
|
|||||||
populateTagNameCombo();
|
populateTagNameCombo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void addListeners() {
|
||||||
|
super.addListeners();
|
||||||
|
optiongroup.addValueChangeListener(event -> optionValueChanged(event));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Populate target name combo.
|
* Populate target name combo.
|
||||||
*/
|
*/
|
||||||
@@ -132,4 +138,11 @@ public class CreateUpdateTargetTagLayoutWindow extends CreateUpdateTagLayout {
|
|||||||
createOptionGroup(permChecker.hasCreateTargetPermission(), permChecker.hasUpdateTargetPermission());
|
createOptionGroup(permChecker.hasCreateTargetPermission(), permChecker.hasUpdateTargetPermission());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void reset() {
|
||||||
|
|
||||||
|
super.reset();
|
||||||
|
setOptionGroupDefaultValue(permChecker.hasCreateTargetPermission(), permChecker.hasUpdateTargetPermission());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
|
|||||||
setRows(9);
|
setRows(9);
|
||||||
setColumns(3);
|
setColumns(3);
|
||||||
|
|
||||||
addComponent(mandatoryLabel, 0, 0, 2, 0);
|
addComponent(mandatoryLabel, 1, 0, 2, 0);
|
||||||
addComponent(getLabel("textfield.name"), 0, 1);
|
addComponent(getLabel("textfield.name"), 0, 1);
|
||||||
addComponent(rolloutName, 1, 1);
|
addComponent(rolloutName, 1, 1);
|
||||||
addComponent(getLabel("prompt.distribution.set"), 0, 2);
|
addComponent(getLabel("prompt.distribution.set"), 0, 2);
|
||||||
|
|||||||
Reference in New Issue
Block a user