Search in sources :

Example 1 with LifecycleRenderer

use of org.cristalise.kernel.lifecycle.renderer.LifecycleRenderer in project kernel by cristal-ise.

the class LifecycleRendererTest method generateInstance_SVG.

@Test
public void generateInstance_SVG() throws Exception {
    String wfXML = FileStringUtility.url2String(LifecycleRendererTest.class.getResource("/LifeCycle.workflow"));
    Workflow wf = (Workflow) Gateway.getMarshaller().unmarshall(wfXML);
    LifecycleRenderer generator = new LifecycleRenderer(wf.search("workflow/domain").getChildrenGraphModel(), false);
    int zoomFactor = generator.getZoomFactor(500, 500);
    SVGGraphics2D svgG2D = new SVGGraphics2D(500, 500);
    svgG2D.scale((double) zoomFactor / 100, (double) zoomFactor / 100);
    generator.draw(svgG2D);
    SVGUtils.writeToSVG(new File("target/workflow.svg"), svgG2D.getSVGElement());
}
Also used : LifecycleRenderer(org.cristalise.kernel.lifecycle.renderer.LifecycleRenderer) Workflow(org.cristalise.kernel.lifecycle.instance.Workflow) SVGGraphics2D(org.jfree.graphics2d.svg.SVGGraphics2D) File(java.io.File) Test(org.junit.Test)

Example 2 with LifecycleRenderer

use of org.cristalise.kernel.lifecycle.renderer.LifecycleRenderer in project kernel by cristal-ise.

the class LifecycleRendererTest method generateDef_SVG.

@Test
public void generateDef_SVG() throws Exception {
    String caDefXML = FileStringUtility.url2String(Gateway.getResource().getKernelResourceURL("boot/CA/ManageModule.xml"));
    CompositeActivityDef caDef = (CompositeActivityDef) Gateway.getMarshaller().unmarshall(caDefXML);
    LifecycleRenderer generator = new LifecycleRenderer(caDef.getChildrenGraphModel(), true);
    int zoomFactor = generator.getZoomFactor(500, 500);
    SVGGraphics2D svgG2D = new SVGGraphics2D(500, 500);
    svgG2D.scale((double) zoomFactor / 100, (double) zoomFactor / 100);
    generator.draw(svgG2D);
    SVGUtils.writeToSVG(new File("target/ManageModule.svg"), svgG2D.getSVGElement());
}
Also used : LifecycleRenderer(org.cristalise.kernel.lifecycle.renderer.LifecycleRenderer) SVGGraphics2D(org.jfree.graphics2d.svg.SVGGraphics2D) CompositeActivityDef(org.cristalise.kernel.lifecycle.CompositeActivityDef) File(java.io.File) Test(org.junit.Test)

Example 3 with LifecycleRenderer

use of org.cristalise.kernel.lifecycle.renderer.LifecycleRenderer in project kernel by cristal-ise.

the class LifecycleRendererTest method generateDef_PNG.

@Test
public void generateDef_PNG() throws Exception {
    String caDefXML = FileStringUtility.url2String(Gateway.getResource().getKernelResourceURL("boot/CA/ManageModule.xml"));
    CompositeActivityDef caDef = (CompositeActivityDef) Gateway.getMarshaller().unmarshall(caDefXML);
    BufferedImage img = new LifecycleRenderer(caDef.getChildrenGraphModel(), true).getWorkFlowModelImage(500, 500);
    ImageIO.write(img, "png", new File("target/ManageModule.png"));
}
Also used : LifecycleRenderer(org.cristalise.kernel.lifecycle.renderer.LifecycleRenderer) CompositeActivityDef(org.cristalise.kernel.lifecycle.CompositeActivityDef) File(java.io.File) BufferedImage(java.awt.image.BufferedImage) Test(org.junit.Test)

Aggregations

File (java.io.File)3 LifecycleRenderer (org.cristalise.kernel.lifecycle.renderer.LifecycleRenderer)3 Test (org.junit.Test)3 CompositeActivityDef (org.cristalise.kernel.lifecycle.CompositeActivityDef)2 SVGGraphics2D (org.jfree.graphics2d.svg.SVGGraphics2D)2 BufferedImage (java.awt.image.BufferedImage)1 Workflow (org.cristalise.kernel.lifecycle.instance.Workflow)1