use of org.kie.workbench.common.stunner.core.client.shape.ShapeViewExtStub in project kie-wb-common by kiegroup.
the class AbstractControlTest method setUp.
public void setUp() {
shapeView = new ShapeViewExtStub(shapeEventHandler, hasControlPoints);
when(element.getUUID()).thenReturn(ELEMENT_UUID);
when(canvasHandler.getDiagram()).thenReturn(diagram);
when(diagram.getMetadata()).thenReturn(metadata);
when(metadata.getCanvasRootUUID()).thenReturn(ROOT_UUID);
when(canvasHandler.getCanvas()).thenReturn(canvas);
when(canvasHandler.getAbstractCanvas()).thenReturn(canvas);
when(canvas.getLayer()).thenReturn(layer);
when(canvas.getShape(eq(ELEMENT_UUID))).thenReturn(shape);
when(canvas.getShapes()).thenReturn(Collections.singletonList(shape));
when(shape.getUUID()).thenReturn(ELEMENT_UUID);
when(shape.getShapeView()).thenReturn(shapeView);
when(shapeEventHandler.supports(eq(ViewEventType.MOUSE_CLICK))).thenReturn(true);
when(shapeEventHandler.supports(eq(ViewEventType.MOUSE_ENTER))).thenReturn(true);
when(shapeEventHandler.supports(eq(ViewEventType.MOUSE_EXIT))).thenReturn(true);
when(shapeEventHandler.supports(eq(ViewEventType.DRAG))).thenReturn(true);
}
use of org.kie.workbench.common.stunner.core.client.shape.ShapeViewExtStub in project kie-wb-common by kiegroup.
the class MapSelectionControlTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() throws Exception {
ShapeViewExtStub shapeView = new ShapeViewExtStub(shapeEventHandler, hasControlPoints);
when(element.getUUID()).thenReturn(ELEMENT_UUID);
when(element.getContent()).thenReturn(new ViewImpl<>(definition, BoundsImpl.build(0, 0, 10, 10)));
when(canvasHandler.getDiagram()).thenReturn(diagram);
when(diagram.getMetadata()).thenReturn(metadata);
when(metadata.getCanvasRootUUID()).thenReturn(ROOT_UUID);
when(canvasHandler.getCanvas()).thenReturn(canvas);
when(canvas.getLayer()).thenReturn(layer);
when(canvas.getShape(eq(ELEMENT_UUID))).thenReturn(shape);
when(canvas.getShapes()).thenReturn(Collections.singletonList(shape));
when(shape.getUUID()).thenReturn(ELEMENT_UUID);
when(shape.getShapeView()).thenReturn(shapeView);
when(shapeEventHandler.supports(eq(ViewEventType.MOUSE_CLICK))).thenReturn(true);
this.tested = new MapSelectionControl(e -> elementSelectedEvent.fire((CanvasSelectionEvent) e), e -> clearSelectionEvent.fire((CanvasClearSelectionEvent) e));
this.tested.setReadonly(false);
}
use of org.kie.workbench.common.stunner.core.client.shape.ShapeViewExtStub in project kie-wb-common by kiegroup.
the class NodeShapeImplTest method setup.
@Before
public void setup() throws Exception {
when(shapeStateHandler.shapeAttributesChanged()).thenReturn(shapeStateHandler);
when(def.titleHandler()).thenReturn(Optional.of(titleHandler));
when(def.fontHandler()).thenReturn(Optional.of(fontHandler));
when(def.sizeHandler()).thenReturn(Optional.of(sizeHandler));
when(def.viewHandler()).thenReturn(viewHandler);
when(element.getContent()).thenReturn(content);
when(content.getDefinition()).thenReturn(definition);
when(content.getBounds()).thenReturn(bounds);
when(bounds.getUpperLeft()).thenReturn(new BoundImpl(10d, 20d));
when(bounds.getLowerRight()).thenReturn(new BoundImpl(50d, 60d));
this.view = spy(new ShapeViewExtStub());
this.tested = new NodeShapeImpl<>(def, new ShapeImpl<>(view, shapeStateHandler));
}
use of org.kie.workbench.common.stunner.core.client.shape.ShapeViewExtStub in project kie-wb-common by kiegroup.
the class LocationControlImplTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() throws Exception {
this.canvasCommandFactory = new DefaultCanvasCommandFactory(null, null);
this.shapeView = spy(new ShapeViewExtStub(shapeEventHandler, hasControlPoints));
when(element.getUUID()).thenReturn(ELEMENT_UUID);
when(element.asNode()).thenReturn(element);
when(canvasHandler.getDiagram()).thenReturn(diagram);
when(canvasHandler.getGraphIndex()).thenReturn(graphIndex);
when(graphIndex.get(eq(ELEMENT_UUID))).thenReturn(element);
when(element.getContent()).thenReturn(elementContent);
when(elementContent.getDefinition()).thenReturn(definition);
when(elementContent.getBounds()).thenReturn(ELEMENT_BOUNDS);
when(graph.getContent()).thenReturn(graphContent);
when(graphContent.getBounds()).thenReturn(GRAPH_BOUNDS);
when(diagram.getGraph()).thenReturn(graph);
when(diagram.getMetadata()).thenReturn(metadata);
when(metadata.getCanvasRootUUID()).thenReturn(ROOT_UUID);
when(canvasHandler.getCanvas()).thenReturn(canvas);
when(canvas.getLayer()).thenReturn(layer);
when(canvas.getShape(eq(ELEMENT_UUID))).thenReturn(shape);
when(canvas.getShapes()).thenReturn(Collections.singletonList(shape));
when(canvas.getWiresManager()).thenReturn(wiresManager);
when(shape.getUUID()).thenReturn(ELEMENT_UUID);
when(shape.getShapeView()).thenReturn(shapeView);
when(shapeEventHandler.supports(any(ViewEventType.class))).thenReturn(true);
when(wiresManager.getSelectionManager()).thenReturn(selectionManager);
when(selectionManager.getControl()).thenReturn(wiresCompositeControl);
this.tested = new LocationControlImpl(canvasCommandFactory, shapeLocationsChangedEvent);
tested.setCommandManagerProvider(() -> commandManager);
}
use of org.kie.workbench.common.stunner.core.client.shape.ShapeViewExtStub in project kie-wb-common by kiegroup.
the class ToolboxControlImplTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() throws Exception {
this.shapeView = new ShapeViewExtStub(shapeEventHandler, hasControlPoints);
when(element.getUUID()).thenReturn(ELEMENT_UUID);
when(canvasHandler.getDiagram()).thenReturn(diagram);
when(diagram.getMetadata()).thenReturn(metadata);
when(metadata.getCanvasRootUUID()).thenReturn(ROOT_UUID);
when(canvasHandler.getCanvas()).thenReturn(canvas);
when(canvas.getShape(eq(ELEMENT_UUID))).thenReturn(shape);
when(canvas.getShapes()).thenReturn(Collections.singletonList(shape));
when(shape.getUUID()).thenReturn(ELEMENT_UUID);
when(shape.getShapeView()).thenReturn(shapeView);
when(shapeEventHandler.supports(eq(ViewEventType.MOUSE_CLICK))).thenReturn(true);
when(toolboxFactory.build(eq(canvasHandler), eq(element))).thenReturn(Optional.of(toolbox));
when(showToolboxPredicate.test(anyString())).thenReturn(true);
this.tested = new ToolboxControlImpl(() -> Collections.singletonList(toolboxFactory), showToolboxPredicate);
}
Aggregations