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();
}
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);
}
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);
}
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;
}
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);
}
Aggregations