diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/property/PropertyGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/property/PropertyGrid.java index a49829e117ca24e5fc2457840d3441c83fb6edb8..818aee4dacad6c866335af2664d187ae37f2744d 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/property/PropertyGrid.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/property/PropertyGrid.java @@ -167,6 +167,7 @@ public final class PropertyGrid extends Grid { this.properties = properties; assert properties != null : "Unspecified properties."; + resizeRows(properties.size()); addPropertiesToTable(properties, 0); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleViewer.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleViewer.java index 6b1fb106a28f1f3a7c3c8f2ec8be1fed50399758..a72a795df0f82b2cdcc8d4bd3ff93250bf14e4de 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleViewer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleViewer.java @@ -322,7 +322,9 @@ abstract public class GenericSampleViewer extends AbstractViewerWithVerticalSpli final ContentPanel panel = new ContentPanel(); panel.setScrollMode(Scroll.AUTOY); panel.setHeading(getViewContext().getMessage(Dict.SAMPLE_PROPERTIES_HEADING)); + viewContext.log("create property section"); propertyGrid = createPropertyGrid(getViewContext(), sampleId); + propertyGrid.getElement().setId(PROPERTIES_ID_PREFIX + sampleId); updateProperties(sampleGeneration); panel.add(propertyGrid); @@ -344,7 +346,6 @@ abstract public class GenericSampleViewer extends AbstractViewerWithVerticalSpli propertyGrid.resizeRows(0); final Map<String, Object> properties = createProperties(viewContext, sampleGeneration); propertyGrid.setProperties(properties); - propertyGrid.getElement().setId(PROPERTIES_ID_PREFIX + sampleId); Sample sample = sampleGeneration.getParent(); SampleType sampleType = sample.getSampleType(); if (sampleType.isShowParentMetadata()) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/ParentsPropertiesSectionBuilder.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/ParentsPropertiesSectionBuilder.java index b2d8659cacbe92e9dd8ccaa9df511c6fd4478360..458a3e65ddd134b6f22869e98e12c53d956d47de 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/ParentsPropertiesSectionBuilder.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/ParentsPropertiesSectionBuilder.java @@ -106,7 +106,7 @@ class ParentsPropertiesSectionBuilder } if (commonProperties.isEmpty() == false) { - sections.put("Properties common by all parents", commonProperties); + sections.put("Common Parents Properties:", commonProperties); } } for (Sample sample : samples) @@ -121,7 +121,8 @@ class ParentsPropertiesSectionBuilder } if (properties.isEmpty() == false) { - sections.put("Properties of " + sample.getIdentifier(), properties); + sections.put(sample.getIdentifier() + " [" + sample.getSampleType().getCode() + + "]:", properties); } } return sections; diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/ParentsPropertiesSectionBuilderTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/ParentsPropertiesSectionBuilderTest.java index bcc83ad0f543888b51f4cb71f6e6d1e19be09c7f..724fdf7df9335ba58ce5c161ed9c14217ea1c713 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/ParentsPropertiesSectionBuilderTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/ParentsPropertiesSectionBuilderTest.java @@ -46,10 +46,10 @@ public class ParentsPropertiesSectionBuilderTest extends AssertJUnit { ParentsPropertiesSectionBuilder builder = new ParentsPropertiesSectionBuilder(); - builder.addParent(new SampleBuilder("/S/S1").property("answer", "42").getSample()); + builder.addParent(new SampleBuilder("/S/S1").type("A").property("answer", "42").getSample()); Map<String, List<IEntityProperty>> sections = builder.getSections(); - assertEquals("{Properties of /S/S1=[answer: 42]}", sections.toString()); + assertEquals("{/S/S1 [A]:=[answer: 42]}", sections.toString()); } @Test @@ -57,13 +57,13 @@ public class ParentsPropertiesSectionBuilderTest extends AssertJUnit { ParentsPropertiesSectionBuilder builder = new ParentsPropertiesSectionBuilder(); - builder.addParent(new SampleBuilder("/S/S1").property("answer", "43").getSample()); - builder.addParent(new SampleBuilder("/S/S2").property("answer", "42") + builder.addParent(new SampleBuilder("/S/S1").type("A").property("answer", "43").getSample()); + builder.addParent(new SampleBuilder("/S/S2").type("B").property("answer", "42") .property("question", "6 x 7").getSample()); Map<String, List<IEntityProperty>> sections = builder.getSections(); - assertEquals("{Properties of /S/S1=[answer: 43], " - + "Properties of /S/S2=[answer: 42, question: 6 x 7]}", sections.toString()); + assertEquals("{/S/S1 [A]:=[answer: 43], " + "/S/S2 [B]:=[answer: 42, question: 6 x 7]}", + sections.toString()); } @Test @@ -71,13 +71,14 @@ public class ParentsPropertiesSectionBuilderTest extends AssertJUnit { ParentsPropertiesSectionBuilder builder = new ParentsPropertiesSectionBuilder(); - builder.addParent(new SampleBuilder("/S/S1").property("answer", "42").getSample()); - builder.addParent(new SampleBuilder("/S/S2").property("answer", "42") + builder.addParent(new SampleBuilder("/S/S1").type("A").property("answer", "42").getSample()); + builder.addParent(new SampleBuilder("/S/S2").type("B").property("answer", "42") .property("question", "6 x 7").getSample()); Map<String, List<IEntityProperty>> sections = builder.getSections(); - assertEquals("{Properties common by all parents=[answer: 42], " - + "Properties of /S/S2=[question: 6 x 7]}", sections.toString()); + assertEquals( + "{Common Parents Properties:=[answer: 42], " + "/S/S2 [B]:=[question: 6 x 7]}", + sections.toString()); } @Test @@ -86,21 +87,24 @@ public class ParentsPropertiesSectionBuilderTest extends AssertJUnit ParentsPropertiesSectionBuilder builder = new ParentsPropertiesSectionBuilder(); SampleBuilder s1 = - new SampleBuilder("/S/S1").property("answer", "42").property("question", "6 x 7"); + new SampleBuilder("/S/S1").type("A").property("answer", "42") + .property("question", "6 x 7"); s1.property("property").type(DataTypeCode.INTEGER).value(101); builder.addParent(s1.getSample()); SampleBuilder s2 = - new SampleBuilder("/S/S2").property("question", "6 x 7").property("answer", "42"); + new SampleBuilder("/S/S2").type("B").property("question", "6 x 7") + .property("answer", "42"); s2.property("property", "101"); builder.addParent(s2.getSample()); SampleBuilder s3 = - new SampleBuilder("/S/S3").property("question", "6 x 7").property("answer", "42"); + new SampleBuilder("/S/S3").type("C").property("question", "6 x 7") + .property("answer", "42"); s3.property("property", "101"); builder.addParent(s3.getSample()); Map<String, List<IEntityProperty>> sections = builder.getSections(); - assertEquals("{Properties common by all parents=[answer: 42, question: 6 x 7], " - + "Properties of /S/S1=[property: 101], " + "Properties of /S/S2=[property: 101], " - + "Properties of /S/S3=[property: 101]}", sections.toString()); + assertEquals("{Common Parents Properties:=[answer: 42, question: 6 x 7], " + + "/S/S1 [A]:=[property: 101], " + "/S/S2 [B]:=[property: 101], " + + "/S/S3 [C]:=[property: 101]}", sections.toString()); } }