Add a textfield builder
Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
@@ -483,7 +483,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
if (distributionSetMetadataRepository.exists(metadata.getId())) {
|
||||
throwMetadataKeyAlreadyExists(metadata.getId().getKey());
|
||||
}
|
||||
|
||||
|
||||
touch(metadata.getDistributionSet());
|
||||
return distributionSetMetadataRepository.save(metadata);
|
||||
}
|
||||
@@ -515,7 +515,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
findOne(metadata.getDistributionSet(), metadata.getKey());
|
||||
// touch it to update the lock revision because we are modifying the
|
||||
// DS indirectly
|
||||
touch(metadata.getDistributionSet());;
|
||||
touch(metadata.getDistributionSet());
|
||||
return distributionSetMetadataRepository.save(metadata);
|
||||
}
|
||||
|
||||
@@ -528,8 +528,11 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the latest distribution set based on ds ID after the metadata changes for that distribution set.
|
||||
* @param distributionSet Distribution set
|
||||
* Method to get the latest distribution set based on ds ID after the
|
||||
* metadata changes for that distribution set.
|
||||
*
|
||||
* @param distributionSet
|
||||
* Distribution set
|
||||
*/
|
||||
private void touch(final DistributionSet distributionSet) {
|
||||
final DistributionSet latestDistributionSet = findDistributionSetById(distributionSet.getId());
|
||||
@@ -552,7 +555,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
|
||||
@Override
|
||||
public List<DistributionSetMetadata> findDistributionSetMetadataByDistributionSetId(final Long distributionSetId) {
|
||||
return new ArrayList<DistributionSetMetadata>(distributionSetMetadataRepository
|
||||
return new ArrayList<>(distributionSetMetadataRepository
|
||||
.findAll((Specification<JpaDistributionSetMetadata>) (root, query, cb) -> cb.equal(
|
||||
root.get(JpaDistributionSetMetadata_.distributionSet).get(JpaDistributionSet_.id),
|
||||
distributionSetId)));
|
||||
|
||||
@@ -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.TextFieldBuilder;
|
||||
import org.eclipse.hawkbit.ui.common.builder.WindowBuilder;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
@@ -118,21 +119,13 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent implements Se
|
||||
}
|
||||
|
||||
private void createRequiredComponents() {
|
||||
/* name textfield */
|
||||
nameTextField = SPUIComponentProvider.getTextField(i18n.get("textfield.name"), "", ValoTheme.TEXTFIELD_TINY,
|
||||
true, null, i18n.get("textfield.name"), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
nameTextField.setId(SPUIComponentIdProvider.SOFT_MODULE_NAME);
|
||||
|
||||
/* version text field */
|
||||
versionTextField = SPUIComponentProvider.getTextField(i18n.get("textfield.version"), "",
|
||||
ValoTheme.TEXTFIELD_TINY, true, null, i18n.get("textfield.version"), true,
|
||||
SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
versionTextField.setId(SPUIComponentIdProvider.SOFT_MODULE_VERSION);
|
||||
nameTextField = createTextField("textfield.name", SPUIComponentIdProvider.SOFT_MODULE_NAME);
|
||||
|
||||
/* Vendor text field */
|
||||
vendorTextField = SPUIComponentProvider.getTextField(i18n.get("textfield.vendor"), "", ValoTheme.TEXTFIELD_TINY,
|
||||
false, null, i18n.get("textfield.vendor"), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
vendorTextField.setId(SPUIComponentIdProvider.SOFT_MODULE_VENDOR);
|
||||
versionTextField = createTextField("textfield.version", SPUIComponentIdProvider.SOFT_MODULE_VERSION);
|
||||
|
||||
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"),
|
||||
@@ -148,6 +141,11 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent implements Se
|
||||
populateTypeNameCombo();
|
||||
}
|
||||
|
||||
private TextField createTextField(final String in18Key, final String id) {
|
||||
return new TextFieldBuilder().caption(i18n.get(in18Key)).required(true).prompt(i18n.get(in18Key))
|
||||
.immediate(true).id(id).buildTextField();
|
||||
}
|
||||
|
||||
private void populateTypeNameCombo() {
|
||||
typeComboBox.setContainerDataSource(HawkbitCommonUtil.createLazyQueryContainer(
|
||||
new BeanQueryFactory<SoftwareModuleTypeBeanQuery>(SoftwareModuleTypeBeanQuery.class)));
|
||||
|
||||
@@ -19,6 +19,7 @@ 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.TextFieldBuilder;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.layouts.CreateUpdateTypeLayout;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
@@ -36,6 +37,7 @@ import com.vaadin.spring.annotation.ViewScope;
|
||||
import com.vaadin.ui.Button.ClickEvent;
|
||||
import com.vaadin.ui.Label;
|
||||
import com.vaadin.ui.OptionGroup;
|
||||
import com.vaadin.ui.TextField;
|
||||
import com.vaadin.ui.components.colorpicker.ColorChangeListener;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
@@ -79,15 +81,9 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout {
|
||||
|
||||
multiAssign = new LabelBuilder().name(multiAssignStr).buildLabel();
|
||||
|
||||
tagName = SPUIComponentProvider.getTextField(i18n.get("textfield.name"), "",
|
||||
ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.TYPE_NAME, true, "", i18n.get("textfield.name"), true,
|
||||
SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
tagName.setId(SPUIDefinitions.NEW_SOFTWARE_TYPE_NAME);
|
||||
tagName = createTextField("textfield.name", SPUIDefinitions.NEW_SOFTWARE_TYPE_NAME, SPUIDefinitions.TYPE_NAME);
|
||||
|
||||
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);
|
||||
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, "",
|
||||
@@ -99,6 +95,11 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout {
|
||||
singleMultiOptionGroup();
|
||||
}
|
||||
|
||||
private TextField createTextField(final String in18Key, final String id, final String styleName) {
|
||||
return new TextFieldBuilder().caption(i18n.get(in18Key)).styleName(ValoTheme.TEXTFIELD_TINY + " " + styleName)
|
||||
.required(true).prompt(i18n.get(in18Key)).immediate(true).id(id).buildTextField();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buildLayout() {
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.eclipse.hawkbit.repository.model.LocalArtifact;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
||||
import org.eclipse.hawkbit.ui.artifacts.state.CustomFile;
|
||||
import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleTiny;
|
||||
@@ -248,29 +249,27 @@ public class UploadConfirmationWindow implements Button.ClickListener {
|
||||
deleteIcon.setData(itemId);
|
||||
newItem.getItemProperty(ACTION).setValue(deleteIcon);
|
||||
|
||||
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 sha1 = createTextField(swNameVersion + "/" + customFile.getFileName() + "/sha1");
|
||||
|
||||
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 md5 = createTextField(swNameVersion + "/" + customFile.getFileName() + "/md5");
|
||||
|
||||
createTextField(swNameVersion + "/" + customFile.getFileName() + "/customFileName");
|
||||
|
||||
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);
|
||||
newItem.getItemProperty(CUSTOM_FILE).setValue(customFile);
|
||||
}
|
||||
}
|
||||
|
||||
private static TextField createTextField(final String id) {
|
||||
return new TextFieldBuilder().immediate(true).id(id).buildTextField();
|
||||
}
|
||||
|
||||
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(null, "", ValoTheme.TEXTFIELD_TINY,
|
||||
false, null, null, true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
fileNameTextField.setId(baseSoftwareModuleNameVersion + "/" + customFileName + "/customFileName");
|
||||
final TextField fileNameTextField = createTextField(
|
||||
baseSoftwareModuleNameVersion + "/" + customFileName + "/customFileName");
|
||||
fileNameTextField.setData(baseSoftwareModuleNameVersion + "/" + customFileName);
|
||||
fileNameTextField.setValue(customFileName);
|
||||
|
||||
|
||||
@@ -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.TextFieldBuilder;
|
||||
import org.eclipse.hawkbit.ui.common.builder.WindowBuilder;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.customrenderers.renderers.HtmlButtonRenderer;
|
||||
@@ -206,9 +207,9 @@ public abstract class AbstractMetadataPopupLayout<E extends NamedVersionedEntity
|
||||
}
|
||||
|
||||
private TextField createKeyTextField() {
|
||||
final TextField keyField = SPUIComponentProvider.getTextField(i18n.get("textfield.key"), "",
|
||||
ValoTheme.TEXTFIELD_TINY, true, "", i18n.get("textfield.key"), true, 128);
|
||||
keyField.setId(SPUIComponentIdProvider.METADATA_KEY_FIELD_ID);
|
||||
final TextField keyField = new TextFieldBuilder().caption(i18n.get("textfield.key")).required(true)
|
||||
.prompt(i18n.get("textfield.key")).immediate(true).id(SPUIComponentIdProvider.METADATA_KEY_FIELD_ID)
|
||||
.maxLengthAllowed(128).buildTextField();
|
||||
keyField.addTextChangeListener(event -> onKeyChange(event));
|
||||
keyField.setTextChangeEventMode(TextChangeEventMode.EAGER);
|
||||
keyField.setWidth("100%");
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
/**
|
||||
* 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.event.FieldEvents.TextChangeListener;
|
||||
import com.vaadin.server.Sizeable.Unit;
|
||||
import com.vaadin.ui.AbstractTextField.TextChangeEventMode;
|
||||
import com.vaadin.ui.TextField;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
* Textfield builder.
|
||||
*
|
||||
*/
|
||||
public class TextFieldBuilder {
|
||||
|
||||
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
|
||||
*/
|
||||
public TextFieldBuilder caption(final String caption) {
|
||||
this.caption = caption;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*
|
||||
* @return textfield
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a search text field.
|
||||
*
|
||||
* @param textChangeListener
|
||||
* listener when text is changed.
|
||||
* @return the textfield
|
||||
*/
|
||||
public TextField createSearchField(final TextChangeListener textChangeListener) {
|
||||
final TextField textField = style("filter-box").styleName("text-style filter-box-hide").buildTextField();
|
||||
textField.setWidth(100.0F, Unit.PERCENTAGE);
|
||||
textField.addTextChangeListener(textChangeListener);
|
||||
textField.setTextChangeEventMode(TextChangeEventMode.LAZY);
|
||||
// 1 seconds timeout.
|
||||
textField.setTextChangeTimeout(1000);
|
||||
return textField;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -48,7 +48,7 @@ public class DistributionSetMetadatadetailslayout extends Table {
|
||||
|
||||
private static final String VIEW = "view";
|
||||
|
||||
private DistributionSetManagement distributionSetManagement;
|
||||
private transient DistributionSetManagement distributionSetManagement;
|
||||
|
||||
private DsMetadataPopupLayout dsMetadataPopupLayout;
|
||||
|
||||
|
||||
@@ -8,16 +8,15 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.common.grid;
|
||||
|
||||
import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIButton;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.vaadin.server.FontAwesome;
|
||||
import com.vaadin.ui.AbstractTextField.TextChangeEventMode;
|
||||
import com.vaadin.ui.Alignment;
|
||||
import com.vaadin.ui.Button;
|
||||
import com.vaadin.ui.HorizontalLayout;
|
||||
@@ -61,7 +60,8 @@ public abstract class AbstractGridHeader extends VerticalLayout {
|
||||
private void createComponents() {
|
||||
headerCaptionLayout = getHeaderCaptionLayout();
|
||||
if (isRollout()) {
|
||||
searchField = createSearchField();
|
||||
searchField = new TextFieldBuilder().id(getSearchBoxId())
|
||||
.createSearchField(event -> searchBy(event.getText()));
|
||||
searchResetIcon = createSearchResetIcon();
|
||||
addButton = createAddButton();
|
||||
}
|
||||
@@ -92,7 +92,7 @@ public abstract class AbstractGridHeader extends VerticalLayout {
|
||||
addStyleName("no-border-bottom");
|
||||
}
|
||||
|
||||
private HorizontalLayout createHeaderFilterIconLayout() {
|
||||
private static HorizontalLayout createHeaderFilterIconLayout() {
|
||||
final HorizontalLayout titleFilterIconsLayout = new HorizontalLayout();
|
||||
titleFilterIconsLayout.addStyleName(SPUIStyleDefinitions.WIDGET_TITLE);
|
||||
titleFilterIconsLayout.setSpacing(false);
|
||||
@@ -101,17 +101,6 @@ public abstract class AbstractGridHeader extends VerticalLayout {
|
||||
return titleFilterIconsLayout;
|
||||
}
|
||||
|
||||
private TextField createSearchField() {
|
||||
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);
|
||||
textField.addTextChangeListener(event -> searchBy(event.getText()));
|
||||
textField.setTextChangeEventMode(TextChangeEventMode.LAZY);
|
||||
textField.setTextChangeTimeout(1000);
|
||||
return textField;
|
||||
}
|
||||
|
||||
private SPUIButton createSearchResetIcon() {
|
||||
final SPUIButton button = (SPUIButton) SPUIComponentProvider.getButton(getSearchRestIconId(), "", "", null,
|
||||
false, FontAwesome.SEARCH, SPUIButtonStyleSmallNoBorder.class);
|
||||
|
||||
@@ -13,20 +13,19 @@ import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.common.builder.LabelBuilder;
|
||||
import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIButton;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
|
||||
import com.vaadin.event.dd.DropHandler;
|
||||
import com.vaadin.server.FontAwesome;
|
||||
import com.vaadin.ui.AbstractTextField.TextChangeEventMode;
|
||||
import com.vaadin.ui.Alignment;
|
||||
import com.vaadin.ui.Button;
|
||||
import com.vaadin.ui.DragAndDropWrapper;
|
||||
@@ -87,7 +86,7 @@ public abstract class AbstractTableHeader extends VerticalLayout {
|
||||
|
||||
private void createComponents() {
|
||||
headerCaption = createHeaderCaption();
|
||||
searchField = createSearchField();
|
||||
searchField = new TextFieldBuilder().id(getSearchBoxId()).createSearchField(event -> searchBy(event.getText()));
|
||||
|
||||
searchResetIcon = createSearchResetIcon();
|
||||
|
||||
@@ -207,18 +206,6 @@ public abstract class AbstractTableHeader extends VerticalLayout {
|
||||
return new LabelBuilder().name(getHeaderCaption()).buildCaptionLabel();
|
||||
}
|
||||
|
||||
private TextField createSearchField() {
|
||||
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);
|
||||
textField.addTextChangeListener(event -> searchBy(event.getText()));
|
||||
textField.setTextChangeEventMode(TextChangeEventMode.LAZY);
|
||||
// 1 seconds timeout.
|
||||
textField.setTextChangeTimeout(1000);
|
||||
return textField;
|
||||
}
|
||||
|
||||
private SPUIButton createSearchResetIcon() {
|
||||
final SPUIButton button = (SPUIButton) SPUIComponentProvider.getButton(getSearchRestIconId(), "", "", null,
|
||||
false, FontAwesome.SEARCH, SPUIButtonStyleSmallNoBorder.class);
|
||||
|
||||
@@ -18,7 +18,6 @@ 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.decorators.SPUITextFieldDecorator;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.slf4j.Logger;
|
||||
@@ -36,7 +35,6 @@ import com.vaadin.ui.Link;
|
||||
import com.vaadin.ui.Panel;
|
||||
import com.vaadin.ui.TabSheet;
|
||||
import com.vaadin.ui.TextArea;
|
||||
import com.vaadin.ui.TextField;
|
||||
import com.vaadin.ui.VerticalLayout;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
@@ -56,34 +54,6 @@ public final class SPUIComponentProvider {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Label UI component.
|
||||
*
|
||||
* @param caption
|
||||
* set the caption of the textfield
|
||||
* @param style
|
||||
* set style
|
||||
* @param styleName
|
||||
* add style
|
||||
* @param required
|
||||
* to set field as mandatory
|
||||
* @param data
|
||||
* component data
|
||||
* @param prompt
|
||||
* prompt user for input
|
||||
* @param immediate
|
||||
* set component's immediate mode specified mode
|
||||
* @param maxLengthAllowed
|
||||
* maximum characters allowed
|
||||
* @return TextField text field
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Label UI component. *
|
||||
*
|
||||
|
||||
@@ -1,88 +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.TextField;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
* Decorate TextField with required style.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public final class SPUITextFieldDecorator {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
private SPUITextFieldDecorator() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param caption
|
||||
* set the caption of the textfield
|
||||
* @param style
|
||||
* set style
|
||||
* @param styleName
|
||||
* add style
|
||||
* @param required
|
||||
* to set field as mandatory
|
||||
* @param data
|
||||
* component data
|
||||
* @param prompt
|
||||
* prompt user for input
|
||||
* @param immediate
|
||||
* as for display
|
||||
* @param maxLengthAllowed
|
||||
* maximum characters allowed
|
||||
* @return Text field as decorated
|
||||
*/
|
||||
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);
|
||||
if (required) {
|
||||
spUITxtFld.setRequired(true);
|
||||
}
|
||||
if (immediate) {
|
||||
spUITxtFld.setImmediate(true);
|
||||
}
|
||||
// Add style
|
||||
if (StringUtils.isNotEmpty(style)) {
|
||||
spUITxtFld.setStyleName(style);
|
||||
}
|
||||
// Add style Name
|
||||
if (StringUtils.isNotEmpty(styleName)) {
|
||||
spUITxtFld.addStyleName(styleName);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(prompt)) {
|
||||
spUITxtFld.setInputPrompt(prompt);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(data)) {
|
||||
spUITxtFld.setData(data);
|
||||
}
|
||||
if (maxLengthAllowed > 0) {
|
||||
spUITxtFld.setMaxLength(maxLengthAllowed);
|
||||
}
|
||||
|
||||
return spUITxtFld;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.TextFieldBuilder;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||
import org.eclipse.hawkbit.ui.distributions.event.DistributionSetTypeEvent;
|
||||
@@ -45,6 +46,7 @@ import com.vaadin.ui.CheckBox;
|
||||
import com.vaadin.ui.Component;
|
||||
import com.vaadin.ui.HorizontalLayout;
|
||||
import com.vaadin.ui.Table;
|
||||
import com.vaadin.ui.TextField;
|
||||
import com.vaadin.ui.VerticalLayout;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
@@ -84,15 +86,11 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout {
|
||||
|
||||
super.createRequiredComponents();
|
||||
|
||||
tagName = 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);
|
||||
tagName.setId(SPUIDefinitions.NEW_DISTRIBUTION_TYPE_NAME);
|
||||
tagName = createTextField("textfield.name", SPUIDefinitions.DIST_SET_TYPE_NAME,
|
||||
SPUIDefinitions.NEW_DISTRIBUTION_TYPE_NAME);
|
||||
|
||||
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);
|
||||
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, "",
|
||||
@@ -102,6 +100,11 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout {
|
||||
tagDesc.setNullRepresentation("");
|
||||
}
|
||||
|
||||
private TextField createTextField(final String in18Key, final String id, final String styleName) {
|
||||
return new TextFieldBuilder().caption(i18n.get(in18Key)).styleName(ValoTheme.TEXTFIELD_TINY + " " + styleName)
|
||||
.required(true).prompt(i18n.get(in18Key)).immediate(true).id(id).buildTextField();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buildLayout() {
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
|
||||
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
||||
import org.eclipse.hawkbit.ui.UiProperties;
|
||||
import org.eclipse.hawkbit.ui.common.builder.LabelBuilder;
|
||||
import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIButton;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||
@@ -249,10 +250,9 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
||||
}
|
||||
|
||||
private TextField createNameTextField() {
|
||||
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(SPUIComponentIdProvider.CUSTOM_FILTER_ADD_NAME);
|
||||
final TextField nameField = new TextFieldBuilder().caption(i18n.get("textfield.customfiltername"))
|
||||
.prompt(i18n.get("textfield.customfiltername")).immediate(true)
|
||||
.id(SPUIComponentIdProvider.CUSTOM_FILTER_ADD_NAME).buildTextField();
|
||||
nameField.setPropertyDataSource(nameLabel);
|
||||
nameField.addTextChangeListener(this::onFilterNameChange);
|
||||
return nameField;
|
||||
@@ -450,10 +450,9 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
||||
return button;
|
||||
}
|
||||
|
||||
private TextField createSearchField() {
|
||||
final TextField textField = SPUIComponentProvider.getTextField(null, "", ValoTheme.TEXTFIELD_TINY, false, "",
|
||||
"", true, SPUILabelDefinitions.TARGET_FILTER_QUERY_TEXT_FIELD_LENGTH);
|
||||
textField.setId("custom.query.text.Id");
|
||||
private static TextField createSearchField() {
|
||||
final TextField textField = new TextFieldBuilder().immediate(true).id("custom.query.text.Id")
|
||||
.maxLengthAllowed(SPUILabelDefinitions.TARGET_FILTER_QUERY_TEXT_FIELD_LENGTH).buildTextField();
|
||||
textField.addStyleName("target-filter-textfield");
|
||||
textField.setWidth(900.0F, Unit.PIXELS);
|
||||
textField.setTextChangeEventMode(TextChangeEventMode.LAZY);
|
||||
|
||||
@@ -12,6 +12,7 @@ import javax.annotation.PostConstruct;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.common.builder.LabelBuilder;
|
||||
import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIButton;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||
@@ -19,7 +20,6 @@ import org.eclipse.hawkbit.ui.filtermanagement.event.CustomFilterUIEvent;
|
||||
import org.eclipse.hawkbit.ui.filtermanagement.state.FilterManagementUIState;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
@@ -27,7 +27,6 @@ import org.vaadin.spring.events.EventBus;
|
||||
import com.vaadin.server.FontAwesome;
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.ViewScope;
|
||||
import com.vaadin.ui.AbstractTextField.TextChangeEventMode;
|
||||
import com.vaadin.ui.Alignment;
|
||||
import com.vaadin.ui.Button;
|
||||
import com.vaadin.ui.HorizontalLayout;
|
||||
@@ -121,14 +120,9 @@ public class TargetFilterHeader extends VerticalLayout {
|
||||
}
|
||||
|
||||
private TextField createSearchField() {
|
||||
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);
|
||||
campSearchTextField.addTextChangeListener(event -> searchBy(event.getText()));
|
||||
campSearchTextField.setTextChangeEventMode(TextChangeEventMode.LAZY);
|
||||
// 1 seconds timeout.
|
||||
campSearchTextField.setTextChangeTimeout(1000);
|
||||
final TextField campSearchTextField = new TextFieldBuilder().id("target.filter.search.text.Id")
|
||||
.createSearchField(event -> searchBy(event.getText()));
|
||||
campSearchTextField.setWidth(500.0F, Unit.PIXELS);
|
||||
return campSearchTextField;
|
||||
}
|
||||
|
||||
|
||||
@@ -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.TextFieldBuilder;
|
||||
import org.eclipse.hawkbit.ui.common.builder.WindowBuilder;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
@@ -152,10 +153,10 @@ public abstract class AbstractCreateUpdateTagLayout extends CustomComponent
|
||||
colorLabel = new LabelBuilder().name(i18n.get("label.choose.tag.color")).buildLabel();
|
||||
colorLabel.addStyleName(SPUIDefinitions.COLOR_LABEL_STYLE);
|
||||
|
||||
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);
|
||||
tagName = new TextFieldBuilder().caption(i18n.get("textfield.name"))
|
||||
.styleName(ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.TAG_NAME).required(true)
|
||||
.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"),
|
||||
|
||||
@@ -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.TextFieldBuilder;
|
||||
import org.eclipse.hawkbit.ui.common.builder.WindowBuilder;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
@@ -124,16 +125,8 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
|
||||
* Create required UI components.
|
||||
*/
|
||||
private void createRequiredComponents() {
|
||||
distNameTextField = SPUIComponentProvider.getTextField(i18n.get("textfield.name"), "", ValoTheme.TEXTFIELD_TINY,
|
||||
true, null, i18n.get("textfield.name"), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
distNameTextField.setId(SPUIComponentIdProvider.DIST_ADD_NAME);
|
||||
distNameTextField.setNullRepresentation("");
|
||||
|
||||
distVersionTextField = SPUIComponentProvider.getTextField(i18n.get("textfield.version"), "",
|
||||
ValoTheme.TEXTFIELD_TINY, true, null, i18n.get("textfield.version"), true,
|
||||
SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
distVersionTextField.setId(SPUIComponentIdProvider.DIST_ADD_VERSION);
|
||||
distVersionTextField.setNullRepresentation("");
|
||||
distNameTextField = createTextField("textfield.name", SPUIComponentIdProvider.DIST_ADD_NAME);
|
||||
distVersionTextField = createTextField("textfield.version", SPUIComponentIdProvider.DIST_ADD_VERSION);
|
||||
|
||||
distsetTypeNameComboBox = SPUIComponentProvider.getComboBox(i18n.get("label.combobox.type"), "", "", null, "",
|
||||
false, "", i18n.get("label.combobox.type"));
|
||||
@@ -154,6 +147,13 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
|
||||
reqMigStepCheckbox.setId(SPUIComponentIdProvider.DIST_ADD_MIGRATION_CHECK);
|
||||
}
|
||||
|
||||
private TextField createTextField(final String in18Key, final String id) {
|
||||
final TextField buildTextField = new TextFieldBuilder().caption(i18n.get(in18Key)).required(true)
|
||||
.prompt(i18n.get(in18Key)).immediate(true).id(id).buildTextField();
|
||||
buildTextField.setNullRepresentation("");
|
||||
return buildTextField;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the LazyQueryContainer instance for DistributionSetTypes.
|
||||
*
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.TextFieldBuilder;
|
||||
import org.eclipse.hawkbit.ui.common.builder.WindowBuilder;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
@@ -82,15 +83,9 @@ public class TargetAddUpdateWindowLayout extends CustomComponent {
|
||||
}
|
||||
|
||||
private void createRequiredComponents() {
|
||||
/* Textfield for controller Id */
|
||||
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(SPUIComponentIdProvider.TARGET_ADD_CONTROLLER_ID);
|
||||
/* Textfield for target name */
|
||||
nameTextField = SPUIComponentProvider.getTextField(i18n.get("textfield.name"), "", ValoTheme.TEXTFIELD_TINY,
|
||||
false, null, i18n.get("textfield.name"), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
nameTextField.setId(SPUIComponentIdProvider.TARGET_ADD_NAME);
|
||||
controllerIDTextField = createTextField("prompt.target.id", SPUIComponentIdProvider.TARGET_ADD_CONTROLLER_ID);
|
||||
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",
|
||||
@@ -100,12 +95,12 @@ public class TargetAddUpdateWindowLayout extends CustomComponent {
|
||||
descTextArea.setNullRepresentation(HawkbitCommonUtil.SP_STRING_EMPTY);
|
||||
}
|
||||
|
||||
private void buildLayout() {
|
||||
private TextField createTextField(final String in18Key, final String id) {
|
||||
return new TextFieldBuilder().caption(i18n.get(in18Key)).required(true).prompt(i18n.get(in18Key))
|
||||
.immediate(true).id(id).buildTextField();
|
||||
}
|
||||
|
||||
/*
|
||||
* The main layout of the window contains mandatory info, textboxes
|
||||
* (controller Id, name & description) and action buttons layout
|
||||
*/
|
||||
private void buildLayout() {
|
||||
setSizeUndefined();
|
||||
formLayout = new FormLayout();
|
||||
formLayout.addComponent(controllerIDTextField);
|
||||
|
||||
@@ -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.TextFieldBuilder;
|
||||
import org.eclipse.hawkbit.ui.common.builder.WindowBuilder;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.filtermanagement.TargetFilterBeanQuery;
|
||||
@@ -262,9 +263,17 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
|
||||
return new LabelBuilder().name(i18n.get(key)).buildLabel();
|
||||
}
|
||||
|
||||
private TextField getTextfield(final String key) {
|
||||
return SPUIComponentProvider.getTextField(null, "", ValoTheme.TEXTFIELD_TINY, false, null, i18n.get(key), true,
|
||||
SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
private TextField createTextField(final String in18Key, final String id) {
|
||||
return new TextFieldBuilder().prompt(i18n.get(in18Key)).immediate(true).id(id).buildTextField();
|
||||
}
|
||||
|
||||
private TextField createIntegerTextField(final String in18Key, final String id) {
|
||||
final TextField textField = createTextField(in18Key, id);
|
||||
textField.setNullRepresentation("");
|
||||
textField.setConverter(new StringToIntegerConverter());
|
||||
textField.setConversionError(i18n.get(MESSAGE_ENTER_NUMBER));
|
||||
textField.setSizeUndefined();
|
||||
return textField;
|
||||
}
|
||||
|
||||
private static Label getPercentHintLabel() {
|
||||
@@ -514,39 +523,26 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
|
||||
}
|
||||
|
||||
private TextField createErrorThreshold() {
|
||||
final TextField errorField = getTextfield("prompt.error.threshold");
|
||||
errorField.setNullRepresentation("");
|
||||
final TextField errorField = createIntegerTextField("prompt.error.threshold",
|
||||
SPUIComponentIdProvider.ROLLOUT_ERROR_THRESOLD_ID);
|
||||
errorField.addValidator(new ThresholdFieldValidator());
|
||||
errorField.setConverter(new StringToIntegerConverter());
|
||||
errorField.setConversionError(i18n.get(MESSAGE_ENTER_NUMBER));
|
||||
errorField.setId(SPUIComponentIdProvider.ROLLOUT_ERROR_THRESOLD_ID);
|
||||
errorField.setMaxLength(7);
|
||||
errorField.setSizeUndefined();
|
||||
return errorField;
|
||||
}
|
||||
|
||||
private TextField createTriggerThreshold() {
|
||||
final TextField thresholdField = getTextfield("prompt.tigger.threshold");
|
||||
thresholdField.setId(SPUIComponentIdProvider.ROLLOUT_TRIGGER_THRESOLD_ID);
|
||||
thresholdField.setNullRepresentation("");
|
||||
final TextField thresholdField = createIntegerTextField("prompt.tigger.threshold",
|
||||
SPUIComponentIdProvider.ROLLOUT_TRIGGER_THRESOLD_ID);
|
||||
thresholdField.addValidator(new ThresholdFieldValidator());
|
||||
thresholdField.setConverter(new StringToIntegerConverter());
|
||||
thresholdField.setConversionError(i18n.get(MESSAGE_ENTER_NUMBER));
|
||||
thresholdField.setSizeUndefined();
|
||||
thresholdField.setMaxLength(3);
|
||||
return thresholdField;
|
||||
}
|
||||
|
||||
private TextField createNoOfGroupsField() {
|
||||
final TextField noOfGroupsField = getTextfield("prompt.number.of.groups");
|
||||
noOfGroupsField.setId(SPUIComponentIdProvider.ROLLOUT_NO_OF_GROUPS_ID);
|
||||
final TextField noOfGroupsField = createIntegerTextField("prompt.number.of.groups",
|
||||
SPUIComponentIdProvider.ROLLOUT_NO_OF_GROUPS_ID);
|
||||
noOfGroupsField.addValidator(new GroupNumberValidator());
|
||||
noOfGroupsField.setSizeUndefined();
|
||||
noOfGroupsField.setMaxLength(3);
|
||||
noOfGroupsField.setConverter(new StringToIntegerConverter());
|
||||
noOfGroupsField.setConversionError(i18n.get(MESSAGE_ENTER_NUMBER));
|
||||
noOfGroupsField.addValueChangeListener(this::onGroupNumberChange);
|
||||
noOfGroupsField.setNullRepresentation("");
|
||||
return noOfGroupsField;
|
||||
}
|
||||
|
||||
@@ -584,8 +580,8 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
|
||||
}
|
||||
|
||||
private TextField createRolloutNameField() {
|
||||
final TextField rolloutNameField = getTextfield("textfield.name");
|
||||
rolloutNameField.setId(SPUIComponentIdProvider.ROLLOUT_NAME_FIELD_ID);
|
||||
final TextField rolloutNameField = createTextField("textfield.name",
|
||||
SPUIComponentIdProvider.ROLLOUT_NAME_FIELD_ID);
|
||||
rolloutNameField.setSizeUndefined();
|
||||
return rolloutNameField;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import javax.annotation.PostConstruct;
|
||||
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
|
||||
import org.eclipse.hawkbit.ui.common.builder.LabelBuilder;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
@@ -22,7 +22,6 @@ import com.vaadin.ui.HorizontalLayout;
|
||||
import com.vaadin.ui.Label;
|
||||
import com.vaadin.ui.TextField;
|
||||
import com.vaadin.ui.VerticalLayout;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
* This class represents the UI item for the certificate authenticated by an
|
||||
@@ -65,10 +64,8 @@ public class CertificateAuthenticationConfigurationItem extends AbstractAuthenti
|
||||
caRootAuthorityLabel.setDescription(
|
||||
"The SSL Issuer iRules.X509 hash, to validate against the controller request certifcate.");
|
||||
|
||||
caRootAuthorityTextField = SPUIComponentProvider.getTextField(null, "", ValoTheme.TEXTFIELD_TINY, false, null,
|
||||
"", true, 128);
|
||||
caRootAuthorityTextField = new TextFieldBuilder().immediate(true).maxLengthAllowed(128).buildTextField();
|
||||
caRootAuthorityTextField.setWidth("500px");
|
||||
caRootAuthorityTextField.setImmediate(true);
|
||||
caRootAuthorityTextField.addTextChangeListener(event -> caRootAuthorityChanged());
|
||||
|
||||
caRootAuthorityLayout.addComponent(caRootAuthorityLabel);
|
||||
|
||||
@@ -14,9 +14,9 @@ import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||
import org.eclipse.hawkbit.security.SecurityTokenGenerator;
|
||||
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
|
||||
import org.eclipse.hawkbit.ui.common.builder.LabelBuilder;
|
||||
import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmall;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.vaadin.server.FontAwesome;
|
||||
@@ -46,12 +46,12 @@ public class GatewaySecurityTokenAuthenticationConfigurationItem extends Abstrac
|
||||
|
||||
private Label gatewayTokenkeyLabel;
|
||||
|
||||
private boolean configurationEnabled = false;
|
||||
private boolean configurationEnabledChange = false;
|
||||
private boolean configurationEnabled;
|
||||
private boolean configurationEnabledChange;
|
||||
|
||||
private boolean keyNameChanged = false;
|
||||
private boolean keyNameChanged;
|
||||
|
||||
private boolean keyChanged = false;
|
||||
private boolean keyChanged;
|
||||
|
||||
private VerticalLayout detailLayout;
|
||||
|
||||
@@ -75,9 +75,7 @@ public class GatewaySecurityTokenAuthenticationConfigurationItem extends Abstrac
|
||||
|
||||
detailLayout = new VerticalLayout();
|
||||
detailLayout.setImmediate(true);
|
||||
gatewayTokenNameTextField = SPUIComponentProvider.getTextField(null, "", ValoTheme.TEXTFIELD_TINY, false, null,
|
||||
"", true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
gatewayTokenNameTextField.setImmediate(true);
|
||||
gatewayTokenNameTextField = new TextFieldBuilder().immediate(true).buildTextField();
|
||||
// hide text field until we support multiple gateway tokens for a tenan
|
||||
gatewayTokenNameTextField.setVisible(false);
|
||||
gatewayTokenNameTextField.addTextChangeListener(event -> doKeyNameChanged());
|
||||
|
||||
@@ -268,10 +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_FIELD_MAX_LENGTH = 64;
|
||||
/**
|
||||
* Text area and text field max allowed length.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user