@Test public void checkLogicalReplacementWithOneChild() { final CaseManagementShapeView child = createShapeView("child"); final CaseManagementShapeView replacement = createShapeView("replacement"); shape.add(child); verify(layoutHandler, times(1)).requestLayout(shape); assertEquals(1, shape.getChildShapes().size()); assertEquals(child, shape.getChildShapes().get(0)); assertEquals(shape, child.getParent()); shape.logicallyReplace(child, replacement); assertEquals(1, shape.getChildShapes().size()); assertEquals(replacement, shape.getChildShapes().get(0)); assertEquals(shape, replacement.getParent()); assertNull(child.getParent()); verify(layoutHandler, times(2)).requestLayout(shape); }
public void logicallyReplace(final CaseManagementShapeView original, final CaseManagementShapeView replacement) { if (original == null || replacement == null || replacement.getParent() == this) { return; } int index = getIndex(original); if (index < 0) { return; } getChildShapes().set(index, replacement); getContainer().getChildNodes().set(getNodeIndex(original.getGroup()), replacement.getGroup()); original.setParent(null); replacement.setParent(this); getLayoutHandler().requestLayout(this); }
CaseManagementShapeView extends SVGShapeViewImpl implements HasSize<SVGShapeViewImpl> { public void logicallyReplace(final CaseManagementShapeView original, final CaseManagementShapeView replacement) { if (original == null || replacement == null || replacement.getParent() == this) { return; } int index = getIndex(original); if (index < 0) { return; } getChildShapes().set(index, replacement); getContainer().getChildNodes().set(getNodeIndex(original.getGroup()), replacement.getGroup()); original.setParent(null); replacement.setParent(this); getLayoutHandler().requestLayout(this); } }
CaseManagementShapeView extends SVGShapeViewImpl implements HasSize<SVGShapeViewImpl> { public void logicallyReplace(final CaseManagementShapeView original, final CaseManagementShapeView replacement) { if (original == null || replacement == null || replacement.getParent() == this) { return; } int index = getIndex(original); if (index < 0) { return; } getChildShapes().set(index, replacement); getContainer().getChildNodes().set(getNodeIndex(original.getGroup()), replacement.getGroup()); original.setParent(null); replacement.setParent(this); getLayoutHandler().requestLayout(this); } 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 logicallyReplace(final CaseManagementShapeView original, final CaseManagementShapeView replacement) { if (original == null || replacement == null || replacement.getParent() == this) { return; } int index = getIndex(original); if (index < 0) { return; } getChildShapes().set(index, replacement); getContainer().getChildNodes().set(getNodeIndex(original.getGroup()), replacement.getGroup()); original.setParent(null); replacement.setParent(this); getLayoutHandler().requestLayout(this); } 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 logicallyReplace(final CaseManagementShapeView original, final CaseManagementShapeView replacement) { if (original == null || replacement == null || replacement.getParent() == this) { return; } int index = getIndex(original); if (index < 0) { return; } getChildShapes().set(index, replacement); getContainer().getChildNodes().set(getNodeIndex(original.getGroup()), replacement.getGroup()); original.setParent(null); replacement.setParent(this); getLayoutHandler().requestLayout(this); } 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);  }