@Test @SuppressWarnings("unchecked") public void testConsumeChildrenAndConnectors() { final Consumer<IDrawable> consumer = mock(Consumer.class); final WiresShapeView child1 = newShape(); final WiresShapeView child2 = newShape(); tested.add(child1); tested.add(child2); final WiresConnectorView connector1 = newConnector(); final WiresConnectorView connector2 = newConnector(); final MagnetManager.Magnets magnets1 = mock(MagnetManager.Magnets.class); final MagnetManager.Magnets magnets2 = mock(MagnetManager.Magnets.class); final WiresMagnet magnet1 = mock(WiresMagnet.class); final WiresMagnet magnet2 = mock(WiresMagnet.class); final WiresConnection connection1 = mock(WiresConnection.class); final WiresConnection connection2 = mock(WiresConnection.class); final NFastArrayList<WiresConnection> connections1 = new NFastArrayList<WiresConnection>().add(connection1); final NFastArrayList<WiresConnection> connections2 = new NFastArrayList<WiresConnection>().add(connection2); when(magnets1.size()).thenReturn(1); when(magnets1.getMagnet(eq(0))).thenReturn(magnet1); when(magnets2.size()).thenReturn(1); when(magnets2.getMagnet(eq(0))).thenReturn(magnet2); when(magnet1.getConnections()).thenReturn(connections1); when(magnet2.getConnections()).thenReturn(connections2); when(connection1.getConnector()).thenReturn(connector1); when(connection2.getConnector()).thenReturn(connector2); child1.setMagnets(magnets1); child2.setMagnets(magnets2); tested.consumeChildrenAndConnectors(consumer); verify(consumer, times(1)).accept(eq(tested.getContainer())); verify(consumer, times(1)).accept(eq(child1.getContainer())); verify(consumer, times(1)).accept(eq(child2.getContainer())); verify(consumer, times(1)).accept(eq(connector1.getGroup())); verify(consumer, times(1)).accept(eq(connector2.getGroup())); }
void consumeChildrenAndConnectors(final Consumer<IDrawable> primConsumer) { primConsumer.accept(getContainer()); final NFastArrayList<WiresShape> childShapes = getChildShapes(); if (null != childShapes) { for (int i = 0; i < childShapes.size(); i++) { final WiresShape shape = childShapes.get(i); if (shape instanceof WiresShapeView) { ((WiresShapeView) shape).consumeChildrenAndConnectors(primConsumer); } else { primConsumer.accept(shape.getContainer()); } } } if (null != getMagnets()) { for (int i = 0; i < getMagnets().size(); i++) { final WiresMagnet magnet = getMagnets().getMagnet(i); final NFastArrayList<WiresConnection> connections = magnet.getConnections(); if (null != connections) { for (int j = 0; j < connections.size(); j++) { final WiresConnection connection = connections.get(j); if (null != connection.getConnector()) { primConsumer.accept(connection.getConnector().getGroup()); } } } } } }
WiresShapeView extends WiresShape implements LienzoShapeView<T>,
                   HasDragBounds<T> { void consumeChildrenAndConnectors(final Consumer<IDrawable> primConsumer) { primConsumer.accept(getContainer()); final NFastArrayList<WiresShape> childShapes = getChildShapes(); if (null != childShapes) { for (int i = 0; i < childShapes.size(); i++) { final WiresShape shape = childShapes.get(i); if (shape instanceof WiresShapeView) { ((WiresShapeView) shape).consumeChildrenAndConnectors(primConsumer); } else { primConsumer.accept(shape.getContainer()); } } } if (null != getMagnets()) { for (int i = 0; i < getMagnets().size(); i++) { final WiresMagnet magnet = getMagnets().getMagnet(i); final NFastArrayList<WiresConnection> connections = magnet.getConnections(); if (null != connections) { for (int j = 0; j < connections.size(); j++) { final WiresConnection connection = connections.get(j); if (null != connection.getConnector()) { primConsumer.accept(connection.getConnector().getGroup()); } } } } } } }
WiresShapeView extends WiresShape implements LienzoShapeView<T>,
                   HasDragBounds<T> { void consumeChildrenAndConnectors(final Consumer<IDrawable> primConsumer) { primConsumer.accept(getContainer()); final NFastArrayList<WiresShape> childShapes = getChildShapes(); if (null != childShapes) { for (int i = 0; i < childShapes.size(); i++) { final WiresShape shape = childShapes.get(i); if (shape instanceof WiresShapeView) { ((WiresShapeView) shape).consumeChildrenAndConnectors(primConsumer); } else { primConsumer.accept(shape.getContainer()); } } } if (null != getMagnets()) { for (int i = 0; i < getMagnets().size(); i++) { final WiresMagnet magnet = getMagnets().getMagnet(i); final NFastArrayList<WiresConnection> connections = magnet.getConnections(); if (null != connections) { for (int j = 0; j < connections.size(); j++) { final WiresConnection connection = connections.get(j); if (null != connection.getConnector()) { primConsumer.accept(connection.getConnector().getGroup()); } } } } } } WiresShapeView(final MultiPath path);  WiresShapeView(final MultiPath path,
                          final LayoutContainer layoutContainer); }
WiresShapeView extends WiresShape implements LienzoShapeView<T>,
                   HasDragBounds<T> { void consumeChildrenAndConnectors(final Consumer<IDrawable> primConsumer) { primConsumer.accept(getContainer()); final NFastArrayList<WiresShape> childShapes = getChildShapes(); if (null != childShapes) { for (int i = 0; i < childShapes.size(); i++) { final WiresShape shape = childShapes.get(i); if (shape instanceof WiresShapeView) { ((WiresShapeView) shape).consumeChildrenAndConnectors(primConsumer); } else { primConsumer.accept(shape.getContainer()); } } } if (null != getMagnets()) { for (int i = 0; i < getMagnets().size(); i++) { final WiresMagnet magnet = getMagnets().getMagnet(i); final NFastArrayList<WiresConnection> connections = magnet.getConnections(); if (null != connections) { for (int j = 0; j < connections.size(); j++) { final WiresConnection connection = connections.get(j); if (null != connection.getConnector()) { primConsumer.accept(connection.getConnector().getGroup()); } } } } } } WiresShapeView(final MultiPath path);  WiresShapeView(final MultiPath path,
                          final LayoutContainer layoutContainer); Shape<?> getShape(); @Override T setUUID(final String uuid); @Override String getUUID(); @Override double getShapeX(); @Override double getShapeY(); @Override T setShapeLocation(final Point2D location); @Override double getAlpha(); @Override T setAlpha(final double alpha); @Override Point2D getShapeAbsoluteLocation(); @Override String getFillColor(); @Override @SuppressWarnings("unchecked") T setFillColor(final String color); @Override double getFillAlpha(); @Override T setFillAlpha(final double alpha); @Override String getStrokeColor(); @Override T setStrokeColor(final String color); @Override double getStrokeAlpha(); @Override T setStrokeAlpha(final double alpha); @Override double getStrokeWidth(); @Override T setStrokeWidth(final double width); @Override T setDragEnabled(boolean draggable); @Override T setDragBounds(final Bounds bounds); @Override T moveToTop(); @Override T moveToBottom(); @Override T moveUp(); @Override T moveDown(); @Override BoundingBox getBoundingBox(); @Override void destroy(); T setListening(final boolean listening); @Override List<Shape<?>> getDecorators(); @Override T setShadow(final String color,
                       final int blur,
                       final double offx,
                       final double offy); @Override T removeShadow(); @Override Object getUserData(); @Override void setUserData(Object userData); }
WiresShapeView extends WiresShape implements LienzoShapeView<T>,
                   HasDragBounds<T> { void consumeChildrenAndConnectors(final Consumer<IDrawable> primConsumer) { primConsumer.accept(getContainer()); final NFastArrayList<WiresShape> childShapes = getChildShapes(); if (null != childShapes) { for (int i = 0; i < childShapes.size(); i++) { final WiresShape shape = childShapes.get(i); if (shape instanceof WiresShapeView) { ((WiresShapeView) shape).consumeChildrenAndConnectors(primConsumer); } else { primConsumer.accept(shape.getContainer()); } } } if (null != getMagnets()) { for (int i = 0; i < getMagnets().size(); i++) { final WiresMagnet magnet = getMagnets().getMagnet(i); final NFastArrayList<WiresConnection> connections = magnet.getConnections(); if (null != connections) { for (int j = 0; j < connections.size(); j++) { final WiresConnection connection = connections.get(j); if (null != connection.getConnector()) { primConsumer.accept(connection.getConnector().getGroup()); } } } } } } WiresShapeView(final MultiPath path);  WiresShapeView(final MultiPath path,
                          final LayoutContainer layoutContainer); Shape<?> getShape(); @Override T setUUID(final String uuid); @Override String getUUID(); @Override double getShapeX(); @Override double getShapeY(); @Override T setShapeLocation(final Point2D location); @Override double getAlpha(); @Override T setAlpha(final double alpha); @Override Point2D getShapeAbsoluteLocation(); @Override String getFillColor(); @Override @SuppressWarnings("unchecked") T setFillColor(final String color); @Override double getFillAlpha(); @Override T setFillAlpha(final double alpha); @Override String getStrokeColor(); @Override T setStrokeColor(final String color); @Override double getStrokeAlpha(); @Override T setStrokeAlpha(final double alpha); @Override double getStrokeWidth(); @Override T setStrokeWidth(final double width); @Override T setDragEnabled(boolean draggable); @Override T setDragBounds(final Bounds bounds); @Override T moveToTop(); @Override T moveToBottom(); @Override T moveUp(); @Override T moveDown(); @Override BoundingBox getBoundingBox(); @Override void destroy(); T setListening(final boolean listening); @Override List<Shape<?>> getDecorators(); @Override T setShadow(final String color,
                       final int blur,
                       final double offx,
                       final double offy); @Override T removeShadow(); @Override Object getUserData(); @Override void setUserData(Object userData);  }