Skip to content
Snippets Groups Projects
Commit b218cc8a authored by buczekp's avatar buczekp
Browse files

[LMS-2354] introduced MaterialMergedSummarySection (not shown yet because of...

[LMS-2354] introduced MaterialMergedSummarySection (not shown yet because of some bugs), extracted code for experiment chooser to SingleOrAllExperimentsChooser

SVN: 21957
parent 968aa2a5
No related branches found
No related tags found
No related merge requests found
Showing
with 359 additions and 155 deletions
......@@ -64,6 +64,9 @@ public final class Dict extends ch.systemsx.cisd.openbis.generic.client.web.clie
public static final String PLATE_LOCATIONS = "plate_locations";
public static final String MATERIAL_MERGED_SUMMARY_SECTION_TITLE =
"MATERIAL_MERGED_SUMMARY_SECTION_TITLE";
public static final String MATERIAL_REPLICA_SUMMARY_SECTION_TITLE =
"MATERIAL_REPLICA_SUMMARY_SECTION_TITLE";
......
......@@ -28,7 +28,7 @@ public enum DisplayTypeIDGenerator implements IDisplayTypeIDGenerator
PLATE_LAYOUT_SAMPLE_SECTION("plate-layout-sample-section"),
LOGICAL_IMAGE_WELL_SECTION("logical-image-well-section"),
PLATE_LAYOUT_DATASET_SECTION("plate-layout-dataset-section"),
LOGICAL_IMAGE_DATASET_SECTION("logical-image-dataset-section"),
......@@ -40,9 +40,11 @@ public enum DisplayTypeIDGenerator implements IDisplayTypeIDGenerator
EXPERIMENT_WELL_MATERIALS_SECTION("experiment-well-materials-section"),
EXPERIMENT_FEATURE_VECTOR_SUMMARY_SECTION("experiment-feature-vector-summary-section"),
MATERIAL_MERGED_SUMMARY_SECTION("material-merged-summary-section"),
MATERIAL_REPLICA_SUMMARY_SECTION("material-replica-summary-section"),
MATERIAL_FEATURES_FROM_ALL_EXPERIMENTS_SECTION("material-features-all-experiments-section");
private final String genericNameOrPrefix;
......
......@@ -40,6 +40,8 @@ import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellSearchCrit
public class ImagingMaterialViewer extends GenericMaterialViewer
{
private static final boolean SUMMARY_SECTION_IMPLEMENTED = false; // FIXME
/**
* @param experimentCriteriaOrNull if the experiment criteria are specified, they will be chosen
* automatically when the window opens.
......@@ -56,14 +58,14 @@ public class ImagingMaterialViewer extends GenericMaterialViewer
private final IViewContext<IScreeningClientServiceAsync> screeningViewContext;
private final ExperimentSearchCriteria experimentCriteriaOrNull;
private final ExperimentSearchCriteria initialExperimentCriteriaOrNull;
private ImagingMaterialViewer(IViewContext<IScreeningClientServiceAsync> viewContext,
TechId materialTechId, ExperimentSearchCriteria experimentCriteriaOrNull)
{
super(viewContext, materialTechId);
this.screeningViewContext = viewContext;
this.experimentCriteriaOrNull = experimentCriteriaOrNull;
this.initialExperimentCriteriaOrNull = experimentCriteriaOrNull;
}
@Override
......@@ -80,20 +82,29 @@ public class ImagingMaterialViewer extends GenericMaterialViewer
WellSearchMaterialSection wellSearchSection =
new WellSearchMaterialSection(screeningViewContext, materialId,
experimentCriteriaOrNull);
initialExperimentCriteriaOrNull);
sections.add(wellSearchSection);
String experimentPermId = tryGetExperimentPermId();
boolean restrictGlobalScopeLinkToProject =
isRestrictGlobalScopeLinkToProject(initialExperimentCriteriaOrNull);
if (SUMMARY_SECTION_IMPLEMENTED)
{
MaterialMergedSummarySection summarySection =
new MaterialMergedSummarySection(screeningViewContext, material,
initialExperimentCriteriaOrNull, restrictGlobalScopeLinkToProject);
sections.add(summarySection);
}
String experimentPermId = tryGetExperimentPermId(initialExperimentCriteriaOrNull);
if (experimentPermId != null)
{
boolean restrictGlobalScopeLinkToProject =
isRestrictGlobalScopeLinkToProject(experimentCriteriaOrNull);
MaterialReplicaSummarySection replicaSummarySection =
new MaterialReplicaSummarySection(screeningViewContext, material,
experimentPermId, restrictGlobalScopeLinkToProject);
sections.add(replicaSummarySection);
}
ExperimentSearchByProjectCriteria experimentCriteria = tryConvert(experimentCriteriaOrNull);
ExperimentSearchByProjectCriteria experimentCriteria =
tryConvert(initialExperimentCriteriaOrNull);
MaterialFeaturesFromAllExpermentsSection featuresFromAllExperimentsSection =
new MaterialFeaturesFromAllExpermentsSection(screeningViewContext, material,
experimentCriteria);
......@@ -126,7 +137,7 @@ public class ImagingMaterialViewer extends GenericMaterialViewer
}
}
private String tryGetExperimentPermId()
private static String tryGetExperimentPermId(ExperimentSearchCriteria experimentCriteriaOrNull)
{
if (experimentCriteriaOrNull != null)
{
......
......@@ -61,4 +61,5 @@ public class MaterialFeaturesFromAllExperimentsComponent
return MaterialComponentUtils.createMaterialViewer(screeningViewContext, material,
headingText, gridComponent);
}
}
package ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.detailviewers;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.AbstractAsyncCallback;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.DisposableTabContent;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.IDisposableComponent;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IDelegatedAction;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Material;
import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.IScreeningClientServiceAsync;
import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.Dict;
import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.DisplayTypeIDGenerator;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellSearchCriteria.ExperimentSearchCriteria;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellSearchCriteria.ExperimentSearchCriteriaHolder;
/**
* Section in material detail view which presents either
* {@link MaterialFeaturesFromAllExperimentsComponent} or {@link MaterialReplicaSummaryComponent}
* for a selected experiment.
*
* @author Piotr Buczek
*/
class MaterialMergedSummarySection extends DisposableTabContent
{
private final IViewContext<IScreeningClientServiceAsync> screeningViewContext;
private final Material material;
private final boolean restrictGlobalScopeLinkToProject;
private ExperimentSearchCriteriaHolder experimentSearchCriteriaHolder;
public MaterialMergedSummarySection(
IViewContext<IScreeningClientServiceAsync> screeningViewContext, Material material,
ExperimentSearchCriteria experimentCriteriaOrNull,
boolean restrictGlobalScopeLinkToProject)
{
super(screeningViewContext.getMessage(Dict.MATERIAL_MERGED_SUMMARY_SECTION_TITLE),
screeningViewContext, material);
this.screeningViewContext = screeningViewContext;
this.material = material;
this.restrictGlobalScopeLinkToProject = restrictGlobalScopeLinkToProject;
this.experimentSearchCriteriaHolder =
new ExperimentSearchCriteriaHolder(experimentCriteriaOrNull);
setIds(DisplayTypeIDGenerator.MATERIAL_MERGED_SUMMARY_SECTION);
}
private IDelegatedAction createRefreshAction(
final ExperimentSearchCriteriaHolder searchCriteriaHolder)
{
return new IDelegatedAction()
{
public void execute()
{
ExperimentSearchCriteria criteriaOrNull = searchCriteriaHolder.tryGetCriteria();
if (criteriaOrNull != null && criteriaOrNull.tryGetExperiment() != null)
{
final String experimentPermId =
criteriaOrNull.tryGetExperiment().getExperimentPermId();
screeningViewContext.getCommonService().getExperimentInfoByPermId(
experimentPermId,
new AbstractAsyncCallback<Experiment>(screeningViewContext)
{
@Override
protected void process(Experiment experiment)
{
setHeading(screeningViewContext.getMessage(
Dict.MATERIAL_REPLICA_SUMMARY_SECTION_TITLE,
experiment.getCode()));
replaceContent(MaterialReplicaSummaryComponent
.createViewer(screeningViewContext, experiment,
material,
restrictGlobalScopeLinkToProject));
}
});
} else
{
replaceContent(MaterialFeaturesFromAllExperimentsComponent.createComponent(
screeningViewContext, material, criteriaOrNull == null ? null
: criteriaOrNull.tryAsSearchByProjectCriteria()));
}
}
};
}
@Override
protected IDisposableComponent createDisposableContent()
{
return null; // content will be automatically added on criteria change
}
@Override
protected void showContent()
{
super.showContent();
// getHeader().setText("");
setHeading("");
getHeader().addTool(
new SingleOrAllExperimentsChooser(screeningViewContext,
experimentSearchCriteriaHolder,
createRefreshAction(experimentSearchCriteriaHolder)));
}
}
\ No newline at end of file
/*
* Copyright 2011 ETH Zuerich, CISD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.detailviewers;
import com.extjs.gxt.ui.client.Style.Orientation;
import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.form.Radio;
import com.extjs.gxt.ui.client.widget.form.RadioGroup;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext;
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.field.IChosenEntityListener;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IDelegatedAction;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.ExperimentIdentifier;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModelRowWithObject;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellSearchCriteria.ExperimentSearchCriteria;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellSearchCriteria.ExperimentSearchCriteriaHolder;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellSearchCriteria.SingleExperimentSearchCriteria;
/**
* A {@link LayoutContainer} making it possible to choose between either all experiments and a
* single experiment.
*/
class SingleOrAllExperimentsChooser extends LayoutContainer
{
private static final String SINGLE_EXPERIMENT_TEXT = "Single experiment";
private static final String ALL_EXPERIMENTS_TEXT = "All experiments";
private static final String CHOOSE_ONE_EXPERIMENT_TEXT = "Choose one experiment...";
private SingleExperimentSearchCriteria singleExperimentChooserStateOrNull;
private final IViewContext<?> viewContext;
private final IDelegatedAction refreshAction;
private final ExperimentSearchCriteriaHolder experimentCriteriaHolder;
public SingleOrAllExperimentsChooser(IViewContext<?> viewContext,
ExperimentSearchCriteriaHolder experimentCriteriaHolder, IDelegatedAction refreshAction)
{
this.viewContext = viewContext;
this.experimentCriteriaHolder = experimentCriteriaHolder;
this.refreshAction = refreshAction;
ExperimentChooserFieldAdaptor singleExperimentChooser = createSingleExperimentChooser();
RadioGroup experimentRadioChooser = createExperimentRadio(singleExperimentChooser);
setWidth(400);
add(experimentRadioChooser);
add(singleExperimentChooser.getField());
}
private ExperimentSearchCriteria tryGetExperimentSearchCriteria()
{
return experimentCriteriaHolder.tryGetCriteria();
}
private boolean isAllExperimentsChoosen()
{
ExperimentSearchCriteria criteriaOrNull = tryGetExperimentSearchCriteria();
return criteriaOrNull != null && criteriaOrNull.tryGetExperiment() == null;
}
private ExperimentChooserFieldAdaptor createSingleExperimentChooser()
{
ExperimentChooserFieldAdaptor experimentChooser =
ExperimentChooserField.create("", true, null, viewContext.getCommonViewContext());
final ExperimentChooserField chooserField = experimentChooser.getChooserField();
chooserField
.addChosenEntityListener(new IChosenEntityListener<TableModelRowWithObject<Experiment>>()
{
public void entityChosen(TableModelRowWithObject<Experiment> row)
{
if (row != null)
{
chooseSingleExperiment(chooserField, row.getObjectOrNull());
}
}
});
chooserField.setEditable(false);
ExperimentSearchCriteria criteriaOrNull = tryGetExperimentSearchCriteria();
if (criteriaOrNull == null || criteriaOrNull.tryGetExperiment() == null)
{
// we search in all experiments or single experiment has not been chosen
this.singleExperimentChooserStateOrNull = null;
chooserField.reset();
} else
{
// we search in a single experiment
updateSingleExperimentChooser(chooserField, criteriaOrNull.tryGetExperiment());
}
if (criteriaOrNull == null || criteriaOrNull.tryGetExperiment() != null)
{
chooserField.setEmptyText(CHOOSE_ONE_EXPERIMENT_TEXT);
} else
{
chooserField.setEmptyText(ALL_EXPERIMENTS_TEXT);
}
return experimentChooser;
}
private RadioGroup createExperimentRadio(
final ExperimentChooserFieldAdaptor singleExperimentChooser)
{
final RadioGroup experimentRadio = new RadioGroup();
experimentRadio.setSelectionRequired(true);
experimentRadio.setOrientation(Orientation.HORIZONTAL);
final Radio allExps = new Radio();
allExps.setBoxLabel(ALL_EXPERIMENTS_TEXT);
experimentRadio.add(allExps);
final Radio oneExps = new Radio();
oneExps.setBoxLabel(SINGLE_EXPERIMENT_TEXT);
experimentRadio.add(oneExps);
experimentRadio.setValue(isAllExperimentsChoosen() ? allExps : oneExps);
experimentRadio.setAutoHeight(true);
experimentRadio.addListener(Events.Change, new Listener<BaseEvent>()
{
public void handleEvent(BaseEvent be)
{
if (allExps.getValue())
{
singleExperimentChooser.getChooserField().setEnabled(false);
singleExperimentChooser.getChooserField()
.setEmptyText(ALL_EXPERIMENTS_TEXT);
experimentCriteriaHolder.setCriteria(ExperimentSearchCriteria
.createAllExperiments());
refreshAction.execute();
} else
{
singleExperimentChooser.getChooserField().setEmptyText(
CHOOSE_ONE_EXPERIMENT_TEXT);
singleExperimentChooser.getChooserField().setEnabled(true);
if (singleExperimentChooserStateOrNull == null)
{
experimentCriteriaHolder.setCriteria(null);
} else
{
experimentCriteriaHolder.setCriteria(ExperimentSearchCriteria
.createExperiment(singleExperimentChooserStateOrNull));
refreshAction.execute();
}
}
}
});
return experimentRadio;
}
private void chooseSingleExperiment(final ExperimentChooserField chooserField,
Experiment experiment)
{
SingleExperimentSearchCriteria singleExperiment =
new SingleExperimentSearchCriteria(experiment.getId(), experiment.getPermId(),
experiment.getIdentifier());
updateSingleExperimentChooser(chooserField, singleExperiment);
experimentCriteriaHolder.setCriteria(ExperimentSearchCriteria
.createExperiment(singleExperiment));
refreshAction.execute();
}
private void updateSingleExperimentChooser(ExperimentChooserField chooserField,
SingleExperimentSearchCriteria singleExperiment)
{
this.singleExperimentChooserStateOrNull = singleExperiment;
chooserField.updateValue(new ExperimentIdentifier(singleExperiment
.getExperimentIdentifier()));
}
}
\ No newline at end of file
......@@ -21,16 +21,9 @@ import java.util.Date;
import java.util.List;
import java.util.Set;
import com.extjs.gxt.ui.client.Style.Orientation;
import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.widget.Component;
import com.extjs.gxt.ui.client.widget.Label;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
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.grid.ColumnData;
import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer;
......@@ -50,15 +43,11 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.help.HelpP
import ch.systemsx.cisd.openbis.generic.client.web.client.application.model.BaseEntityModel;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.TypedTableGrid;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.columns.framework.LinkExtractor;
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.field.IChosenEntityListener;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.ColumnDefsAndConfigs;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.ICellListenerAndLinkGenerator;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.IDisposableComponent;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.listener.OpenEntityDetailsTabAction;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.DefaultResultSetConfig;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.ExperimentIdentifier;
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.IEntityInformationHolderWithIdentifier;
......@@ -84,8 +73,8 @@ import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ImageDatasetPa
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellContent;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellSearchCriteria;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellSearchCriteria.ExperimentSearchCriteria;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellSearchCriteria.ExperimentSearchCriteriaHolder;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellSearchCriteria.MaterialSearchCriteria;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellSearchCriteria.SingleExperimentSearchCriteria;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.grids.WellSearchGridColumnIds;
/**
......@@ -98,12 +87,6 @@ public class WellSearchGrid extends TypedTableGrid<WellContent>
private static final String CHANNEL_CHOOSER_LABEL = "Channel:";
private static final String SINGLE_EXPERIMENT_TEXT = "Single experiment";
private static final String ALL_EXPERIMENTS_TEXT = "All experiments";
private static final String CHOOSE_ONE_EXPERIMENT_TEXT = "Choose one experiment...";
private static final int IMAGE_SIZE_PX = 80;
// by experiment perm id
......@@ -248,9 +231,9 @@ public class WellSearchGrid extends TypedTableGrid<WellContent>
private final MaterialSearchCriteria materialCriteria;
private ExperimentSearchCriteria experimentCriteriaOrNull;
private final ExperimentSearchCriteriaHolder experimentCriteriaHolder;
private SingleExperimentSearchCriteria singleExperimentChooserStateOrNull;
// private ExperimentSearchCriteria experimentCriteriaOrNull;
private ChannelChooserPanel channelChooser;
......@@ -261,7 +244,9 @@ public class WellSearchGrid extends TypedTableGrid<WellContent>
super(viewContext.getCommonViewContext(), BROWSER_ID, experimentCriteriaOrNull != null,
DisplayTypeIDGenerator.PLATE_MATERIAL_REVIEWER);
this.viewContext = viewContext;
this.experimentCriteriaOrNull = experimentCriteriaOrNull;
this.experimentCriteriaHolder =
new ExperimentSearchCriteriaHolder(experimentCriteriaOrNull);
this.materialCriteria = materialCriteria;
final IDefaultChannelState defaultChannelState =
......@@ -521,129 +506,8 @@ public class WellSearchGrid extends TypedTableGrid<WellContent>
private Component createExperimentChooser()
{
LayoutContainer container = new LayoutContainer();
container.setWidth(400);
ExperimentChooserFieldAdaptor singleExperimentChooser = createSingleExperimentChooser();
RadioGroup experimentRadioChooser = createExperimentRadio(singleExperimentChooser);
container.add(experimentRadioChooser);
container.add(singleExperimentChooser.getField());
return container;
}
private ExperimentChooserFieldAdaptor createSingleExperimentChooser()
{
ExperimentChooserFieldAdaptor experimentChooser =
ExperimentChooserField.create("", true, null, viewContext.getCommonViewContext());
final ExperimentChooserField chooserField = experimentChooser.getChooserField();
chooserField
.addChosenEntityListener(new IChosenEntityListener<TableModelRowWithObject<Experiment>>()
{
public void entityChosen(TableModelRowWithObject<Experiment> row)
{
if (row != null)
{
chooseSingleExperiment(chooserField, row.getObjectOrNull());
}
}
});
chooserField.setEditable(false);
if (experimentCriteriaOrNull != null && experimentCriteriaOrNull.tryGetExperiment() != null)
{
// we search in a single experiment
updateSingleExperimentChooser(chooserField, experimentCriteriaOrNull.tryGetExperiment());
} else
{
// we search in all experiments or single experiment has not been chosen
this.singleExperimentChooserStateOrNull = null;
chooserField.reset();
}
if (experimentCriteriaOrNull == null || experimentCriteriaOrNull.tryGetExperiment() != null)
{
chooserField.setEmptyText(CHOOSE_ONE_EXPERIMENT_TEXT);
} else
{
chooserField.setEmptyText(ALL_EXPERIMENTS_TEXT);
}
return experimentChooser;
}
private void chooseSingleExperiment(final ExperimentChooserField chooserField,
Experiment experiment)
{
SingleExperimentSearchCriteria singleExperiment =
new SingleExperimentSearchCriteria(experiment.getId(), experiment.getPermId(),
experiment.getIdentifier());
updateSingleExperimentChooser(chooserField, singleExperiment);
this.experimentCriteriaOrNull =
ExperimentSearchCriteria.createExperiment(singleExperiment);
refresh();
}
private void updateSingleExperimentChooser(ExperimentChooserField chooserField,
SingleExperimentSearchCriteria singleExperiment)
{
this.singleExperimentChooserStateOrNull = singleExperiment;
chooserField.updateValue(new ExperimentIdentifier(singleExperiment
.getExperimentIdentifier()));
}
private boolean isAllExperimentsChoosen()
{
return experimentCriteriaOrNull != null
&& experimentCriteriaOrNull.tryGetExperiment() == null;
}
private RadioGroup createExperimentRadio(
final ExperimentChooserFieldAdaptor singleExperimentChooser)
{
final RadioGroup experimentRadio = new RadioGroup();
experimentRadio.setSelectionRequired(true);
experimentRadio.setOrientation(Orientation.HORIZONTAL);
final Radio allExps = new Radio();
allExps.setBoxLabel(ALL_EXPERIMENTS_TEXT);
experimentRadio.add(allExps);
final Radio oneExps = new Radio();
oneExps.setBoxLabel(SINGLE_EXPERIMENT_TEXT);
experimentRadio.add(oneExps);
experimentRadio.setValue(isAllExperimentsChoosen() ? allExps : oneExps);
experimentRadio.setAutoHeight(true);
experimentRadio.addListener(Events.Change, new Listener<BaseEvent>()
{
public void handleEvent(BaseEvent be)
{
if (allExps.getValue())
{
singleExperimentChooser.getChooserField().setEnabled(false);
singleExperimentChooser.getChooserField()
.setEmptyText(ALL_EXPERIMENTS_TEXT);
experimentCriteriaOrNull = ExperimentSearchCriteria.createAllExperiments();
refresh();
} else
{
singleExperimentChooser.getChooserField().setEmptyText(
CHOOSE_ONE_EXPERIMENT_TEXT);
singleExperimentChooser.getChooserField().setEnabled(true);
if (singleExperimentChooserStateOrNull == null)
{
experimentCriteriaOrNull = null;
} else
{
experimentCriteriaOrNull =
ExperimentSearchCriteria
.createExperiment(singleExperimentChooserStateOrNull);
refresh();
}
}
}
});
return experimentRadio;
return new SingleOrAllExperimentsChooser(viewContext, experimentCriteriaHolder,
createRefreshGridAction());
}
@Override
......@@ -714,6 +578,8 @@ public class WellSearchGrid extends TypedTableGrid<WellContent>
DefaultResultSetConfig<String, TableModelRowWithObject<WellContent>> resultSetConfig,
final AsyncCallback<TypedTableResultSet<WellContent>> callback)
{
ExperimentSearchCriteria experimentCriteriaOrNull =
experimentCriteriaHolder.tryGetCriteria();
assert experimentCriteriaOrNull != null : "experiment not specified";
WellSearchCriteria searchCriteria =
......
......@@ -66,6 +66,7 @@ separator: "Separator",
// Material Viewer
//
plate_locations: "Plate Locations",
MATERIAL_MERGED_SUMMARY_SECTION_TITLE: "Summary",
MATERIAL_REPLICA_SUMMARY_SECTION_TITLE: "{0} Summary",
//
......
......@@ -90,6 +90,27 @@ public class WellSearchCriteria implements ISerializable
}
}
public static final class ExperimentSearchCriteriaHolder
{
private ExperimentSearchCriteria criteriaOrNull;
public ExperimentSearchCriteriaHolder(ExperimentSearchCriteria criteriaOrNull)
{
this.criteriaOrNull = criteriaOrNull;
}
public ExperimentSearchCriteria tryGetCriteria()
{
return criteriaOrNull;
}
public void setCriteria(ExperimentSearchCriteria criteria)
{
this.criteriaOrNull = criteria;
}
}
/** Points to one experiment, all experiments of a project or all accessible experiments. */
public static final class ExperimentSearchCriteria implements IsSerializable, Serializable
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment