diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/DisplaySettingsManager.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/DisplaySettingsManager.java index dc44f1caa92800e6ef4ceb49b0cf91def05f5a3e..d6e4ecefa29ee488d6a22834b3ac7c5d06fa72bd 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/DisplaySettingsManager.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/DisplaySettingsManager.java @@ -30,6 +30,7 @@ import com.extjs.gxt.ui.client.util.DelayedTask; import com.extjs.gxt.ui.client.widget.grid.ColumnConfig; import com.extjs.gxt.ui.client.widget.grid.ColumnModel; import com.extjs.gxt.ui.client.widget.grid.Grid; +import com.google.gwt.user.client.rpc.IsSerializable; import ch.systemsx.cisd.openbis.generic.client.web.client.application.CommonViewContext.ClientStaticState; import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IDelegatedAction; @@ -372,14 +373,15 @@ public class DisplaySettingsManager /** @deprecated Should be used only by specific display settings manager */ @Deprecated - public final Object tryGetTechnologySpecificSettings(String technologyName) + public final IsSerializable tryGetTechnologySpecificSettings(String technologyName) { return displaySettings.getTechnologySpecificSettings().get(technologyName); } /** @deprecated Should be used only by specific display settings manager */ @Deprecated - public final void setTechnologySpecificSettings(String technologyName, Object newSettings) + public final void setTechnologySpecificSettings(String technologyName, + IsSerializable newSettings) { displaySettings.getTechnologySpecificSettings().put(technologyName, newSettings); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DisplaySettings.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DisplaySettings.java index 4f16951548a96150352ff3824697ee5d32785a90..f90ac9e5f713ccceff2bbaaa930a14721c6e87a0 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DisplaySettings.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DisplaySettings.java @@ -18,7 +18,6 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto; import java.io.Serializable; import java.util.HashMap; -import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -41,9 +40,10 @@ public class DisplaySettings implements Serializable, IsSerializable private static final long serialVersionUID = 1L; private Map<String, List<ColumnSetting>> columnSettings = - new LinkedHashMap<String, List<ColumnSetting>>(); + new HashMap<String, List<ColumnSetting>>(); - private Map<String, Object> technologySpecificSettings = new HashMap<String, Object>(); + private Map<String, IsSerializable> technologySpecificSettings = + new HashMap<String, IsSerializable>(); private Map<String, String> tabSettings = new HashMap<String, String>(); @@ -64,11 +64,11 @@ public class DisplaySettings implements Serializable, IsSerializable /** @deprecated Should be used only by DisplaySettingsManager. */ @Deprecated - public Map<String, Object> getTechnologySpecificSettings() + public Map<String, IsSerializable> getTechnologySpecificSettings() { if (technologySpecificSettings == null) { - technologySpecificSettings = new HashMap<String, Object>(); + technologySpecificSettings = new HashMap<String, IsSerializable>(); } return technologySpecificSettings; } @@ -149,7 +149,8 @@ public class DisplaySettings implements Serializable, IsSerializable // for serialization @SuppressWarnings("unused") - private void setTechnologySpecificSettings(Map<String, Object> technologySpecificSettings) + private void setTechnologySpecificSettings( + Map<String, IsSerializable> technologySpecificSettings) { this.technologySpecificSettings = technologySpecificSettings; } diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/ScreeningDisplaySettingsManager.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/ScreeningDisplaySettingsManager.java new file mode 100644 index 0000000000000000000000000000000000000000..de9a1c2483d2788e933e827acf7249aaf4c47a6c --- /dev/null +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/ScreeningDisplaySettingsManager.java @@ -0,0 +1,61 @@ +/* + * Copyright 2010 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; + +import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.DisplaySettingsManager; +import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.IScreeningClientServiceAsync; +import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ScreeningDisplaySettings; + +/** + * @author Piotr Buczek + */ +public class ScreeningDisplaySettingsManager +{ + private final ScreeningDisplaySettings screeningSettings; + + @SuppressWarnings("deprecation") + public ScreeningDisplaySettingsManager(IViewContext<IScreeningClientServiceAsync> viewContext) + { + DisplaySettingsManager displaySettingsManager = viewContext.getDisplaySettingsManager(); + ScreeningDisplaySettings settingsOrNull = + (ScreeningDisplaySettings) displaySettingsManager + .tryGetTechnologySpecificSettings(viewContext.getTechnology()); + if (settingsOrNull == null) + { + settingsOrNull = new ScreeningDisplaySettings(); + displaySettingsManager.setTechnologySpecificSettings(viewContext.getTechnology(), + settingsOrNull); + } + screeningSettings = settingsOrNull; + } + + // delegate + + @SuppressWarnings("deprecation") + public String tryGetDefaultChannel(String displayTypeID) + { + return screeningSettings.getDefaultChannels().get(displayTypeID); + } + + @SuppressWarnings("deprecation") + public void setDefaultChannel(String displayTypeID, String channel) + { + screeningSettings.getDefaultChannels().put(displayTypeID, channel); + } + +} diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/ScreeningDisplayTypeIDGenerator.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/ScreeningDisplayTypeIDGenerator.java index 3f19a5e49eab7bf6dc023d5545f1dc644f122cba..71c8f99e76625a9538ce84c23f48c18f3bf04e47 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/ScreeningDisplayTypeIDGenerator.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/ScreeningDisplayTypeIDGenerator.java @@ -19,14 +19,15 @@ package ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application; import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.IDisplayTypeIDGenerator; /** - * IDisplayTypeIDGenerator specifit to screening. + * IDisplayTypeIDGenerator specific to screening. * * @author Izabela Adamczyk */ public enum ScreeningDisplayTypeIDGenerator implements IDisplayTypeIDGenerator { - PLATE_METADATA_GRID("plate-metadata-grid"), ; + PLATE_METADATA_GRID("plate-metadata-grid"), EXPERIMENT_CHANNEL("experiment-channel"), + WELL_SEARCH_CHANNEL("well-search-channel"); private final String genericNameOrPrefix; diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/ScreeningViewContext.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/ScreeningViewContext.java index cf1b2dc91584c8229f2251a6a4722fc5c4d215f2..6ebd766915883f4001820b55350e80340517b539 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/ScreeningViewContext.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/ScreeningViewContext.java @@ -47,4 +47,11 @@ public final class ScreeningViewContext extends handlerRegistry.registerHandler(new PlateMetadataBrowserLocatorResolver(this)); handlerRegistry.registerHandler(new PlateMaterialReviewerLocatorResolver(this)); } + + public static ScreeningDisplaySettingsManager getTechnologySpecificDisplaySettingsManager( + IViewContext<IScreeningClientServiceAsync> viewContext) + { + return new ScreeningDisplaySettingsManager(viewContext); + } + } diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/ChannelChooser.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/ChannelChooser.java index b10cc8c9c418dbd41af25d9a1b95fc25c6719472..d9bdd7ab82c09a4aa21f9cee561dffa2ae63b07e 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/ChannelChooser.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/ChannelChooser.java @@ -48,8 +48,8 @@ class ChannelChooser } public static LayoutContainer createViewerWithChannelChooser( - final IChanneledViewerFactory viewerFactory, final DefaultChannelState channelState, - List<String> channelsNames) + final IChanneledViewerFactory viewerFactory, + final IDefaultChannelState defaultChannelState, List<String> channelsNames) { final LayoutContainer container = new LayoutContainer(); container.setLayout(new RowLayout()); @@ -59,11 +59,15 @@ class ChannelChooser container.add(new Label("No images available")); return container; } - String initialChannel = channelState.getDefaultChannel(channelsNames); + String initialChannel = defaultChannelState.tryGetDefaultChannel(); + if (initialChannel == null) + { + initialChannel = channelsNames.get(0); + } if (channelsNames.size() > 1) { ComboBox<SimpleComboValue<String>> channelChooser = - new ChannelComboBox(channelsNames, initialChannel); + new ChannelComboBox(channelsNames, defaultChannelState); viewerFactory.setChannelChooser(channelChooser); channelChooser .addSelectionChangedListener(new SelectionChangedListener<SimpleComboValue<String>>() @@ -74,7 +78,6 @@ class ChannelChooser { String value = se.getSelectedItem().getValue(); Widget viewerWidget = viewerFactory.create(value); - channelState.setDefaultChannel(value); GuiUtils.replaceLastItem(container, viewerWidget); } }); diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/ChannelComboBox.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/ChannelComboBox.java index bd940db43ad5ab748868e2567a4a948dce9219b7..5c0e61c39a84c6b167a79e7b96090e5326207e01 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/ChannelComboBox.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/ChannelComboBox.java @@ -19,6 +19,7 @@ package ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application. import java.util.ArrayList; 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.widget.form.SimpleComboBox; import com.extjs.gxt.ui.client.widget.form.SimpleComboValue; @@ -33,41 +34,57 @@ import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ScreeningConst public class ChannelComboBox extends SimpleComboBox<String> { + private IDefaultChannelState defaultChannelState; + /** * Creates empty {@link ChannelComboBox}. */ - public ChannelComboBox() + public ChannelComboBox(final IDefaultChannelState defaultChannelState) { setTriggerAction(TriggerAction.ALL); setAllowBlank(false); setEditable(false); setEmptyText("Choose..."); + this.defaultChannelState = defaultChannelState; + addSelectionChangedListener(new SelectionChangedListener<SimpleComboValue<String>>() + { + @Override + public void selectionChanged(SelectionChangedEvent<SimpleComboValue<String>> se) + { + String selectedValueOrNull = se.getSelectedItem().getValue(); + if (selectedValueOrNull != null) + { + defaultChannelState.setDefaultChannel(selectedValueOrNull); + } + } + }); } /** * Creates {@link ChannelComboBox} with initial list of values and selects given initial value. */ - public ChannelComboBox(List<String> names, String initialValue) + public ChannelComboBox(List<String> names, IDefaultChannelState defaultChannelState) { - this(); + this(defaultChannelState); addUniqueCodes(names); - if (initialValue != null) - { - setSimpleValue(initialValue); - } else - { - autoselect(); - } + autoselect(); } /** - * Selects first element if nothing was selected before. + * Selects default channel if such an information was saved before. Otherwise first element if + * nothing was selected before. */ private void autoselect() { if (getStore().getModels().size() > 0 && getValue() == null) { - setValue(getStore().getModels().get(0)); + if (defaultChannelState != null && defaultChannelState.tryGetDefaultChannel() != null) + { + setSimpleValue(defaultChannelState.tryGetDefaultChannel()); + } else + { + setValue(getStore().getModels().get(0)); + } } } diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/DefaultChannelState.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/DefaultChannelState.java deleted file mode 100644 index 412b9885a7d24db77867ed47621d103d59f744b3..0000000000000000000000000000000000000000 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/DefaultChannelState.java +++ /dev/null @@ -1,33 +0,0 @@ -package ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.detailviewers; - -import java.util.List; - -/** - * Allows to get and set the channel which is chosen by default when well images are shown. Channel - * 0 consists of all other channels merged. - * - * @author Tomasz Pylak - */ -public class DefaultChannelState -{ - private String defaultChannel = null; - - public DefaultChannelState() - { - - } - - public String getDefaultChannel(List<String> channelsNames) - { - if (defaultChannel == null) - { - defaultChannel = channelsNames.get(0); - } - return defaultChannel; - } - - public void setDefaultChannel(String value) - { - this.defaultChannel = value; - } -} \ No newline at end of file diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/IDefaultChannelState.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/IDefaultChannelState.java new file mode 100644 index 0000000000000000000000000000000000000000..2c5a07eca70e80dd889b507dc22a4b89e101ae59 --- /dev/null +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/IDefaultChannelState.java @@ -0,0 +1,14 @@ +package ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.detailviewers; + + +/** + * Allows to get and set the channel which is chosen by default when images are shown in a specific context. + * + * @author Piotr Buczek + */ +public interface IDefaultChannelState +{ + public String tryGetDefaultChannel(); + + public void setDefaultChannel(String value); +} \ No newline at end of file diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/WellContentDialog.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/WellContentDialog.java index 99cdcd1072dd23432eb2397ddee2e788cae2352f..66849a4ca876ffc5c5ab0e700cb0f01a15ae2405 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/WellContentDialog.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/WellContentDialog.java @@ -61,6 +61,9 @@ import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.IScreeningCli import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.ParameterNames; import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.Constants; import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.Dict; +import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.ScreeningDisplaySettingsManager; +import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.ScreeningDisplayTypeIDGenerator; +import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.ScreeningViewContext; import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.detailviewers.ChannelChooser.IChanneledViewerFactory; import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.ui.columns.specific.ScreeningLinkExtractor; import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.utils.GuiUtils; @@ -102,16 +105,44 @@ public class WellContentDialog extends Dialog * A dialog which shows the content of the well (static or a timepoints movie). */ public static void showContentDialog(final WellData wellData, - DatasetImagesReference imageDatasetOrNull, DefaultChannelState channelState, + DatasetImagesReference imageDatasetOrNull, final IViewContext<IScreeningClientServiceAsync> viewContext) { final WellContentDialog contentDialog = createContentDialog(wellData, viewContext, imageDatasetOrNull != null); - showContentDialog(contentDialog, imageDatasetOrNull, channelState, viewContext); + + final IDefaultChannelState defaultChannelState = + createDefaultChannelState(viewContext, wellData.getExperiment().getPermId()); + + showContentDialog(contentDialog, imageDatasetOrNull, defaultChannelState, viewContext); + } + + private static IDefaultChannelState createDefaultChannelState( + final IViewContext<IScreeningClientServiceAsync> viewContext, + final String experimentPermId) + { + final ScreeningDisplaySettingsManager screeningDisplaySettingManager = + ScreeningViewContext.getTechnologySpecificDisplaySettingsManager(viewContext); + final ScreeningDisplayTypeIDGenerator wellSearchChannelIdGenerator = + ScreeningDisplayTypeIDGenerator.EXPERIMENT_CHANNEL; + final String displayTypeID = wellSearchChannelIdGenerator.createID(experimentPermId); + + return new IDefaultChannelState() + { + public void setDefaultChannel(String channel) + { + screeningDisplaySettingManager.setDefaultChannel(displayTypeID, channel); + } + + public String tryGetDefaultChannel() + { + return screeningDisplaySettingManager.tryGetDefaultChannel(displayTypeID); + } + }; } private static void showContentDialog(final WellContentDialog contentDialog, - final DatasetImagesReference imagesOrNull, DefaultChannelState channelState, + final DatasetImagesReference imagesOrNull, IDefaultChannelState channelState, final IViewContext<IScreeningClientServiceAsync> viewContext) { if (imagesOrNull != null && imagesOrNull.getImageParameters().isMultidimensional()) @@ -195,15 +226,15 @@ public class WellContentDialog extends Dialog new WellContentDialog(wellContent.getWell(), null, wellContent.tryGetLocation(), hasDataSet, getExperiment(wellContent.getExperiment()), viewContext); - // NOTE: channel chooser state will be not reused among different dialogs - DefaultChannelState channelState = new DefaultChannelState(); - showContentDialog(contentDialog, imageDatasetOrNull, channelState, viewContext); + final IDefaultChannelState defaultChannelState = + createDefaultChannelState(viewContext, wellContent.getExperiment().getPermId()); + showContentDialog(contentDialog, imageDatasetOrNull, defaultChannelState, viewContext); } // --------------- STATIC IMAGES VIEWER private static void showStaticImageDialog(final WellContentDialog contentDialog, - final DatasetImagesReference imageDatasetOrNull, DefaultChannelState channelState, + final DatasetImagesReference imageDatasetOrNull, IDefaultChannelState channelState, final IViewContext<?> viewContext) { WellLocation wellLocation = contentDialog.wellLocationOrNull; @@ -258,7 +289,7 @@ public class WellContentDialog extends Dialog // --------------- TIMEPOINT IMAGES PLAYER private static void showTimepointImageDialog(final WellContentDialog contentDialog, - final DatasetImagesReference imageDataset, final DefaultChannelState channelState, + final DatasetImagesReference imageDataset, final IDefaultChannelState channelState, final IViewContext<IScreeningClientServiceAsync> viewContext) { assert imageDataset != null; diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/WellSearchGrid.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/WellSearchGrid.java index c88aed47ba7467410c50a378970c427891eb62fc..70e36b8e198831d816b4720abb01f718611ef617 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/WellSearchGrid.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/WellSearchGrid.java @@ -76,6 +76,9 @@ import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.IScreeningCli import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.ClientPluginFactory; 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.client.web.client.application.ScreeningDisplaySettingsManager; +import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.ScreeningDisplayTypeIDGenerator; +import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.ScreeningViewContext; import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.detailviewers.ChannelChooser.IChanneledViewerFactory; import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.ui.columns.specific.ScreeningLinkExtractor; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.DatasetImagesReference; @@ -236,7 +239,28 @@ public class WellSearchGrid extends TypedTableGrid<WellContent> this.viewContext = viewContext; this.experimentCriteriaOrNull = experimentCriteriaOrNull; this.materialCriteria = materialCriteria; - channelChooser = new ChannelComboBox(); + + final ScreeningDisplaySettingsManager screeningDisplaySettingManager = + ScreeningViewContext.getTechnologySpecificDisplaySettingsManager(viewContext); + final ScreeningDisplayTypeIDGenerator wellSearchChannelIdGenerator = + ScreeningDisplayTypeIDGenerator.WELL_SEARCH_CHANNEL; + final String wellSearchChannelDisplayTypeId = wellSearchChannelIdGenerator.createID(); + final IDefaultChannelState defaultChannelState = new IDefaultChannelState() + { + public void setDefaultChannel(String channel) + { + screeningDisplaySettingManager.setDefaultChannel( + wellSearchChannelDisplayTypeId, channel); + } + + public String tryGetDefaultChannel() + { + return screeningDisplaySettingManager + .tryGetDefaultChannel(wellSearchChannelDisplayTypeId); + } + }; + + channelChooser = new ChannelComboBox(defaultChannelState); linkWellContent(); linkExperiment(); linkPlate(); diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/heatmaps/PlateLayouter.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/heatmaps/PlateLayouter.java index 02c58353a97c5da34cd78a9075e6827e7eeb6154..d030905e6e03e295b5aa43f7d1610eb2c740c5aa 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/heatmaps/PlateLayouter.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/heatmaps/PlateLayouter.java @@ -44,7 +44,6 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IMess import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.IScreeningClientServiceAsync; import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.ScreeningViewContext; -import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.detailviewers.DefaultChannelState; import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.detailviewers.PlateStyleSetter; import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.detailviewers.WellContentDialog; import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.detailviewers.WellData; @@ -208,13 +207,13 @@ public class PlateLayouter int colsNum = getColumnsNum(wellMatrix); Component[][] wells = new Component[rowsNum][colsNum]; - DefaultChannelState channelState = new DefaultChannelState(); + for (int row = 0; row < rowsNum; row++) { for (int col = 0; col < colsNum; col++) { WellData wellData = wellMatrix[row][col]; - wells[row][col] = createWellWidget(wellData, channelState, model, viewContext); + wells[row][col] = createWellWidget(wellData, model, viewContext); } } return wells; @@ -285,8 +284,7 @@ public class PlateLayouter } private static Component createWellWidget(final WellData wellData, - final DefaultChannelState channelState, final PlateLayouterModel model, - final ScreeningViewContext screeningViewContext) + final PlateLayouterModel model, final ScreeningViewContext screeningViewContext) { Component widget = createWellBox(wellData); @@ -298,26 +296,25 @@ public class PlateLayouter DatasetImagesReference dataset = model.tryGetImageDataset(); if (dataset == null) { - WellContentDialog.showContentDialog(wellData, null, channelState, - screeningViewContext); + WellContentDialog.showContentDialog(wellData, null, screeningViewContext); } else { // Reload meta data because they might be out dated especially when // image transformer factory has changed. For the image URL the // signature of the factory is needed to distinguish them. This is important // because Web browser cache images. - service.getPlateContentForDataset(new TechId(dataset - .getDatasetId()), new AbstractAsyncCallback<PlateImages>( - screeningViewContext) + service.getPlateContentForDataset(new TechId(dataset.getDatasetId()), + new AbstractAsyncCallback<PlateImages>(screeningViewContext) + { + @Override + protected void process(PlateImages plateContent) { - @Override - protected void process(PlateImages plateContent) - { - DatasetImagesReference ds = plateContent.getImagesDataset(); - WellContentDialog.showContentDialog(wellData, ds, channelState, - screeningViewContext); - } - }); + DatasetImagesReference ds = + plateContent.getImagesDataset(); + WellContentDialog.showContentDialog(wellData, ds, + screeningViewContext); + } + }); } } }); diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/basic/dto/ScreeningDisplaySettings.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/basic/dto/ScreeningDisplaySettings.java new file mode 100644 index 0000000000000000000000000000000000000000..3683f91e36b146fa625566f6b1cf75da9fac1794 --- /dev/null +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/basic/dto/ScreeningDisplaySettings.java @@ -0,0 +1,52 @@ +/* + * Copyright 2010 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.shared.basic.dto; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import com.google.gwt.user.client.rpc.IsSerializable; + +/** + * Screening specific display settings. + * + * @author Piotr Buczek + */ +public class ScreeningDisplaySettings implements Serializable, IsSerializable +{ + private static final long serialVersionUID = 1L; + + private Map<String/* displayTypeID */, String/* channel name */> defaultChannels = + new HashMap<String, String>(); + + /** @deprecated Should be used only by ScreeningDisplaySettingsManager. */ + @Deprecated + public Map<String, String> getDefaultChannels() + { + return defaultChannels; + } + + // for serialization + + @SuppressWarnings("unused") + private void setDefaultChannels(Map<String, String> defaultChannels) + { + this.defaultChannels = defaultChannels; + } + +}