From 5a1fc91ea75534cf500000ef1a0cf22b0d59d519 Mon Sep 17 00:00:00 2001 From: felmer <felmer> Date: Thu, 4 Oct 2012 13:14:18 +0000 Subject: [PATCH] SP-298, BIS-210: some bug in GUI code fixed. SVN: 26990 --- .../managed_property/ManagedPropertyFormHelper.java | 8 ++++---- .../ManagedPropertyGridActionDialog.java | 12 ++++++------ .../basic/dto/ManagedInputWidgetDescription.java | 3 ++- .../application/experiment/ManagedPropertyField.java | 6 +++--- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/managed_property/ManagedPropertyFormHelper.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/managed_property/ManagedPropertyFormHelper.java index 6a3d5c72113..4518898885e 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/managed_property/ManagedPropertyFormHelper.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/managed_property/ManagedPropertyFormHelper.java @@ -41,14 +41,14 @@ public class ManagedPropertyFormHelper private final FormPanel formPanel; - private final Map<String, TextField<?>> inputFieldsByLabel; + private final Map<String, TextField<?>> inputFieldsByCode; public ManagedPropertyFormHelper(IViewContext<?> viewContext, FormPanel formPanel, - Map<String, TextField<?>> inputFieldsByLabel) + Map<String, TextField<?>> inputFieldsByCode) { this.viewContext = viewContext; this.formPanel = formPanel; - this.inputFieldsByLabel = inputFieldsByLabel; + this.inputFieldsByCode = inputFieldsByCode; } @@ -88,7 +88,7 @@ public class ManagedPropertyFormHelper } FieldUtil.setMandatoryFlag(field, inputDescription.isMandatory()); - inputFieldsByLabel.put(label, field); + inputFieldsByCode.put(inputDescription.getCode(), field); formPanel.add(field); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/managed_property/ManagedPropertyGridActionDialog.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/managed_property/ManagedPropertyGridActionDialog.java index 76ab67e95fc..6c528a8197f 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/managed_property/ManagedPropertyGridActionDialog.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/managed_property/ManagedPropertyGridActionDialog.java @@ -60,7 +60,7 @@ public final class ManagedPropertyGridActionDialog extends private final IManagedUiTableAction managedAction; - private final Map<String, TextField<?>> inputFieldsByLabel = + private final Map<String, TextField<?>> inputFieldsByCode = new LinkedHashMap<String, TextField<?>>(); private final ManagedPropertyFormHelper formHelper; @@ -77,7 +77,7 @@ public final class ManagedPropertyGridActionDialog extends this.callback = callback; this.managedAction = managedAction; setWidth(400); - formHelper = new ManagedPropertyFormHelper(viewContext, formPanel, inputFieldsByLabel) + formHelper = new ManagedPropertyFormHelper(viewContext, formPanel, inputFieldsByCode) { @Override protected void trySetBoundedValue(IManagedInputWidgetDescription inputDescription) @@ -112,7 +112,7 @@ public final class ManagedPropertyGridActionDialog extends for (IManagedInputWidgetDescription inputDescription : managedAction .getInputWidgetDescriptions()) { - TextField<?> field = inputFieldsByLabel.get(inputDescription.getLabel()); + TextField<?> field = inputFieldsByCode.get(inputDescription.getCode()); Object fieldValue = field.getValue(); String value = fieldValue == null ? null : field.getValue().toString().trim(); if (fieldValue instanceof SimpleComboValue) @@ -147,12 +147,12 @@ public final class ManagedPropertyGridActionDialog extends && data.size() == 1) { String boundedColumnTitleOrNull = - managedAction.getBindings().get(inputDescription.getLabel()); + managedAction.getBindings().get(inputDescription.getCode()); if (boundedColumnTitleOrNull != null) { if (viewContext.isLoggingEnabled()) { - GWTUtils.displayInfo("found binding", inputDescription.getLabel() + "->" + GWTUtils.displayInfo("found binding", inputDescription.getCode() + "->" + boundedColumnTitleOrNull); } TableModelRowWithObject<ReportRowModel> selectedRow = data.get(0); @@ -169,7 +169,7 @@ public final class ManagedPropertyGridActionDialog extends inputDescription.setValue(value.toString()); if (viewContext.isLoggingEnabled()) { - Info.display("bounded value", inputDescription.getLabel() + "=" + value); + Info.display("bounded value", inputDescription.getCode() + "=" + value); } break; } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ManagedInputWidgetDescription.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ManagedInputWidgetDescription.java index c04d99dd1aa..9d0696a861f 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ManagedInputWidgetDescription.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ManagedInputWidgetDescription.java @@ -45,13 +45,14 @@ public abstract class ManagedInputWidgetDescription implements IManagedInputWidg return code; } - public void setCode(String code) + public IManagedInputWidgetDescription setCode(String code) { if (isBlank(code)) { throw new IllegalArgumentException("Code is null or a blank string."); } this.code = code.toUpperCase(); + return this; } @Override diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/ManagedPropertyField.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/ManagedPropertyField.java index 2e15b428598..a80f86cb3e9 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/ManagedPropertyField.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/ManagedPropertyField.java @@ -116,16 +116,16 @@ public class ManagedPropertyField extends Field<List<Map<String, String>>> formPanel.setLabelWidth(AbstractRegistrationForm.DEFAULT_LABEL_WIDTH - SPACING - 2); formPanel.setFieldWidth(AbstractRegistrationForm.DEFAULT_FIELD_WIDTH); formPanel.setHeaderVisible(false); - Map<String, TextField<?>> inputFieldsByLabel = new HashMap<String, TextField<?>>(); + Map<String, TextField<?>> inputFieldsByCode = new HashMap<String, TextField<?>>(); ManagedPropertyFormHelper formHelper = - new ManagedPropertyFormHelper(viewContext, formPanel, inputFieldsByLabel); + new ManagedPropertyFormHelper(viewContext, formPanel, inputFieldsByCode); formHelper.fillForm(widgetDescriptions); final HorizontalPanel horizontalPanel = new HorizontalPanel(); horizontalPanel.setSpacing(SPACING); horizontalPanel.add(formPanel); Button removeButton = new Button("-"); removeButton.setToolTip("Delete this section."); - final Section section = new Section(inputFieldsByLabel); + final Section section = new Section(inputFieldsByCode); removeButton.addSelectionListener(new SelectionListener<ButtonEvent>() { @Override -- GitLab