Search in sources :

Example 1 with WFNodeContainer

use of org.adempiere.webui.apps.wf.WFNodeContainer in project adempiere by adempiere.

the class WWFPanelManufacturing method load.

private void load(int workflowId) {
    //	Get Workflow
    MWorkflow wf = new MWorkflow(Env.getCtx(), workflowId, null);
    WFNodeContainer nodeContainer = new WFNodeContainer();
    nodeContainer.setWorkflow(wf);
    //	Add Nodes for Paint
    MWFNode[] nodes = wf.getNodes(true, Env.getAD_Client_ID(Env.getCtx()));
    for (int i = 0; i < nodes.length; i++) {
        WFNode wfn = new WFNode(nodes[i]);
        nodeContainer.add(wfn);
        //	Add Lines
        MWFNodeNext[] nexts = nodes[i].getTransitions(Env.getAD_Client_ID(Env.getCtx()));
        for (int j = 0; j < nexts.length; j++) nodeContainer.add(new WFLine(nexts[j]));
    }
    Dimension dimension = nodeContainer.getDimension();
    BufferedImage bi = new BufferedImage(dimension.width + 2, dimension.height + 2, BufferedImage.TYPE_INT_ARGB);
    nodeContainer.paint(bi.createGraphics());
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    try {
        ImageIO.write(bi, "png", os);
        AImage imageContent = new AImage("workflow.png", os.toByteArray());
        imageMap.setWidth(dimension.width + "px");
        imageMap.setHeight(dimension.height + "px");
        imageMap.setContent(imageContent);
    } catch (Exception e) {
        logger.log(Level.SEVERE, e.getLocalizedMessage(), e);
    }
}
Also used : WFNode(org.adempiere.webui.apps.wf.WFNode) MWFNode(org.compiere.wf.MWFNode) MWorkflow(org.compiere.wf.MWorkflow) MWFNode(org.compiere.wf.MWFNode) ByteArrayOutputStream(java.io.ByteArrayOutputStream) MWFNodeNext(org.compiere.wf.MWFNodeNext) BufferedImage(java.awt.image.BufferedImage) WFLine(org.compiere.apps.wf.WFLine) AImage(org.zkoss.image.AImage) WFNodeContainer(org.adempiere.webui.apps.wf.WFNodeContainer)

Aggregations

BufferedImage (java.awt.image.BufferedImage)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 WFNode (org.adempiere.webui.apps.wf.WFNode)1 WFNodeContainer (org.adempiere.webui.apps.wf.WFNodeContainer)1 WFLine (org.compiere.apps.wf.WFLine)1 MWFNode (org.compiere.wf.MWFNode)1 MWFNodeNext (org.compiere.wf.MWFNodeNext)1 MWorkflow (org.compiere.wf.MWorkflow)1 AImage (org.zkoss.image.AImage)1