Skip to content
Snippets Groups Projects
Commit 615da062 authored by anttil's avatar anttil
Browse files

SOB-72 / BIS-106 / SP-225: Embedded well view is initialized with the wrong data set

SVN: 28673
parent 245d6092
No related branches found
No related tags found
No related merge requests found
package ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application;
import java.util.HashMap;
import java.util.Map;
import com.google.gwt.core.client.GWT;
import ch.systemsx.cisd.openbis.generic.client.web.client.ICommonClientServiceAsync;
......@@ -14,6 +17,7 @@ import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.l
import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.locator.ImagingMaterialLocatorResolver;
import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.locator.PlateMetadataBrowserLocatorResolver;
import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.locator.WellSearchLocatorResolver;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ImageDatasetEnrichedReference;
/**
* The <i>screening</i> plugin specific {@link IViewContext} implementation.
......@@ -25,6 +29,9 @@ public final class ScreeningViewContext extends
{
private static final String TECHNOLOGY_NAME = "screening";
private Map<Long /*Plate Id*/, ImageDatasetEnrichedReference> currentlyViewedPlateToDataSetMap =
new HashMap<Long, ImageDatasetEnrichedReference>();
public ScreeningViewContext(final IViewContext<ICommonClientServiceAsync> commonViewContext)
{
super(commonViewContext);
......@@ -66,4 +73,15 @@ public final class ScreeningViewContext extends
return new ScreeningDisplaySettingsManager(viewContext);
}
public ImageDatasetEnrichedReference tryCurrentlyViewedPlateDataSet(Long plateId)
{
return currentlyViewedPlateToDataSetMap.get(plateId);
}
public void setCurrentlyViewedPlateDataSet(Long plateId,
ImageDatasetEnrichedReference dataSet)
{
currentlyViewedPlateToDataSetMap.put(plateId, dataSet);
}
}
......@@ -16,6 +16,7 @@
package ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.detailviewers;
import java.util.ArrayList;
import java.util.List;
import com.extjs.gxt.ui.client.Style.Scroll;
......@@ -90,7 +91,8 @@ public class ImageSampleSection extends TabContent
protected void showContent()
{
final ScreeningViewContext context = getViewContext();
add(new Text(context.getMessage(ch.systemsx.cisd.openbis.generic.client.web.client.application.Dict.LOAD_IN_PROGRESS)));
add(new Text(
context.getMessage(ch.systemsx.cisd.openbis.generic.client.web.client.application.Dict.LOAD_IN_PROGRESS)));
context.getService().getImageDatasetInfosForSample(sampleId,
isWell ? wellLocationOrNull : null, createDisplayImagesCallback(context));
}
......@@ -137,14 +139,37 @@ public class ImageSampleSection extends TabContent
final ScreeningViewContext context = getViewContext();
final LogicalImageLayouter logicalImageLayouter =
new LogicalImageLayouter(context, wellLocationOrNull, images);
ImageDatasetEnrichedReference viewedImageDataSet =
context.tryCurrentlyViewedPlateDataSet(sampleId.getId());
ImageDatasetEnrichedReference currentImageDataSet = images.get(0).getImageDataset();
List<ImageDatasetEnrichedReference> list =
new ArrayList<ImageDatasetEnrichedReference>();
if (null != viewedImageDataSet)
{
for (LogicalImageInfo imageInfos : images)
{
ImageDatasetEnrichedReference ref = imageInfos.getImageDataset();
if (ref.getId() == viewedImageDataSet.getId())
{
currentImageDataSet = ref;
} else
{
list.add(ref);
}
}
}
list.add(0, currentImageDataSet);
final Widget imageDatasetsDetails =
new ImagingDatasetGuiUtils(context)
.createImageDatasetDetailsRow(
logicalImageLayouter.getDatasetImagesReferences(),
list,
logicalImageLayouter);
ImageDatasetEnrichedReference firstImageDataset = images.get(0).getImageDataset();
logicalImageLayouter.changeDisplayedImageDataset(firstImageDataset);
logicalImageLayouter.changeDisplayedImageDataset(currentImageDataSet);
add(imageDatasetsDetails, margins);
add(logicalImageLayouter, margins);
......
......@@ -57,6 +57,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Material;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Sample;
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.ScreeningViewContext;
import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.detailviewers.dto.LogicalImageChannelsReference;
import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.detailviewers.dto.LogicalImageReference;
import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.detailviewers.dto.WellData;
......@@ -548,8 +549,41 @@ public class WellContentDialog extends ImageDialog
private Widget createEntityLink(IEntityInformationHolderWithPermId entity, String label)
{
final ClickHandler listener = new OpenEntityDetailsTabClickListener(entity, viewContext);
final ClickHandler listener =
new WellContentOpenEntityDetailsTabClickLister(entity, viewContext,
this.imageDatasetOrNull);
return LinkRenderer.getLinkWidget(label, listener);
}
private static class WellContentOpenEntityDetailsTabClickLister extends
OpenEntityDetailsTabClickListener
{
private final ImageDatasetEnrichedReference currentDataSet;
private final ScreeningViewContext screeningViewContext;
/**
* @param entity
* @param viewContext
*/
public WellContentOpenEntityDetailsTabClickLister(
IEntityInformationHolderWithPermId entity,
IViewContext<IScreeningClientServiceAsync> viewContext,
ImageDatasetEnrichedReference currentDataSet)
{
super(entity, viewContext);
this.currentDataSet = currentDataSet;
this.screeningViewContext = (ScreeningViewContext) viewContext;
}
@Override
public void onClick(ClickEvent event)
{
screeningViewContext.setCurrentlyViewedPlateDataSet(getEntity().getId(),
currentDataSet);
super.onClick(event);
}
}
}
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