Skip to content
Snippets Groups Projects
Commit c33556ad authored by felmer's avatar felmer
Browse files

SP-242, BIS-154: Bug fixed concerning refreshing. Section titles changed.

SVN: 26403
parent 3b4fd1e3
No related branches found
No related tags found
No related merge requests found
...@@ -167,6 +167,7 @@ public final class PropertyGrid extends Grid ...@@ -167,6 +167,7 @@ public final class PropertyGrid extends Grid
{ {
this.properties = properties; this.properties = properties;
assert properties != null : "Unspecified properties."; assert properties != null : "Unspecified properties.";
resizeRows(properties.size());
addPropertiesToTable(properties, 0); addPropertiesToTable(properties, 0);
} }
......
...@@ -322,7 +322,9 @@ abstract public class GenericSampleViewer extends AbstractViewerWithVerticalSpli ...@@ -322,7 +322,9 @@ abstract public class GenericSampleViewer extends AbstractViewerWithVerticalSpli
final ContentPanel panel = new ContentPanel(); final ContentPanel panel = new ContentPanel();
panel.setScrollMode(Scroll.AUTOY); panel.setScrollMode(Scroll.AUTOY);
panel.setHeading(getViewContext().getMessage(Dict.SAMPLE_PROPERTIES_HEADING)); panel.setHeading(getViewContext().getMessage(Dict.SAMPLE_PROPERTIES_HEADING));
viewContext.log("create property section");
propertyGrid = createPropertyGrid(getViewContext(), sampleId); propertyGrid = createPropertyGrid(getViewContext(), sampleId);
propertyGrid.getElement().setId(PROPERTIES_ID_PREFIX + sampleId);
updateProperties(sampleGeneration); updateProperties(sampleGeneration);
panel.add(propertyGrid); panel.add(propertyGrid);
...@@ -344,7 +346,6 @@ abstract public class GenericSampleViewer extends AbstractViewerWithVerticalSpli ...@@ -344,7 +346,6 @@ abstract public class GenericSampleViewer extends AbstractViewerWithVerticalSpli
propertyGrid.resizeRows(0); propertyGrid.resizeRows(0);
final Map<String, Object> properties = createProperties(viewContext, sampleGeneration); final Map<String, Object> properties = createProperties(viewContext, sampleGeneration);
propertyGrid.setProperties(properties); propertyGrid.setProperties(properties);
propertyGrid.getElement().setId(PROPERTIES_ID_PREFIX + sampleId);
Sample sample = sampleGeneration.getParent(); Sample sample = sampleGeneration.getParent();
SampleType sampleType = sample.getSampleType(); SampleType sampleType = sample.getSampleType();
if (sampleType.isShowParentMetadata()) if (sampleType.isShowParentMetadata())
......
...@@ -106,7 +106,7 @@ class ParentsPropertiesSectionBuilder ...@@ -106,7 +106,7 @@ class ParentsPropertiesSectionBuilder
} }
if (commonProperties.isEmpty() == false) if (commonProperties.isEmpty() == false)
{ {
sections.put("Properties common by all parents", commonProperties); sections.put("Common Parents Properties:", commonProperties);
} }
} }
for (Sample sample : samples) for (Sample sample : samples)
...@@ -121,7 +121,8 @@ class ParentsPropertiesSectionBuilder ...@@ -121,7 +121,8 @@ class ParentsPropertiesSectionBuilder
} }
if (properties.isEmpty() == false) if (properties.isEmpty() == false)
{ {
sections.put("Properties of " + sample.getIdentifier(), properties); sections.put(sample.getIdentifier() + " [" + sample.getSampleType().getCode()
+ "]:", properties);
} }
} }
return sections; return sections;
......
...@@ -46,10 +46,10 @@ public class ParentsPropertiesSectionBuilderTest extends AssertJUnit ...@@ -46,10 +46,10 @@ public class ParentsPropertiesSectionBuilderTest extends AssertJUnit
{ {
ParentsPropertiesSectionBuilder builder = new ParentsPropertiesSectionBuilder(); 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(); 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 @Test
...@@ -57,13 +57,13 @@ public class ParentsPropertiesSectionBuilderTest extends AssertJUnit ...@@ -57,13 +57,13 @@ public class ParentsPropertiesSectionBuilderTest extends AssertJUnit
{ {
ParentsPropertiesSectionBuilder builder = new ParentsPropertiesSectionBuilder(); ParentsPropertiesSectionBuilder builder = new ParentsPropertiesSectionBuilder();
builder.addParent(new SampleBuilder("/S/S1").property("answer", "43").getSample()); builder.addParent(new SampleBuilder("/S/S1").type("A").property("answer", "43").getSample());
builder.addParent(new SampleBuilder("/S/S2").property("answer", "42") builder.addParent(new SampleBuilder("/S/S2").type("B").property("answer", "42")
.property("question", "6 x 7").getSample()); .property("question", "6 x 7").getSample());
Map<String, List<IEntityProperty>> sections = builder.getSections(); Map<String, List<IEntityProperty>> sections = builder.getSections();
assertEquals("{Properties of /S/S1=[answer: 43], " assertEquals("{/S/S1 [A]:=[answer: 43], " + "/S/S2 [B]:=[answer: 42, question: 6 x 7]}",
+ "Properties of /S/S2=[answer: 42, question: 6 x 7]}", sections.toString()); sections.toString());
} }
@Test @Test
...@@ -71,13 +71,14 @@ public class ParentsPropertiesSectionBuilderTest extends AssertJUnit ...@@ -71,13 +71,14 @@ public class ParentsPropertiesSectionBuilderTest extends AssertJUnit
{ {
ParentsPropertiesSectionBuilder builder = new ParentsPropertiesSectionBuilder(); 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());
builder.addParent(new SampleBuilder("/S/S2").property("answer", "42") builder.addParent(new SampleBuilder("/S/S2").type("B").property("answer", "42")
.property("question", "6 x 7").getSample()); .property("question", "6 x 7").getSample());
Map<String, List<IEntityProperty>> sections = builder.getSections(); Map<String, List<IEntityProperty>> sections = builder.getSections();
assertEquals("{Properties common by all parents=[answer: 42], " assertEquals(
+ "Properties of /S/S2=[question: 6 x 7]}", sections.toString()); "{Common Parents Properties:=[answer: 42], " + "/S/S2 [B]:=[question: 6 x 7]}",
sections.toString());
} }
@Test @Test
...@@ -86,21 +87,24 @@ public class ParentsPropertiesSectionBuilderTest extends AssertJUnit ...@@ -86,21 +87,24 @@ public class ParentsPropertiesSectionBuilderTest extends AssertJUnit
ParentsPropertiesSectionBuilder builder = new ParentsPropertiesSectionBuilder(); ParentsPropertiesSectionBuilder builder = new ParentsPropertiesSectionBuilder();
SampleBuilder s1 = 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); s1.property("property").type(DataTypeCode.INTEGER).value(101);
builder.addParent(s1.getSample()); builder.addParent(s1.getSample());
SampleBuilder s2 = 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"); s2.property("property", "101");
builder.addParent(s2.getSample()); builder.addParent(s2.getSample());
SampleBuilder s3 = 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"); s3.property("property", "101");
builder.addParent(s3.getSample()); builder.addParent(s3.getSample());
Map<String, List<IEntityProperty>> sections = builder.getSections(); Map<String, List<IEntityProperty>> sections = builder.getSections();
assertEquals("{Properties common by all parents=[answer: 42, question: 6 x 7], " assertEquals("{Common Parents Properties:=[answer: 42, question: 6 x 7], "
+ "Properties of /S/S1=[property: 101], " + "Properties of /S/S2=[property: 101], " + "/S/S1 [A]:=[property: 101], " + "/S/S2 [B]:=[property: 101], "
+ "Properties of /S/S3=[property: 101]}", sections.toString()); + "/S/S3 [C]:=[property: 101]}", sections.toString());
} }
} }
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