From 5e8558bfd07649bb02288667ba29bcd52698fa1d Mon Sep 17 00:00:00 2001
From: felmer <felmer>
Date: Tue, 15 Mar 2011 13:18:19 +0000
Subject: [PATCH] LMS-2103 Wizard framework slightly modified.
 BiologicalSampleCreatingPage implemented.

SVN: 20332
---
 .../DatabaseModificationAwareObject.java      |   5 +
 .../application/framework/DefaultTabItem.java |   8 +-
 .../ui/sample/SampleTypeSelectionWidget.java  |  11 +-
 .../search/DetailedSearchCriterionWidget.java |   3 +
 .../client/application/ui/wizard/Wizard.java  |  32 ++++-
 .../application/ui/wizard/WizardPage.java     |  14 ++
 .../shared/basic/dto/DetailedSearchField.java |   5 +-
 ...AbstractGenericSampleRegisterEditForm.java |  11 +-
 .../web/client/IPhosphoNetXClientService.java |   4 +
 .../IPhosphoNetXClientServiceAsync.java       |   5 +
 .../client/application/PhosphoNetXModule.java |   2 +-
 .../wizard/BiologicalSampleChoosingPage.java  |   5 +-
 .../wizard/BiologicalSampleCreatingPage.java  | 130 +++++++++++++++++-
 .../MsInjectionSampleAnnotationModel.java     |  38 +++--
 .../MsInjectionSampleAnnotationWizard.java    |   2 +-
 .../wizard/MsInjectionSampleChoosingPage.java |  14 +-
 .../application/wizard/QuestionPage.java      |  10 +-
 .../web/public/phosphonetx-dictionary.js      |  16 +++
 .../web/server/PhosphoNetXClientService.java  |  17 ++-
 .../resultset/BiologicalSampleProvider.java   |   2 +-
 .../ParentlessMsInjectionSampleProvider.java  |   3 +-
 21 files changed, 287 insertions(+), 50 deletions(-)

diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/DatabaseModificationAwareObject.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/DatabaseModificationAwareObject.java
index 4977e764054..05f32deef80 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/DatabaseModificationAwareObject.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/DatabaseModificationAwareObject.java
@@ -66,6 +66,11 @@ public class DatabaseModificationAwareObject<T> implements IDatabaseModification
         this.modificationObserver = modificationObserver;
     }
 
+    public IDatabaseModificationObserver getModificationObserver()
+    {
+        return modificationObserver;
+    }
+
     public DatabaseModificationKind[] getRelevantModifications()
     {
         return modificationObserver.getRelevantModifications();
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/DefaultTabItem.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/DefaultTabItem.java
index b78e92ed8a2..48fc3802cf8 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/DefaultTabItem.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/DefaultTabItem.java
@@ -81,7 +81,13 @@ public class DefaultTabItem implements ITabItem
             final DatabaseModificationAwareComponent component, IViewContext<?> viewContext,
             boolean isCloseConfirmationNeeded)
     {
-        return create(viewContext, title, component.get(), component, null,
+        IDelegatedAction disposer = null;
+        IDatabaseModificationObserver modificationObserver = component.getModificationObserver();
+        if (modificationObserver instanceof IDisposableComponent)
+        {
+            disposer = createDisposer((IDisposableComponent) modificationObserver);
+        }
+        return create(viewContext, title, component.get(), component, disposer,
                 isCloseConfirmationNeeded);
     }
 
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/sample/SampleTypeSelectionWidget.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/sample/SampleTypeSelectionWidget.java
index b0116a10313..71c5d1abebc 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/sample/SampleTypeSelectionWidget.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/sample/SampleTypeSelectionWidget.java
@@ -43,7 +43,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleType;
  * 
  * @author Izabela Adamczyk
  */
-public final class SampleTypeSelectionWidget extends DropDownList<SampleTypeModel, SampleType>
+public class SampleTypeSelectionWidget extends DropDownList<SampleTypeModel, SampleType>
 {
     public static final String SUFFIX = "sample-type";
 
@@ -138,6 +138,14 @@ public final class SampleTypeSelectionWidget extends DropDownList<SampleTypeMode
                     edit(ObjectKind.PROPERTY_TYPE_ASSIGNMENT) };
     }
 
+    /**
+     * Filters sample types returned from server. This is a hook method which does nothing. Can be
+     * overridden by subclasses.
+     */
+    protected void filterTypes(List<SampleType> types)
+    {
+    }
+
     //
     // initial value support
     //
@@ -163,6 +171,7 @@ public final class SampleTypeSelectionWidget extends DropDownList<SampleTypeMode
         @Override
         public void process(List<SampleType> result)
         {
+            filterTypes(result);
             super.process(result);
             selectInitialValue();
         }
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/search/DetailedSearchCriterionWidget.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/search/DetailedSearchCriterionWidget.java
index 6a942bdf37b..32d128cd6f2 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/search/DetailedSearchCriterionWidget.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/search/DetailedSearchCriterionWidget.java
@@ -254,6 +254,9 @@ public class DetailedSearchCriterionWidget extends HorizontalPanel
             case ANY_PROPERTY:
                 description = "Any Property";
                 break;
+            case REGISTRATOR:
+                description = "";
+                break;
         }
 
         DetailedSearchFieldComboModel model = new DetailedSearchFieldComboModel(description, field);
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/wizard/Wizard.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/wizard/Wizard.java
index b77b997516b..6044d99e1e9 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/wizard/Wizard.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/wizard/Wizard.java
@@ -21,18 +21,22 @@ import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
+import com.extjs.gxt.ui.client.widget.Component;
 import com.extjs.gxt.ui.client.widget.LayoutContainer;
 import com.extjs.gxt.ui.client.widget.MessageBox;
 import com.extjs.gxt.ui.client.widget.TabItem;
 import com.extjs.gxt.ui.client.widget.layout.CardLayout;
 import com.google.gwt.user.client.ui.Widget;
 
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.IDisposableComponent;
+import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind;
+
 /**
  * Container of {@link WizardPage} instance. Manages changing between pages.
  *
  * @author Franz-Josef Elmer
  */
-public class Wizard<M extends IWizardDataModel> extends LayoutContainer
+public class Wizard<M extends IWizardDataModel> extends LayoutContainer implements IDisposableComponent
 {
     private final CardLayout layout;
     
@@ -86,6 +90,28 @@ public class Wizard<M extends IWizardDataModel> extends LayoutContainer
         workflowModel.nextState();
     }
 
+    public void update(Set<DatabaseModificationKind> observedModifications)
+    {
+    }
+
+    public DatabaseModificationKind[] getRelevantModifications()
+    {
+        return new DatabaseModificationKind[0];
+    }
+
+    public Component getComponent()
+    {
+        return this;
+    }
+
+    public void dispose()
+    {
+        for (WizardPage<M> page : visitedPages)
+        {
+            page.destroy();
+        }
+    }
+
     private void changePage(IWizardState previousStateOrNull, IWizardState currentStateOrNull)
     {
         if (currentStateOrNull != null)
@@ -106,10 +132,6 @@ public class Wizard<M extends IWizardDataModel> extends LayoutContainer
         {
             String message = model.finish();
             MessageBox.info("Info", message, null);
-            for (WizardPage<M> page : visitedPages)
-            {
-                page.destroy();
-            }
             Widget parent = getParent();
             if (parent instanceof TabItem)
             {
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/wizard/WizardPage.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/wizard/WizardPage.java
index 07a175e3ecc..fd257fd6caa 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/wizard/WizardPage.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/wizard/WizardPage.java
@@ -22,6 +22,7 @@ import com.extjs.gxt.ui.client.event.SelectionListener;
 import com.extjs.gxt.ui.client.util.Margins;
 import com.extjs.gxt.ui.client.widget.Component;
 import com.extjs.gxt.ui.client.widget.ContentPanel;
+import com.extjs.gxt.ui.client.widget.Html;
 import com.extjs.gxt.ui.client.widget.LayoutContainer;
 import com.extjs.gxt.ui.client.widget.button.Button;
 import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
@@ -40,10 +41,12 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IMess
  */
 public class WizardPage<M extends IWizardDataModel> extends LayoutContainer
 {
+    private static final String _LEFT_CONTENT = "_left_content";
     public static final String PREVIOUS_BUTTON_LABEL_KEY = "wizard_page_previous_button_label";
     public static final String NEXT_BUTTON_LABEL_KEY = "wizard_page_next_button_label";
     public static final String FINISH_BUTTON_LABEL_KEY = "wizard_page_finish_button_label";
     
+    private final IMessageProvider messageProvider;
     protected final M model;
     private final IWizardState state;
     private final LayoutContainer leftContent;
@@ -60,6 +63,7 @@ public class WizardPage<M extends IWizardDataModel> extends LayoutContainer
     public WizardPage(IMessageProvider messageProvider, IWizardState state, final M model)
     {
         super(new BorderLayout());
+        this.messageProvider = messageProvider;
         this.state = state;
         this.model = model;
         LayoutContainer leftCenterPanel = new LayoutContainer(new CenterLayout());
@@ -110,6 +114,16 @@ public class WizardPage<M extends IWizardDataModel> extends LayoutContainer
         return state;
     }
 
+    /**
+     * Sets the content of the left panel by an HTML snippet defined in the dictionary by the
+     * specified key. Note that the complete key in the dictionary reads <code>&lt;wizard
+     * state&gt;_left_content</code>.
+     */
+    public void setLeftContentByDictionary()
+    {
+        setLeftContentBy(new Html(messageProvider.getMessage(state + _LEFT_CONTENT)));
+    }
+
     /**
      * Sets the content of the left hand part of this wizard page.
      */
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DetailedSearchField.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DetailedSearchField.java
index 4c17e28826b..de671983559 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DetailedSearchField.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DetailedSearchField.java
@@ -64,10 +64,9 @@ public class DetailedSearchField implements ISerializable
         return createAttributeField(attributeFieldKind.getCode());
     }
 
-    public static DetailedSearchField createRegistratorField(
-            String userID)
+    public static DetailedSearchField createRegistratorField()
     {
-        return new DetailedSearchField(DetailedSearchFieldKind.REGISTRATOR, userID);
+        return new DetailedSearchField(DetailedSearchFieldKind.REGISTRATOR, null);
     }
     
     private static DetailedSearchField createAttributeField(String code)
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 1fc05d62b78..5b40674ad19 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
@@ -25,6 +25,7 @@ import com.extjs.gxt.ui.client.event.ButtonEvent;
 import com.extjs.gxt.ui.client.event.Events;
 import com.extjs.gxt.ui.client.event.SelectionListener;
 import com.extjs.gxt.ui.client.widget.button.Button;
+import com.extjs.gxt.ui.client.widget.form.Field;
 import com.extjs.gxt.ui.client.widget.form.FormPanel;
 
 import ch.systemsx.cisd.common.shared.basic.utils.StringUtils;
@@ -340,7 +341,13 @@ abstract public class AbstractGenericSampleRegisterEditForm extends
 
     protected final String createSampleIdentifier()
     {
-        final Space space = groupSelectionWidget.tryGetSelectedSpace();
+        return createSampleIdentifier(groupSelectionWidget, codeField);
+    }
+
+    public static final String createSampleIdentifier(SpaceSelectionWidget spaceSelectionWidget,
+            Field<String> codeField)
+    {
+        final Space space = spaceSelectionWidget.tryGetSelectedSpace();
         final boolean shared = SpaceSelectionWidget.isSharedSpace(space);
         final String code = codeField.getValue();
         final StringBuilder builder = new StringBuilder("/");
@@ -351,7 +358,7 @@ abstract public class AbstractGenericSampleRegisterEditForm extends
         builder.append(code);
         return builder.toString().toUpperCase();
     }
-
+    
     /** sets visibility of container and parent fields dependent on sample type */
     private final void setContainerAndParentVisibility(final SampleType sampleType)
     {
diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/IPhosphoNetXClientService.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/IPhosphoNetXClientService.java
index 2dbdbfe6c6f..a299c9d8cc1 100644
--- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/IPhosphoNetXClientService.java
+++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/IPhosphoNetXClientService.java
@@ -26,6 +26,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.dto.TableExportCriteri
 import ch.systemsx.cisd.openbis.generic.client.web.client.dto.TypedTableResultSet;
 import ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException;
 import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
+import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewSample;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Sample;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModelRowWithObject;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Vocabulary;
@@ -64,6 +65,9 @@ public interface IPhosphoNetXClientService extends IClientService
     
     public void linkSamples(Sample parentSample, List<Sample> childSamples) throws UserFailureException;
     
+    public void createAndLinkSamples(NewSample newBiologicalSample,
+            List<Sample> msInjectionSamples) throws UserFailureException;
+    
     public Vocabulary getTreatmentTypeVocabulary() throws UserFailureException;
 
     public List<AbundanceColumnDefinition> getAbundanceColumnDefinitionsForProteinByExperiment(
diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/IPhosphoNetXClientServiceAsync.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/IPhosphoNetXClientServiceAsync.java
index baa9472aebc..84e9b6986a1 100644
--- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/IPhosphoNetXClientServiceAsync.java
+++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/IPhosphoNetXClientServiceAsync.java
@@ -27,6 +27,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.dto.ResultSet;
 import ch.systemsx.cisd.openbis.generic.client.web.client.dto.TableExportCriteria;
 import ch.systemsx.cisd.openbis.generic.client.web.client.dto.TypedTableResultSet;
 import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
+import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewSample;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Sample;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModelRowWithObject;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Vocabulary;
@@ -61,6 +62,10 @@ public interface IPhosphoNetXClientServiceAsync extends IClientServiceAsync
     /** @see IPhosphoNetXClientService#linkSamples(Sample, List) */
     public void linkSamples(Sample parentSample, List<Sample> childSamples, AsyncCallback<Void> callback);
     
+    /** @see IPhosphoNetXClientService#createAndLinkSamples(NewSample, List) */
+    public void createAndLinkSamples(NewSample newBiologicalSample,
+            List<Sample> msInjectionSamples, AsyncCallback<Void> callback);
+    
     /** @see IPhosphoNetXClientService#getTreatmentTypeVocabulary() */
     public void getTreatmentTypeVocabulary(AsyncCallback<Vocabulary> callback);
     
diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/PhosphoNetXModule.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/PhosphoNetXModule.java
index 9ebbb338054..3a88b2db57c 100644
--- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/PhosphoNetXModule.java
+++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/PhosphoNetXModule.java
@@ -71,7 +71,7 @@ public class PhosphoNetXModule implements IModule
                         public DatabaseModificationAwareComponent createComponent(
                                 IViewContext<IPhosphoNetXClientServiceAsync> context)
                         {
-                            return DatabaseModificationAwareComponent.wrapUnaware(new MsInjectionSampleAnnotationWizard(context));
+                            return DatabaseModificationAwareComponent.create(new MsInjectionSampleAnnotationWizard(context));
                         }
 
                         public String tryGetLink()
diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/wizard/BiologicalSampleChoosingPage.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/wizard/BiologicalSampleChoosingPage.java
index 7f25c66295f..ccd692ba732 100644
--- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/wizard/BiologicalSampleChoosingPage.java
+++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/wizard/BiologicalSampleChoosingPage.java
@@ -22,7 +22,6 @@ import com.extjs.gxt.ui.client.data.ModelData;
 import com.extjs.gxt.ui.client.event.Listener;
 import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
 import com.extjs.gxt.ui.client.util.Margins;
-import com.extjs.gxt.ui.client.widget.Html;
 import com.extjs.gxt.ui.client.widget.Label;
 import com.extjs.gxt.ui.client.widget.layout.RowData;
 
@@ -49,9 +48,7 @@ public class BiologicalSampleChoosingPage extends WizardPage<MsInjectionSampleAn
     {
         super(viewContext, MsInjectionAnnotationWizardState.BIOLOGICAL_SAMPLE_CHOOSING, model);
         this.viewContext = viewContext;
-        setLeftContentBy(new Html(
-                "Annotating <tt>MS_INJECTION</tt> sample by choosing one biological sample means " +
-                "that all properties of the biological sample is also for the <tt>MS_INJECTION</tt> to be annotated."));
+        setLeftContentByDictionary();
     }
 
     @Override
diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/wizard/BiologicalSampleCreatingPage.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/wizard/BiologicalSampleCreatingPage.java
index 6cf175b130e..c8b9dc2647b 100644
--- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/wizard/BiologicalSampleCreatingPage.java
+++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/wizard/BiologicalSampleCreatingPage.java
@@ -16,10 +16,33 @@
 
 package ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.application.wizard;
 
-import com.extjs.gxt.ui.client.widget.Html;
+import java.util.Iterator;
+import java.util.List;
 
+import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
+import com.extjs.gxt.ui.client.event.SelectionChangedListener;
+import com.extjs.gxt.ui.client.util.Margins;
+import com.extjs.gxt.ui.client.widget.layout.RowData;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.Dict;
 import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext;
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.SampleTypeDisplayID;
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.model.SampleTypeModel;
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.SpaceSelectionWidget;
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.field.CodeFieldWithGenerator;
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.field.ExperimentChooserField;
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.field.ExperimentChooserField.ExperimentChooserFieldAdaptor;
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.sample.SampleTypeSelectionWidget;
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.widget.ClickableFormPanel;
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.widget.FieldUtil;
 import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.wizard.WizardPage;
+import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty;
+import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleType;
+import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleTypePropertyType;
+import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.sample.AbstractGenericSampleRegisterEditForm;
+import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.sample.SamplePropertyEditor;
 import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.IPhosphoNetXClientServiceAsync;
 
 /**
@@ -30,12 +53,113 @@ import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.IPhosphoNet
 public class BiologicalSampleCreatingPage extends WizardPage<MsInjectionSampleAnnotationModel>
 {
 
+    private final IViewContext<IPhosphoNetXClientServiceAsync> viewContext;
+    private ClickableFormPanel formPanel;
+    private SampleTypeSelectionWidget sampleTypeSelectionWidget;
+    private SampleType sampleType;
+    private CodeFieldWithGenerator codeField;
+    private SpaceSelectionWidget spaceSelectionWidget;
+    private SamplePropertyEditor samplePropertyEditor;
+    private ExperimentChooserFieldAdaptor experimentField;
+
     public BiologicalSampleCreatingPage(IViewContext<IPhosphoNetXClientServiceAsync> viewContext,
             MsInjectionSampleAnnotationModel model)
     {
         super(viewContext, MsInjectionAnnotationWizardState.BIOLOGICAL_SAMPLE_CREATING, model);
-        setLeftContentBy(new Html(
-                "Annotating <tt>MS_INJECTION</tt> sample by creating a new biological sample means ..."));
+        this.viewContext = viewContext;
+        setLeftContentByDictionary();
+    }
+
+    @Override
+    public void init()
+    {
+        formPanel = new ClickableFormPanel();
+        formPanel.setHeaderVisible(false);
+        sampleTypeSelectionWidget = new SampleTypeSelectionWidget(viewContext, "bio-samp", true,
+                SampleTypeDisplayID.SAMPLE_REGISTRATION, null)
+            {
+
+                @Override
+                protected void filterTypes(List<SampleType> types)
+                {
+                    for (Iterator<SampleType> iterator = types.iterator(); iterator.hasNext();)
+                    {
+                        SampleType type = iterator.next();
+                        if (type.getCode().startsWith("BIO") == false)
+                        {
+                            iterator.remove();
+                        }
+                    }
+                }
+            };
+            sampleTypeSelectionWidget.addSelectionChangedListener(new SelectionChangedListener<SampleTypeModel>()
+                {
+                    
+                    @Override
+                    public void selectionChanged(SelectionChangedEvent<SampleTypeModel> se)
+                    {
+                        SampleType sampleTypeOrNull = sampleTypeSelectionWidget.tryGetSelectedSampleType();
+                        if (sampleTypeOrNull != null)
+                        {
+                            onSampleTypeChanged(sampleTypeOrNull);
+                        }
+                    }
+                });
+        formPanel.add(sampleTypeSelectionWidget);
+        addToRightContent(formPanel, new RowData(1, 500, new Margins(10)));
+    }
+
+    protected void onSampleTypeChanged(SampleType type)
+    {
+        this.sampleType = type;
+        formPanel.removeAll();
+        formPanel.add(sampleTypeSelectionWidget);
+        codeField =
+                new CodeFieldWithGenerator(viewContext, viewContext.getMessage(Dict.CODE),
+                        type.getGeneratedCodePrefix(), type.isAutoGeneratedCode());
+        boolean codeReadonly = type.isAutoGeneratedCode();
+        codeField.setReadOnly(codeReadonly);
+        codeField.setHideTrigger(codeReadonly);
+        formPanel.add(codeField);
+        List<SampleTypePropertyType> types = type.getAssignedPropertyTypes();
+        spaceSelectionWidget =
+                new SpaceSelectionWidget(viewContext, getId(), true, false, viewContext.getModel()
+                        .getSessionContext().getUser().getHomeGroupCode());
+        FieldUtil.markAsMandatory(spaceSelectionWidget);
+        formPanel.add(spaceSelectionWidget);
+        String label = viewContext.getMessage(Dict.EXPERIMENT);
+        experimentField = ExperimentChooserField.create(label, false, null,
+                viewContext.getCommonViewContext());
+        formPanel.add(experimentField.getChooserField());
+
+        samplePropertyEditor = new SamplePropertyEditor("bio-s", viewContext.getCommonViewContext());
+        samplePropertyEditor.initWithoutProperties(types);
+        samplePropertyEditor.addPropertyFieldsWithFieldsetToPanel(formPanel);
+        formPanel.layout();
+        formPanel.addClickListener(new ClickHandler()
+            {
+                public void onClick(ClickEvent event)
+                {
+                    enableNextButton(formPanel.isValid());
+                }
+            });
+    }
+
+    @Override
+    public void deactivate()
+    {
+        String identifier =
+                AbstractGenericSampleRegisterEditForm.createSampleIdentifier(spaceSelectionWidget,
+                        codeField);
+        String experimentIdentifierOrNull = experimentField.getChooserField().getValue();
+        List<IEntityProperty> properties = samplePropertyEditor.extractProperties();
+        model.defineBiologicalSample(sampleType, identifier, experimentIdentifierOrNull, properties);
+    }
+
+    @Override
+    public void destroy()
+    {
+        spaceSelectionWidget.dispose();
     }
 
 }
diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/wizard/MsInjectionSampleAnnotationModel.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/wizard/MsInjectionSampleAnnotationModel.java
index b44484d5dcc..2905c16ba3a 100644
--- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/wizard/MsInjectionSampleAnnotationModel.java
+++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/wizard/MsInjectionSampleAnnotationModel.java
@@ -29,23 +29,29 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.VoidAsyncC
 import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.wizard.IWizardDataModel;
 import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.wizard.IWizardState;
 import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.wizard.WizardWorkflowModel;
+import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty;
+import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewSample;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Sample;
+import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleType;
 import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.IPhosphoNetXClientServiceAsync;
 
 /**
- * 
- *
  * @author Franz-Josef Elmer
  */
 public class MsInjectionSampleAnnotationModel implements IWizardDataModel
 {
     private final IViewContext<IPhosphoNetXClientServiceAsync> context;
+
     private final WizardWorkflowModel workflowModel;
+
     private List<Sample> msInjectionSamples = new ArrayList<Sample>();
-    
+
     private boolean chooseBiologicalSampleFlag;
+
     private Sample biologicalSample;
-    
+
+    private NewSample newBiologicalSample;
+
     public MsInjectionSampleAnnotationModel(IViewContext<IPhosphoNetXClientServiceAsync> context)
     {
         this.context = context;
@@ -54,7 +60,7 @@ public class MsInjectionSampleAnnotationModel implements IWizardDataModel
         workflowModel.addTransition(CHOOSE_OR_CREATE_QUESTION, BIOLOGICAL_SAMPLE_CHOOSING);
         workflowModel.addTransition(CHOOSE_OR_CREATE_QUESTION, BIOLOGICAL_SAMPLE_CREATING);
     }
-    
+
     public WizardWorkflowModel getWorkflow()
     {
         return workflowModel;
@@ -64,17 +70,17 @@ public class MsInjectionSampleAnnotationModel implements IWizardDataModel
     {
         return chooseBiologicalSampleFlag ? BIOLOGICAL_SAMPLE_CHOOSING : BIOLOGICAL_SAMPLE_CREATING;
     }
-    
+
     public void setSelectedMsInjectionSample(List<Sample> samples)
     {
         msInjectionSamples = samples;
     }
-    
+
     public List<Sample> getMsInjectionSamples()
     {
         return msInjectionSamples;
     }
-    
+
     public void setChooseBiologicalSampleFlag(boolean flag)
     {
         chooseBiologicalSampleFlag = flag;
@@ -85,10 +91,24 @@ public class MsInjectionSampleAnnotationModel implements IWizardDataModel
         this.biologicalSample = biologicalSample;
     }
 
+    public void defineBiologicalSample(SampleType sampleType, String identifier,
+            String experimentIdentifierOrNull, List<IEntityProperty> properties)
+    {
+        newBiologicalSample = NewSample.createWithParents(identifier, sampleType, null, null);
+        newBiologicalSample.setProperties(properties.toArray(IEntityProperty.EMPTY_ARRAY));
+        newBiologicalSample.setExperimentIdentifier(experimentIdentifierOrNull);
+    }
+
     public String finish()
     {
         VoidAsyncCallback<Void> callback = new VoidAsyncCallback<Void>(context);
-        context.getService().linkSamples(biologicalSample, msInjectionSamples, callback);
+        if (chooseBiologicalSampleFlag)
+        {
+            context.getService().linkSamples(biologicalSample, msInjectionSamples, callback);
+        } else
+        {
+            context.getService().createAndLinkSamples(newBiologicalSample, msInjectionSamples, callback);
+        }
         return msInjectionSamples.size() + " MS_INJECTION samples have been annotated.";
     }
 
diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/wizard/MsInjectionSampleAnnotationWizard.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/wizard/MsInjectionSampleAnnotationWizard.java
index d4893777d37..83ecb08375a 100644
--- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/wizard/MsInjectionSampleAnnotationWizard.java
+++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/wizard/MsInjectionSampleAnnotationWizard.java
@@ -21,7 +21,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.wizard.
 import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.IPhosphoNetXClientServiceAsync;
 
 /**
- * 
+ * Wizard for annotation MS_INJECTION samples.
  *
  * @author Franz-Josef Elmer
  */
diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/wizard/MsInjectionSampleChoosingPage.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/wizard/MsInjectionSampleChoosingPage.java
index 1e8d921fa4c..4dc424bf051 100644
--- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/wizard/MsInjectionSampleChoosingPage.java
+++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/wizard/MsInjectionSampleChoosingPage.java
@@ -23,7 +23,6 @@ import com.extjs.gxt.ui.client.data.ModelData;
 import com.extjs.gxt.ui.client.event.Listener;
 import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
 import com.extjs.gxt.ui.client.util.Margins;
-import com.extjs.gxt.ui.client.widget.Html;
 import com.extjs.gxt.ui.client.widget.Label;
 import com.extjs.gxt.ui.client.widget.layout.RowData;
 
@@ -50,16 +49,7 @@ public class MsInjectionSampleChoosingPage extends WizardPage<MsInjectionSampleA
     {
         super(viewContext, MsInjectionAnnotationWizardState.MS_INJECTION_SAMPLE_CHOOSING, model);
         this.viewContext = viewContext;
-        setLeftContentBy(new Html(
-                "MS data are added to openBIS in an automated process. "
-                        + "The corresponding data sets are associated with samples of type <tt>MS_INJECTION</tt>."
-                        + "<p>Before MS data of such samples can be processed in a protein identification pipeline "
-                        + "they have to be <b>annotated</b>. In the terminology of openBIS this means: "
-                        + "An <tt>MS_INJECTION</tt> sample is linked to biological sample where "
-                        + "the biological sample is the parent and the <tt>MS_INJECTION</tt> sample is the child. "
-                        + "The biological sample has all annotations. "
-                        + "They define the scientific context of proteins found. "
-                        + "<p>This wizard helps you add these important annotations to openBIS."));
+        setLeftContentByDictionary();
     }
 
     @Override
@@ -80,7 +70,7 @@ public class MsInjectionSampleChoosingPage extends WizardPage<MsInjectionSampleA
                 }
 
             });
-        addToRightContent(sampleGrid, new RowData(1, 500, new Margins(20, 10, 10, 10)));
+        addToRightContent(sampleGrid, new RowData(1, 400, new Margins(20, 10, 10, 10)));
     }
 
     @Override
diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/wizard/QuestionPage.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/wizard/QuestionPage.java
index 651f2a05755..d271778980e 100644
--- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/wizard/QuestionPage.java
+++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/wizard/QuestionPage.java
@@ -17,7 +17,7 @@
 package ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.application.wizard;
 
 import com.extjs.gxt.ui.client.util.Margins;
-import com.extjs.gxt.ui.client.widget.Html;
+import com.extjs.gxt.ui.client.widget.Label;
 import com.extjs.gxt.ui.client.widget.form.Radio;
 import com.extjs.gxt.ui.client.widget.form.RadioGroup;
 import com.extjs.gxt.ui.client.widget.layout.RowData;
@@ -41,10 +41,10 @@ public class QuestionPage extends WizardPage<MsInjectionSampleAnnotationModel>
             MsInjectionSampleAnnotationModel model)
     {
         super(viewContext, MsInjectionAnnotationWizardState.CHOOSE_OR_CREATE_QUESTION, model);
-        setLeftContentBy(new Html(
-                "Annotating the <tt>MS_INJECTION</tt> samples you have chosen means to link them to a <b>biological sample</b>. "
-                        + "You can choose an existing biological sample or you can create a new one."));
-        radioGroup = new RadioGroup("What do you want to annotate your samples?");
+        setLeftContentByDictionary();
+        addToRightContent(new Label("What do you want to annotate your samples?"), new RowData(1,
+                -1, new Margins(10)));
+        radioGroup = new RadioGroup();
         radioGroup.setFieldLabel("choose");
         chooseSampleRadioButton = new Radio();
         chooseSampleRadioButton.setBoxLabel("I want to choose an existing biological sample.");
diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/public/phosphonetx-dictionary.js b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/public/phosphonetx-dictionary.js
index be7e8db6aa9..158ecaa7447 100644
--- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/public/phosphonetx-dictionary.js
+++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/public/phosphonetx-dictionary.js
@@ -40,10 +40,26 @@ var phosphonetx = {
   
   // MS_INJECTION annotation wizard
   
+  MS_INJECTION_SAMPLE_CHOOSING_left_content: "MS data are added to openBIS in an automated process. "
+        + "The corresponding data sets are associated with samples of type <tt>MS_INJECTION</tt>."
+        + "<p>Before MS data of such samples can be processed in a protein identification pipeline "
+        + "they have to be <b>annotated</b>. In the terminology of openBIS this means: "
+        + "An <tt>MS_INJECTION</tt> sample is linked to a biological sample where "
+        + "the biological sample is the parent and the <tt>MS_INJECTION</tt> sample is the child. "
+        + "The biological sample has all annotations (called properties in openBIS). "
+        + "They define the scientific context of proteins found. "
+        + "<p>This wizard helps you adding these important annotations to openBIS.",
   openbis_parentless_ms_injection_sample_main_IDENTIFIER: "MS_INJECTION Sample",
   openbis_parentless_ms_injection_sample_main_REGISTRATION_DATE: "Registration Date",
+  CHOOSE_OR_CREATE_QUESTION_left_content: "Annotating the <tt>MS_INJECTION</tt> samples you have chosen "
+        + "means to link them to a <b>biological sample</b>. "
+        + "You can choose an existing biological sample or you can create a new one.",
+  BIOLOGICAL_SAMPLE_CHOOSING_left_content: "Annotating <tt>MS_INJECTION</tt> sample by choosing one biological sample means " 
+        + "that all properties of the biological sample is also for the <tt>MS_INJECTION</tt> to be annotated.",
   openbis_biological_sample_main_IDENTIFIER: "Biological Sample",
   openbis_biological_sample_main_REGISTRATION_DATE: "Registration Date",
+  BIOLOGICAL_SAMPLE_CREATING_left_content: "Annotating <tt>MS_INJECTION</tt> sample by creating a new biological sample means " 
+        + "mainly specifying properties of a freshly created biological sample in openBIS.",
   
   
   // RawDataSample Browser
diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/PhosphoNetXClientService.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/PhosphoNetXClientService.java
index 82ab5321db3..f569b8264b1 100644
--- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/PhosphoNetXClientService.java
+++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/PhosphoNetXClientService.java
@@ -52,6 +52,7 @@ import ch.systemsx.cisd.openbis.generic.shared.IServer;
 import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewAttachment;
+import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewSample;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Sample;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ServiceVersionHolder;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModelRowWithObject;
@@ -193,8 +194,22 @@ public class PhosphoNetXClientService extends AbstractClientService implements
             throws ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException
     {
         String sessionToken = getSessionToken();
+        linkSamples(sessionToken, parentSample.getIdentifier(), childSamples);
+    }
+
+    public void createAndLinkSamples(NewSample newBiologicalSample, List<Sample> msInjectionSamples)
+    throws ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException
+    {
+        String sessionToken = getSessionToken();
+        List<NewAttachment> noAttachments = Collections.<NewAttachment>emptyList();
+        genericServer.registerSample(sessionToken, newBiologicalSample, noAttachments);
+        linkSamples(sessionToken, newBiologicalSample.getIdentifier(), msInjectionSamples);
+    }
+    
+    private void linkSamples(String sessionToken, String identifier, List<Sample> childSamples)
+    {
         String[] parents = new String[]
-            { parentSample.getIdentifier() };
+            { identifier };
         for (Sample childSample : childSamples)
         {
             SampleIdentifier childSampleIdentifier =
diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/resultset/BiologicalSampleProvider.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/resultset/BiologicalSampleProvider.java
index 25ceb8c7b81..9da3f00c18e 100644
--- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/resultset/BiologicalSampleProvider.java
+++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/resultset/BiologicalSampleProvider.java
@@ -58,7 +58,7 @@ public class BiologicalSampleProvider extends AbstractCommonTableModelProvider<S
         typeCriterion.setValue(CommonConstants.BIOLOGICAL_SAMPLE_PREFIX + "*");
         DetailedSearchCriterion registratorCriterion = new DetailedSearchCriterion();
         String userName = commonServer.tryGetSession(sessionToken).getUserName();
-        registratorCriterion.setField(DetailedSearchField.createRegistratorField(""));
+        registratorCriterion.setField(DetailedSearchField.createRegistratorField());
         registratorCriterion.setValue(userName);
         criteria.setCriteria(Arrays.asList(typeCriterion, registratorCriterion));
         List<Sample> samples = commonServer.searchForSamples(sessionToken, criteria);
diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/resultset/ParentlessMsInjectionSampleProvider.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/resultset/ParentlessMsInjectionSampleProvider.java
index f7983672404..dd56b8727d9 100644
--- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/resultset/ParentlessMsInjectionSampleProvider.java
+++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/resultset/ParentlessMsInjectionSampleProvider.java
@@ -61,8 +61,9 @@ public class ParentlessMsInjectionSampleProvider extends AbstractCommonTableMode
         spaceCriterion.setValue(CommonConstants.MS_DATA_SPACE);
         DetailedSearchCriterion registratorCriterion = new DetailedSearchCriterion();
         String userName = commonServer.tryGetSession(sessionToken).getUserName();
-        registratorCriterion.setField(DetailedSearchField.createRegistratorField(""));
+        registratorCriterion.setField(DetailedSearchField.createRegistratorField());
         registratorCriterion.setValue(userName);
+        System.out.println("userName:"+userName);
         criteria.setCriteria(Arrays.asList(typeCriterion, spaceCriterion, registratorCriterion));
         List<Sample> samples = commonServer.searchForSamples(sessionToken, criteria);
         TypedTableModelBuilder<Sample> builder = new TypedTableModelBuilder<Sample>();
-- 
GitLab