@Test public void checkAddShapeAtIndex0WithNoExistingChildren() { final CaseManagementShapeView child = createShapeView("child"); shape.addShape(child, 0); verify(layoutHandler, times(1)).requestLayout(shape); assertEquals(1, shape.getChildShapes().size()); assertEquals(child, shape.getChildShapes().get(0)); }
public void addShape(final WiresShape shape, final int targetIndex) { if (shape == null || (targetIndex < 0 || targetIndex > getChildShapes().size())) { return; } final List<WiresShape> childShapes = getChildShapes().toList(); childShapes.forEach(WiresShape::removeFromParent); final List<WiresShape> existingChildShapes = childShapes.stream() .filter(s -> !((WiresShapeView) s).getUUID().equals(((WiresShapeView) shape).getUUID())) .collect(Collectors.toList()); existingChildShapes.add(targetIndex, shape); existingChildShapes.forEach(this::add); }
CaseManagementShapeView extends SVGShapeViewImpl implements HasSize<SVGShapeViewImpl> { public void addShape(final WiresShape shape, final int targetIndex) { if (shape == null || (targetIndex < 0 || targetIndex > getChildShapes().size())) { return; } final List<WiresShape> childShapes = getChildShapes().toList(); childShapes.forEach(WiresShape::removeFromParent); final List<WiresShape> existingChildShapes = childShapes.stream() .filter(s -> !((WiresShapeView) s).getUUID().equals(((WiresShapeView) shape).getUUID())) .collect(Collectors.toList()); existingChildShapes.add(targetIndex, shape); existingChildShapes.forEach(this::add); } }
CaseManagementShapeView extends SVGShapeViewImpl implements HasSize<SVGShapeViewImpl> { public void addShape(final WiresShape shape, final int targetIndex) { if (shape == null || (targetIndex < 0 || targetIndex > getChildShapes().size())) { return; } final List<WiresShape> childShapes = getChildShapes().toList(); childShapes.forEach(WiresShape::removeFromParent); final List<WiresShape> existingChildShapes = childShapes.stream() .filter(s -> !((WiresShapeView) s).getUUID().equals(((WiresShapeView) shape).getUUID())) .collect(Collectors.toList()); existingChildShapes.add(targetIndex, shape); existingChildShapes.forEach(this::add); } CaseManagementShapeView(final String name,
                                   final SVGPrimitiveShape svgPrimitive,
                                   final double width,
                                   final double height,
                                   final boolean resizable);  CaseManagementShapeView(final String name,
                                   final SVGPrimitiveShape svgPrimitive,
                                   final double width,
                                   final double height,
                                   final boolean resizable,
                                   final Optional<MultiPath> optDropZone); }
CaseManagementShapeView extends SVGShapeViewImpl implements HasSize<SVGShapeViewImpl> { public void addShape(final WiresShape shape, final int targetIndex) { if (shape == null || (targetIndex < 0 || targetIndex > getChildShapes().size())) { return; } final List<WiresShape> childShapes = getChildShapes().toList(); childShapes.forEach(WiresShape::removeFromParent); final List<WiresShape> existingChildShapes = childShapes.stream() .filter(s -> !((WiresShapeView) s).getUUID().equals(((WiresShapeView) shape).getUUID())) .collect(Collectors.toList()); existingChildShapes.add(targetIndex, shape); existingChildShapes.forEach(this::add); } CaseManagementShapeView(final String name,
                                   final SVGPrimitiveShape svgPrimitive,
                                   final double width,
                                   final double height,
                                   final boolean resizable);  CaseManagementShapeView(final String name,
                                   final SVGPrimitiveShape svgPrimitive,
                                   final double width,
                                   final double height,
                                   final boolean resizable,
                                   final Optional<MultiPath> optDropZone); void setLabel(String shapeLabel); double getWidth(); double getHeight(); void logicallyReplace(final CaseManagementShapeView original, final CaseManagementShapeView replacement); void addShape(final WiresShape shape, final int targetIndex); int getIndex(final WiresShape shape); Optional<MultiPath> getDropZone(); CaseManagementShapeView getGhost(); void setCanvas(CaseManagementCanvas canvas); }
CaseManagementShapeView extends SVGShapeViewImpl implements HasSize<SVGShapeViewImpl> { public void addShape(final WiresShape shape, final int targetIndex) { if (shape == null || (targetIndex < 0 || targetIndex > getChildShapes().size())) { return; } final List<WiresShape> childShapes = getChildShapes().toList(); childShapes.forEach(WiresShape::removeFromParent); final List<WiresShape> existingChildShapes = childShapes.stream() .filter(s -> !((WiresShapeView) s).getUUID().equals(((WiresShapeView) shape).getUUID())) .collect(Collectors.toList()); existingChildShapes.add(targetIndex, shape); existingChildShapes.forEach(this::add); } CaseManagementShapeView(final String name,
                                   final SVGPrimitiveShape svgPrimitive,
                                   final double width,
                                   final double height,
                                   final boolean resizable);  CaseManagementShapeView(final String name,
                                   final SVGPrimitiveShape svgPrimitive,
                                   final double width,
                                   final double height,
                                   final boolean resizable,
                                   final Optional<MultiPath> optDropZone); void setLabel(String shapeLabel); double getWidth(); double getHeight(); void logicallyReplace(final CaseManagementShapeView original, final CaseManagementShapeView replacement); void addShape(final WiresShape shape, final int targetIndex); int getIndex(final WiresShape shape); Optional<MultiPath> getDropZone(); CaseManagementShapeView getGhost(); void setCanvas(CaseManagementCanvas canvas);  }