Package org.enhydra.jawe.base.controller

Examples of org.enhydra.jawe.base.controller.JaWEController


    public BufferedImage generateProcessImage(String xpdl, String packageId, String processDefId, String[] runningActivityIds) {

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

        JaWEController jaweController = jaweManager.getJaWEController();
        synchronized (jaweController) {
            try {
                // check process id
                String[] split = processDefId.split("#");
                if (split.length == 3) {
                    processDefId = split[2];
                }

                // load package definition
                XPDLHandler xpdlHandler = jaweManager.getXPDLHandler();
                xpdlHandler.setValidation(false);
                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;
            }catch(Exception e){
                LogFactory.getLog(Viewer.class.getName()).error(e);
                return null;
            } finally {
                try {
                    jaweController.closePackage(null, true);
                } catch (Exception e) {
                    // ignore
                }
            }
        }
View Full Code Here


    public void enableDisableAction() {
    }

    public void actionPerformed(ActionEvent e) {
        JaWEController jcon = (JaWEController) jawecomponent;
        final JDialog d = new JDialog();
        final ConfigurationPanel config = new ConfigurationPanel();
        JButton btnOk = new JButton("ok");
        JButton btnCancel = new JButton("cancel");
        JPanel buttons = new JPanel();

        System.out.println("action performed " + e.getActionCommand());

        d.getContentPane().setLayout(new BoxLayout(d.getContentPane(), BoxLayout.Y_AXIS));
        buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS));
        buttons.add(btnOk);
        buttons.add(btnCancel);

        btnOk.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                config.applyConfig();
                d.setVisible(false);
                d.dispose();
            }
        });
        btnCancel.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                d.setVisible(false);
                d.dispose();
            }
        });

        d.getContentPane().add(config);
        d.getContentPane().add(buttons);

        d.setLocationRelativeTo(jcon.getJaWEFrame());
        d.setModal(true);
        d.pack();
        d.setVisible(true);
    }
View Full Code Here

    public void enableDisableAction() {
    }

    public void actionPerformed(ActionEvent e) {
        JaWEController jc=JaWEManager.getInstance().getJaWEController();
        if (jc.tryToClosePackage(jc.getMainPackageId(), true)) {
            //jc.newPackage(JaWEConstants.PACKAGE_DEFAULT);
            NewPackageWizardList wizz = new NewPackageWizardList(jc);
            wizz.setLocationRelativeTo(jc.getJaWEFrame());
            wizz.setVisible(true);

            Designer.APP_ID = "";
            Designer.APP_VERSION = "";

            //pop up properties
            XPDLElementEditor ed = JaWEManager.getInstance().getXPDLElementEditor();
            ed.editXPDLElement(jc.getSelectionManager().getWorkingPKG());
        }
    }
View Full Code Here

    public Undo(JaWEComponent jawecomponent) {
        super(jawecomponent);
    }

    public void enableDisableAction() {
        JaWEController jc = JaWEManager.getInstance().getJaWEController();
        UndoHistoryManager um = jc.getUndoHistoryManager();
        setEnabled(um.canUndo());
    }
View Full Code Here

        UndoHistoryManager um = jc.getUndoHistoryManager();
        setEnabled(um.canUndo());
    }

    public void actionPerformed(ActionEvent e) {
        JaWEController jc = JaWEManager.getInstance().getJaWEController();
        jc.undo();


    }
View Full Code Here

    public Redo(JaWEComponent jawecomponent) {
        super(jawecomponent);
    }

    public void enableDisableAction() {
        JaWEController jc = JaWEManager.getInstance().getJaWEController();
        UndoHistoryManager um = jc.getUndoHistoryManager();
        setEnabled(um.canRedo());
    }
View Full Code Here

        // launch JaWE
        JaWE.main(argument);

        // Automatically create new package when launched without any existing package.
        if (APP_ID == null || APP_ID.isEmpty()) {
            JaWEController jc = JaWEManager.getInstance().getJaWEController();
            if (jc.tryToClosePackage(jc.getMainPackageId(), false)) {
                //create new package
                jc.newPackage(jc.getJaWETypes().getDefaultType(Package.class));
                //pop up properties
                XPDLElementEditor ed = JaWEManager.getInstance().getXPDLElementEditor();
                ed.editXPDLElement(jc.getSelectionManager().getWorkingPKG());
            }
        }

    }
View Full Code Here

        setEnabled(true || Designer.isPackageFixed());
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        JaWEController jc = (JaWEController) jawecomponent;

        int deployStatus = JOptionPane.showConfirmDialog(null, ResourceManager.getLanguageDependentString("DeployConfirm"));

        if (deployStatus == JOptionPane.YES_OPTION) {
View Full Code Here

        return checkValidity;
    }

    public File saveTempFile() throws IOException {
        JaWEController jc = JaWEManager.getInstance().getJaWEController();

        Package pkg = jc.getMainPackage();

        File file = File.createTempFile("wfxpdl", null);

        jc.savePackage(pkg.getId(), file.getAbsolutePath());

        return file;
    }
View Full Code Here

        UndoHistoryManager um = jc.getUndoHistoryManager();
        setEnabled(um.canRedo());
    }

    public void actionPerformed(ActionEvent e) {
        JaWEController jc = JaWEManager.getInstance().getJaWEController();
        jc.redo();
    }
View Full Code Here

TOP

Related Classes of org.enhydra.jawe.base.controller.JaWEController

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.