final GroupDefinition groupDefinition = new GroupDefinition(id); final NodeList childNodes = element.getChildNodes(); if (null != childNodes && childNodes.getLength() > 0) { context.addSVGViewRef((ViewRefDefinition) childDefinition); } else if (childDefinition instanceof ShapeDefinition) { groupDefinition.getChildren().add((PrimitiveDefinition) childDefinition); } else if (childDefinition instanceof GroupDefinition) { throw new UnsupportedOperationException("Nested SVG groups are not allowed! [svgId=" +
@Test public void testGenerate() throws Exception { final GroupDefinition definition = new GroupDefinition(ID); definition.setX(X); definition.setY(Y); definition.setAlpha(ALPHA); definition.setTransformDefinition(new TransformDefinitionImpl(VBOX_WIDTH, VBOX_HEIGHT, VBOX_MIN_X, VBOX_MIN_Y)); final String generated = tested.generate(definition).toString(); assertTrue(generated.contains("new " + Group.class.getName() + "()")); GeneratorAssertions.assertDraggable(generated); GeneratorAssertions.assertID(generated, ID); GeneratorAssertions.assertX(generated, X); GeneratorAssertions.assertY(generated, Y); GeneratorAssertions.assertAlpha(generated, ALPHA); GeneratorAssertions.assertScale(generated, VBOX_WIDTH, VBOX_HEIGHT); GeneratorAssertions.assertListening(generated, LISTENING); } }
} else if (child instanceof GroupDefinition) { final GroupDefinition groupDefinition = (GroupDefinition) child; final List<PrimitiveDefinition> children = groupDefinition.getChildren(); if (children.stream().anyMatch(generationFilter)) { groupDefinition.getId(), childBuffer.toString(), scalableRaw,
public static void visit(final Collection<PrimitiveDefinition> definitions, final Consumer<PrimitiveDefinition> definitionConsumer) { for (final PrimitiveDefinition child : definitions) { if (child instanceof GroupDefinition) { visit(((GroupDefinition) child).getChildren(), definitionConsumer); } else { definitionConsumer.accept(child); } } } }
assertFalse(groupDefinition.isListening()); SVGTranslationTestAssertions.assertGroupRef(groupDefinition); final List<ViewRefDefinition> svgViewRefs = viewDefinition.getSVGViewRefs();