Search in sources :

Example 1 with PictureShapeView

use of org.kie.workbench.common.stunner.shapes.client.view.PictureShapeView in project kie-wb-common by kiegroup.

the class CaseManagementShapeDefFactoryTest method setup.

@Before
@SuppressWarnings("unchecked")
public void setup() throws Exception {
    this.pictureShapeView = new PictureShapeView(new MultiPath().rect(0, 0, 10, 10));
    when(stageView.setWidth(anyDouble())).thenReturn(stageView);
    when(stageView.setHeight(anyDouble())).thenReturn(stageView);
    when(basicShapeViewFactory.pictureFromUri(any(SafeUri.class), anyDouble(), anyDouble())).thenReturn(pictureShapeView);
    when(basicShapeViewFactory.connector(anyDouble(), anyDouble(), anyDouble(), anyDouble())).thenReturn(connectorShapeView);
    when(cmShapeViewFactory.newNullView()).thenReturn(nullView);
    when(cmShapeViewFactory.newStageView(anyDouble(), anyDouble(), anyDouble())).thenReturn(stageView);
    when(cmShapeViewFactory.newActivityView(anyDouble(), anyDouble())).thenReturn(activityView);
    when(cmShapeViewFactory.newDiagramView(anyDouble(), anyDouble())).thenReturn(diagramView);
    this.tested = new CaseManagementShapeDefFactory(cmShapeViewFactory, basicShapeViewFactory, new ShapeDefFunctionalFactory<>());
    this.tested.init();
}
Also used : MultiPath(com.ait.lienzo.client.core.shape.MultiPath) ShapeDefFunctionalFactory(org.kie.workbench.common.stunner.core.client.shape.factory.ShapeDefFunctionalFactory) SafeUri(com.google.gwt.safehtml.shared.SafeUri) PictureShapeView(org.kie.workbench.common.stunner.shapes.client.view.PictureShapeView) Before(org.junit.Before)

Example 2 with PictureShapeView

use of org.kie.workbench.common.stunner.shapes.client.view.PictureShapeView in project kie-wb-common by kiegroup.

the class CaseManagementShapeFactoryTest method setup.

@Before
@SuppressWarnings("unchecked")
public void setup() {
    this.pictureShapeView = new PictureShapeView(new MultiPath().rect(0, 0, 10, 10));
    this.cmShapeViewFactory = new CaseManagementShapeViewFactory();
    final BasicShapesFactory basicShapesFactory = new BasicShapesFactory(new ShapeDefFunctionalFactory<>(), basicViewFactory);
    basicShapesFactory.init();
    final CaseManagementShapeDefFactory cmShapeDefFactory = new CaseManagementShapeDefFactory(cmShapeViewFactory, basicViewFactory, new ShapeDefFunctionalFactory<>());
    cmShapeDefFactory.init();
    this.delegate = spy(new DelegateShapeFactory());
    doReturn(glyph).when(delegate).getGlyph(anyString());
    this.factory = new CaseManagementShapeFactory(cmShapeDefFactory, basicShapesFactory, delegate);
    this.factory.init();
    when(basicViewFactory.pictureFromUri(any(SafeUri.class), anyDouble(), anyDouble())).thenReturn(pictureShapeView);
    when(basicViewFactory.connector(anyDouble(), anyDouble(), anyDouble(), anyDouble())).thenReturn(connectorShapeView);
    when(definitionManager.adapters()).thenReturn(adapterManager);
    when(adapterManager.forDefinition()).thenReturn(definitionAdapter);
}
Also used : MultiPath(com.ait.lienzo.client.core.shape.MultiPath) DelegateShapeFactory(org.kie.workbench.common.stunner.core.client.shape.factory.DelegateShapeFactory) BasicShapesFactory(org.kie.workbench.common.stunner.shapes.client.factory.BasicShapesFactory) SafeUri(com.google.gwt.safehtml.shared.SafeUri) PictureShapeView(org.kie.workbench.common.stunner.shapes.client.view.PictureShapeView) Before(org.junit.Before)

Example 3 with PictureShapeView

use of org.kie.workbench.common.stunner.shapes.client.view.PictureShapeView in project kie-wb-common by kiegroup.

the class CaseManagementShapeDefFactory method newActivityShape.

@SuppressWarnings("unchecked")
private Shape newActivityShape(final Object instance, final ShapeDef shapeDef) {
    final BPMNViewDefinition bpmnDefinition = (BPMNViewDefinition) instance;
    final CaseManagementActivityShapeDef cmShapeDef = (CaseManagementActivityShapeDef) shapeDef;
    final double width = cmShapeDef.getWidth(bpmnDefinition);
    final double height = cmShapeDef.getHeight(bpmnDefinition);
    final ActivityView view = cmShapeViewFactory.newActivityView(width, height);
    final SafeUri iconUri = cmShapeDef.getIconUri(instance.getClass());
    final PictureShapeView iconView = basicShapeViewFactory.pictureFromUri(iconUri, 15d, 15d);
    return new ActivityShape(cmShapeDef, iconView, view);
}
Also used : CaseManagementActivityShapeDef(org.kie.workbench.common.stunner.cm.client.shape.def.CaseManagementActivityShapeDef) ActivityView(org.kie.workbench.common.stunner.cm.client.shape.view.ActivityView) SafeUri(com.google.gwt.safehtml.shared.SafeUri) BPMNViewDefinition(org.kie.workbench.common.stunner.bpmn.definition.BPMNViewDefinition) ActivityShape(org.kie.workbench.common.stunner.cm.client.shape.ActivityShape) PictureShapeView(org.kie.workbench.common.stunner.shapes.client.view.PictureShapeView)

Example 4 with PictureShapeView

use of org.kie.workbench.common.stunner.shapes.client.view.PictureShapeView in project kie-wb-common by kiegroup.

the class CaseManagementCanvasHandlerTest method makeShape.

@SuppressWarnings("unchecked")
private ActivityShape makeShape() {
    final CaseManagementTaskShapeDef shapeDef = new CaseManagementTaskShapeDef();
    final ActivityView shapeView = new ActivityView(10.0, 20.0);
    final ActivityShape shape = new ActivityShape(shapeDef, new PictureShapeView(new MultiPath()), shapeView);
    return shape;
}
Also used : MultiPath(com.ait.lienzo.client.core.shape.MultiPath) ActivityView(org.kie.workbench.common.stunner.cm.client.shape.view.ActivityView) CaseManagementTaskShapeDef(org.kie.workbench.common.stunner.cm.client.shape.def.CaseManagementTaskShapeDef) ActivityShape(org.kie.workbench.common.stunner.cm.client.shape.ActivityShape) PictureShapeView(org.kie.workbench.common.stunner.shapes.client.view.PictureShapeView)

Example 5 with PictureShapeView

use of org.kie.workbench.common.stunner.shapes.client.view.PictureShapeView in project kie-wb-common by kiegroup.

the class BasicShapesFactory method newPicture.

@SuppressWarnings("unchecked")
private Shape newPicture(final Object instance, final BasicShapeDef shapeDef) {
    final PictureShapeDef pictShapeDef = (PictureShapeDef) shapeDef;
    final Object pictureSource = pictShapeDef.getPictureSource(instance);
    final double width = pictShapeDef.getWidth(instance);
    final double height = pictShapeDef.getHeight(instance);
    final PictureShapeView view = shapeViewFactory.picture(pictureSource, width, height);
    return new PictureShape(view);
}
Also used : PictureShapeDef(org.kie.workbench.common.stunner.shapes.def.picture.PictureShapeDef) PictureShape(org.kie.workbench.common.stunner.shapes.client.PictureShape) PictureShapeView(org.kie.workbench.common.stunner.shapes.client.view.PictureShapeView)

Aggregations

PictureShapeView (org.kie.workbench.common.stunner.shapes.client.view.PictureShapeView)5 MultiPath (com.ait.lienzo.client.core.shape.MultiPath)3 SafeUri (com.google.gwt.safehtml.shared.SafeUri)3 Before (org.junit.Before)2 ActivityShape (org.kie.workbench.common.stunner.cm.client.shape.ActivityShape)2 ActivityView (org.kie.workbench.common.stunner.cm.client.shape.view.ActivityView)2 BPMNViewDefinition (org.kie.workbench.common.stunner.bpmn.definition.BPMNViewDefinition)1 CaseManagementActivityShapeDef (org.kie.workbench.common.stunner.cm.client.shape.def.CaseManagementActivityShapeDef)1 CaseManagementTaskShapeDef (org.kie.workbench.common.stunner.cm.client.shape.def.CaseManagementTaskShapeDef)1 DelegateShapeFactory (org.kie.workbench.common.stunner.core.client.shape.factory.DelegateShapeFactory)1 ShapeDefFunctionalFactory (org.kie.workbench.common.stunner.core.client.shape.factory.ShapeDefFunctionalFactory)1 PictureShape (org.kie.workbench.common.stunner.shapes.client.PictureShape)1 BasicShapesFactory (org.kie.workbench.common.stunner.shapes.client.factory.BasicShapesFactory)1 PictureShapeDef (org.kie.workbench.common.stunner.shapes.def.picture.PictureShapeDef)1