@Test @SuppressWarnings("unchecked") public void checkApplyElementMutationRenderableShapes() { final CaseManagementShape shape = spy(makeShape()); final Node<View<BPMNViewDefinition>, Edge> node = makeNode("uuid", shape); final MutationContext mutationContext = mock(MutationContext.class); final String name = "mockName"; when(textPropertyProvider.getText(eq(node))).thenReturn(name); handler.applyElementMutation(shape, node, true, true, mutationContext); final CaseManagementShapeView shapeView = (CaseManagementShapeView) shape.getShapeView(); verify(shapeView, times(1)).refresh(); verify(shapeView, times(1)).setLabel(eq(name)); verify(shape, times(1)).beforeDraw(); verify(shape, times(1)).afterDraw(); verify(canvasElementUpdatedEvent, times(1)).fire(any()); verify(viewHandler, times(1)).accept(eq(node.getContent().getDefinition()), eq(shapeView)); }
@Override public void applyElementMutation(final Shape shape, final Element candidate, final boolean applyPosition, final boolean applyProperties, final MutationContext mutationContext) { if (!isRenderable(shape)) { return; } if (shape instanceof CaseManagementShape) { CaseManagementShape caseManagementShape = (CaseManagementShape) shape; if (applyProperties) { applyElementTitle(caseManagementShape, candidate); applyProperties(caseManagementShape, candidate); } caseManagementShape.getShapeView().refresh(); } this.applyElementMutation(shape, candidate); }
CaseManagementCanvasHandler extends CanvasHandlerImpl<D, C> { @Override public void applyElementMutation(final Shape shape, final Element candidate, final boolean applyPosition, final boolean applyProperties, final MutationContext mutationContext) { if (!isRenderable(shape)) { return; } if (shape instanceof CaseManagementShape) { CaseManagementShape caseManagementShape = (CaseManagementShape) shape; if (applyProperties) { applyElementTitle(caseManagementShape, candidate); applyProperties(caseManagementShape, candidate); } caseManagementShape.getShapeView().refresh(); } this.applyElementMutation(shape, candidate); } }
CaseManagementCanvasHandler extends CanvasHandlerImpl<D, C> { @Override public void applyElementMutation(final Shape shape, final Element candidate, final boolean applyPosition, final boolean applyProperties, final MutationContext mutationContext) { if (!isRenderable(shape)) { return; } if (shape instanceof CaseManagementShape) { CaseManagementShape caseManagementShape = (CaseManagementShape) shape; if (applyProperties) { applyElementTitle(caseManagementShape, candidate); applyProperties(caseManagementShape, candidate); } caseManagementShape.getShapeView().refresh(); } this.applyElementMutation(shape, candidate); } @Inject  CaseManagementCanvasHandler(final ClientDefinitionManager clientDefinitionManager,
                                       final RuleManager ruleManager,
                                       final GraphUtils graphUtils,
                                       final GraphIndexBuilder<? extends MutableIndex<Node, Edge>> indexBuilder,
                                       final ShapeManager shapeManager,
                                       final TextPropertyProviderFactory textPropertyProviderFactory,
                                       final Event<CanvasElementAddedEvent> canvasElementAddedEvent,
                                       final Event<CanvasElementRemovedEvent> canvasElementRemovedEvent,
                                       final Event<CanvasElementUpdatedEvent> canvasElementUpdatedEvent,
                                       final Event<CanvasElementsClearEvent> canvasElementsClearEvent,
                                       final @CaseManagementEditor CanvasCommandFactory<AbstractCanvasHandler> canvasCommandFactory); }
CaseManagementCanvasHandler extends CanvasHandlerImpl<D, C> { @Override public void applyElementMutation(final Shape shape, final Element candidate, final boolean applyPosition, final boolean applyProperties, final MutationContext mutationContext) { if (!isRenderable(shape)) { return; } if (shape instanceof CaseManagementShape) { CaseManagementShape caseManagementShape = (CaseManagementShape) shape; if (applyProperties) { applyElementTitle(caseManagementShape, candidate); applyProperties(caseManagementShape, candidate); } caseManagementShape.getShapeView().refresh(); } this.applyElementMutation(shape, candidate); } @Inject  CaseManagementCanvasHandler(final ClientDefinitionManager clientDefinitionManager,
                                       final RuleManager ruleManager,
                                       final GraphUtils graphUtils,
                                       final GraphIndexBuilder<? extends MutableIndex<Node, Edge>> indexBuilder,
                                       final ShapeManager shapeManager,
                                       final TextPropertyProviderFactory textPropertyProviderFactory,
                                       final Event<CanvasElementAddedEvent> canvasElementAddedEvent,
                                       final Event<CanvasElementRemovedEvent> canvasElementRemovedEvent,
                                       final Event<CanvasElementUpdatedEvent> canvasElementUpdatedEvent,
                                       final Event<CanvasElementsClearEvent> canvasElementsClearEvent,
                                       final @CaseManagementEditor CanvasCommandFactory<AbstractCanvasHandler> canvasCommandFactory); @Override boolean isCanvasRoot(final Element parent); @Override void register(final Shape shape,
                         final Element<View<?>> candidate,
                         final boolean fireEvents); @Override void deregister(final Shape shape,
                           final Element element,
                           final boolean fireEvents); @Override void addShape(final Shape shape); @Override void addChild(final Element parent,
                         final Element child); @SuppressWarnings("unchecked") void addChild(final Element parent,
                         final Element child,
                         final int index); @Override void removeShape(final Shape shape); @Override void removeChild(final Element parent,
                            final Element child); @Override void applyElementMutation(final Shape shape,
                                     final Element candidate,
                                     final boolean applyPosition,
                                     final boolean applyProperties,
                                     final MutationContext mutationContext); @Override void applyElementMutation(final Element candidate,
                                     final boolean applyPosition,
                                     final boolean applyProperties,
                                     final MutationContext mutationContext); Optional<Element> getDiagramNode(); @Override Optional<Element> getElementAt(double x, double y); }
CaseManagementCanvasHandler extends CanvasHandlerImpl<D, C> { @Override public void applyElementMutation(final Shape shape, final Element candidate, final boolean applyPosition, final boolean applyProperties, final MutationContext mutationContext) { if (!isRenderable(shape)) { return; } if (shape instanceof CaseManagementShape) { CaseManagementShape caseManagementShape = (CaseManagementShape) shape; if (applyProperties) { applyElementTitle(caseManagementShape, candidate); applyProperties(caseManagementShape, candidate); } caseManagementShape.getShapeView().refresh(); } this.applyElementMutation(shape, candidate); } @Inject  CaseManagementCanvasHandler(final ClientDefinitionManager clientDefinitionManager,
                                       final RuleManager ruleManager,
                                       final GraphUtils graphUtils,
                                       final GraphIndexBuilder<? extends MutableIndex<Node, Edge>> indexBuilder,
                                       final ShapeManager shapeManager,
                                       final TextPropertyProviderFactory textPropertyProviderFactory,
                                       final Event<CanvasElementAddedEvent> canvasElementAddedEvent,
                                       final Event<CanvasElementRemovedEvent> canvasElementRemovedEvent,
                                       final Event<CanvasElementUpdatedEvent> canvasElementUpdatedEvent,
                                       final Event<CanvasElementsClearEvent> canvasElementsClearEvent,
                                       final @CaseManagementEditor CanvasCommandFactory<AbstractCanvasHandler> canvasCommandFactory); @Override boolean isCanvasRoot(final Element parent); @Override void register(final Shape shape,
                         final Element<View<?>> candidate,
                         final boolean fireEvents); @Override void deregister(final Shape shape,
                           final Element element,
                           final boolean fireEvents); @Override void addShape(final Shape shape); @Override void addChild(final Element parent,
                         final Element child); @SuppressWarnings("unchecked") void addChild(final Element parent,
                         final Element child,
                         final int index); @Override void removeShape(final Shape shape); @Override void removeChild(final Element parent,
                            final Element child); @Override void applyElementMutation(final Shape shape,
                                     final Element candidate,
                                     final boolean applyPosition,
                                     final boolean applyProperties,
                                     final MutationContext mutationContext); @Override void applyElementMutation(final Element candidate,
                                     final boolean applyPosition,
                                     final boolean applyProperties,
                                     final MutationContext mutationContext); Optional<Element> getDiagramNode(); @Override Optional<Element> getElementAt(double x, double y);  }