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