Package org.enhydra.jawe.components.graph

Examples of org.enhydra.jawe.components.graph.Graph


                jaweController.openPackageFromStream(xpdl.getBytes("UTF-8"));
                org.enhydra.shark.xpdl.elements.Package pkg = xpdlHandler.getPackageById(packageId);
                org.enhydra.shark.xpdl.elements.WorkflowProcess wp = pkg.getWorkflowProcess(processDefId);
                GraphController gc = (GraphController) jaweManager.getComponentManager().getComponent("GraphComponent");
                gc.selectGraphForElement(wp);
                Graph graph = gc.getGraph(wp);

                // highlight running activities
                if (runningActivityIds != null && runningActivityIds.length > 0) {
                    graph.clearSelection();
                    try {
                        for (int i = 0; i < runningActivityIds.length; i++) {
                            try {
                                GraphManager wm = graph.getGraphManager();
                                Object go = wm.getGraphActivity(runningActivityIds[i]);
                                if (go != null) {
                                    graph.addSelectionCell(go);
                                }
                            } catch (Exception ex) {
                                LogFactory.getLog(Viewer.class.getName()).error(ex);
                            }
                        }
                    } catch (Exception ex) {
                        LogFactory.getLog(Viewer.class.getName()).error("Problems while updating selection", ex);
                    }
                }

                // generate image
                BufferedImage img = null;
                Object[] cells = graph.getRoots();

                if (cells.length > 0) {
                    graph.setSize(graph.getPreferredSize());
                    Rectangle bounds = graph.getCellBounds(cells).getBounds();// HM, JGraph3.4.1
                    graph.toScreen(bounds);

                    // Create a Buffered Image
                    Dimension d = bounds.getSize();
                    img = new BufferedImage(d.width, d.height, BufferedImage.TYPE_INT_RGB);
                    Graphics2D graphics = img.createGraphics();
                    graph.paint(graphics);
                }

                LogFactory.getLog(Viewer.class.getName()).info("Completed generating process image");

                return img;
View Full Code Here


        public void valueChanged(ListSelectionEvent lse) {
            XMLElement element = getSelectedElement();
            if (element != null) {
                // select element in graph
                GraphController gc = (GraphController) JaWEManager.getInstance().getComponentManager().getComponent("GraphComponent");
                Graph g = null;
                WorkflowProcess wp = null;
                if (element instanceof Activity) {
                    wp = (WorkflowProcess) element.getParent().getParent();
                    g = gc.getGraph(wp);
                    gc.selectGraphForElement(wp);
                    g.selectActivity((Activity) element, false);
                } else if (element instanceof Transition) {
                    wp = (WorkflowProcess) element.getParent().getParent();
                    g = gc.getGraph(wp);
                    gc.selectGraphForElement(wp);
                    g.selectTransition((Transition) element, false);
                }

                // hilite affected process in tree
                if (wp != null) {
                    SimpleNavigator tcon = (SimpleNavigator) JaWEManager.getInstance().getComponentManager().getComponent("SimpleNavigatorComponent");
View Full Code Here

TOP

Related Classes of org.enhydra.jawe.components.graph.Graph

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.