Add TextBuilderArea

Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
SirWayne
2016-08-17 09:02:04 +02:00
parent 8d7cdb7e13
commit 7ea17c54f1
18 changed files with 254 additions and 286 deletions

View File

@@ -18,6 +18,7 @@ import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent; import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
import org.eclipse.hawkbit.ui.common.CommonDialogWindow; import org.eclipse.hawkbit.ui.common.CommonDialogWindow;
import org.eclipse.hawkbit.ui.common.SoftwareModuleTypeBeanQuery; import org.eclipse.hawkbit.ui.common.SoftwareModuleTypeBeanQuery;
import org.eclipse.hawkbit.ui.common.builder.TextAreaBuilder;
import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder; import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder;
import org.eclipse.hawkbit.ui.common.builder.WindowBuilder; import org.eclipse.hawkbit.ui.common.builder.WindowBuilder;
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType; import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
@@ -127,10 +128,9 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent implements Se
vendorTextField = createTextField("textfield.vendor", SPUIComponentIdProvider.SOFT_MODULE_VENDOR); vendorTextField = createTextField("textfield.vendor", SPUIComponentIdProvider.SOFT_MODULE_VENDOR);
vendorTextField.setRequired(false); vendorTextField.setRequired(false);
descTextArea = SPUIComponentProvider.getTextArea(i18n.get("textfield.description"), "text-area-style", descTextArea = new TextAreaBuilder().caption(i18n.get("textfield.description")).style("text-area-style")
ValoTheme.TEXTAREA_TINY, false, null, i18n.get("textfield.description"), .prompt(i18n.get("textfield.description")).id(SPUIComponentIdProvider.ADD_SW_MODULE_DESCRIPTION)
SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH); .buildTextField();
descTextArea.setId(SPUIComponentIdProvider.ADD_SW_MODULE_DESCRIPTION);
typeComboBox = SPUIComponentProvider.getComboBox(i18n.get("upload.swmodule.type"), "", "", null, null, true, typeComboBox = SPUIComponentProvider.getComboBox(i18n.get("upload.swmodule.type"), "", "", null, null, true,
null, i18n.get("upload.swmodule.type")); null, i18n.get("upload.swmodule.type"));

View File

@@ -19,8 +19,8 @@ import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleTypeEvent.SoftwareMo
import org.eclipse.hawkbit.ui.colorpicker.ColorPickerHelper; import org.eclipse.hawkbit.ui.colorpicker.ColorPickerHelper;
import org.eclipse.hawkbit.ui.common.SoftwareModuleTypeBeanQuery; import org.eclipse.hawkbit.ui.common.SoftwareModuleTypeBeanQuery;
import org.eclipse.hawkbit.ui.common.builder.LabelBuilder; import org.eclipse.hawkbit.ui.common.builder.LabelBuilder;
import org.eclipse.hawkbit.ui.common.builder.TextAreaBuilder;
import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder; import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.layouts.CreateUpdateTypeLayout; import org.eclipse.hawkbit.ui.layouts.CreateUpdateTypeLayout;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil; import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions; import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
@@ -85,11 +85,10 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout {
typeKey = createTextField("textfield.key", SPUIDefinitions.NEW_SOFTWARE_TYPE_KEY, SPUIDefinitions.TYPE_KEY); typeKey = createTextField("textfield.key", SPUIDefinitions.NEW_SOFTWARE_TYPE_KEY, SPUIDefinitions.TYPE_KEY);
tagDesc = SPUIComponentProvider.getTextArea(i18n.get("textfield.description"), "", tagDesc = new TextAreaBuilder().caption(i18n.get("textfield.description"))
ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.TYPE_DESC, false, "", .styleName(ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.TYPE_DESC)
i18n.get("textfield.description"), SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH); .prompt(i18n.get("textfield.description")).immediate(true).id(SPUIDefinitions.NEW_SOFTWARE_TYPE_DESC)
tagDesc.setId(SPUIDefinitions.NEW_SOFTWARE_TYPE_DESC); .buildTextField();
tagDesc.setImmediate(true);
tagDesc.setNullRepresentation(""); tagDesc.setNullRepresentation("");
singleMultiOptionGroup(); singleMultiOptionGroup();

View File

@@ -17,6 +17,7 @@ import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.model.MetaData; import org.eclipse.hawkbit.repository.model.MetaData;
import org.eclipse.hawkbit.repository.model.NamedVersionedEntity; import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
import org.eclipse.hawkbit.ui.common.builder.LabelBuilder; import org.eclipse.hawkbit.ui.common.builder.LabelBuilder;
import org.eclipse.hawkbit.ui.common.builder.TextAreaBuilder;
import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder; import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder;
import org.eclipse.hawkbit.ui.common.builder.WindowBuilder; import org.eclipse.hawkbit.ui.common.builder.WindowBuilder;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider; import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
@@ -49,7 +50,6 @@ import com.vaadin.ui.TextField;
import com.vaadin.ui.UI; import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.renderers.ClickableRenderer.RendererClickEvent; import com.vaadin.ui.renderers.ClickableRenderer.RendererClickEvent;
import com.vaadin.ui.themes.ValoTheme;
/** /**
* *
@@ -217,9 +217,9 @@ public abstract class AbstractMetadataPopupLayout<E extends NamedVersionedEntity
} }
private TextArea createValueTextField() { private TextArea createValueTextField() {
valueTextArea = SPUIComponentProvider.getTextArea(i18n.get("textfield.value"), null, ValoTheme.TEXTAREA_TINY, valueTextArea = new TextAreaBuilder().caption(i18n.get("textfield.value")).required(true)
true, null, i18n.get("textfield.value"), 4000); .prompt(i18n.get("textfield.value")).immediate(true).id(SPUIComponentIdProvider.METADATA_VALUE_ID)
valueTextArea.setId(SPUIComponentIdProvider.METADATA_VALUE_ID); .maxLengthAllowed(4000).buildTextField();
valueTextArea.setNullRepresentation(""); valueTextArea.setNullRepresentation("");
valueTextArea.setSizeFull(); valueTextArea.setSizeFull();
valueTextArea.setHeight(100, Unit.PERCENTAGE); valueTextArea.setHeight(100, Unit.PERCENTAGE);

View File

@@ -0,0 +1,151 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.ui.common.builder;
import org.apache.commons.lang3.StringUtils;
import com.vaadin.ui.AbstractTextField;
/**
* Abstract Text field builder.
*
* @param <E>
* the concrete text component
*/
public abstract class AbstractTextFieldBuilder<E extends AbstractTextField> {
private String caption;
private String style;
private String styleName;
private String prompt;
private String id;
private boolean immediate;
private boolean required;
private int maxLengthAllowed;
/**
* @param caption
* the caption to set
* @return the builder
*/
public AbstractTextFieldBuilder<E> caption(final String caption) {
this.caption = caption;
return this;
}
/**
* @param style
* the style to set * @return the builder
* @return the builder
*/
public AbstractTextFieldBuilder<E> style(final String style) {
this.style = style;
return this;
}
/**
* @param styleName
* the styleName to set
* @return the builder
*/
public AbstractTextFieldBuilder<E> styleName(final String styleName) {
this.styleName = styleName;
return this;
}
/**
* @param required
* the required to set
* @return the builder
*/
public AbstractTextFieldBuilder<E> required(final boolean required) {
this.required = required;
return this;
}
/**
* @param prompt
* the prompt to set
* @return the builder
*/
public AbstractTextFieldBuilder<E> prompt(final String prompt) {
this.prompt = prompt;
return this;
}
/**
* @param immediate
* the immediate to set
* @return the builder
*/
public AbstractTextFieldBuilder<E> immediate(final boolean immediate) {
this.immediate = immediate;
return this;
}
/**
* @param maxLengthAllowed
* the maxLengthAllowed to set
* @return the builder
*/
public AbstractTextFieldBuilder<E> maxLengthAllowed(final int maxLengthAllowed) {
this.maxLengthAllowed = maxLengthAllowed;
return this;
}
/**
* @param id
* the id to set
* @return the builder
*/
public AbstractTextFieldBuilder<E> id(final String id) {
this.id = id;
return this;
}
/**
* Build a textfield
*
* @return textfield
*/
public E buildTextField() {
final E textComponent = createTextComponent();
textComponent.setRequired(required);
textComponent.setImmediate(immediate);
if (StringUtils.isNotEmpty(caption)) {
textComponent.setCaption(caption);
}
if (StringUtils.isNotEmpty(style)) {
textComponent.setStyleName(style);
}
if (StringUtils.isNotEmpty(styleName)) {
textComponent.addStyleName(styleName);
}
if (StringUtils.isNotEmpty(prompt)) {
textComponent.setInputPrompt(prompt);
}
if (maxLengthAllowed > 0) {
textComponent.setMaxLength(maxLengthAllowed);
}
if (StringUtils.isNotEmpty(id)) {
textComponent.setId(id);
}
return textComponent;
}
protected abstract E createTextComponent();
}

View File

@@ -0,0 +1,37 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.ui.common.builder;
import com.vaadin.ui.TextArea;
import com.vaadin.ui.themes.ValoTheme;
/**
* TextArea builder.
*
*/
public class TextAreaBuilder extends AbstractTextFieldBuilder<TextArea> {
private static final int TEXT_AREA_DEFAULT_MAX_LENGTH = 512;
/**
* Constructor.
*/
public TextAreaBuilder() {
maxLengthAllowed(TEXT_AREA_DEFAULT_MAX_LENGTH);
styleName(ValoTheme.TEXTAREA_TINY);
}
@Override
protected TextArea createTextComponent() {
final TextArea textArea = new TextArea();
textArea.addStyleName(ValoTheme.TEXTAREA_SMALL);
return textArea;
}
}

View File

@@ -8,8 +8,6 @@
*/ */
package org.eclipse.hawkbit.ui.common.builder; package org.eclipse.hawkbit.ui.common.builder;
import org.apache.commons.lang3.StringUtils;
import com.vaadin.event.FieldEvents.TextChangeListener; import com.vaadin.event.FieldEvents.TextChangeListener;
import com.vaadin.server.Sizeable.Unit; import com.vaadin.server.Sizeable.Unit;
import com.vaadin.ui.AbstractTextField.TextChangeEventMode; import com.vaadin.ui.AbstractTextField.TextChangeEventMode;
@@ -20,134 +18,27 @@ import com.vaadin.ui.themes.ValoTheme;
* Textfield builder. * Textfield builder.
* *
*/ */
public class TextFieldBuilder { public class TextFieldBuilder extends AbstractTextFieldBuilder<TextField> {
private static final int TEXT_FIELD_DEFAULT_MAX_LENGTH = 64; private static final int TEXT_FIELD_DEFAULT_MAX_LENGTH = 64;
private String caption;
private String style;
private String styleName = ValoTheme.TEXTFIELD_TINY;
private String prompt;
private String id;
private boolean immediate;
private boolean required;
private int maxLengthAllowed = TEXT_FIELD_DEFAULT_MAX_LENGTH;
/** /**
* @param caption * Constructor.
* the caption to set
* @return the builder
*/ */
public TextFieldBuilder caption(final String caption) { public TextFieldBuilder() {
this.caption = caption; this(null);
return this;
} }
/** /**
* @param style * Constructor.
* the style to set * @return the builder
* @return the builder
*/
public TextFieldBuilder style(final String style) {
this.style = style;
return this;
}
/**
* @param styleName
* the styleName to set
* @return the builder
*/
public TextFieldBuilder styleName(final String styleName) {
this.styleName = styleName;
return this;
}
/**
* @param required
* the required to set
* @return the builder
*/
public TextFieldBuilder required(final boolean required) {
this.required = required;
return this;
}
/**
* @param prompt
* the prompt to set
* @return the builder
*/
public TextFieldBuilder prompt(final String prompt) {
this.prompt = prompt;
return this;
}
/**
* @param immediate
* the immediate to set
* @return the builder
*/
public TextFieldBuilder immediate(final boolean immediate) {
this.immediate = immediate;
return this;
}
/**
* @param maxLengthAllowed
* the maxLengthAllowed to set
* @return the builder
*/
public TextFieldBuilder maxLengthAllowed(final int maxLengthAllowed) {
this.maxLengthAllowed = maxLengthAllowed;
return this;
}
/**
* @param id
* the id to set
* @return the builder
*/
public TextFieldBuilder id(final String id) {
this.id = id;
return this;
}
/**
* Build a textfield
* *
* @return textfield * @param id
* the id
*/ */
public TextField buildTextField() { public TextFieldBuilder(final String id) {
final TextField textField = new TextField(); maxLengthAllowed(TEXT_FIELD_DEFAULT_MAX_LENGTH);
textField.addStyleName(ValoTheme.TEXTFIELD_SMALL); styleName(ValoTheme.TEXTAREA_TINY);
textField.setRequired(required); id(id);
textField.setImmediate(immediate);
if (StringUtils.isNotEmpty(caption)) {
textField.setCaption(caption);
}
if (StringUtils.isNotEmpty(style)) {
textField.setStyleName(style);
}
if (StringUtils.isNotEmpty(styleName)) {
textField.addStyleName(styleName);
}
if (StringUtils.isNotEmpty(prompt)) {
textField.setInputPrompt(prompt);
}
if (maxLengthAllowed > 0) {
textField.setMaxLength(maxLengthAllowed);
}
if (StringUtils.isNotEmpty(id)) {
textField.setId(id);
}
return textField;
} }
/** /**
@@ -167,4 +58,11 @@ public class TextFieldBuilder {
return textField; return textField;
} }
@Override
protected TextField createTextComponent() {
final TextField textField = new TextField();
textField.addStyleName(ValoTheme.TEXTFIELD_SMALL);
return textField;
}
} }

View File

@@ -60,8 +60,7 @@ public abstract class AbstractGridHeader extends VerticalLayout {
private void createComponents() { private void createComponents() {
headerCaptionLayout = getHeaderCaptionLayout(); headerCaptionLayout = getHeaderCaptionLayout();
if (isRollout()) { if (isRollout()) {
searchField = new TextFieldBuilder().id(getSearchBoxId()) searchField = new TextFieldBuilder(getSearchBoxId()).createSearchField(event -> searchBy(event.getText()));
.createSearchField(event -> searchBy(event.getText()));
searchResetIcon = createSearchResetIcon(); searchResetIcon = createSearchResetIcon();
addButton = createAddButton(); addButton = createAddButton();
} }

View File

@@ -86,7 +86,7 @@ public abstract class AbstractTableHeader extends VerticalLayout {
private void createComponents() { private void createComponents() {
headerCaption = createHeaderCaption(); headerCaption = createHeaderCaption();
searchField = new TextFieldBuilder().id(getSearchBoxId()).createSearchField(event -> searchBy(event.getText())); searchField = new TextFieldBuilder(getSearchBoxId()).createSearchField(event -> searchBy(event.getText()));
searchResetIcon = createSearchResetIcon(); searchResetIcon = createSearchResetIcon();
@@ -308,7 +308,7 @@ public abstract class AbstractTableHeader extends VerticalLayout {
maxMinIcon.setData(Boolean.FALSE); maxMinIcon.setData(Boolean.FALSE);
} }
private HorizontalLayout createHeaderFilterIconLayout() { private static HorizontalLayout createHeaderFilterIconLayout() {
final HorizontalLayout titleFilterIconsLayout = new HorizontalLayout(); final HorizontalLayout titleFilterIconsLayout = new HorizontalLayout();
titleFilterIconsLayout.addStyleName(SPUIStyleDefinitions.WIDGET_TITLE); titleFilterIconsLayout.addStyleName(SPUIStyleDefinitions.WIDGET_TITLE);
titleFilterIconsLayout.setSpacing(false); titleFilterIconsLayout.setSpacing(false);

View File

@@ -17,7 +17,6 @@ import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter; import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonDecorator; import org.eclipse.hawkbit.ui.decorators.SPUIButtonDecorator;
import org.eclipse.hawkbit.ui.decorators.SPUIComboBoxDecorator; import org.eclipse.hawkbit.ui.decorators.SPUIComboBoxDecorator;
import org.eclipse.hawkbit.ui.decorators.SPUITextAreaDecorator;
import org.eclipse.hawkbit.ui.utils.I18N; import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions; import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.slf4j.Logger; import org.slf4j.Logger;
@@ -34,7 +33,6 @@ import com.vaadin.ui.Label;
import com.vaadin.ui.Link; import com.vaadin.ui.Link;
import com.vaadin.ui.Panel; import com.vaadin.ui.Panel;
import com.vaadin.ui.TabSheet; import com.vaadin.ui.TabSheet;
import com.vaadin.ui.TextArea;
import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.themes.ValoTheme; import com.vaadin.ui.themes.ValoTheme;
@@ -54,30 +52,6 @@ public final class SPUIComponentProvider {
} }
/**
* Get Label UI component. *
*
* @param caption
* set the caption of the textArea
* @param style
* set style
* @param styleName
* add style
* @param required
* to set field as mandatory
* @param data
* component data
* @param promt
* prompt user for input
* @param maxLength
* maximum characters allowed
* @return TextArea text area
*/
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. * Get Label UI component.
* *

View File

@@ -1,81 +0,0 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.ui.decorators;
import org.apache.commons.lang3.StringUtils;
import com.vaadin.ui.TextArea;
import com.vaadin.ui.themes.ValoTheme;
/**
* TextArea with required style.
*
*
*
*/
public final class SPUITextAreaDecorator {
/**
* Private Constrcutor.
*/
private SPUITextAreaDecorator() {
}
/**
* Decorate.
*
* @param style
* set style
* @param styleName
* add style
* @param required
* to set field as mandatory
* @param data
* component data
* @param prompt
* as user for input
* @param maxLength
* maximum characters allowed
* @return TextArea as comp
*/
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.TEXTAREA_SMALL);
if (StringUtils.isNotEmpty(caption)) {
spUITxtArea.setCaption(caption);
}
if (required) {
spUITxtArea.setRequired(true);
}
// Add style
if (StringUtils.isNotEmpty(style)) {
spUITxtArea.setStyleName(style);
}
// Add style Name
if (StringUtils.isNotEmpty(styleName)) {
spUITxtArea.addStyleName(styleName);
}
if (StringUtils.isNotEmpty(prompt)) {
spUITxtArea.setInputPrompt(prompt);
}
if (StringUtils.isNotEmpty(data)) {
spUITxtArea.setData(data);
}
if (maxLength > 0) {
spUITxtArea.setMaxLength(maxLength);
}
return spUITxtArea;
}
}

View File

@@ -18,6 +18,7 @@ import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType; import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.ui.colorpicker.ColorPickerHelper; import org.eclipse.hawkbit.ui.colorpicker.ColorPickerHelper;
import org.eclipse.hawkbit.ui.common.DistributionSetTypeBeanQuery; import org.eclipse.hawkbit.ui.common.DistributionSetTypeBeanQuery;
import org.eclipse.hawkbit.ui.common.builder.TextAreaBuilder;
import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder; import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder;
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;
@@ -92,11 +93,10 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout {
typeKey = createTextField("textfield.key", SPUIDefinitions.DIST_SET_TYPE_KEY, typeKey = createTextField("textfield.key", SPUIDefinitions.DIST_SET_TYPE_KEY,
SPUIDefinitions.NEW_DISTRIBUTION_TYPE_KEY); SPUIDefinitions.NEW_DISTRIBUTION_TYPE_KEY);
tagDesc = SPUIComponentProvider.getTextArea(i18n.get("textfield.description"), "", tagDesc = new TextAreaBuilder().caption(i18n.get("textfield.description"))
ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.DIST_SET_TYPE_DESC, false, "", .styleName(ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.DIST_SET_TYPE_DESC)
i18n.get("textfield.description"), SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH); .prompt(i18n.get("textfield.description")).immediate(true)
tagDesc.setId(SPUIDefinitions.NEW_DISTRIBUTION_TYPE_DESC); .id(SPUIDefinitions.NEW_DISTRIBUTION_TYPE_DESC).buildTextField();
tagDesc.setImmediate(true);
tagDesc.setNullRepresentation(""); tagDesc.setNullRepresentation("");
} }

View File

@@ -120,7 +120,7 @@ public class TargetFilterHeader extends VerticalLayout {
} }
private TextField createSearchField() { private TextField createSearchField() {
final TextField campSearchTextField = new TextFieldBuilder().id("target.filter.search.text.Id") final TextField campSearchTextField = new TextFieldBuilder("target.filter.search.text.Id")
.createSearchField(event -> searchBy(event.getText())); .createSearchField(event -> searchBy(event.getText()));
campSearchTextField.setWidth(500.0F, Unit.PIXELS); campSearchTextField.setWidth(500.0F, Unit.PIXELS);
return campSearchTextField; return campSearchTextField;
@@ -150,7 +150,6 @@ public class TargetFilterHeader extends VerticalLayout {
} }
private void openSearchTextField() { private void openSearchTextField() {
//
searchResetIcon.addStyleName(SPUIDefinitions.FILTER_RESET_ICON); searchResetIcon.addStyleName(SPUIDefinitions.FILTER_RESET_ICON);
searchResetIcon.togleIcon(FontAwesome.TIMES); searchResetIcon.togleIcon(FontAwesome.TIMES);
searchResetIcon.setData(Boolean.TRUE); searchResetIcon.setData(Boolean.TRUE);

View File

@@ -20,6 +20,7 @@ import org.eclipse.hawkbit.ui.colorpicker.ColorPickerHelper;
import org.eclipse.hawkbit.ui.colorpicker.ColorPickerLayout; import org.eclipse.hawkbit.ui.colorpicker.ColorPickerLayout;
import org.eclipse.hawkbit.ui.common.CommonDialogWindow; import org.eclipse.hawkbit.ui.common.CommonDialogWindow;
import org.eclipse.hawkbit.ui.common.builder.LabelBuilder; import org.eclipse.hawkbit.ui.common.builder.LabelBuilder;
import org.eclipse.hawkbit.ui.common.builder.TextAreaBuilder;
import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder; import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder;
import org.eclipse.hawkbit.ui.common.builder.WindowBuilder; import org.eclipse.hawkbit.ui.common.builder.WindowBuilder;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider; import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
@@ -27,7 +28,6 @@ import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.I18N; import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIComponentIdProvider; import org.eclipse.hawkbit.ui.utils.SPUIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions; import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.UINotification; import org.eclipse.hawkbit.ui.utils.UINotification;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus; import org.vaadin.spring.events.EventBus;
@@ -158,11 +158,11 @@ public abstract class AbstractCreateUpdateTagLayout extends CustomComponent
.prompt(i18n.get("textfield.name")).immediate(true).id(SPUIDefinitions.NEW_TARGET_TAG_NAME) .prompt(i18n.get("textfield.name")).immediate(true).id(SPUIDefinitions.NEW_TARGET_TAG_NAME)
.buildTextField(); .buildTextField();
tagDesc = SPUIComponentProvider.getTextArea(i18n.get("textfield.description"), "", tagDesc = new TextAreaBuilder().caption(i18n.get("textfield.description"))
ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.TAG_DESC, false, "", i18n.get("textfield.description"), .styleName(ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.TAG_DESC)
SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH); .prompt(i18n.get("textfield.description")).immediate(true).id(SPUIDefinitions.NEW_TARGET_TAG_DESC)
tagDesc.setId(SPUIDefinitions.NEW_TARGET_TAG_DESC); .buildTextField();
tagDesc.setImmediate(true);
tagDesc.setNullRepresentation(""); tagDesc.setNullRepresentation("");
tagNameComboBox = SPUIComponentProvider.getComboBox(null, "", "", null, null, false, "", tagNameComboBox = SPUIComponentProvider.getComboBox(null, "", "", null, null, false, "",

View File

@@ -25,6 +25,7 @@ import org.eclipse.hawkbit.repository.model.TenantMetaData;
import org.eclipse.hawkbit.ui.common.CommonDialogWindow; import org.eclipse.hawkbit.ui.common.CommonDialogWindow;
import org.eclipse.hawkbit.ui.common.DistributionSetIdName; import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
import org.eclipse.hawkbit.ui.common.DistributionSetTypeBeanQuery; import org.eclipse.hawkbit.ui.common.DistributionSetTypeBeanQuery;
import org.eclipse.hawkbit.ui.common.builder.TextAreaBuilder;
import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder; import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder;
import org.eclipse.hawkbit.ui.common.builder.WindowBuilder; import org.eclipse.hawkbit.ui.common.builder.WindowBuilder;
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType; import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
@@ -135,10 +136,9 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
distsetTypeNameComboBox.setId(SPUIComponentIdProvider.DIST_ADD_DISTSETTYPE); distsetTypeNameComboBox.setId(SPUIComponentIdProvider.DIST_ADD_DISTSETTYPE);
populateDistSetTypeNameCombo(); populateDistSetTypeNameCombo();
descTextArea = SPUIComponentProvider.getTextArea(i18n.get("textfield.description"), "text-area-style", descTextArea = new TextAreaBuilder().caption(i18n.get("textfield.description")).style("text-area-style")
ValoTheme.TEXTAREA_TINY, false, null, i18n.get("textfield.description"), .prompt(i18n.get("textfield.description")).immediate(true).id(SPUIComponentIdProvider.DIST_ADD_DESC)
SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH); .buildTextField();
descTextArea.setId(SPUIComponentIdProvider.DIST_ADD_DESC);
descTextArea.setNullRepresentation(""); descTextArea.setNullRepresentation("");
reqMigStepCheckbox = SPUIComponentProvider.getCheckBox(i18n.get("checkbox.dist.required.migration.step"), reqMigStepCheckbox = SPUIComponentProvider.getCheckBox(i18n.get("checkbox.dist.required.migration.step"),

View File

@@ -16,17 +16,16 @@ import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.model.Target; import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetIdName; import org.eclipse.hawkbit.repository.model.TargetIdName;
import org.eclipse.hawkbit.ui.common.CommonDialogWindow; import org.eclipse.hawkbit.ui.common.CommonDialogWindow;
import org.eclipse.hawkbit.ui.common.builder.TextAreaBuilder;
import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder; import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder;
import org.eclipse.hawkbit.ui.common.builder.WindowBuilder; import org.eclipse.hawkbit.ui.common.builder.WindowBuilder;
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType; import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.management.event.DragEvent; import org.eclipse.hawkbit.ui.management.event.DragEvent;
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent; import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil; import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.I18N; import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIComponentIdProvider; import org.eclipse.hawkbit.ui.utils.SPUIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions; import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions; import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.eclipse.hawkbit.ui.utils.SpringContextHelper; import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
import org.eclipse.hawkbit.ui.utils.UINotification; import org.eclipse.hawkbit.ui.utils.UINotification;
@@ -40,7 +39,6 @@ import com.vaadin.ui.FormLayout;
import com.vaadin.ui.TextArea; import com.vaadin.ui.TextArea;
import com.vaadin.ui.TextField; import com.vaadin.ui.TextField;
import com.vaadin.ui.Window; import com.vaadin.ui.Window;
import com.vaadin.ui.themes.ValoTheme;
/** /**
* Add and Update Target. * Add and Update Target.
@@ -87,11 +85,9 @@ public class TargetAddUpdateWindowLayout extends CustomComponent {
nameTextField = createTextField("textfield.name", SPUIComponentIdProvider.TARGET_ADD_NAME); nameTextField = createTextField("textfield.name", SPUIComponentIdProvider.TARGET_ADD_NAME);
nameTextField.setRequired(false); nameTextField.setRequired(false);
/* Textarea for target description */ descTextArea = new TextAreaBuilder().caption(i18n.get("textfield.description")).style("text-area-style")
descTextArea = SPUIComponentProvider.getTextArea(i18n.get("textfield.description"), "text-area-style", .prompt(i18n.get("textfield.description")).immediate(true).id(SPUIComponentIdProvider.TARGET_ADD_DESC)
ValoTheme.TEXTFIELD_TINY, false, null, i18n.get("textfield.description"), .buildTextField();
SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH);
descTextArea.setId(SPUIComponentIdProvider.TARGET_ADD_DESC);
descTextArea.setNullRepresentation(HawkbitCommonUtil.SP_STRING_EMPTY); descTextArea.setNullRepresentation(HawkbitCommonUtil.SP_STRING_EMPTY);
} }

View File

@@ -19,6 +19,7 @@ import org.eclipse.hawkbit.repository.DeploymentManagement;
import org.eclipse.hawkbit.repository.TargetManagement; import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.ui.UiProperties; import org.eclipse.hawkbit.ui.UiProperties;
import org.eclipse.hawkbit.ui.common.DistributionSetIdName; import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
import org.eclipse.hawkbit.ui.common.builder.TextAreaBuilder;
import org.eclipse.hawkbit.ui.common.builder.WindowBuilder; import org.eclipse.hawkbit.ui.common.builder.WindowBuilder;
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;
@@ -193,10 +194,9 @@ public class TargetBulkUpdateWindowLayout extends CustomComponent {
} }
private TextArea getDescriptionTextArea() { private TextArea getDescriptionTextArea() {
final TextArea description = SPUIComponentProvider.getTextArea(i18n.get("textfield.description"), final TextArea description = new TextAreaBuilder().caption(i18n.get("textfield.description"))
"text-area-style", ValoTheme.TEXTFIELD_TINY, false, null, i18n.get("textfield.description"), .style("text-area-style").prompt(i18n.get("textfield.description")).immediate(true)
SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH); .id(SPUIComponentIdProvider.BULK_UPLOAD_DESC).buildTextField();
description.setId(SPUIComponentIdProvider.BULK_UPLOAD_DESC);
description.setNullRepresentation(HawkbitCommonUtil.SP_STRING_EMPTY); description.setNullRepresentation(HawkbitCommonUtil.SP_STRING_EMPTY);
description.setWidth("100%"); description.setWidth("100%");
return description; return description;

View File

@@ -31,6 +31,7 @@ import org.eclipse.hawkbit.ui.UiProperties;
import org.eclipse.hawkbit.ui.common.CommonDialogWindow; import org.eclipse.hawkbit.ui.common.CommonDialogWindow;
import org.eclipse.hawkbit.ui.common.DistributionSetIdName; import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
import org.eclipse.hawkbit.ui.common.builder.LabelBuilder; import org.eclipse.hawkbit.ui.common.builder.LabelBuilder;
import org.eclipse.hawkbit.ui.common.builder.TextAreaBuilder;
import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder; import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder;
import org.eclipse.hawkbit.ui.common.builder.WindowBuilder; import org.eclipse.hawkbit.ui.common.builder.WindowBuilder;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider; import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
@@ -313,9 +314,10 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
} }
private static TextArea createTargetFilterQuery() { private static TextArea createTargetFilterQuery() {
final TextArea filterField = SPUIComponentProvider.getTextArea(null, "text-area-style", final TextArea filterField = new TextAreaBuilder().style("text-area-style")
ValoTheme.TEXTFIELD_TINY, false, null, null, .id(SPUIComponentIdProvider.ROLLOUT_TARGET_FILTER_QUERY_FIELD)
SPUILabelDefinitions.TARGET_FILTER_QUERY_TEXT_FIELD_LENGTH); .maxLengthAllowed(SPUILabelDefinitions.TARGET_FILTER_QUERY_TEXT_FIELD_LENGTH).buildTextField();
filterField.setId(SPUIComponentIdProvider.ROLLOUT_TARGET_FILTER_QUERY_FIELD); filterField.setId(SPUIComponentIdProvider.ROLLOUT_TARGET_FILTER_QUERY_FIELD);
filterField.setNullRepresentation(HawkbitCommonUtil.SP_STRING_EMPTY); filterField.setNullRepresentation(HawkbitCommonUtil.SP_STRING_EMPTY);
filterField.setEnabled(false); filterField.setEnabled(false);
@@ -513,10 +515,9 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
} }
private TextArea createDescription() { private TextArea createDescription() {
final TextArea descriptionField = SPUIComponentProvider.getTextArea(null, "text-area-style", final TextArea descriptionField = new TextAreaBuilder().style("text-area-style")
ValoTheme.TEXTAREA_TINY, false, null, i18n.get("textfield.description"), .prompt(i18n.get("textfield.description")).id(SPUIComponentIdProvider.ROLLOUT_DESCRIPTION_ID)
SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH); .buildTextField();
descriptionField.setId(SPUIComponentIdProvider.ROLLOUT_DESCRIPTION_ID);
descriptionField.setNullRepresentation(HawkbitCommonUtil.SP_STRING_EMPTY); descriptionField.setNullRepresentation(HawkbitCommonUtil.SP_STRING_EMPTY);
descriptionField.setSizeUndefined(); descriptionField.setSizeUndefined();
return descriptionField; return descriptionField;

View File

@@ -268,11 +268,6 @@ public final class SPUILabelDefinitions {
*/ */
public static final String UPDATE_CUSTOM_FILTER = "Update Custom Filter"; public static final String UPDATE_CUSTOM_FILTER = "Update Custom Filter";
/**
* Text area and text field max allowed length.
*/
public static final int TEXT_AREA_MAX_LENGTH = 512;
/** /**
* Yes label. * Yes label.
*/ */