public static void visit(final ViewDefinition<?> viewDefinition, final Consumer<PrimitiveDefinition> definitionConsumer) { definitionConsumer.accept(viewDefinition); visit(viewDefinition.getChildren(), definitionConsumer); }
StringBuffer result = null; final String factoryName = viewFactory.getSimpleName(); final String viewId = viewDefinition.getId(); final String methodName = viewDefinition.getFactoryMethodName(); final ShapeDefinition main = viewDefinition.getMain(); if (null != main) { final Map<String, Object> root = new HashMap<>(); final List<PrimitiveDefinition> children = viewDefinition.getChildren(); for (final PrimitiveDefinition child : children) { final String childId = SVGGeneratorFormatUtils.getValidInstanceId(child); final List<ViewRefDefinition> svgViewRefs = viewDefinition.getSVGViewRefs(); svgViewRefs.forEach(viewRef -> { final String parent = viewRef.getParent(); final boolean existReferencedView = viewFactory .getViewDefinitions().stream() .anyMatch(def -> viewRefId.equals(def.getId())); if (existReferencedView) { final String childRaw = formatString(SVG_CHILD_TEMPLATE, mainLayoutRaw); root.put("width", formatDouble(viewDefinition.getWidth())); root.put("height", formatDouble(viewDefinition.getHeight())); root.put("text", viewTextRaw);
assertNotNull(viewDefinition); assertEquals("svg-test-file", viewDefinition.getId()); final ViewDefinition.ViewBoxDefinition viewBox = viewDefinition.getViewBox(); assertNotNull(viewBox); final double minX = viewBox.getMinX(); 0d); final PrimitiveDefinition mainShapeDef = viewDefinition.getMain(); assertNotNull(mainShapeDef); assertTrue(mainShapeDef instanceof MultiPathDefinition); assertTrue(mainPathDef.isListening()); final List<PrimitiveDefinition> childrenDefs = viewDefinition.getChildren(); assertNotNull(childrenDefs); assertTrue(childrenDefs.size() == 3); assertFalse(groupDefinition.isListening()); SVGTranslationTestAssertions.assertGroupRef(groupDefinition); final List<ViewRefDefinition> svgViewRefs = viewDefinition.getSVGViewRefs(); assertNotNull(svgViewRefs); assertTrue(svgViewRefs.size() == 1);
.flatMap(v -> v.getSVGViewRefs().stream()) .filter(vd -> !processedSvgIds.contains(vd.getViewRefId())) .forEach(vd -> parseSVGViewSource(vd.getViewRefId(),
main, result.toArray(new PrimitiveDefinition<?>[result.size()])); viewDefinition.getSVGViewRefs().addAll(context.getViewRefDefinitions()); return viewDefinition;