@Test public void testCloneNodeContentWithProperties() { final View cloneContent = mock(View.class); final DefinitionManager definitionManager = mock(DefinitionManager.class); final CloneManager cloneManager = mock(CloneManager.class); final Object clonedDefinition = mock(Object.class); cloneNodeCommand.setClone(clone); when(clone.getContent()).thenReturn(cloneContent); when(graphCommandExecutionContext.getDefinitionManager()).thenReturn(definitionManager); when(definitionManager.cloneManager()).thenReturn(cloneManager); when(cloneManager.clone(candidateContent.getDefinition(), ClonePolicy.ALL)).thenReturn(clonedDefinition); cloneNodeCommand.cloneNodeContentWithProperties(graphCommandExecutionContext); verify(cloneContent).setBounds(boundsArgumentCaptor.capture()); verify(cloneContent).setDefinition(clonedDefinition); final Bounds clonedBounds = boundsArgumentCaptor.getValue(); assertEquals(candidateBounds, clonedBounds); assertNotSame(candidateBounds, clonedBounds); }
void cloneNodeContentWithProperties(final GraphCommandExecutionContext context) { final View cloneContent = getClone().getContent(); final View candidateContent = (View) getCandidate().getContent(); final Bounds candidateBounds = candidateContent.getBounds(); final Bounds clonedBounds = cloneBounds(candidateBounds); final CloneManager cloneManager = context.getDefinitionManager().cloneManager(); final Object clonedDefinition = cloneManager.clone(candidateContent.getDefinition(), ClonePolicy.ALL); cloneContent.setBounds(clonedBounds); cloneContent.setDefinition(clonedDefinition); }
CloneNodeCommand extends AbstractGraphCompositeCommand { void cloneNodeContentWithProperties(final GraphCommandExecutionContext context) { final View cloneContent = getClone().getContent(); final View candidateContent = (View) getCandidate().getContent(); final Bounds candidateBounds = candidateContent.getBounds(); final Bounds clonedBounds = cloneBounds(candidateBounds); final CloneManager cloneManager = context.getDefinitionManager().cloneManager(); final Object clonedDefinition = cloneManager.clone(candidateContent.getDefinition(), ClonePolicy.ALL); cloneContent.setBounds(clonedBounds); cloneContent.setDefinition(clonedDefinition); } }
CloneNodeCommand extends AbstractGraphCompositeCommand { void cloneNodeContentWithProperties(final GraphCommandExecutionContext context) { final View cloneContent = getClone().getContent(); final View candidateContent = (View) getCandidate().getContent(); final Bounds candidateBounds = candidateContent.getBounds(); final Bounds clonedBounds = cloneBounds(candidateBounds); final CloneManager cloneManager = context.getDefinitionManager().cloneManager(); final Object clonedDefinition = cloneManager.clone(candidateContent.getDefinition(), ClonePolicy.ALL); cloneContent.setBounds(clonedBounds); cloneContent.setDefinition(clonedDefinition); } protected  CloneNodeCommand();  CloneNodeCommand(final @MapsTo("candidate") Node candidate, final @MapsTo("parentUuid") String parentUuid);  CloneNodeCommand(final Node candidate, final String parentUuid, final Point2D position, final Consumer<Node> callback, final ManagedInstance<ChildrenTraverseProcessor> childrenTraverseProcessor);  CloneNodeCommand(final Node candidate, final String parentUuid, final Point2D position, final Consumer<Node> callback); }
CloneNodeCommand extends AbstractGraphCompositeCommand { void cloneNodeContentWithProperties(final GraphCommandExecutionContext context) { final View cloneContent = getClone().getContent(); final View candidateContent = (View) getCandidate().getContent(); final Bounds candidateBounds = candidateContent.getBounds(); final Bounds clonedBounds = cloneBounds(candidateBounds); final CloneManager cloneManager = context.getDefinitionManager().cloneManager(); final Object clonedDefinition = cloneManager.clone(candidateContent.getDefinition(), ClonePolicy.ALL); cloneContent.setBounds(clonedBounds); cloneContent.setDefinition(clonedDefinition); } protected  CloneNodeCommand();  CloneNodeCommand(final @MapsTo("candidate") Node candidate, final @MapsTo("parentUuid") String parentUuid);  CloneNodeCommand(final Node candidate, final String parentUuid, final Point2D position, final Consumer<Node> callback, final ManagedInstance<ChildrenTraverseProcessor> childrenTraverseProcessor);  CloneNodeCommand(final Node candidate, final String parentUuid, final Point2D position, final Consumer<Node> callback); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); List<CommandResult<RuleViolation>> processChildrenNodes(GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(GraphCommandExecutionContext context); Node<View, Edge> getClone(); Node<Definition, Edge> getCandidate(); List<Command<GraphCommandExecutionContext, RuleViolation>> getChildrenCommands(); }
CloneNodeCommand extends AbstractGraphCompositeCommand { void cloneNodeContentWithProperties(final GraphCommandExecutionContext context) { final View cloneContent = getClone().getContent(); final View candidateContent = (View) getCandidate().getContent(); final Bounds candidateBounds = candidateContent.getBounds(); final Bounds clonedBounds = cloneBounds(candidateBounds); final CloneManager cloneManager = context.getDefinitionManager().cloneManager(); final Object clonedDefinition = cloneManager.clone(candidateContent.getDefinition(), ClonePolicy.ALL); cloneContent.setBounds(clonedBounds); cloneContent.setDefinition(clonedDefinition); } protected  CloneNodeCommand();  CloneNodeCommand(final @MapsTo("candidate") Node candidate, final @MapsTo("parentUuid") String parentUuid);  CloneNodeCommand(final Node candidate, final String parentUuid, final Point2D position, final Consumer<Node> callback, final ManagedInstance<ChildrenTraverseProcessor> childrenTraverseProcessor);  CloneNodeCommand(final Node candidate, final String parentUuid, final Point2D position, final Consumer<Node> callback); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); List<CommandResult<RuleViolation>> processChildrenNodes(GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(GraphCommandExecutionContext context); Node<View, Edge> getClone(); Node<Definition, Edge> getCandidate(); List<Command<GraphCommandExecutionContext, RuleViolation>> getChildrenCommands();  }