@Test public void testOnMove() { when(containmentAcceptor .containmentAllowed(eq(parent), eq(new WiresShape[]{shape}))) .thenReturn(true); final double x = 15.5d; final double y = 21.63d; control.onMove(x, y); verify(containmentControl, times(1)).onMove(eq(x), eq(y)); verify(parentLayoutHandler, times(1)).add(eq(ghost), eq(parent), eq(new Point2D(x, y))); verify(containmentAcceptor, never()).acceptContainment(any(WiresContainer.class), any(WiresShape[].class)); }
@Override public boolean onMove(double dx, double dy) { containmentControl.onMove(dx, dy); final Optional<CaseManagementShapeView> ghost = state.getGhost(); if (ghost.isPresent() && null != getParent() && null != getParent().getGroup()) { if (getWiresManager().getContainmentAcceptor().containmentAllowed(getParent(), new WiresShape[]{getShape()})) { final WiresParentPickerControlImpl parentPickerControl = (WiresParentPickerControlImpl) containmentControl.getParentPickerControl(); final double mouseX = parentPickerControl.getMouseStartX() + dx; final double mouseY = parentPickerControl.getMouseStartY() + dy; final Point2D parentAbsLoc = getParent().getGroup().getComputedLocation(); final Point2D mouseRelativeLoc = new Point2D(mouseX - parentAbsLoc.getX(), mouseY - parentAbsLoc.getY()); getParent().getLayoutHandler().add(ghost.get(), getParent(), mouseRelativeLoc); containmentControl.getParentPickerControl().getIndex().build(getWiresManager().getLayer()); } } return false; }
CaseManagementContainmentControl implements WiresContainmentControl { @Override public boolean onMove(double dx, double dy) { containmentControl.onMove(dx, dy); final Optional<CaseManagementShapeView> ghost = state.getGhost(); if (ghost.isPresent() && null != getParent() && null != getParent().getGroup()) { if (getWiresManager().getContainmentAcceptor().containmentAllowed(getParent(), new WiresShape[]{getShape()})) { final WiresParentPickerControlImpl parentPickerControl = (WiresParentPickerControlImpl) containmentControl.getParentPickerControl(); final double mouseX = parentPickerControl.getMouseStartX() + dx; final double mouseY = parentPickerControl.getMouseStartY() + dy; final Point2D parentAbsLoc = getParent().getGroup().getComputedLocation(); final Point2D mouseRelativeLoc = new Point2D(mouseX - parentAbsLoc.getX(), mouseY - parentAbsLoc.getY()); getParent().getLayoutHandler().add(ghost.get(), getParent(), mouseRelativeLoc); containmentControl.getParentPickerControl().getIndex().build(getWiresManager().getLayer()); } } return false; } }
CaseManagementContainmentControl implements WiresContainmentControl { @Override public boolean onMove(double dx, double dy) { containmentControl.onMove(dx, dy); final Optional<CaseManagementShapeView> ghost = state.getGhost(); if (ghost.isPresent() && null != getParent() && null != getParent().getGroup()) { if (getWiresManager().getContainmentAcceptor().containmentAllowed(getParent(), new WiresShape[]{getShape()})) { final WiresParentPickerControlImpl parentPickerControl = (WiresParentPickerControlImpl) containmentControl.getParentPickerControl(); final double mouseX = parentPickerControl.getMouseStartX() + dx; final double mouseY = parentPickerControl.getMouseStartY() + dy; final Point2D parentAbsLoc = getParent().getGroup().getComputedLocation(); final Point2D mouseRelativeLoc = new Point2D(mouseX - parentAbsLoc.getX(), mouseY - parentAbsLoc.getY()); getParent().getLayoutHandler().add(ghost.get(), getParent(), mouseRelativeLoc); containmentControl.getParentPickerControl().getIndex().build(getWiresManager().getLayer()); } } return false; } CaseManagementContainmentControl(final WiresParentPickerControl parentPickerControl,
                                            final CaseManagementContainmentStateHolder state);   CaseManagementContainmentControl(final WiresContainmentControlImpl containmentControl,
                                     final CaseManagementContainmentStateHolder state); }
CaseManagementContainmentControl implements WiresContainmentControl { @Override public boolean onMove(double dx, double dy) { containmentControl.onMove(dx, dy); final Optional<CaseManagementShapeView> ghost = state.getGhost(); if (ghost.isPresent() && null != getParent() && null != getParent().getGroup()) { if (getWiresManager().getContainmentAcceptor().containmentAllowed(getParent(), new WiresShape[]{getShape()})) { final WiresParentPickerControlImpl parentPickerControl = (WiresParentPickerControlImpl) containmentControl.getParentPickerControl(); final double mouseX = parentPickerControl.getMouseStartX() + dx; final double mouseY = parentPickerControl.getMouseStartY() + dy; final Point2D parentAbsLoc = getParent().getGroup().getComputedLocation(); final Point2D mouseRelativeLoc = new Point2D(mouseX - parentAbsLoc.getX(), mouseY - parentAbsLoc.getY()); getParent().getLayoutHandler().add(ghost.get(), getParent(), mouseRelativeLoc); containmentControl.getParentPickerControl().getIndex().build(getWiresManager().getLayer()); } } return false; } CaseManagementContainmentControl(final WiresParentPickerControl parentPickerControl,
                                            final CaseManagementContainmentStateHolder state);   CaseManagementContainmentControl(final WiresContainmentControlImpl containmentControl,
                                     final CaseManagementContainmentStateHolder state); @Override WiresContainmentControl setEnabled(boolean enabled); @Override void onMoveStart(double x, double y); @Override boolean onMove(double dx,
                          double dy); @Override void onMoveComplete(); @Override boolean isAllow(); @Override boolean accept(); @Override Point2D getCandidateLocation(); @Override Point2D getAdjust(); @Override void execute(); @Override void clear(); @Override void reset(); @Override void destroy(); }
CaseManagementContainmentControl implements WiresContainmentControl { @Override public boolean onMove(double dx, double dy) { containmentControl.onMove(dx, dy); final Optional<CaseManagementShapeView> ghost = state.getGhost(); if (ghost.isPresent() && null != getParent() && null != getParent().getGroup()) { if (getWiresManager().getContainmentAcceptor().containmentAllowed(getParent(), new WiresShape[]{getShape()})) { final WiresParentPickerControlImpl parentPickerControl = (WiresParentPickerControlImpl) containmentControl.getParentPickerControl(); final double mouseX = parentPickerControl.getMouseStartX() + dx; final double mouseY = parentPickerControl.getMouseStartY() + dy; final Point2D parentAbsLoc = getParent().getGroup().getComputedLocation(); final Point2D mouseRelativeLoc = new Point2D(mouseX - parentAbsLoc.getX(), mouseY - parentAbsLoc.getY()); getParent().getLayoutHandler().add(ghost.get(), getParent(), mouseRelativeLoc); containmentControl.getParentPickerControl().getIndex().build(getWiresManager().getLayer()); } } return false; } CaseManagementContainmentControl(final WiresParentPickerControl parentPickerControl,
                                            final CaseManagementContainmentStateHolder state);   CaseManagementContainmentControl(final WiresContainmentControlImpl containmentControl,
                                     final CaseManagementContainmentStateHolder state); @Override WiresContainmentControl setEnabled(boolean enabled); @Override void onMoveStart(double x, double y); @Override boolean onMove(double dx,
                          double dy); @Override void onMoveComplete(); @Override boolean isAllow(); @Override boolean accept(); @Override Point2D getCandidateLocation(); @Override Point2D getAdjust(); @Override void execute(); @Override void clear(); @Override void reset(); @Override void destroy();  }