setMargin(readMargin(design, getMargin(), designContext));
- // Prepare a 2D map for reading column contents
- Elements rowElements = design.getElementsByTag("row");
+ List<Element> rowElements = new ArrayList<Element>();
List<Map<Integer, Component>> rows = new ArrayList<Map<Integer, Component>>();
- for (int i = 0; i < rowElements.size(); ++i) {
- rows.add(new HashMap<Integer, Component>());
+ // Prepare a 2D map for reading column contents
+ for (Element e : design.children()) {
+ if (e.tagName().equalsIgnoreCase("row")) {
+ rowElements.add(e);
+ rows.add(new HashMap<Integer, Component>());
+
+ }
}
setRows(Math.max(rows.size(), 1));
}
return result;
}
+
+ @Test
+ public void testNestedGridLayouts() {
+ String design = "<!DOCTYPE html>" + //
+ "<html>" + //
+ " <body> " + //
+ " <v-grid-layout> " + //
+ " <row> " + //
+ " <column> " + //
+ " <v-grid-layout> " + //
+ " <row> " + //
+ " <column> " + //
+ " <v-button>" + //
+ " Button " + //
+ " </v-button> " + //
+ " </column> " + //
+ " </row> " + //
+ " </v-grid-layout> " + //
+ " </column> " + //
+ " </row> " + //
+ " </v-grid-layout> " + //
+ " </body>" + //
+ "</html>";
+ GridLayout outer = new GridLayout();
+ GridLayout inner = new GridLayout();
+ Button b = new Button("Button");
+ b.setCaptionAsHtml(true);
+ inner.addComponent(b);
+ outer.addComponent(inner);
+ testRead(design, outer);
+ testWrite(design, outer);
+
+ }
}