diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/AbstractGenericEntityRegistrationForm.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/AbstractGenericEntityRegistrationForm.java index 190182dfbebe73df4d46608ff655df718e56076b..ff1d78c5b056582bc114dbd3148d05736abf4748 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/AbstractGenericEntityRegistrationForm.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/AbstractGenericEntityRegistrationForm.java @@ -139,8 +139,7 @@ public abstract class AbstractGenericEntityRegistrationForm<T extends EntityType // ID generation // --------------------------------------------------------------------------------------------- /** - * Creates unique id based on {@link #createSimpleId(IIdAndCodeHolder, EntityKind)} and - * application specific ID prefix. + * Creates unique id based on {@link #createSimpleId(IIdAndCodeHolder, EntityKind)} and application specific ID prefix. */ public static final String createId(IIdAndCodeHolder identifiable, EntityKind entityKind) { @@ -148,8 +147,7 @@ public abstract class AbstractGenericEntityRegistrationForm<T extends EntityType } /** - * Creates unique id based on {@link #createSimpleId(TechId, EntityKind)} and application - * specific ID prefix. + * Creates unique id based on {@link #createSimpleId(TechId, EntityKind)} and application specific ID prefix. */ public static final String createId(TechId techId, EntityKind entityKind) { @@ -415,9 +413,14 @@ public abstract class AbstractGenericEntityRegistrationForm<T extends EntityType initializeFormFields(); addFormFieldsToPanel(formPanel); layout(); + postRenderingTask(); setLoading(false); } + protected void postRenderingTask() + { + } + /** * Adds previously created and initialized fields to the form. */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/AbstractGenericSampleRegisterEditForm.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/AbstractGenericSampleRegisterEditForm.java index dc10e92d301d4370f12950716e6d0e8db378f7a5..e027fa1ba6b8b6179dc89cfa7cd19f05d0ffdc1b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/AbstractGenericSampleRegisterEditForm.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/AbstractGenericSampleRegisterEditForm.java @@ -19,7 +19,6 @@ package ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.sa import static ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.DatabaseModificationAwareField.wrapUnaware; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -98,7 +97,7 @@ abstract public class AbstractGenericSampleRegisterEditForm extends protected SpaceSelectionWidget groupSelectionWidget; - private String initialGroupCodeOrNull; + private String initialSpaceCodeOrNull; protected SampleChooserFieldAdaptor container; @@ -146,7 +145,7 @@ abstract public class AbstractGenericSampleRegisterEditForm extends private void extractInitialValues(ActionContext context) { this.initialExperimentIdentifierOrNull = tryGetExperimentIdentifier(context); - this.initialGroupCodeOrNull = tryGetSpaceCode(context); + this.initialSpaceCodeOrNull = tryGetSpaceCode(context); parentOrNull = context.getParent(); } @@ -312,11 +311,20 @@ abstract public class AbstractGenericSampleRegisterEditForm extends return sampleType.getGeneratedCodePrefix(); } + @Override + protected void postRenderingTask() + { + if (parentOrNull != null) + { + parentsArea.appendItem(parentOrNull.getIdentifier()); + } + } + @Override protected void createEntitySpecificFormFields() { groupSelectionWidget = - new SpaceSelectionWidget(viewContext, getId(), true, false, initialGroupCodeOrNull); + new SpaceSelectionWidget(viewContext, getId(), true, false, initialSpaceCodeOrNull); groupSelectionWidget.setId("register-sample-space-selection"); FieldUtil.markAsMandatory(groupSelectionWidget); groupSelectionWidget.setFieldLabel(viewContext.getMessage(Dict.GROUP)); @@ -327,10 +335,6 @@ abstract public class AbstractGenericSampleRegisterEditForm extends SampleTypeDisplayID.SAMPLE_REGISTRATION_PARENT_CHOOSER .withSuffix(getSampleTypeCode()), true); parentsArea = new ParentSamplesArea(viewContext, getId()); - if (parentOrNull != null) - { - parentsArea.setSamples(Arrays.asList(parentOrNull)); - } SampleChooserButton parentChooserButton = parentButton.getChooserButton(); parentChooserButton .addChosenEntityListener(new IChosenEntitiesListener<TableModelRowWithObject<Sample>>()