Search in sources :

Example 6 with SubGraph

use of com.centurylink.mdw.designer.display.SubGraph in project mdw-designer by CenturyLinkCloud.

the class ExportHelper method printOneProcessPdf.

private Chapter printOneProcessPdf(DocWriter writer, DesignerCanvas canvas, String type, int chapterNumber, Graph process, String filename, Rectangle page_size) throws Exception {
    Paragraph cTitle = new Paragraph("Workflow Process: \"" + process.getName() + "\"", chapterFont);
    Chapter chapter = new Chapter(cTitle, chapterNumber);
    // print image
    printGraphPdf(writer, canvas, process, page_size, type, filename, chapter, chapterNumber);
    // print documentation text
    printGraphPdf(process, chapter);
    for (Node node : process.getNodes(nodeIdType)) {
        printNodePdf(node, chapter);
    }
    for (SubGraph subgraph : process.getSubgraphs(nodeIdType)) {
        printGraphPdf(subgraph, chapter);
        for (Node node : subgraph.getNodes(nodeIdType)) {
            printNodePdf(node, chapter);
        }
    }
    if (options.contains(VARIABLES)) {
        printVariablesPdf(chapter, process.getProcessVO().getVariables(), options.contains(SECTION_NUMBER) ? 1 : 0);
    }
    return chapter;
}
Also used : Node(com.centurylink.mdw.designer.display.Node) Chapter(com.lowagie.text.Chapter) SubGraph(com.centurylink.mdw.designer.display.SubGraph) Paragraph(com.lowagie.text.Paragraph)

Example 7 with SubGraph

use of com.centurylink.mdw.designer.display.SubGraph in project mdw-designer by CenturyLinkCloud.

the class ExportHelper method printProcessBodyHtml.

private void printProcessBodyHtml(StringBuilder sb, GraphCommon graph) throws Exception {
    String tmp = null;
    if (graph instanceof SubGraph) {
        SubGraph subgraph = (SubGraph) graph;
        String id = subgraph.getDisplayId(nodeIdType);
        if (id == null || id.length() == 0)
            id = subgraph.getId().toString();
        tmp = "Subprocess " + id + " - " + subgraph.getName().replace('\n', ' ');
    }
    if (tmp != null)
        sb.append("<h2>").append(tmp).append("</h2>\n");
    String summary = (graph instanceof SubGraph) ? ((SubGraph) graph).getProcessVO().getProcessDescription() : ((Graph) graph).getProcessVO().getProcessDescription();
    if (summary != null && summary.length() > 0)
        sb.append("<span style='font-weight:bold'>").append(summary).append("</span>");
    if (options.contains(DOCUMENTATION)) {
        String detail = graph.getProcessVO().getAttribute(WorkAttributeConstant.DOCUMENTATION);
        if (detail != null && detail.length() > 0) {
            printParagraphsHtml(sb, detail);
        }
    }
    if (options.contains(ATTRIBUTES) && graph instanceof SubGraph) {
        printAttributesHtml(sb, graph.getProcessVO().getAttributes());
    }
    sb.append(BR);
}
Also used : Graph(com.centurylink.mdw.designer.display.Graph) SubGraph(com.centurylink.mdw.designer.display.SubGraph) SubGraph(com.centurylink.mdw.designer.display.SubGraph)

Example 8 with SubGraph

use of com.centurylink.mdw.designer.display.SubGraph in project mdw-designer by CenturyLinkCloud.

the class FlowchartPage method actionPerformed.

public void actionPerformed(ActionEvent event) {
    String cmd = event.getActionCommand();
    if (cmd.equals(Constants.ACTION_DELETE)) {
        if (process.isReadonly()) {
            return;
        }
        if (canvas.getSelectedObject() != null) {
            if (canvas.getSelectedObject() instanceof Node) {
                if (getConfirmation("Are you sure you want to delete the node?")) {
                    process.removeNode((Node) canvas.getSelectedObject(), this.recordchange);
                }
            } else if (canvas.getSelectedObject() instanceof Link) {
                if (getConfirmation("Are you sure you want to delete the link?")) {
                    process.removeLink((Link) canvas.getSelectedObject(), this.recordchange);
                }
            } else if (canvas.getSelectedObject() instanceof SubGraph) {
                if (getConfirmation("Are you sure you want to delete the handler?")) {
                    process.removeSubGraph((SubGraph) canvas.getSelectedObject());
                }
            } else if (canvas.getSelectedObject() instanceof GraphFragment) {
                if (getConfirmation("Are you sure you want to delete the selected objects?")) {
                    GraphFragment frag = (GraphFragment) canvas.getSelectedObject();
                    for (Link l : frag.links) {
                        process.removeLink(l, recordchange);
                    }
                    for (Node n : frag.nodes) {
                        process.removeNode(n, recordchange);
                    }
                    for (SubGraph sg : frag.subgraphs) {
                        // TODO record changes
                        process.removeSubGraph(sg);
                    }
                }
            } else if (canvas.getSelectedObject() instanceof TextNote) {
                if (getConfirmation("Are you sure you want to delete the note?")) {
                    process.removeTextNote((TextNote) canvas.getSelectedObject());
                }
            }
            canvas.setSelectedObject(null);
            canvas.repaint();
        }
    } else if (cmd.equals(Constants.ACTION_TIPMODE)) {
        JCheckBox tipMode = (JCheckBox) event.getSource();
        showtip = tipMode.isSelected();
    } else if (cmd.equals(ACTION_RECORD_CHANGES)) {
        JCheckBox checkbox = (JCheckBox) event.getSource();
        recordchange = checkbox.isSelected();
    } else if (cmd.equals(ACTION_SHOW_ID)) {
        if (process != null) {
            JComboBox showId = (JComboBox) event.getSource();
            process.setNodeIdType((String) showId.getSelectedItem());
            canvas.repaint();
        }
    // else during init
    } else if (cmd.equals(Constants.ACTION_START)) {
        showStartProcessDialog(null);
    } else if (cmd.equals(ACTION_RUN_ACTIVITY)) {
        if (model.canExecuteProcess(process.getProcessVO())) {
            Node node = (Node) canvas.getSelectedObject();
            showStartProcessDialog(node);
        } else
            this.showError("You are not authorized to run processes");
    } else if (cmd.equals(ACTION_ARROWTYPE)) {
        JComboBox arrowType = (JComboBox) event.getSource();
        ImageIcon arrowTypeIcon = (ImageIcon) arrowType.getSelectedItem();
        setArrowStyle(arrowTypeIcon.getDescription());
    } else if (cmd.equals(ACTION_NODETYPE)) {
        JComboBox nodeType = (JComboBox) event.getSource();
        ImageIcon nodeTypeIcon = (ImageIcon) nodeType.getSelectedItem();
        setNodeStyle(nodeTypeIcon.getDescription());
    } else if (cmd.equals(ACTION_ZOOM)) {
        int zoomLevel = Graph.zoomLevels[zoomWidget.getSelectedIndex()];
        canvas.zoom(process, zoomLevel);
    } else if (cmd.equals(ACTION_ALL_LINK_STYLE_CHANGE)) {
        process.changeAllLinkStyle(this.linktype);
        canvas.repaint();
    } else if (cmd.equals(ACTION_COMMIT_CHANGES)) {
        if (process.isReadonly()) {
            return;
        }
        if (getConfirmation("This will commit recorded changes. Proceed?")) {
            process.commitChanges();
            canvas.repaint();
        }
    } else if (cmd.equals(ACTION_MARK_AS_NEW)) {
        markChangeType(Changes.NEW);
    } else if (cmd.equals(ACTION_MARK_AS_DELETED)) {
        markChangeType(Changes.DELETE);
    } else if (cmd.equals(ACTION_MARK_AS_NOCHANGE)) {
        markChangeType(Changes.NONE);
    } else if (cmd.equals(ACTION_LINEUP_HORIZONTAL)) {
        lineUpActivities(false);
    } else if (cmd.equals(ACTION_LINEUP_VERTICAL)) {
        lineUpActivities(true);
    } else if (cmd.equals(ACTION_ADD_NOTE)) {
        if (process.isReadonly()) {
            return;
        }
        addNote();
    } else {
        super.actionPerformed(event);
    }
}
Also used : JCheckBox(javax.swing.JCheckBox) ImageIcon(javax.swing.ImageIcon) JComboBox(javax.swing.JComboBox) Node(com.centurylink.mdw.designer.display.Node) GraphFragment(com.centurylink.mdw.designer.display.GraphFragment) TextNote(com.centurylink.mdw.designer.display.TextNote) SubGraph(com.centurylink.mdw.designer.display.SubGraph) Link(com.centurylink.mdw.designer.display.Link) Point(java.awt.Point)

Example 9 with SubGraph

use of com.centurylink.mdw.designer.display.SubGraph in project mdw-designer by CenturyLinkCloud.

the class ProcessInstanceLoader method loadCompletionMap.

public Graph loadCompletionMap(ProcessVO procdef, ProcessInstanceVO processInstance, DesignerDataAccess dao) throws Exception {
    ProcessInstanceVO fullInfo = dao.getProcessInstanceAll(processInstance.getId(), procdef);
    processInstance.copyFrom(fullInfo);
    Graph graph = new Graph(procdef, processInstance, page.getDataModel().getNodeMetaInfo(), page.frame.getIconFactory());
    if (graph.subgraphs != null) {
        if (procdef.isInRuleSet()) {
            Map<String, String> pMap = new HashMap<String, String>();
            pMap.put("owner", OwnerType.MAIN_PROCESS_INSTANCE);
            pMap.put("ownerId", processInstance.getId().toString());
            pMap.put("processId", procdef.getProcessId().toString());
            List<ProcessInstanceVO> childProcessInstances = dao.getProcessInstanceList(pMap, 0, QueryRequest.ALL_ROWS, procdef, null).getItems();
            for (ProcessInstanceVO childInst : childProcessInstances) {
                ProcessInstanceVO fullChildInfo = dao.getProcessInstanceAll(childInst.getId(), procdef);
                childInst.copyFrom(fullChildInfo);
                Long subprocId = new Long(childInst.getComment());
                for (SubGraph subgraph : graph.subgraphs) {
                    if (subgraph.getProcessVO().getProcessId().equals(subprocId)) {
                        List<ProcessInstanceVO> insts = subgraph.getInstances();
                        if (insts == null) {
                            insts = new ArrayList<ProcessInstanceVO>();
                            subgraph.setInstances(insts);
                        }
                        insts.add(childInst);
                        break;
                    }
                }
            }
        } else {
            for (SubGraph subgraph : graph.subgraphs) {
                Map<String, String> pMap = new HashMap<String, String>();
                pMap.put("owner", OwnerType.PROCESS_INSTANCE);
                pMap.put("ownerId", processInstance.getId().toString());
                pMap.put("processId", subgraph.getProcessVO().getProcessId().toString());
                List<ProcessInstanceVO> childProcessInstances = dao.getProcessInstanceList(pMap, 0, QueryRequest.ALL_ROWS, procdef, null).getItems();
                subgraph.setInstances(childProcessInstances);
                for (ProcessInstanceVO childInst : childProcessInstances) {
                    ProcessInstanceVO fullChildInfo = dao.getProcessInstanceAll(childInst.getId(), procdef);
                    childInst.copyFrom(fullChildInfo);
                }
            }
        }
    }
    StringBuffer errmsg_buffer = new StringBuffer();
    graph.setStatus(errmsg_buffer);
    if (errmsg_buffer.length() > 0) {
        errmsg = "There are runtime information about activities and transitions\n" + " that are not found in process definition.\n" + "This may happen when the process definition has been modified.\n" + errmsg_buffer.toString();
    }
    return graph;
}
Also used : Graph(com.centurylink.mdw.designer.display.Graph) SubGraph(com.centurylink.mdw.designer.display.SubGraph) HashMap(java.util.HashMap) SubGraph(com.centurylink.mdw.designer.display.SubGraph) ProcessInstanceVO(com.centurylink.mdw.model.value.process.ProcessInstanceVO)

Example 10 with SubGraph

use of com.centurylink.mdw.designer.display.SubGraph in project mdw-designer by CenturyLinkCloud.

the class RunTimeDesignerCanvas method paintComponent.

/*
     * (non-Javadoc)
     *
     * @see javax.swing.JComponent#paintComponent(java.awt.Graphics)
     */
public void paintComponent(Graphics g) {
    super.paintComponent(g);
    Graph process = page.getProcess();
    if (process != null) {
        if (g instanceof Graphics2D) {
            Graphics2D g2d = (Graphics2D) g;
            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
            if (process.zoom != 100) {
                double scale = process.zoom / 100.0;
                g2d.scale(scale, scale);
            }
        }
        draw_graph(g, process, true);
        if (page.frame != null && !page.frame.isVisible() && selected_obj != null) {
            if (selected_obj instanceof Node) {
                drawSelectionBox(g, (Node) selected_obj);
            } else if (selected_obj instanceof Link) {
                drawSelectionBox(g, (Link) selected_obj);
            } else if (selected_obj instanceof SubGraph) {
                drawSelectionBox(g, (SubGraph) selected_obj);
            } else if (selected_obj instanceof Graph) {
                drawSelectionBox(g, (Graph) selected_obj);
            }
        }
    }
}
Also used : Graph(com.centurylink.mdw.designer.display.Graph) SubGraph(com.centurylink.mdw.designer.display.SubGraph) Node(com.centurylink.mdw.designer.display.Node) SubGraph(com.centurylink.mdw.designer.display.SubGraph) Link(com.centurylink.mdw.designer.display.Link) Graphics2D(java.awt.Graphics2D)

Aggregations

SubGraph (com.centurylink.mdw.designer.display.SubGraph)25 Node (com.centurylink.mdw.designer.display.Node)17 Graph (com.centurylink.mdw.designer.display.Graph)14 Link (com.centurylink.mdw.designer.display.Link)13 GraphFragment (com.centurylink.mdw.designer.display.GraphFragment)8 TextNote (com.centurylink.mdw.designer.display.TextNote)8 ProcessInstanceVO (com.centurylink.mdw.model.value.process.ProcessInstanceVO)4 Rectangle (java.awt.Rectangle)4 HashMap (java.util.HashMap)3 VariableVO (com.centurylink.mdw.model.value.variable.VariableVO)2 Paragraph (com.lowagie.text.Paragraph)2 Graphics2D (java.awt.Graphics2D)2 AuthenticationException (com.centurylink.mdw.auth.AuthenticationException)1 DataAccessException (com.centurylink.mdw.common.exception.DataAccessException)1 TranslationException (com.centurylink.mdw.common.exception.TranslationException)1 DataAccessOfflineException (com.centurylink.mdw.dataaccess.DataAccessOfflineException)1 DesignerDataAccess (com.centurylink.mdw.designer.DesignerDataAccess)1 GraphCommon (com.centurylink.mdw.designer.display.GraphCommon)1 Label (com.centurylink.mdw.designer.display.Label)1 ProcessInstanceLoader (com.centurylink.mdw.designer.runtime.ProcessInstanceLoader)1