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