Search in sources :

Example 16 with SubGraph

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

the class ExportHelper method printGraphPdf.

private void printGraphPdf(GraphCommon graph, Chapter chapter) throws Exception {
    Section section;
    String tmp;
    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', ' ') + "\"";
    } else {
        tmp = "Process Description";
    }
    Paragraph sTitle = new Paragraph(tmp, sectionFont);
    sTitle.setSpacingBefore(10);
    section = chapter.addSection(sTitle, options.contains(SECTION_NUMBER) ? 2 : 0);
    String summary = (graph instanceof SubGraph) ? ((SubGraph) graph).getProcessVO().getProcessDescription() : ((Graph) graph).getProcessVO().getProcessDescription();
    if (summary != null && summary.length() > 0)
        printBoldParagraphsPdf(section, summary);
    if (options.contains(DOCUMENTATION)) {
        String detail = graph.getProcessVO().getAttribute(WorkAttributeConstant.DOCUMENTATION);
        if (detail != null && detail.length() > 0) {
            printHtmlParagraphsPdf(section, detail, options.contains(SECTION_NUMBER) ? 2 : 0);
        }
    }
    if (options.contains(ATTRIBUTES) && !graph.getProcessVO().getAttributes().isEmpty() && graph instanceof SubGraph) {
        printAttributesPdf(section, graph.getProcessVO().getAttributes(), options.contains(SECTION_NUMBER) ? 2 : 0);
    }
}
Also used : Graph(com.centurylink.mdw.designer.display.Graph) SubGraph(com.centurylink.mdw.designer.display.SubGraph) Section(com.lowagie.text.Section) SubGraph(com.centurylink.mdw.designer.display.SubGraph) Paragraph(com.lowagie.text.Paragraph)

Example 17 with SubGraph

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

the class RunTimeDesignerCanvas method mouseClicked.

public void mouseClicked(MouseEvent arg0) {
    if (arg0.getButton() != 1)
        return;
    if (arg0.getClickCount() != 2)
        return;
    Graph process = page.getProcess();
    int x = arg0.getX();
    int y = arg0.getY();
    if (process.zoom != 100) {
        x = x * 100 / process.zoom;
        y = y * 100 / process.zoom;
    }
    Object obj = process.objectAt(x, y, getGraphics());
    if (obj == null)
        return;
    if (obj instanceof Link) {
        Link link = (Link) obj;
        try {
            List<WorkTransitionInstanceVO> workTransitionList;
            Long linkId = new Long(link.conn.getWorkTransitionId());
            if (link.from.graph instanceof SubGraph) {
                workTransitionList = new ArrayList<WorkTransitionInstanceVO>();
                SubGraph subgraph = (SubGraph) link.from.graph;
                if (subgraph.getInstances() != null) {
                    for (ProcessInstanceVO inst : subgraph.getInstances()) {
                        List<WorkTransitionInstanceVO> coll1 = inst.getTransitionInstances(linkId);
                        workTransitionList.addAll(coll1);
                    }
                }
            } else {
                workTransitionList = page.getProcessInstance().getTransitionInstances(linkId);
            }
            WorkTransitionsDialog workTransDialog = new WorkTransitionsDialog(page.frame);
            workTransDialog.setWorkTransitionList(workTransitionList);
            workTransDialog.setVisible(true);
        } catch (Exception ex) {
            ex.printStackTrace();
            page.frame.setNewServer();
        }
    }
}
Also used : WorkTransitionInstanceVO(com.centurylink.mdw.model.value.work.WorkTransitionInstanceVO) Graph(com.centurylink.mdw.designer.display.Graph) SubGraph(com.centurylink.mdw.designer.display.SubGraph) SubGraph(com.centurylink.mdw.designer.display.SubGraph) Link(com.centurylink.mdw.designer.display.Link) ProcessInstanceVO(com.centurylink.mdw.model.value.process.ProcessInstanceVO)

Example 18 with SubGraph

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

the class RunTimeDesignerCanvas method mouseDragged.

public void mouseDragged(MouseEvent arg0) {
    Graph process = page.getProcess();
    // if (process.isReadonly()) return;
    if (selected_obj != null) {
        int x = arg0.getX();
        int y = arg0.getY();
        if (process.zoom != 100) {
            x = x * 100 / process.zoom;
            y = y * 100 / process.zoom;
        }
        if (selected_obj instanceof Node) {
            moveNode(x, y);
        } else if (selected_obj instanceof SubGraph) {
            moveSubgraph(x, y);
        } else if (selected_obj instanceof Graph) {
            moveGraphLabel(x, y);
        }
        repaint();
    }
}
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)

Example 19 with SubGraph

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

the class CanvasCommon method checkIfMoveIntoSubprocess.

private void checkIfMoveIntoSubprocess(Node node, int x, int y, DesignerPage page, boolean recordchange) {
    if (node.graph instanceof SubGraph)
        return;
    Graph process = (Graph) node.graph;
    for (Link l : process.links) {
        if (l.from == node || l.to == node)
            return;
    }
    for (SubGraph subgraph : process.subgraphs) {
        if (subgraph.containsPoint(x, y)) {
            boolean toSubproc = page.getConfirmation("Do you want to move the node into the subprocess?");
            if (toSubproc) {
                node.save_temp_vars();
                process.removeNode(node, recordchange);
                selected_obj = process.addNode(subgraph, node.nodet, 0, 0, recordchange, true);
            }
            break;
        }
    }
}
Also used : Graph(com.centurylink.mdw.designer.display.Graph) SubGraph(com.centurylink.mdw.designer.display.SubGraph) SubGraph(com.centurylink.mdw.designer.display.SubGraph) Link(com.centurylink.mdw.designer.display.Link)

Example 20 with SubGraph

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

the class CanvasCommon method moveSubgraph.

protected void moveSubgraph(int ex, int ey) {
    SubGraph subgraph = (SubGraph) selected_obj;
    Graph graph = subgraph.getGraph();
    int x = subgraph.x;
    int y = subgraph.y;
    int w = subgraph.w;
    int h = subgraph.h;
    x = ex - delta_x;
    y = ey - delta_y;
    if (x < graph.x)
        x = graph.x;
    else if (x + w > graph.x + graph.w)
        x = graph.x + graph.w - w;
    if (y < graph.y)
        y = graph.y;
    else if (y + h > graph.y + graph.h)
        y = graph.y + graph.h - h;
    subgraph.move(x, y, graph.arrowstyle);
    if (!graph.isReadonly())
        graph.setDirtyLevel(Graph.GEOCHANGE);
    resizeCanvasToFit(x + w, y + h, graph.zoom);
}
Also used : Graph(com.centurylink.mdw.designer.display.Graph) SubGraph(com.centurylink.mdw.designer.display.SubGraph) SubGraph(com.centurylink.mdw.designer.display.SubGraph)

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