Create a parent class for all dialogs
Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com>
This commit is contained in:
@@ -133,22 +133,24 @@ public class SoftwareModuleAddUpdateWindow implements Serializable {
|
||||
|
||||
private void createRequiredComponents() {
|
||||
/* name textfield */
|
||||
nameTextField = SPUIComponentProvider.getTextField("", ValoTheme.TEXTFIELD_TINY, true, null,
|
||||
i18n.get("textfield.name"), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
nameTextField = SPUIComponentProvider.getTextField(i18n.get("textfield.name"), "", ValoTheme.TEXTFIELD_TINY,
|
||||
true, null, i18n.get("textfield.name"), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
nameTextField.setId(SPUIComponetIdProvider.SOFT_MODULE_NAME);
|
||||
|
||||
/* version text field */
|
||||
versionTextField = SPUIComponentProvider.getTextField("", ValoTheme.TEXTFIELD_TINY, true, null,
|
||||
i18n.get("textfield.version"), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
versionTextField = SPUIComponentProvider.getTextField(i18n.get("textfield.version"), "",
|
||||
ValoTheme.TEXTFIELD_TINY, true, null, i18n.get("textfield.version"), true,
|
||||
SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
versionTextField.setId(SPUIComponetIdProvider.SOFT_MODULE_VERSION);
|
||||
|
||||
/* Vendor text field */
|
||||
vendorTextField = SPUIComponentProvider.getTextField("", ValoTheme.TEXTFIELD_TINY, false, null,
|
||||
i18n.get("textfield.vendor"), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
vendorTextField = SPUIComponentProvider.getTextField(i18n.get("textfield.vendor"), "", ValoTheme.TEXTFIELD_TINY,
|
||||
false, null, i18n.get("textfield.vendor"), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
vendorTextField.setId(SPUIComponetIdProvider.SOFT_MODULE_VENDOR);
|
||||
|
||||
descTextArea = SPUIComponentProvider.getTextArea("text-area-style", ValoTheme.TEXTAREA_TINY, false, null,
|
||||
i18n.get("textfield.description"), SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH);
|
||||
descTextArea = SPUIComponentProvider.getTextArea(i18n.get("textfield.description"), "text-area-style",
|
||||
ValoTheme.TEXTAREA_TINY, false, null, i18n.get("textfield.description"),
|
||||
SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH);
|
||||
descTextArea.setId(SPUIComponetIdProvider.ADD_SW_MODULE_DESCRIPTION);
|
||||
addDescriptionTextChangeListener();
|
||||
addVendorTextChangeListener();
|
||||
@@ -158,8 +160,8 @@ public class SoftwareModuleAddUpdateWindow implements Serializable {
|
||||
madatoryLabel.setStyleName(SPUIStyleDefinitions.SP_TEXTFIELD_ERROR);
|
||||
madatoryLabel.addStyleName(ValoTheme.LABEL_SMALL);
|
||||
|
||||
typeComboBox = SPUIComponentProvider.getComboBox("", "", null, null, false, null,
|
||||
i18n.get("upload.swmodule.type"));
|
||||
typeComboBox = SPUIComponentProvider.getComboBox(i18n.get("upload.swmodule.type"), "", "", null, null, false,
|
||||
null, i18n.get("upload.swmodule.type"));
|
||||
typeComboBox.setId(SPUIComponetIdProvider.SW_MODULE_TYPE);
|
||||
typeComboBox.setStyleName(SPUIDefinitions.COMBO_BOX_SPECIFIC_STYLE + " " + ValoTheme.COMBOBOX_TINY);
|
||||
typeComboBox.setNewItemsAllowed(Boolean.FALSE);
|
||||
|
||||
@@ -165,23 +165,26 @@ public class CreateUpdateSoftwareTypeLayout extends CustomComponent implements C
|
||||
colorLabel = SPUIComponentProvider.getLabel(i18n.get("label.choose.type.color"), null);
|
||||
colorLabel.addStyleName(SPUIDefinitions.COLOR_LABEL_STYLE);
|
||||
|
||||
typeName = SPUIComponentProvider.getTextField("", ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.TYPE_NAME,
|
||||
true, "", i18n.get("textfield.name"), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
typeName = SPUIComponentProvider.getTextField(i18n.get("textfield.name"), "",
|
||||
ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.TYPE_NAME, true, "", i18n.get("textfield.name"), true,
|
||||
SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
typeName.setId(SPUIDefinitions.NEW_SOFTWARE_TYPE_NAME);
|
||||
|
||||
typeKey = SPUIComponentProvider.getTextField("", ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.TYPE_KEY,
|
||||
true, "", i18n.get("textfield.key"), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
typeKey = SPUIComponentProvider.getTextField(i18n.get("textfield.key"), "",
|
||||
ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.TYPE_KEY, true, "", i18n.get("textfield.key"), true,
|
||||
SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
typeKey.setId(SPUIDefinitions.NEW_SOFTWARE_TYPE_KEY);
|
||||
|
||||
typeDesc = SPUIComponentProvider.getTextArea("", ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.TYPE_DESC,
|
||||
false, "", i18n.get("textfield.description"), SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH);
|
||||
typeDesc = SPUIComponentProvider.getTextArea(i18n.get("textfield.description"), "",
|
||||
ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.TYPE_DESC, false, "",
|
||||
i18n.get("textfield.description"), SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH);
|
||||
|
||||
typeDesc.setId(SPUIDefinitions.NEW_SOFTWARE_TYPE_DESC);
|
||||
typeDesc.setImmediate(true);
|
||||
typeDesc.setNullRepresentation("");
|
||||
|
||||
typeNameComboBox = SPUIComponentProvider.getComboBox("", "", null, null, false, "",
|
||||
i18n.get("label.combobox.type"));
|
||||
typeNameComboBox = SPUIComponentProvider.getComboBox(i18n.get("label.combobox.type"), "", "", null, null, false,
|
||||
"", i18n.get("label.combobox.type"));
|
||||
typeNameComboBox.addStyleName(SPUIDefinitions.FILTER_TYPE_COMBO_STYLE);
|
||||
typeNameComboBox.setImmediate(true);
|
||||
|
||||
|
||||
@@ -245,16 +245,16 @@ public class UploadConfirmationwindow implements Button.ClickListener {
|
||||
deleteIcon.setData(itemId);
|
||||
newItem.getItemProperty(ACTION).setValue(deleteIcon);
|
||||
|
||||
final TextField sha1 = SPUIComponentProvider.getTextField("", ValoTheme.TEXTFIELD_TINY, false, null, null,
|
||||
true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
final TextField sha1 = SPUIComponentProvider.getTextField(null, "", ValoTheme.TEXTFIELD_TINY, false, null,
|
||||
null, true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
sha1.setId(swNameVersion + "/" + customFile.getFileName() + "/sha1");
|
||||
|
||||
final TextField md5 = SPUIComponentProvider.getTextField("", ValoTheme.TEXTFIELD_TINY, false, null, null,
|
||||
true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
final TextField md5 = SPUIComponentProvider.getTextField(null, "", ValoTheme.TEXTFIELD_TINY, false, null,
|
||||
null, true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
md5.setId(swNameVersion + "/" + customFile.getFileName() + "/md5");
|
||||
|
||||
final TextField customFileName = SPUIComponentProvider.getTextField("", ValoTheme.TEXTFIELD_TINY, false,
|
||||
null, null, true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
final TextField customFileName = SPUIComponentProvider.getTextField(null, "", ValoTheme.TEXTFIELD_TINY,
|
||||
false, null, null, true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
customFileName.setId(swNameVersion + "/" + customFile.getFileName() + "/customFileName");
|
||||
newItem.getItemProperty(SHA1_CHECKSUM).setValue(sha1);
|
||||
newItem.getItemProperty(MD5_CHECKSUM).setValue(md5);
|
||||
@@ -265,8 +265,8 @@ public class UploadConfirmationwindow implements Button.ClickListener {
|
||||
private void addFileNameLayout(final Item newItem, final String baseSoftwareModuleNameVersion,
|
||||
final String customFileName, final String itemId) {
|
||||
final HorizontalLayout horizontalLayout = new HorizontalLayout();
|
||||
final TextField fileNameTextField = SPUIComponentProvider.getTextField("", ValoTheme.TEXTFIELD_TINY, false,
|
||||
null, null, true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
final TextField fileNameTextField = SPUIComponentProvider.getTextField(null, "", ValoTheme.TEXTFIELD_TINY,
|
||||
false, null, null, true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
fileNameTextField.setId(baseSoftwareModuleNameVersion + "/" + customFileName + "/customFileName");
|
||||
fileNameTextField.setData(baseSoftwareModuleNameVersion + "/" + customFileName);
|
||||
fileNameTextField.setValue(customFileName);
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
package org.eclipse.hawkbit.ui.common;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.vaadin.server.FontAwesome;
|
||||
import com.vaadin.ui.Button;
|
||||
import com.vaadin.ui.Button.ClickListener;
|
||||
import com.vaadin.ui.FormLayout;
|
||||
import com.vaadin.ui.HorizontalLayout;
|
||||
import com.vaadin.ui.Link;
|
||||
import com.vaadin.ui.VerticalLayout;
|
||||
import com.vaadin.ui.Window;
|
||||
|
||||
public class CommonDialog extends Window {
|
||||
|
||||
private static final long serialVersionUID = -1321949234316858703L;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(CommonDialog.class);
|
||||
|
||||
private final VerticalLayout mainLayout = new VerticalLayout();
|
||||
|
||||
private FormLayout formLayout = new FormLayout();
|
||||
|
||||
private Button saveButton;
|
||||
|
||||
private Button cancelButton;
|
||||
|
||||
public CommonDialog() {
|
||||
|
||||
mainLayout.addComponent(formLayout);
|
||||
mainLayout.addComponent(createActionButtonsLayout());
|
||||
setContent(mainLayout);
|
||||
|
||||
setResizable(false);
|
||||
center();
|
||||
}
|
||||
|
||||
public CommonDialog(final String title, final FormLayout form, final String helpLink) {
|
||||
|
||||
if (formLayout != null) {
|
||||
formLayout = form;
|
||||
}
|
||||
formLayout.setSpacing(true);
|
||||
formLayout.setMargin(true);
|
||||
|
||||
if (StringUtils.isNotEmpty(helpLink)) {
|
||||
mainLayout.addComponent(createLinkToHelp(helpLink));
|
||||
}
|
||||
mainLayout.addComponent(formLayout);
|
||||
mainLayout.addComponent(createActionButtonsLayout());
|
||||
|
||||
setCaption(title);
|
||||
setContent(mainLayout);
|
||||
setResizable(false);
|
||||
center();
|
||||
}
|
||||
|
||||
private HorizontalLayout createActionButtonsLayout() {
|
||||
|
||||
final HorizontalLayout hlayout = new HorizontalLayout();
|
||||
hlayout.setSpacing(true);
|
||||
|
||||
saveButton = SPUIComponentProvider.getButton(SPUIComponetIdProvider.SYSTEM_CONFIGURATION_SAVE, "", "", "", true,
|
||||
FontAwesome.SAVE, SPUIButtonStyleSmallNoBorder.class);
|
||||
// saveButton.setDescription(i18n.get("configuration.savebutton.tooltip"));
|
||||
hlayout.addComponent(saveButton);
|
||||
|
||||
cancelButton = SPUIComponentProvider.getButton(SPUIComponetIdProvider.SYSTEM_CONFIGURATION_CANCEL, "", "", "",
|
||||
true, FontAwesome.UNDO, SPUIButtonStyleSmallNoBorder.class);
|
||||
// cancelButton.setDescription(i18n.get("configuration.cancellbutton.tooltip"));
|
||||
hlayout.addComponent(cancelButton);
|
||||
|
||||
return hlayout;
|
||||
}
|
||||
|
||||
public void setSaveButtonClickListener(final ClickListener clickListener) {
|
||||
saveButton.addClickListener(clickListener);
|
||||
}
|
||||
|
||||
public void setCancelButtonClickListener(final ClickListener clickListener) {
|
||||
cancelButton.addClickListener(clickListener);
|
||||
}
|
||||
|
||||
private Link createLinkToHelp(final String link) {
|
||||
return SPUIComponentProvider.getHelpLink(link);
|
||||
}
|
||||
|
||||
public FormLayout getFormLayout() {
|
||||
return formLayout;
|
||||
}
|
||||
|
||||
public void setFormLayout(final FormLayout formLayout) {
|
||||
this.formLayout = formLayout;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -102,7 +102,7 @@ public abstract class AbstractGridHeader extends VerticalLayout {
|
||||
}
|
||||
|
||||
private TextField createSearchField() {
|
||||
final TextField textField = SPUIComponentProvider.getTextField("filter-box", "text-style filter-box-hide",
|
||||
final TextField textField = SPUIComponentProvider.getTextField("", "filter-box", "text-style filter-box-hide",
|
||||
false, "", "", false, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
textField.setId(getSearchBoxId());
|
||||
textField.setWidth(100.0f, Unit.PERCENTAGE);
|
||||
|
||||
@@ -44,7 +44,7 @@ import com.vaadin.ui.VerticalLayout;
|
||||
public abstract class AbstractTableHeader extends VerticalLayout {
|
||||
|
||||
private static final long serialVersionUID = 4881626370291837175L;
|
||||
|
||||
|
||||
@Autowired
|
||||
protected I18N i18n;
|
||||
|
||||
@@ -53,7 +53,6 @@ public abstract class AbstractTableHeader extends VerticalLayout {
|
||||
|
||||
@Autowired
|
||||
protected transient EventBus.SessionEventBus eventbus;
|
||||
|
||||
|
||||
private Label headerCaption;
|
||||
|
||||
@@ -83,7 +82,7 @@ public abstract class AbstractTableHeader extends VerticalLayout {
|
||||
restoreState();
|
||||
eventbus.subscribe(this);
|
||||
}
|
||||
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventbus.unsubscribe(this);
|
||||
@@ -214,7 +213,7 @@ public abstract class AbstractTableHeader extends VerticalLayout {
|
||||
}
|
||||
|
||||
private TextField createSearchField() {
|
||||
final TextField textField = SPUIComponentProvider.getTextField("filter-box", "text-style filter-box-hide",
|
||||
final TextField textField = SPUIComponentProvider.getTextField("", "filter-box", "text-style filter-box-hide",
|
||||
false, "", "", false, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
textField.setId(getSearchBoxId());
|
||||
textField.setWidth(100.0f, Unit.PERCENTAGE);
|
||||
|
||||
@@ -152,6 +152,8 @@ public final class SPUIComponentProvider {
|
||||
/**
|
||||
* Get Label UI component.
|
||||
*
|
||||
* @param caption
|
||||
* set the caption of the textfield
|
||||
* @param style
|
||||
* set style
|
||||
* @param styleName
|
||||
@@ -160,7 +162,7 @@ public final class SPUIComponentProvider {
|
||||
* to set field as mandatory
|
||||
* @param data
|
||||
* component data
|
||||
* @param promt
|
||||
* @param prompt
|
||||
* prompt user for input
|
||||
* @param immediate
|
||||
* set component's immediate mode specified mode
|
||||
@@ -168,9 +170,11 @@ public final class SPUIComponentProvider {
|
||||
* maximum characters allowed
|
||||
* @return TextField text field
|
||||
*/
|
||||
public static TextField getTextField(final String style, final String styleName, final boolean required,
|
||||
final String data, final String promt, final boolean immediate, final int maxLengthAllowed) {
|
||||
return SPUITextFieldDecorator.decorate(style, styleName, required, data, promt, immediate, maxLengthAllowed);
|
||||
public static TextField getTextField(final String caption, final String style, final String styleName,
|
||||
final boolean required, final String data, final String prompt, final boolean immediate,
|
||||
final int maxLengthAllowed) {
|
||||
return SPUITextFieldDecorator.decorate(caption, style, styleName, required, data, prompt, immediate,
|
||||
maxLengthAllowed);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -190,14 +194,16 @@ public final class SPUIComponentProvider {
|
||||
* maximum characters allowed
|
||||
* @return TextArea text area
|
||||
*/
|
||||
public static TextArea getTextArea(final String style, final String styleName, final boolean required,
|
||||
final String data, final String promt, final int maxLength) {
|
||||
return SPUITextAreaDecorator.decorate(style, styleName, required, data, promt, maxLength);
|
||||
public static TextArea getTextArea(final String caption, final String style, final String styleName,
|
||||
final boolean required, final String data, final String promt, final int maxLength) {
|
||||
return SPUITextAreaDecorator.decorate(caption, style, styleName, required, data, promt, maxLength);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Label UI component.
|
||||
*
|
||||
* @param caption
|
||||
* caption of the combo box
|
||||
* @param height
|
||||
* combo box height
|
||||
* @param width
|
||||
@@ -214,9 +220,9 @@ public final class SPUIComponentProvider {
|
||||
* input prompt
|
||||
* @return ComboBox
|
||||
*/
|
||||
public static ComboBox getComboBox(final String height, final String width, final String style,
|
||||
final String styleName, final boolean required, final String data, final String promt) {
|
||||
return SPUIComboBoxDecorator.decorate(height, width, style, styleName, required, data, promt);
|
||||
public static ComboBox getComboBox(final String caption, final String height, final String width,
|
||||
final String style, final String styleName, final boolean required, final String data, final String promt) {
|
||||
return SPUIComboBoxDecorator.decorate(caption, height, width, style, styleName, required, data, promt);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.decorators;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.vaadin.ui.ComboBox;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
@@ -29,6 +31,8 @@ public final class SPUIComboBoxDecorator {
|
||||
/**
|
||||
* Decorate.
|
||||
*
|
||||
* @param caption
|
||||
* caption of the combobox
|
||||
* @param height
|
||||
* as H
|
||||
* @param width
|
||||
@@ -41,39 +45,42 @@ public final class SPUIComboBoxDecorator {
|
||||
* as T|F
|
||||
* @param data
|
||||
* as data
|
||||
* @param promt
|
||||
* @param prompt
|
||||
* as promt
|
||||
* @return ComboBox as comp
|
||||
*/
|
||||
public static ComboBox decorate(final String height, final String width, final String style, final String styleName,
|
||||
final boolean required, final String data, final String promt) {
|
||||
public static ComboBox decorate(final String caption, final String height, final String width, final String style,
|
||||
final String styleName, final boolean required, final String data, final String prompt) {
|
||||
final ComboBox spUICombo = new ComboBox();
|
||||
// Default settings
|
||||
spUICombo.setRequired(required);
|
||||
spUICombo.addStyleName(ValoTheme.COMBOBOX_TINY);
|
||||
|
||||
if (StringUtils.isNotEmpty(caption)) {
|
||||
spUICombo.setCaption(caption);
|
||||
}
|
||||
// Add style
|
||||
if (null != style) {
|
||||
if (StringUtils.isNotEmpty(style)) {
|
||||
spUICombo.setStyleName(style);
|
||||
}
|
||||
// Add style Name
|
||||
if (null != styleName) {
|
||||
if (StringUtils.isNotEmpty(styleName)) {
|
||||
spUICombo.addStyleName(styleName);
|
||||
}
|
||||
// Add height
|
||||
if (null != height) {
|
||||
if (StringUtils.isNotEmpty(height)) {
|
||||
spUICombo.setHeight(height);
|
||||
}
|
||||
// AddWidth
|
||||
if (null != width) {
|
||||
if (StringUtils.isNotEmpty(width)) {
|
||||
spUICombo.setWidth(width);
|
||||
}
|
||||
// Set promt
|
||||
if (null != promt) {
|
||||
spUICombo.setInputPrompt(promt);
|
||||
// Set prompt
|
||||
if (StringUtils.isNotEmpty(prompt)) {
|
||||
spUICombo.setInputPrompt(prompt);
|
||||
}
|
||||
// Set Data
|
||||
if (null != data) {
|
||||
if (StringUtils.isNotEmpty(data)) {
|
||||
spUICombo.setData(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.decorators;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.vaadin.ui.TextArea;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
@@ -37,33 +39,36 @@ public final class SPUITextAreaDecorator {
|
||||
* to set field as mandatory
|
||||
* @param data
|
||||
* component data
|
||||
* @param promt
|
||||
* @param prompt
|
||||
* as user for input
|
||||
* @param maxLength
|
||||
* maximum characters allowed
|
||||
* @return TextArea as comp
|
||||
*/
|
||||
public static TextArea decorate(String style, String styleName, boolean required, String data, String promt,
|
||||
int maxLength) {
|
||||
public static TextArea decorate(final String caption, final String style, final String styleName,
|
||||
final boolean required, final String data, final String prompt, final int maxLength) {
|
||||
final TextArea spUITxtArea = new TextArea();
|
||||
// Default settings
|
||||
spUITxtArea.setRequired(false);
|
||||
spUITxtArea.addStyleName(ValoTheme.COMBOBOX_SMALL);
|
||||
if (StringUtils.isNotEmpty(caption)) {
|
||||
spUITxtArea.setCaption(caption);
|
||||
}
|
||||
if (required) {
|
||||
spUITxtArea.setRequired(true);
|
||||
}
|
||||
// Add style
|
||||
if (null != style) {
|
||||
if (StringUtils.isNotEmpty(style)) {
|
||||
spUITxtArea.setStyleName(style);
|
||||
}
|
||||
// Add style Name
|
||||
if (null != styleName) {
|
||||
if (StringUtils.isNotEmpty(styleName)) {
|
||||
spUITxtArea.addStyleName(styleName);
|
||||
}
|
||||
if (null != promt) {
|
||||
spUITxtArea.setInputPrompt(promt);
|
||||
if (StringUtils.isNotEmpty(prompt)) {
|
||||
spUITxtArea.setInputPrompt(prompt);
|
||||
}
|
||||
if (null != data) {
|
||||
if (StringUtils.isNotEmpty(data)) {
|
||||
spUITxtArea.setData(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.decorators;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.vaadin.ui.TextField;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
@@ -27,8 +29,9 @@ public final class SPUITextFieldDecorator {
|
||||
}
|
||||
|
||||
/**
|
||||
* Decorate.
|
||||
*
|
||||
* @param caption
|
||||
* set the caption of the textfield
|
||||
* @param style
|
||||
* set style
|
||||
* @param styleName
|
||||
@@ -37,7 +40,7 @@ public final class SPUITextFieldDecorator {
|
||||
* to set field as mandatory
|
||||
* @param data
|
||||
* component data
|
||||
* @param promt
|
||||
* @param prompt
|
||||
* prompt user for input
|
||||
* @param immediate
|
||||
* as for display
|
||||
@@ -45,9 +48,13 @@ public final class SPUITextFieldDecorator {
|
||||
* maximum characters allowed
|
||||
* @return Text field as decorated
|
||||
*/
|
||||
public static TextField decorate(String style, String styleName, boolean required, String data, String promt,
|
||||
boolean immediate, int maxLengthAllowed) {
|
||||
public static TextField decorate(final String caption, final String style, final String styleName,
|
||||
final boolean required, final String data, final String prompt, final boolean immediate,
|
||||
final int maxLengthAllowed) {
|
||||
final TextField spUITxtFld = new TextField();
|
||||
if (StringUtils.isNotEmpty(caption)) {
|
||||
spUITxtFld.setCaption(caption);
|
||||
}
|
||||
// Default settings
|
||||
spUITxtFld.setRequired(false);
|
||||
spUITxtFld.addStyleName(ValoTheme.TEXTFIELD_SMALL);
|
||||
@@ -58,17 +65,17 @@ public final class SPUITextFieldDecorator {
|
||||
spUITxtFld.setImmediate(true);
|
||||
}
|
||||
// Add style
|
||||
if (null != style) {
|
||||
if (StringUtils.isNotEmpty(style)) {
|
||||
spUITxtFld.setStyleName(style);
|
||||
}
|
||||
// Add style Name
|
||||
if (null != styleName) {
|
||||
if (StringUtils.isNotEmpty(styleName)) {
|
||||
spUITxtFld.addStyleName(styleName);
|
||||
}
|
||||
if (null != promt) {
|
||||
spUITxtFld.setInputPrompt(promt);
|
||||
if (StringUtils.isNotEmpty(prompt)) {
|
||||
spUITxtFld.setInputPrompt(prompt);
|
||||
}
|
||||
if (null != data) {
|
||||
if (StringUtils.isNotEmpty(data)) {
|
||||
spUITxtFld.setData(data);
|
||||
}
|
||||
if (maxLengthAllowed > 0) {
|
||||
|
||||
@@ -181,17 +181,17 @@ public class CreateUpdateDistSetTypeLayout extends CustomComponent implements Co
|
||||
comboLabel = SPUIComponentProvider.getLabel(i18n.get("label.choose.type"), null);
|
||||
madatoryLabel = getMandatoryLabel();
|
||||
|
||||
typeName = SPUIComponentProvider.getTextField("",
|
||||
typeName = SPUIComponentProvider.getTextField(i18n.get("textfield.name"), "",
|
||||
ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.DIST_SET_TYPE_NAME, true, "",
|
||||
i18n.get("textfield.name"), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
typeName.setId(SPUIDefinitions.NEW_DISTRIBUTION_TYPE_NAME);
|
||||
|
||||
typeKey = SPUIComponentProvider.getTextField("",
|
||||
typeKey = SPUIComponentProvider.getTextField(i18n.get("textfield.key"), "",
|
||||
ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.DIST_SET_TYPE_KEY, true, "", i18n.get("textfield.key"),
|
||||
true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
typeKey.setId(SPUIDefinitions.NEW_DISTRIBUTION_TYPE_KEY);
|
||||
|
||||
typeDesc = SPUIComponentProvider.getTextArea("",
|
||||
typeDesc = SPUIComponentProvider.getTextArea(i18n.get("textfield.description"), "",
|
||||
ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.DIST_SET_TYPE_DESC, false, "",
|
||||
i18n.get("textfield.description"), SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH);
|
||||
|
||||
@@ -199,8 +199,8 @@ public class CreateUpdateDistSetTypeLayout extends CustomComponent implements Co
|
||||
typeDesc.setImmediate(true);
|
||||
typeDesc.setNullRepresentation("");
|
||||
|
||||
typeNameComboBox = SPUIComponentProvider.getComboBox("", "", null, null, false, "",
|
||||
i18n.get("label.combobox.type"));
|
||||
typeNameComboBox = SPUIComponentProvider.getComboBox(i18n.get("label.combobox.type"), "", "", null, null, false,
|
||||
"", i18n.get("label.combobox.type"));
|
||||
typeNameComboBox.setId(SPUIDefinitions.NEW_DISTRIBUTION_SET_TYPE_NAME_COMBO);
|
||||
typeNameComboBox.addStyleName(SPUIDefinitions.FILTER_TYPE_COMBO_STYLE);
|
||||
typeNameComboBox.setImmediate(true);
|
||||
|
||||
@@ -222,8 +222,9 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
||||
}
|
||||
|
||||
private TextField createNameTextField() {
|
||||
final TextField nameField = SPUIComponentProvider.getTextField("", ValoTheme.TEXTFIELD_TINY, false, null,
|
||||
i18n.get("textfield.customfiltername"), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
final TextField nameField = SPUIComponentProvider.getTextField(i18n.get("textfield.customfiltername"), "",
|
||||
ValoTheme.TEXTFIELD_TINY, false, null, i18n.get("textfield.customfiltername"), true,
|
||||
SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
nameField.setId(SPUIComponetIdProvider.CUSTOM_FILTER_ADD_NAME);
|
||||
nameField.setPropertyDataSource(nameLabel);
|
||||
nameField.addTextChangeListener(event -> onFiterNameChange(event));
|
||||
@@ -414,8 +415,8 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
||||
}
|
||||
|
||||
private TextField createSearchField() {
|
||||
final TextField textField = SPUIComponentProvider.getTextField("", ValoTheme.TEXTFIELD_TINY, false, "", "",
|
||||
true, SPUILabelDefinitions.TARGET_FILTER_QUERY_TEXT_FIELD_LENGTH);
|
||||
final TextField textField = SPUIComponentProvider.getTextField(null, "", ValoTheme.TEXTFIELD_TINY, false, "",
|
||||
"", true, SPUILabelDefinitions.TARGET_FILTER_QUERY_TEXT_FIELD_LENGTH);
|
||||
textField.setId("custom.query.text.Id");
|
||||
textField.addStyleName("target-filter-textfield");
|
||||
textField.setWidth(900.0F, Unit.PIXELS);
|
||||
|
||||
@@ -124,7 +124,7 @@ public class TargetFilterHeader extends VerticalLayout {
|
||||
}
|
||||
|
||||
private TextField createSearchField() {
|
||||
final TextField campSearchTextField = SPUIComponentProvider.getTextField("filter-box",
|
||||
final TextField campSearchTextField = SPUIComponentProvider.getTextField(null, "filter-box",
|
||||
"text-style filter-box-hide", false, "", "", false, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
campSearchTextField.setId("target.filter.search.text.Id");
|
||||
campSearchTextField.setWidth(500.0f, Unit.PIXELS);
|
||||
|
||||
@@ -160,24 +160,26 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
|
||||
* Create required UI components.
|
||||
*/
|
||||
private void createRequiredComponents() {
|
||||
distNameTextField = SPUIComponentProvider.getTextField("", ValoTheme.TEXTFIELD_TINY, true, null,
|
||||
i18n.get("textfield.name"), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
distNameTextField = SPUIComponentProvider.getTextField(i18n.get("textfield.name"), "", ValoTheme.TEXTFIELD_TINY,
|
||||
true, null, i18n.get("textfield.name"), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
distNameTextField.setId(SPUIComponetIdProvider.DIST_ADD_NAME);
|
||||
distNameTextField.setNullRepresentation("");
|
||||
|
||||
distVersionTextField = SPUIComponentProvider.getTextField("", ValoTheme.TEXTFIELD_TINY, true, null,
|
||||
i18n.get("textfield.version"), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
distVersionTextField = SPUIComponentProvider.getTextField(i18n.get("textfield.version"), "",
|
||||
ValoTheme.TEXTFIELD_TINY, true, null, i18n.get("textfield.version"), true,
|
||||
SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
distVersionTextField.setId(SPUIComponetIdProvider.DIST_ADD_VERSION);
|
||||
distVersionTextField.setNullRepresentation("");
|
||||
|
||||
distsetTypeNameComboBox = SPUIComponentProvider.getComboBox("", "", null, "", false, "",
|
||||
i18n.get("label.combobox.type"));
|
||||
distsetTypeNameComboBox = SPUIComponentProvider.getComboBox(i18n.get("label.combobox.type"), "", "", null, "",
|
||||
false, "", i18n.get("label.combobox.type"));
|
||||
distsetTypeNameComboBox.setImmediate(true);
|
||||
distsetTypeNameComboBox.setNullSelectionAllowed(false);
|
||||
distsetTypeNameComboBox.setId(SPUIComponetIdProvider.DIST_ADD_DISTSETTYPE);
|
||||
|
||||
descTextArea = SPUIComponentProvider.getTextArea("text-area-style", ValoTheme.TEXTAREA_TINY, false, null,
|
||||
i18n.get("textfield.description"), SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH);
|
||||
descTextArea = SPUIComponentProvider.getTextArea(i18n.get("textfield.description"), "text-area-style",
|
||||
ValoTheme.TEXTAREA_TINY, false, null, i18n.get("textfield.description"),
|
||||
SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH);
|
||||
descTextArea.setId(SPUIComponetIdProvider.DIST_ADD_DESC);
|
||||
descTextArea.setNullRepresentation("");
|
||||
|
||||
|
||||
@@ -173,19 +173,20 @@ public abstract class CreateUpdateTagLayout extends CustomComponent implements C
|
||||
colorLabel = SPUIComponentProvider.getLabel(i18n.get("label.choose.tag.color"), null);
|
||||
colorLabel.addStyleName(SPUIDefinitions.COLOR_LABEL_STYLE);
|
||||
|
||||
tagName = SPUIComponentProvider.getTextField("", ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.TAG_NAME,
|
||||
true, "", i18n.get("textfield.name"), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
tagName = SPUIComponentProvider.getTextField(i18n.get("textfield.name"), "",
|
||||
ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.TAG_NAME, true, "", i18n.get("textfield.name"), true,
|
||||
SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
tagName.setId(SPUIDefinitions.NEW_TARGET_TAG_NAME);
|
||||
|
||||
tagDesc = SPUIComponentProvider.getTextArea("", ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.TAG_DESC,
|
||||
tagDesc = SPUIComponentProvider.getTextArea(null, "", ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.TAG_DESC,
|
||||
false, "", i18n.get("textfield.description"), SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH);
|
||||
|
||||
tagDesc.setId(SPUIDefinitions.NEW_TARGET_TAG_DESC);
|
||||
tagDesc.setImmediate(true);
|
||||
tagDesc.setNullRepresentation("");
|
||||
|
||||
tagNameComboBox = SPUIComponentProvider.getComboBox("", "", null, null, false, "",
|
||||
i18n.get("label.combobox.tag"));
|
||||
tagNameComboBox = SPUIComponentProvider.getComboBox(i18n.get("label.combobox.tag"), "", "", null, null, false,
|
||||
"", i18n.get("label.combobox.tag"));
|
||||
tagNameComboBox.addStyleName(SPUIDefinitions.FILTER_TYPE_COMBO_STYLE);
|
||||
tagNameComboBox.setImmediate(true);
|
||||
|
||||
|
||||
@@ -105,17 +105,17 @@ public class TargetAddUpdateWindowLayout extends CustomComponent {
|
||||
|
||||
private void createRequiredComponents() {
|
||||
/* Textfield for controller Id */
|
||||
controllerIDTextField = SPUIComponentProvider.getTextField("", ValoTheme.TEXTFIELD_TINY, true, null,
|
||||
controllerIDTextField = SPUIComponentProvider.getTextField( i18n.get("prompt.target.id"), "", ValoTheme.TEXTFIELD_TINY, true, null,
|
||||
i18n.get("prompt.target.id"), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
controllerIDTextField.setId(SPUIComponetIdProvider.TARGET_ADD_CONTROLLER_ID);
|
||||
|
||||
/* Textfield for target name */
|
||||
nameTextField = SPUIComponentProvider.getTextField("", ValoTheme.TEXTFIELD_TINY, false, null,
|
||||
nameTextField = SPUIComponentProvider.getTextField( i18n.get("textfield.name"), "", ValoTheme.TEXTFIELD_TINY, false, null,
|
||||
i18n.get("textfield.name"), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
nameTextField.setId(SPUIComponetIdProvider.TARGET_ADD_NAME);
|
||||
|
||||
/* Textarea for target description */
|
||||
descTextArea = SPUIComponentProvider.getTextArea("text-area-style", ValoTheme.TEXTFIELD_TINY, false, null,
|
||||
descTextArea = SPUIComponentProvider.getTextArea( i18n.get("textfield.description"), "text-area-style", ValoTheme.TEXTFIELD_TINY, false, null,
|
||||
i18n.get("textfield.description"), SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH);
|
||||
descTextArea.setId(SPUIComponetIdProvider.TARGET_ADD_DESC);
|
||||
descTextArea.setNullRepresentation(HawkbitCommonUtil.SP_STRING_EMPTY);
|
||||
|
||||
@@ -195,8 +195,9 @@ public class TargetBulkUpdateWindowLayout extends CustomComponent {
|
||||
}
|
||||
|
||||
private TextArea getDescriptionTextArea() {
|
||||
final TextArea description = SPUIComponentProvider.getTextArea("text-area-style", ValoTheme.TEXTFIELD_TINY,
|
||||
false, null, i18n.get("textfield.description"), SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH);
|
||||
final TextArea description = SPUIComponentProvider.getTextArea(i18n.get("textfield.description"),
|
||||
"text-area-style", ValoTheme.TEXTFIELD_TINY, false, null, i18n.get("textfield.description"),
|
||||
SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH);
|
||||
description.setId(SPUIComponetIdProvider.BULK_UPLOAD_DESC);
|
||||
description.setNullRepresentation(HawkbitCommonUtil.SP_STRING_EMPTY);
|
||||
description.setWidth("100%");
|
||||
@@ -205,8 +206,8 @@ public class TargetBulkUpdateWindowLayout extends CustomComponent {
|
||||
|
||||
private ComboBox getDsComboField() {
|
||||
final Container container = createContainer();
|
||||
final ComboBox dsComboBox = SPUIComponentProvider.getComboBox("", "", null, null, false, "",
|
||||
i18n.get("bulkupload.ds.name"));
|
||||
final ComboBox dsComboBox = SPUIComponentProvider.getComboBox(i18n.get("bulkupload.ds.name"), "", "", null,
|
||||
null, false, "", i18n.get("bulkupload.ds.name"));
|
||||
dsComboBox.setSizeUndefined();
|
||||
dsComboBox.addStyleName(SPUIDefinitions.BULK_UPLOD_DS_COMBO_STYLE);
|
||||
dsComboBox.setImmediate(true);
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupErrorCondit
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupSuccessAction;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupSuccessCondition;
|
||||
import org.eclipse.hawkbit.ui.UiProperties;
|
||||
import org.eclipse.hawkbit.ui.common.PopupWindowHelp;
|
||||
import org.eclipse.hawkbit.ui.common.CommonDialog;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||
import org.eclipse.hawkbit.ui.filtermanagement.TargetFilterBeanQuery;
|
||||
@@ -61,9 +61,10 @@ import com.vaadin.spring.annotation.ViewScope;
|
||||
import com.vaadin.ui.Alignment;
|
||||
import com.vaadin.ui.Button;
|
||||
import com.vaadin.ui.ComboBox;
|
||||
import com.vaadin.ui.CustomComponent;
|
||||
import com.vaadin.ui.FormLayout;
|
||||
import com.vaadin.ui.HorizontalLayout;
|
||||
import com.vaadin.ui.Label;
|
||||
import com.vaadin.ui.Link;
|
||||
import com.vaadin.ui.OptionGroup;
|
||||
import com.vaadin.ui.TextArea;
|
||||
import com.vaadin.ui.TextField;
|
||||
@@ -79,7 +80,7 @@ import com.vaadin.ui.themes.ValoTheme;
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
public class AddUpdateRolloutWindowLayout extends CustomComponent {
|
||||
public class AddUpdateRolloutWindowLayout extends CommonDialog {
|
||||
|
||||
private static final long serialVersionUID = 2999293468801479916L;
|
||||
|
||||
@@ -113,6 +114,8 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
private Label madatoryLabel;
|
||||
|
||||
private TextField rolloutName;
|
||||
|
||||
private ComboBox distributionSet;
|
||||
@@ -135,7 +138,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
|
||||
|
||||
private OptionGroup errorThresholdOptionGroup;
|
||||
|
||||
// private Link linkToHelp;
|
||||
private Link linkToHelp;
|
||||
|
||||
private Window addUpdateRolloutWindow;
|
||||
|
||||
@@ -149,12 +152,21 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
|
||||
|
||||
private TextArea targetFilterQuery;
|
||||
|
||||
public AddUpdateRolloutWindowLayout() {
|
||||
super();
|
||||
}
|
||||
|
||||
public AddUpdateRolloutWindowLayout(final String title, final FormLayout form, final String helpLink) {
|
||||
super(title, form, helpLink);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create components and layout.
|
||||
*/
|
||||
public void init() {
|
||||
createRequiredComponents();
|
||||
buildLayout();
|
||||
// createRequiredComponents();
|
||||
// buildLayout();
|
||||
initForm();
|
||||
}
|
||||
|
||||
public Window getWindow() {
|
||||
@@ -202,17 +214,13 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
|
||||
mainLayout.setSpacing(Boolean.TRUE);
|
||||
mainLayout.setSizeUndefined();
|
||||
|
||||
// mainLayout.addComponents(getMandatoryLabelLinkToHelp(), rolloutName,
|
||||
// distributionSet, getTargetFilterLayout(),
|
||||
// getGroupDetailsLayout(), getTriggerThresoldLayout(),
|
||||
// getErrorThresoldLayout(), description,
|
||||
// actionTypeOptionGroupLayout, getSaveDiscardButtonLayout());
|
||||
mainLayout.addComponents(madatoryLabel, rolloutName, distributionSet, getTargetFilterLayout(),
|
||||
getGroupDetailsLayout(), getTriggerThresoldLayout(), getErrorThresoldLayout(), description,
|
||||
actionTypeOptionGroupLayout, linkToHelp, getSaveDiscardButtonLayout());
|
||||
|
||||
mainLayout.addComponents(new PopupWindowHelp(uiProperties.getLinks().getDocumentation().getRolloutView()),
|
||||
createMandatoryLabel(), rolloutName, distributionSet, getTargetFilterLayout(), getGroupDetailsLayout(),
|
||||
getTriggerThresoldLayout(), getErrorThresoldLayout(), description, actionTypeOptionGroupLayout,
|
||||
getSaveDiscardButtonLayout());
|
||||
setCompositionRoot(mainLayout);
|
||||
mainLayout.addComponent(new Label("TEST TEST TEST"));
|
||||
mainLayout.setComponentAlignment(linkToHelp, Alignment.BOTTOM_RIGHT);
|
||||
rolloutName.focus();
|
||||
}
|
||||
|
||||
private HorizontalLayout getGroupDetailsLayout() {
|
||||
@@ -225,9 +233,12 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
|
||||
}
|
||||
|
||||
private HorizontalLayout getErrorThresoldLayout() {
|
||||
createErrorThresold();
|
||||
createErrorThresholdOptionGroup();
|
||||
final HorizontalLayout errorThresoldLayout = new HorizontalLayout();
|
||||
errorThresoldLayout.setSizeFull();
|
||||
errorThresoldLayout.addComponents(errorThreshold, errorThresholdOptionGroup);
|
||||
errorThresoldLayout.addComponents(SPUIComponentProvider.getLabel(i18n.get("prompt.error.threshold"), null),
|
||||
errorThreshold, errorThresholdOptionGroup);
|
||||
errorThresoldLayout.setExpandRatio(errorThreshold, 1.0F);
|
||||
return errorThresoldLayout;
|
||||
}
|
||||
@@ -244,10 +255,12 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
|
||||
}
|
||||
|
||||
private HorizontalLayout getTriggerThresoldLayout() {
|
||||
createTriggerThresold();
|
||||
final HorizontalLayout triggerThresholdLayout = new HorizontalLayout();
|
||||
triggerThresholdLayout.setSizeFull();
|
||||
triggerThresholdLayout.addComponents(triggerThreshold, getPercentHintLabel());
|
||||
triggerThresholdLayout.setExpandRatio(triggerThreshold, 1.0F);
|
||||
triggerThresholdLayout.addComponents(SPUIComponentProvider.getLabel(i18n.get("prompt.tigger.thresold"), null),
|
||||
triggerThreshold, getPercentHintLabel());
|
||||
triggerThresholdLayout.setExpandRatio(triggerThreshold, 2.0F);
|
||||
return triggerThresholdLayout;
|
||||
}
|
||||
|
||||
@@ -268,20 +281,28 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
|
||||
return buttonsLayout;
|
||||
}
|
||||
|
||||
// private HorizontalLayout getMandatoryLabelLinkToHelp() {
|
||||
// final HorizontalLayout mandatoryLabelLinkToHelpLayout = new
|
||||
// HorizontalLayout();
|
||||
// mandatoryLabelLinkToHelpLayout.setSizeFull();
|
||||
// mandatoryLabelLinkToHelpLayout.addComponents(madatoryLabel, linkToHelp);
|
||||
// mandatoryLabelLinkToHelpLayout.setComponentAlignment(madatoryLabel,
|
||||
// Alignment.MIDDLE_LEFT);
|
||||
// mandatoryLabelLinkToHelpLayout.setComponentAlignment(linkToHelp,
|
||||
// Alignment.MIDDLE_RIGHT);
|
||||
// mandatoryLabelLinkToHelpLayout.addStyleName("window-style");
|
||||
// return mandatoryLabelLinkToHelpLayout;
|
||||
// }
|
||||
private void initForm() {
|
||||
|
||||
getFormLayout().addComponent(createMandatoryLabel());
|
||||
getFormLayout().addComponent(createRolloutNameField());
|
||||
getFormLayout().addComponent(createDistributionSetCombo());
|
||||
populateDistributionSet();
|
||||
getFormLayout().addComponent(createTargetFilterQueryCombo());
|
||||
populateTargetFilterQuery();
|
||||
getFormLayout().addComponent(createNoOfGroupsField());
|
||||
getFormLayout().addComponent(createGroupSizeLabel());
|
||||
getFormLayout().addComponent(getTriggerThresoldLayout());
|
||||
getFormLayout().addComponent(getErrorThresoldLayout());
|
||||
getFormLayout().addComponent(createDescription());
|
||||
getFormLayout().addComponent(actionTypeOptionGroupLayout);
|
||||
actionTypeOptionGroupLayout.selectDefaultOption();
|
||||
|
||||
getFormLayout().addComponent(createTotalTargetsLabel());
|
||||
getFormLayout().addComponent(createTargetFilterQuery());
|
||||
}
|
||||
|
||||
private void createRequiredComponents() {
|
||||
madatoryLabel = createMandatoryLabel();
|
||||
rolloutName = createRolloutNameField();
|
||||
distributionSet = createDistributionSetCombo();
|
||||
populateDistributionSet();
|
||||
@@ -291,10 +312,10 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
|
||||
|
||||
noOfGroups = createNoOfGroupsField();
|
||||
groupSizeLabel = createGroupSizeLabel();
|
||||
triggerThreshold = createTriggerThresold();
|
||||
errorThreshold = createErrorThresold();
|
||||
description = createDescription();
|
||||
errorThresholdOptionGroup = createErrorThresholdOptionGroup();
|
||||
// triggerThreshold = createTriggerThresold();
|
||||
// errorThreshold = createErrorThresold();
|
||||
// description = createDescription();
|
||||
// errorThresholdOptionGroup = createErrorThresholdOptionGroup();
|
||||
setDefaultSaveStartGroupOption();
|
||||
saveRolloutBtn = createSaveButton();
|
||||
discardRollloutBtn = createDiscardButton();
|
||||
@@ -303,16 +324,11 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
|
||||
totalTargetsLabel = createTotalTargetsLabel();
|
||||
targetFilterQuery = createTargetFilterQuery();
|
||||
|
||||
// linkToHelp = createLinkToHelp();
|
||||
linkToHelp = SPUIComponentProvider.getHelpLink(uiProperties.getLinks().getDocumentation().getRolloutView());
|
||||
actionTypeOptionGroupLayout.addStyleName(SPUIStyleDefinitions.ROLLOUT_ACTION_TYPE_LAYOUT);
|
||||
|
||||
}
|
||||
|
||||
// private Link createLinkToHelp() {
|
||||
// return
|
||||
// SPUIComponentProvider.getHelpLink(uiProperties.getLinks().getDocumentation().getRolloutView());
|
||||
// }
|
||||
|
||||
private Label createGroupSizeLabel() {
|
||||
final Label groupSize = SPUIComponentProvider.getLabel("", SPUILabelDefinitions.SP_LABEL_SIMPLE);
|
||||
groupSize.addStyleName(ValoTheme.LABEL_TINY + " " + "rollout-target-count-message");
|
||||
@@ -323,8 +339,9 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
|
||||
}
|
||||
|
||||
private TextArea createTargetFilterQuery() {
|
||||
final TextArea filterField = SPUIComponentProvider.getTextArea("text-area-style", ValoTheme.TEXTFIELD_TINY,
|
||||
false, null, null, SPUILabelDefinitions.TARGET_FILTER_QUERY_TEXT_FIELD_LENGTH);
|
||||
final TextArea filterField = SPUIComponentProvider.getTextArea(null, "text-area-style",
|
||||
ValoTheme.TEXTFIELD_TINY, false, null, null,
|
||||
SPUILabelDefinitions.TARGET_FILTER_QUERY_TEXT_FIELD_LENGTH);
|
||||
filterField.setId(SPUIComponetIdProvider.ROLLOUT_TARGET_FILTER_QUERY_FIELD);
|
||||
filterField.setNullRepresentation(HawkbitCommonUtil.SP_STRING_EMPTY);
|
||||
filterField.setVisible(false);
|
||||
@@ -342,17 +359,17 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
|
||||
return targetCountLabel;
|
||||
}
|
||||
|
||||
private OptionGroup createErrorThresholdOptionGroup() {
|
||||
final OptionGroup errorThresoldOptions = new OptionGroup();
|
||||
private void createErrorThresholdOptionGroup() {
|
||||
errorThresholdOptionGroup = new OptionGroup();
|
||||
for (final ERRORTHRESOLDOPTIONS option : ERRORTHRESOLDOPTIONS.values()) {
|
||||
errorThresoldOptions.addItem(option.getValue());
|
||||
errorThresholdOptionGroup.addItem(option.getValue());
|
||||
}
|
||||
errorThresoldOptions.setId(SPUIComponetIdProvider.ROLLOUT_ERROR_THRESOLD_OPTION_ID);
|
||||
errorThresoldOptions.addStyleName(ValoTheme.OPTIONGROUP_HORIZONTAL);
|
||||
errorThresoldOptions.addStyleName(SPUIStyleDefinitions.ROLLOUT_OPTION_GROUP);
|
||||
errorThresoldOptions.setSizeUndefined();
|
||||
errorThresoldOptions.addValueChangeListener(event -> onErrorThresoldOptionChange(event));
|
||||
return errorThresoldOptions;
|
||||
errorThresholdOptionGroup.setId(SPUIComponetIdProvider.ROLLOUT_ERROR_THRESOLD_OPTION_ID);
|
||||
errorThresholdOptionGroup.addStyleName(ValoTheme.OPTIONGROUP_HORIZONTAL);
|
||||
errorThresholdOptionGroup.addStyleName(SPUIStyleDefinitions.ROLLOUT_OPTION_GROUP);
|
||||
errorThresholdOptionGroup.setSizeUndefined();
|
||||
errorThresholdOptionGroup.addValueChangeListener(event -> onErrorThresoldOptionChange(event));
|
||||
setDefaultSaveStartGroupOption();
|
||||
}
|
||||
|
||||
private void onErrorThresoldOptionChange(final ValueChangeEvent event) {
|
||||
@@ -361,21 +378,21 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
|
||||
if (event.getProperty().getValue().equals(ERRORTHRESOLDOPTIONS.COUNT.getValue())) {
|
||||
errorThreshold.addValidator(new ErrorThresoldOptionValidator());
|
||||
} else {
|
||||
errorThreshold.addValidator(new ThresoldFieldValidator());
|
||||
errorThreshold.addValidator(new ThresholdFieldValidator());
|
||||
}
|
||||
errorThreshold.getValidators();
|
||||
}
|
||||
|
||||
private ComboBox createTargetFilterQueryCombo() {
|
||||
final ComboBox targetFilter = SPUIComponentProvider.getComboBox("", "", null, null, true, "",
|
||||
i18n.get("prompt.target.filter"));
|
||||
targetFilter.setImmediate(true);
|
||||
targetFilter.setPageLength(7);
|
||||
targetFilter.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME);
|
||||
targetFilter.setId(SPUIComponetIdProvider.ROLLOUT_TARGET_FILTER_COMBO_ID);
|
||||
targetFilter.setSizeFull();
|
||||
targetFilter.addValueChangeListener(event -> onTargetFilterChange());
|
||||
return targetFilter;
|
||||
targetFilterQueryCombo = SPUIComponentProvider.getComboBox(i18n.get("prompt.target.filter"), "", "", null, null,
|
||||
true, "", i18n.get("prompt.target.filter"));
|
||||
targetFilterQueryCombo.setImmediate(true);
|
||||
targetFilterQueryCombo.setPageLength(7);
|
||||
targetFilterQueryCombo.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME);
|
||||
targetFilterQueryCombo.setId(SPUIComponetIdProvider.ROLLOUT_TARGET_FILTER_COMBO_ID);
|
||||
targetFilterQueryCombo.setSizeFull();
|
||||
targetFilterQueryCombo.addValueChangeListener(event -> onTargetFilterChange());
|
||||
return targetFilterQueryCombo;
|
||||
}
|
||||
|
||||
private void onTargetFilterChange() {
|
||||
@@ -606,37 +623,37 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
|
||||
}
|
||||
|
||||
private TextArea createDescription() {
|
||||
final TextArea descriptionField = SPUIComponentProvider.getTextArea("text-area-style", ValoTheme.TEXTFIELD_TINY,
|
||||
false, null, i18n.get("textfield.description"), SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH);
|
||||
final TextArea descriptionField = SPUIComponentProvider.getTextArea(i18n.get("textfield.description"),
|
||||
"text-area-style", ValoTheme.TEXTFIELD_TINY, false, null, i18n.get("textfield.description"),
|
||||
SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH);
|
||||
descriptionField.setId(SPUIComponetIdProvider.ROLLOUT_DESCRIPTION_ID);
|
||||
descriptionField.setNullRepresentation(HawkbitCommonUtil.SP_STRING_EMPTY);
|
||||
descriptionField.setSizeFull();
|
||||
return descriptionField;
|
||||
}
|
||||
|
||||
private TextField createErrorThresold() {
|
||||
final TextField errorField = SPUIComponentProvider.getTextField("", ValoTheme.TEXTFIELD_TINY, true, null,
|
||||
private void createErrorThresold() {
|
||||
errorThreshold = SPUIComponentProvider.getTextField(null, "", ValoTheme.TEXTFIELD_TINY, false, null,
|
||||
i18n.get("prompt.error.threshold"), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
errorField.addValidator(new ThresoldFieldValidator());
|
||||
errorField.setId(SPUIComponetIdProvider.ROLLOUT_ERROR_THRESOLD_ID);
|
||||
errorField.setMaxLength(7);
|
||||
errorField.setSizeFull();
|
||||
return errorField;
|
||||
errorThreshold.addValidator(new ThresholdFieldValidator());
|
||||
errorThreshold.setId(SPUIComponetIdProvider.ROLLOUT_ERROR_THRESOLD_ID);
|
||||
errorThreshold.setMaxLength(7);
|
||||
errorThreshold.setSizeFull();
|
||||
}
|
||||
|
||||
private TextField createTriggerThresold() {
|
||||
final TextField thresholdField = SPUIComponentProvider.getTextField("", ValoTheme.TEXTFIELD_TINY, true, null,
|
||||
private void createTriggerThresold() {
|
||||
triggerThreshold = SPUIComponentProvider.getTextField(null, "", ValoTheme.TEXTFIELD_TINY, false, null,
|
||||
i18n.get("prompt.tigger.thresold"), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
thresholdField.setId(SPUIComponetIdProvider.ROLLOUT_TRIGGER_THRESOLD_ID);
|
||||
thresholdField.addValidator(new ThresoldFieldValidator());
|
||||
thresholdField.setSizeFull();
|
||||
thresholdField.setMaxLength(3);
|
||||
return thresholdField;
|
||||
triggerThreshold.setId(SPUIComponetIdProvider.ROLLOUT_TRIGGER_THRESOLD_ID);
|
||||
triggerThreshold.addValidator(new ThresholdFieldValidator());
|
||||
triggerThreshold.setSizeUndefined();
|
||||
triggerThreshold.setMaxLength(3);
|
||||
}
|
||||
|
||||
private TextField createNoOfGroupsField() {
|
||||
final TextField noOfGroupsField = SPUIComponentProvider.getTextField("", ValoTheme.TEXTFIELD_TINY, true, null,
|
||||
i18n.get("prompt.number.of.groups"), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
final TextField noOfGroupsField = SPUIComponentProvider.getTextField(i18n.get("prompt.number.of.groups"), "",
|
||||
ValoTheme.TEXTFIELD_TINY, true, null, i18n.get("prompt.number.of.groups"), true,
|
||||
SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
noOfGroupsField.setId(SPUIComponetIdProvider.ROLLOUT_NO_OF_GROUPS_ID);
|
||||
noOfGroupsField.addValidator(new GroupNumberValidator());
|
||||
noOfGroupsField.setSizeFull();
|
||||
@@ -655,14 +672,14 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
|
||||
}
|
||||
|
||||
private ComboBox createDistributionSetCombo() {
|
||||
final ComboBox dsSet = SPUIComponentProvider.getComboBox("", "", null, null, true, "",
|
||||
i18n.get("prompt.distribution.set"));
|
||||
dsSet.setImmediate(true);
|
||||
dsSet.setPageLength(7);
|
||||
dsSet.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME);
|
||||
dsSet.setId(SPUIComponetIdProvider.ROLLOUT_DS_ID);
|
||||
dsSet.setSizeFull();
|
||||
return dsSet;
|
||||
distributionSet = SPUIComponentProvider.getComboBox(i18n.get("prompt.distribution.set"), "", "", null, null,
|
||||
true, "", i18n.get("prompt.distribution.set"));
|
||||
distributionSet.setImmediate(true);
|
||||
distributionSet.setPageLength(7);
|
||||
distributionSet.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME);
|
||||
distributionSet.setId(SPUIComponetIdProvider.ROLLOUT_DS_ID);
|
||||
distributionSet.setSizeFull();
|
||||
return distributionSet;
|
||||
}
|
||||
|
||||
private void populateDistributionSet() {
|
||||
@@ -680,8 +697,9 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
|
||||
}
|
||||
|
||||
private TextField createRolloutNameField() {
|
||||
final TextField rolloutNameField = SPUIComponentProvider.getTextField("", ValoTheme.TEXTFIELD_TINY, true, null,
|
||||
i18n.get("textfield.name"), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
final TextField rolloutNameField = SPUIComponentProvider.getTextField(i18n.get("textfield.name"), "",
|
||||
ValoTheme.TEXTFIELD_TINY, true, null, i18n.get("textfield.name"), true,
|
||||
SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
rolloutNameField.setId(SPUIComponetIdProvider.ROLLOUT_NAME_FIELD_ID);
|
||||
rolloutNameField.setSizeFull();
|
||||
return rolloutNameField;
|
||||
@@ -728,7 +746,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
|
||||
return (int) Math.ceil((double) totalTargetsCount / Double.parseDouble(noOfGroups.getValue()));
|
||||
}
|
||||
|
||||
class ThresoldFieldValidator implements Validator {
|
||||
class ThresholdFieldValidator implements Validator {
|
||||
private static final long serialVersionUID = 9049939751976326550L;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -54,7 +54,6 @@ import com.vaadin.server.FontAwesome;
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.ViewScope;
|
||||
import com.vaadin.ui.UI;
|
||||
import com.vaadin.ui.Window;
|
||||
import com.vaadin.ui.renderers.ClickableRenderer.RendererClickEvent;
|
||||
import com.vaadin.ui.renderers.HtmlRenderer;
|
||||
|
||||
@@ -77,7 +76,6 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
|
||||
private static final String START_OPTION = "Start";
|
||||
|
||||
|
||||
@Autowired
|
||||
private transient RolloutManagement rolloutManagement;
|
||||
|
||||
@@ -95,7 +93,6 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
|
||||
private transient Map<RolloutStatus, StatusFontIcon> statusIconMap = new EnumMap<>(RolloutStatus.class);
|
||||
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEvent(final RolloutEvent event) {
|
||||
switch (event) {
|
||||
@@ -393,10 +390,8 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
|
||||
private void onUpdate(final ContextMenuData contextMenuData) {
|
||||
addUpdateRolloutWindow.populateData(contextMenuData.getRolloutId());
|
||||
final Window addTargetWindow = addUpdateRolloutWindow.getWindow();
|
||||
addTargetWindow.setCaption(i18n.get("caption.update.rollout"));
|
||||
UI.getCurrent().addWindow(addTargetWindow);
|
||||
addTargetWindow.setVisible(Boolean.TRUE);
|
||||
UI.getCurrent().addWindow(addUpdateRolloutWindow);
|
||||
addUpdateRolloutWindow.setVisible(Boolean.TRUE);
|
||||
}
|
||||
|
||||
private void refreshGrid() {
|
||||
|
||||
@@ -27,7 +27,6 @@ import com.vaadin.ui.Button.ClickEvent;
|
||||
import com.vaadin.ui.HorizontalLayout;
|
||||
import com.vaadin.ui.Label;
|
||||
import com.vaadin.ui.UI;
|
||||
import com.vaadin.ui.Window;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -55,7 +54,6 @@ public class RolloutListHeader extends AbstractGridHeader {
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
addUpdateRolloutWindow.init();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -91,11 +89,10 @@ public class RolloutListHeader extends AbstractGridHeader {
|
||||
|
||||
@Override
|
||||
protected void addNewItem(final ClickEvent event) {
|
||||
addUpdateRolloutWindow.resetComponents();
|
||||
final Window addTargetWindow = addUpdateRolloutWindow.getWindow();
|
||||
UI.getCurrent().addWindow(addTargetWindow);
|
||||
addTargetWindow.setVisible(Boolean.TRUE);
|
||||
|
||||
// addUpdateRolloutWindow.resetComponents();
|
||||
addUpdateRolloutWindow.init();
|
||||
UI.getCurrent().addWindow(addUpdateRolloutWindow);
|
||||
addUpdateRolloutWindow.setVisible(Boolean.TRUE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -95,7 +95,7 @@ public class DefaultDistributionSetTypeLayout extends BaseConfigurationView impl
|
||||
final Iterable<DistributionSetType> distributionSetTypeCollection = distributionSetManagement
|
||||
.findDistributionSetTypesAll(pageReq);
|
||||
|
||||
combobox = SPUIComponentProvider.getComboBox("", "330", null, null, false, "", "label.combobox.tag");
|
||||
combobox = SPUIComponentProvider.getComboBox(null, "", "330", null, null, false, "", "label.combobox.tag");
|
||||
combobox.setId(SPUIComponetIdProvider.SYSTEM_CONFIGURATION_DEFAULTDIS_COMBOBOX);
|
||||
combobox.setNullSelectionAllowed(false);
|
||||
for (final DistributionSetType distributionSetType : distributionSetTypeCollection) {
|
||||
|
||||
@@ -70,8 +70,8 @@ public class CertificateAuthenticationConfigurationItem extends AbstractAuthenti
|
||||
caRootAuthorityLabel.setDescription(
|
||||
"The SSL Issuer iRules.X509 hash, to validate against the controller request certifcate.");
|
||||
|
||||
caRootAuthorityTextField = SPUIComponentProvider.getTextField("", ValoTheme.TEXTFIELD_TINY, false, null, "",
|
||||
true, 128);
|
||||
caRootAuthorityTextField = SPUIComponentProvider.getTextField(null, "", ValoTheme.TEXTFIELD_TINY, false, null,
|
||||
"", true, 128);
|
||||
caRootAuthorityTextField.setWidth("500px");
|
||||
caRootAuthorityTextField.setImmediate(true);
|
||||
caRootAuthorityTextField.addTextChangeListener(event -> caRootAuthorityChanged());
|
||||
|
||||
@@ -74,8 +74,8 @@ public class GatewaySecurityTokenAuthenticationConfigurationItem extends Abstrac
|
||||
|
||||
detailLayout = new VerticalLayout();
|
||||
detailLayout.setImmediate(true);
|
||||
gatewayTokenNameTextField = SPUIComponentProvider.getTextField("", ValoTheme.TEXTFIELD_TINY, false, null, "",
|
||||
true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
gatewayTokenNameTextField = SPUIComponentProvider.getTextField(null, "", ValoTheme.TEXTFIELD_TINY, false, null,
|
||||
"", true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
gatewayTokenNameTextField.setImmediate(true);
|
||||
// hide text field until we support multiple gateway tokens for a tenan
|
||||
gatewayTokenNameTextField.setVisible(false);
|
||||
|
||||
Reference in New Issue
Block a user