From 08beb30125d44452c12f9f38e963512cc2485ef7 Mon Sep 17 00:00:00 2001 From: buczekp <buczekp> Date: Wed, 6 Jul 2011 07:31:08 +0000 Subject: [PATCH] [LMS-2354] minor UI improvements: - changed heading/label when showing material in all experiments from a single project - hide heading in simple/normal mode SVN: 22004 --- .../client/web/client/application/Dict.java | 3 ++ ...alFeaturesFromAllExperimentsComponent.java | 30 ++++++++++++++++--- ...aterialFeaturesFromAllExperimentsGrid.java | 4 +-- .../SingleOrAllExperimentsChooser.java | 11 +++++++ .../utils/MaterialComponentUtils.java | 14 ++++++--- .../client/web/public/screening-dictionary.js | 1 + .../shared/basic/dto/WellSearchCriteria.java | 12 ++++++++ 7 files changed, 65 insertions(+), 10 deletions(-) diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/Dict.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/Dict.java index 808f61b9ef4..b89ece68f91 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/Dict.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/Dict.java @@ -113,6 +113,9 @@ public final class Dict extends ch.systemsx.cisd.openbis.generic.client.web.clie public static final String MATERIAL_IN_ALL_ASSAYS = "MATERIAL_IN_ALL_ASSAYS"; + public static final String MATERIAL_IN_ALL_ASSAYS_OF_PROJECT = + "MATERIAL_IN_ALL_ASSAYS_OF_PROJECT"; + private Dict() { // Can not be instantiated. diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/MaterialFeaturesFromAllExperimentsComponent.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/MaterialFeaturesFromAllExperimentsComponent.java index 59585851dbf..bda748f93aa 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/MaterialFeaturesFromAllExperimentsComponent.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/MaterialFeaturesFromAllExperimentsComponent.java @@ -18,6 +18,7 @@ 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.ui.grid.IDisposableComponent; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.BasicProjectIdentifier; 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; @@ -55,11 +56,32 @@ public class MaterialFeaturesFromAllExperimentsComponent final IDisposableComponent gridComponent = MaterialFeaturesFromAllExperimentsGrid.create(screeningViewContext, material, experimentSearchCriteria); - String headingText = - screeningViewContext.getMessage(Dict.MATERIAL_IN_ALL_ASSAYS, - MaterialComponentUtils.getMaterialFullName(material, true)); + String headingTextOtNull = tryCreateHeadingText(material, experimentSearchCriteria); return MaterialComponentUtils.createMaterialViewer(screeningViewContext, material, - headingText, gridComponent); + headingTextOtNull, gridComponent); } + private String tryCreateHeadingText(Material material, + ExperimentSearchByProjectCriteria experimentSearchCriteria) + { + if (screeningViewContext.getModel().isEmbeddedMode()) + { + BasicProjectIdentifier projectIdentifierOrNull = + experimentSearchCriteria.tryGetProjectIdentifier(); + if (projectIdentifierOrNull != null) + { + return screeningViewContext.getMessage(Dict.MATERIAL_IN_ALL_ASSAYS_OF_PROJECT, + MaterialComponentUtils.getMaterialFullName(material, true), + projectIdentifierOrNull); + } else + { + return screeningViewContext.getMessage(Dict.MATERIAL_IN_ALL_ASSAYS, + MaterialComponentUtils.getMaterialFullName(material, true)); + } + } else + { + // header is not needed in SIMPLE & NORMAL view mode because there the context is clear + return null; + } + } } diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/MaterialFeaturesFromAllExperimentsGrid.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/MaterialFeaturesFromAllExperimentsGrid.java index 3202c0f4bec..ab1e516cfae 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/MaterialFeaturesFromAllExperimentsGrid.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/MaterialFeaturesFromAllExperimentsGrid.java @@ -38,6 +38,7 @@ import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.D 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.ExperimentReference; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.MaterialSimpleFeatureVectorSummary; +import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellSearchCriteria; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellSearchCriteria.ExperimentSearchByProjectCriteria; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellSearchCriteria.ExperimentSearchCriteria; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.grids.MaterialFeatureVectorsFromAllExperimentsGridColumnIDs; @@ -152,8 +153,7 @@ public class MaterialFeaturesFromAllExperimentsGrid extends private boolean getRestrictGlobalScopeLinkToProject() { - return experimentSearchCriteria != null - && experimentSearchCriteria.tryGetProjectIdentifier() != null; + return WellSearchCriteria.shouldRestrictScopeToProject(experimentSearchCriteria); } private ExperimentSearchCriteria getExperimentCriteria( diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/SingleOrAllExperimentsChooser.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/SingleOrAllExperimentsChooser.java index a03755bf345..19664b5b3eb 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/SingleOrAllExperimentsChooser.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/SingleOrAllExperimentsChooser.java @@ -46,6 +46,8 @@ class SingleOrAllExperimentsChooser extends LayoutContainer private static final String ALL_EXPERIMENTS_TEXT = "All experiments"; + private static final String ALL_EXPERIMENTS_FROM_PROJECT_TEXT = "All experiments from "; + private static final String CHOOSE_ONE_EXPERIMENT_TEXT = "Choose one experiment..."; private SingleExperimentSearchCriteria singleExperimentChooserStateOrNull; @@ -140,6 +142,15 @@ class SingleOrAllExperimentsChooser extends LayoutContainer experimentRadio.setOrientation(Orientation.HORIZONTAL); final Radio allExps = new Radio(); + if (restrictGlobalScopeLinkToProject) + { + String projectIdentifier = + experimentCriteriaHolder.tryGetCriteria().tryGetProjectIdentifier().toString(); + allExps.setBoxLabel(ALL_EXPERIMENTS_FROM_PROJECT_TEXT + projectIdentifier); + } else + { + allExps.setBoxLabel(ALL_EXPERIMENTS_TEXT); + } allExps.setBoxLabel(ALL_EXPERIMENTS_TEXT); experimentRadio.add(allExps); diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/utils/MaterialComponentUtils.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/utils/MaterialComponentUtils.java index 276e50d463e..fb67e01f90a 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/utils/MaterialComponentUtils.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/utils/MaterialComponentUtils.java @@ -114,10 +114,13 @@ public class MaterialComponentUtils return additionalProperties; } - /** Creates a grid with some header on top containing the specified title and entity properties. */ + /** + * Creates a grid with optional header on top containing the specified title and entity + * properties. + */ private static IDisposableComponent createViewer( IViewContext<IScreeningClientServiceAsync> viewContext, - IEntityInformationHolderWithProperties entity, String headingText, + IEntityInformationHolderWithProperties entity, String headingTextOrNull, final IDisposableComponent gridComponent, Map<String/* label */, String/* value */> additionalPropertiesOrNull, String... excludedPropertyCodes) @@ -125,8 +128,11 @@ public class MaterialComponentUtils final LayoutContainer panel = new LayoutContainer(); panel.setLayout(new BorderLayout()); - addHeader(panel, viewContext, headingText, entity, additionalPropertiesOrNull, - excludedPropertyCodes); + if (headingTextOrNull != null) + { + addHeader(panel, viewContext, headingTextOrNull, entity, additionalPropertiesOrNull, + excludedPropertyCodes); + } panel.add(gridComponent.getComponent(), new BorderLayoutData(LayoutRegion.CENTER)); diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/public/screening-dictionary.js b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/public/screening-dictionary.js index 34b53f1bef3..ccc22d70049 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/public/screening-dictionary.js +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/public/screening-dictionary.js @@ -113,6 +113,7 @@ FIND_IN_ALL_ASSAYS: "Find {0} in all experiments", MATERIAL_IN_ASSAY: "{0} in experiment {1}", SHOW_ASSAY: "Show experiment {0}", MATERIAL_IN_ALL_ASSAYS: "{0} in all experiments", +MATERIAL_IN_ALL_ASSAYS_OF_PROJECT: "{0} in all experiments of project {1}", // LAST LINE: KEEP IT AT THE END lastline: "" // we need a line without a comma diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/basic/dto/WellSearchCriteria.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/basic/dto/WellSearchCriteria.java index a925b0df343..f443fba9bc7 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/basic/dto/WellSearchCriteria.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/basic/dto/WellSearchCriteria.java @@ -468,4 +468,16 @@ public class WellSearchCriteria implements ISerializable { return materialCriteria; } + + public static boolean shouldRestrictScopeToProject( + ExperimentSearchCriteria searchCriteria) + { + return searchCriteria != null && searchCriteria.tryGetProjectIdentifier() != null; + } + + public static boolean shouldRestrictScopeToProject( + ExperimentSearchByProjectCriteria searchCriteria) + { + return searchCriteria != null && searchCriteria.tryGetProjectIdentifier() != null; + } } -- GitLab