use of com.qcadoo.view.internal.api.ContainerPattern in project qcadoo by qcadoo.
the class ComponentPatternTest method shouldReturnValidPath.
@Test
public void shouldReturnValidPath() throws Exception {
// given
ContainerPattern root = new WindowComponentPattern(getComponentDefinition("rootName", null));
ContainerPattern child1 = new WindowComponentPattern(getComponentDefinition("child1", root, null));
ComponentPattern child2 = new TextInputComponentPattern(getComponentDefinition("child2", root, null));
ComponentPattern child11 = new TextInputComponentPattern(getComponentDefinition("child11", child1, null));
// when
String rootPathName = root.getPath();
String child1PathName = child1.getPath();
String child2PathName = child2.getPath();
String child11PathName = child11.getPath();
// then
Assert.assertEquals("rootName", rootPathName);
Assert.assertEquals("rootName.child1", child1PathName);
Assert.assertEquals("rootName.child2", child2PathName);
Assert.assertEquals("rootName.child1.child11", child11PathName);
}
use of com.qcadoo.view.internal.api.ContainerPattern in project qcadoo by qcadoo.
the class ViewDefinitionImpl method getPatternsAsList.
private List<ComponentPattern> getPatternsAsList(final Collection<ComponentPattern> patterns) {
List<ComponentPattern> list = new ArrayList<ComponentPattern>();
list.addAll(patterns);
for (ComponentPattern pattern : patterns) {
if (pattern instanceof ContainerPattern) {
list.addAll(getPatternsAsList(((ContainerPattern) pattern).getChildren().values()));
}
}
return list;
}
Aggregations