Add TextBuilderArea
Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
@@ -18,6 +18,7 @@ import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
||||
import org.eclipse.hawkbit.ui.common.CommonDialogWindow;
|
||||
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.WindowBuilder;
|
||||
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.setRequired(false);
|
||||
|
||||
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(SPUIComponentIdProvider.ADD_SW_MODULE_DESCRIPTION);
|
||||
descTextArea = new TextAreaBuilder().caption(i18n.get("textfield.description")).style("text-area-style")
|
||||
.prompt(i18n.get("textfield.description")).id(SPUIComponentIdProvider.ADD_SW_MODULE_DESCRIPTION)
|
||||
.buildTextField();
|
||||
|
||||
typeComboBox = SPUIComponentProvider.getComboBox(i18n.get("upload.swmodule.type"), "", "", null, null, true,
|
||||
null, i18n.get("upload.swmodule.type"));
|
||||
|
||||
@@ -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.common.SoftwareModuleTypeBeanQuery;
|
||||
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.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.layouts.CreateUpdateTypeLayout;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
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);
|
||||
|
||||
tagDesc = SPUIComponentProvider.getTextArea(i18n.get("textfield.description"), "",
|
||||
ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.TYPE_DESC, false, "",
|
||||
i18n.get("textfield.description"), SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH);
|
||||
tagDesc.setId(SPUIDefinitions.NEW_SOFTWARE_TYPE_DESC);
|
||||
tagDesc.setImmediate(true);
|
||||
tagDesc = new TextAreaBuilder().caption(i18n.get("textfield.description"))
|
||||
.styleName(ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.TYPE_DESC)
|
||||
.prompt(i18n.get("textfield.description")).immediate(true).id(SPUIDefinitions.NEW_SOFTWARE_TYPE_DESC)
|
||||
.buildTextField();
|
||||
tagDesc.setNullRepresentation("");
|
||||
|
||||
singleMultiOptionGroup();
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||
import org.eclipse.hawkbit.repository.model.MetaData;
|
||||
import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
|
||||
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.WindowBuilder;
|
||||
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.VerticalLayout;
|
||||
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() {
|
||||
valueTextArea = SPUIComponentProvider.getTextArea(i18n.get("textfield.value"), null, ValoTheme.TEXTAREA_TINY,
|
||||
true, null, i18n.get("textfield.value"), 4000);
|
||||
valueTextArea.setId(SPUIComponentIdProvider.METADATA_VALUE_ID);
|
||||
valueTextArea = new TextAreaBuilder().caption(i18n.get("textfield.value")).required(true)
|
||||
.prompt(i18n.get("textfield.value")).immediate(true).id(SPUIComponentIdProvider.METADATA_VALUE_ID)
|
||||
.maxLengthAllowed(4000).buildTextField();
|
||||
valueTextArea.setNullRepresentation("");
|
||||
valueTextArea.setSizeFull();
|
||||
valueTextArea.setHeight(100, Unit.PERCENTAGE);
|
||||
|
||||
@@ -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();
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,8 +8,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.common.builder;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.vaadin.event.FieldEvents.TextChangeListener;
|
||||
import com.vaadin.server.Sizeable.Unit;
|
||||
import com.vaadin.ui.AbstractTextField.TextChangeEventMode;
|
||||
@@ -20,134 +18,27 @@ import com.vaadin.ui.themes.ValoTheme;
|
||||
* Textfield builder.
|
||||
*
|
||||
*/
|
||||
public class TextFieldBuilder {
|
||||
public class TextFieldBuilder extends AbstractTextFieldBuilder<TextField> {
|
||||
|
||||
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
|
||||
* the caption to set
|
||||
* @return the builder
|
||||
* Constructor.
|
||||
*/
|
||||
public TextFieldBuilder caption(final String caption) {
|
||||
this.caption = caption;
|
||||
return this;
|
||||
public TextFieldBuilder() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param style
|
||||
* 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
|
||||
* Constructor.
|
||||
*
|
||||
* @return textfield
|
||||
* @param id
|
||||
* the id
|
||||
*/
|
||||
public TextField buildTextField() {
|
||||
final TextField textField = new TextField();
|
||||
textField.addStyleName(ValoTheme.TEXTFIELD_SMALL);
|
||||
textField.setRequired(required);
|
||||
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;
|
||||
public TextFieldBuilder(final String id) {
|
||||
maxLengthAllowed(TEXT_FIELD_DEFAULT_MAX_LENGTH);
|
||||
styleName(ValoTheme.TEXTAREA_TINY);
|
||||
id(id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -167,4 +58,11 @@ public class TextFieldBuilder {
|
||||
return textField;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TextField createTextComponent() {
|
||||
final TextField textField = new TextField();
|
||||
textField.addStyleName(ValoTheme.TEXTFIELD_SMALL);
|
||||
return textField;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -60,8 +60,7 @@ public abstract class AbstractGridHeader extends VerticalLayout {
|
||||
private void createComponents() {
|
||||
headerCaptionLayout = getHeaderCaptionLayout();
|
||||
if (isRollout()) {
|
||||
searchField = new TextFieldBuilder().id(getSearchBoxId())
|
||||
.createSearchField(event -> searchBy(event.getText()));
|
||||
searchField = new TextFieldBuilder(getSearchBoxId()).createSearchField(event -> searchBy(event.getText()));
|
||||
searchResetIcon = createSearchResetIcon();
|
||||
addButton = createAddButton();
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ public abstract class AbstractTableHeader extends VerticalLayout {
|
||||
|
||||
private void createComponents() {
|
||||
headerCaption = createHeaderCaption();
|
||||
searchField = new TextFieldBuilder().id(getSearchBoxId()).createSearchField(event -> searchBy(event.getText()));
|
||||
searchField = new TextFieldBuilder(getSearchBoxId()).createSearchField(event -> searchBy(event.getText()));
|
||||
|
||||
searchResetIcon = createSearchResetIcon();
|
||||
|
||||
@@ -308,7 +308,7 @@ public abstract class AbstractTableHeader extends VerticalLayout {
|
||||
maxMinIcon.setData(Boolean.FALSE);
|
||||
}
|
||||
|
||||
private HorizontalLayout createHeaderFilterIconLayout() {
|
||||
private static HorizontalLayout createHeaderFilterIconLayout() {
|
||||
final HorizontalLayout titleFilterIconsLayout = new HorizontalLayout();
|
||||
titleFilterIconsLayout.addStyleName(SPUIStyleDefinitions.WIDGET_TITLE);
|
||||
titleFilterIconsLayout.setSpacing(false);
|
||||
|
||||
@@ -17,7 +17,6 @@ import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonDecorator;
|
||||
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.SPUIDefinitions;
|
||||
import org.slf4j.Logger;
|
||||
@@ -34,7 +33,6 @@ import com.vaadin.ui.Label;
|
||||
import com.vaadin.ui.Link;
|
||||
import com.vaadin.ui.Panel;
|
||||
import com.vaadin.ui.TabSheet;
|
||||
import com.vaadin.ui.TextArea;
|
||||
import com.vaadin.ui.VerticalLayout;
|
||||
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.
|
||||
*
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.eclipse.hawkbit.ui.colorpicker.ColorPickerHelper;
|
||||
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.components.SPUIComponentProvider;
|
||||
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,
|
||||
SPUIDefinitions.NEW_DISTRIBUTION_TYPE_KEY);
|
||||
|
||||
tagDesc = SPUIComponentProvider.getTextArea(i18n.get("textfield.description"), "",
|
||||
ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.DIST_SET_TYPE_DESC, false, "",
|
||||
i18n.get("textfield.description"), SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH);
|
||||
tagDesc.setId(SPUIDefinitions.NEW_DISTRIBUTION_TYPE_DESC);
|
||||
tagDesc.setImmediate(true);
|
||||
tagDesc = new TextAreaBuilder().caption(i18n.get("textfield.description"))
|
||||
.styleName(ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.DIST_SET_TYPE_DESC)
|
||||
.prompt(i18n.get("textfield.description")).immediate(true)
|
||||
.id(SPUIDefinitions.NEW_DISTRIBUTION_TYPE_DESC).buildTextField();
|
||||
tagDesc.setNullRepresentation("");
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ public class TargetFilterHeader extends VerticalLayout {
|
||||
}
|
||||
|
||||
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()));
|
||||
campSearchTextField.setWidth(500.0F, Unit.PIXELS);
|
||||
return campSearchTextField;
|
||||
@@ -150,7 +150,6 @@ public class TargetFilterHeader extends VerticalLayout {
|
||||
}
|
||||
|
||||
private void openSearchTextField() {
|
||||
//
|
||||
searchResetIcon.addStyleName(SPUIDefinitions.FILTER_RESET_ICON);
|
||||
searchResetIcon.togleIcon(FontAwesome.TIMES);
|
||||
searchResetIcon.setData(Boolean.TRUE);
|
||||
|
||||
@@ -20,6 +20,7 @@ import org.eclipse.hawkbit.ui.colorpicker.ColorPickerHelper;
|
||||
import org.eclipse.hawkbit.ui.colorpicker.ColorPickerLayout;
|
||||
import org.eclipse.hawkbit.ui.common.CommonDialogWindow;
|
||||
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.WindowBuilder;
|
||||
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.SPUIComponentIdProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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)
|
||||
.buildTextField();
|
||||
|
||||
tagDesc = SPUIComponentProvider.getTextArea(i18n.get("textfield.description"), "",
|
||||
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 = new TextAreaBuilder().caption(i18n.get("textfield.description"))
|
||||
.styleName(ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.TAG_DESC)
|
||||
.prompt(i18n.get("textfield.description")).immediate(true).id(SPUIDefinitions.NEW_TARGET_TAG_DESC)
|
||||
.buildTextField();
|
||||
|
||||
tagDesc.setNullRepresentation("");
|
||||
|
||||
tagNameComboBox = SPUIComponentProvider.getComboBox(null, "", "", null, null, false, "",
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.eclipse.hawkbit.repository.model.TenantMetaData;
|
||||
import org.eclipse.hawkbit.ui.common.CommonDialogWindow;
|
||||
import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
|
||||
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.WindowBuilder;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||
@@ -135,10 +136,9 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
|
||||
distsetTypeNameComboBox.setId(SPUIComponentIdProvider.DIST_ADD_DISTSETTYPE);
|
||||
populateDistSetTypeNameCombo();
|
||||
|
||||
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(SPUIComponentIdProvider.DIST_ADD_DESC);
|
||||
descTextArea = new TextAreaBuilder().caption(i18n.get("textfield.description")).style("text-area-style")
|
||||
.prompt(i18n.get("textfield.description")).immediate(true).id(SPUIComponentIdProvider.DIST_ADD_DESC)
|
||||
.buildTextField();
|
||||
descTextArea.setNullRepresentation("");
|
||||
|
||||
reqMigStepCheckbox = SPUIComponentProvider.getCheckBox(i18n.get("checkbox.dist.required.migration.step"),
|
||||
|
||||
@@ -16,17 +16,16 @@ import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetIdName;
|
||||
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.WindowBuilder;
|
||||
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.TargetTableEvent;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponentIdProvider;
|
||||
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.SpringContextHelper;
|
||||
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.TextField;
|
||||
import com.vaadin.ui.Window;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
* Add and Update Target.
|
||||
@@ -87,11 +85,9 @@ public class TargetAddUpdateWindowLayout extends CustomComponent {
|
||||
nameTextField = createTextField("textfield.name", SPUIComponentIdProvider.TARGET_ADD_NAME);
|
||||
nameTextField.setRequired(false);
|
||||
|
||||
/* Textarea for target description */
|
||||
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(SPUIComponentIdProvider.TARGET_ADD_DESC);
|
||||
descTextArea = new TextAreaBuilder().caption(i18n.get("textfield.description")).style("text-area-style")
|
||||
.prompt(i18n.get("textfield.description")).immediate(true).id(SPUIComponentIdProvider.TARGET_ADD_DESC)
|
||||
.buildTextField();
|
||||
descTextArea.setNullRepresentation(HawkbitCommonUtil.SP_STRING_EMPTY);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import org.eclipse.hawkbit.repository.DeploymentManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.ui.UiProperties;
|
||||
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.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||
@@ -193,10 +194,9 @@ public class TargetBulkUpdateWindowLayout extends CustomComponent {
|
||||
}
|
||||
|
||||
private TextArea getDescriptionTextArea() {
|
||||
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(SPUIComponentIdProvider.BULK_UPLOAD_DESC);
|
||||
final TextArea description = new TextAreaBuilder().caption(i18n.get("textfield.description"))
|
||||
.style("text-area-style").prompt(i18n.get("textfield.description")).immediate(true)
|
||||
.id(SPUIComponentIdProvider.BULK_UPLOAD_DESC).buildTextField();
|
||||
description.setNullRepresentation(HawkbitCommonUtil.SP_STRING_EMPTY);
|
||||
description.setWidth("100%");
|
||||
return description;
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.eclipse.hawkbit.ui.UiProperties;
|
||||
import org.eclipse.hawkbit.ui.common.CommonDialogWindow;
|
||||
import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
|
||||
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.WindowBuilder;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
@@ -313,9 +314,10 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
|
||||
}
|
||||
|
||||
private static TextArea createTargetFilterQuery() {
|
||||
final TextArea filterField = SPUIComponentProvider.getTextArea(null, "text-area-style",
|
||||
ValoTheme.TEXTFIELD_TINY, false, null, null,
|
||||
SPUILabelDefinitions.TARGET_FILTER_QUERY_TEXT_FIELD_LENGTH);
|
||||
final TextArea filterField = new TextAreaBuilder().style("text-area-style")
|
||||
.id(SPUIComponentIdProvider.ROLLOUT_TARGET_FILTER_QUERY_FIELD)
|
||||
.maxLengthAllowed(SPUILabelDefinitions.TARGET_FILTER_QUERY_TEXT_FIELD_LENGTH).buildTextField();
|
||||
|
||||
filterField.setId(SPUIComponentIdProvider.ROLLOUT_TARGET_FILTER_QUERY_FIELD);
|
||||
filterField.setNullRepresentation(HawkbitCommonUtil.SP_STRING_EMPTY);
|
||||
filterField.setEnabled(false);
|
||||
@@ -513,10 +515,9 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
|
||||
}
|
||||
|
||||
private TextArea createDescription() {
|
||||
final TextArea descriptionField = SPUIComponentProvider.getTextArea(null, "text-area-style",
|
||||
ValoTheme.TEXTAREA_TINY, false, null, i18n.get("textfield.description"),
|
||||
SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH);
|
||||
descriptionField.setId(SPUIComponentIdProvider.ROLLOUT_DESCRIPTION_ID);
|
||||
final TextArea descriptionField = new TextAreaBuilder().style("text-area-style")
|
||||
.prompt(i18n.get("textfield.description")).id(SPUIComponentIdProvider.ROLLOUT_DESCRIPTION_ID)
|
||||
.buildTextField();
|
||||
descriptionField.setNullRepresentation(HawkbitCommonUtil.SP_STRING_EMPTY);
|
||||
descriptionField.setSizeUndefined();
|
||||
return descriptionField;
|
||||
|
||||
@@ -268,11 +268,6 @@ public final class SPUILabelDefinitions {
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user