Search in sources :

Example 26 with Graph

use of com.centurylink.mdw.designer.display.Graph 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 27 with Graph

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

the class CanvasCommon method moveGraphLabel.

protected void moveGraphLabel(int ex, int ey) {
    Graph graph = (Graph) selected_obj;
    int x = graph.lx;
    int y = graph.ly;
    int w = graph.lw;
    int h = graph.lh;
    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;
    graph.lx = x;
    graph.ly = y;
    if (!graph.isReadonly())
        graph.setDirtyLevel(Graph.GEOCHANGE);
}
Also used : Graph(com.centurylink.mdw.designer.display.Graph) SubGraph(com.centurylink.mdw.designer.display.SubGraph)

Example 28 with Graph

use of com.centurylink.mdw.designer.display.Graph 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)

Example 29 with Graph

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

the class CanvasCommon method moveNode.

protected void moveNode(int ex, int ey) {
    Node selected_node = (Node) selected_obj;
    GraphCommon graph = selected_node.graph;
    int x = selected_node.x;
    int y = selected_node.y;
    int w = selected_node.w;
    int h = selected_node.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;
    selected_node.x = x;
    selected_node.y = y;
    Graph process = (graph instanceof SubGraph) ? ((SubGraph) graph).getGraph() : (Graph) graph;
    graph.recalcLinkPosition(selected_node, process.arrowstyle);
    // selected_node.save();
    if (!process.isReadonly())
        process.setDirtyLevel(Graph.GEOCHANGE);
    if (graph instanceof SubGraph && process.isSwimLanes()) {
        if (graph.w < x + w + 40)
            graph.w = x + w + 40;
    }
    resizeCanvasToFit(x + w, y + h, process.zoom);
}
Also used : Graph(com.centurylink.mdw.designer.display.Graph) SubGraph(com.centurylink.mdw.designer.display.SubGraph) GraphCommon(com.centurylink.mdw.designer.display.GraphCommon) Node(com.centurylink.mdw.designer.display.Node) SubGraph(com.centurylink.mdw.designer.display.SubGraph)

Example 30 with Graph

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

the class CanvasCommon method paintDraggingAndSelection.

protected void paintDraggingAndSelection(Graphics g) {
    if (dragging && drag_to_create_link) {
        if (selected_obj instanceof Node) {
            g.setColor(Color.GREEN);
            g.drawLine(((Node) selected_obj).x + delta_x, ((Node) selected_obj).y + delta_y, drag_x, drag_y);
        }
    } else if (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);
        } else if (selected_obj instanceof GraphFragment) {
            drawSelectionBox(g, (GraphFragment) selected_obj);
        } else if (selected_obj instanceof TextNote) {
            drawSelectionBox(g, (TextNote) selected_obj);
        }
    }
    if (useLabelEditor && selected_obj != null) /*&& at_anchor==-2 */
    {
        if (labelEditor.isVisible()) {
            Rectangle rect = labelEditor.getBounds();
            g.drawRect(rect.x - 1, rect.y - 1, rect.width + 2, rect.height + 2);
        } else {
            Label label;
            int lx, ly;
            if (selected_obj instanceof Node) {
            // label = ((Node)selected_obj).label;
            // lx = ((Node)selected_obj).lx;
            // ly = ((Node)selected_obj).ly;
            // g.drawRect(lx-1, ly-1, label.width+2, label.height+2);
            } else if (selected_obj instanceof Link) {
                label = ((Link) selected_obj).label;
                if (label != null) {
                    lx = ((Link) selected_obj).lx;
                    ly = ((Link) selected_obj).ly;
                    g.drawRect(lx - 1, ly - 1, label.width + 2, label.height + 2);
                }
            } else if (selected_obj instanceof TextNote) {
                JTextArea textarea = ((TextNote) selected_obj).textarea;
                lx = ((TextNote) selected_obj).x;
                ly = ((TextNote) selected_obj).y;
                g.drawRect(lx - 1, ly - 1, textarea.getWidth() + 2, textarea.getHeight() + 2);
            }
        // else GraphSegment
        }
    }
}
Also used : Graph(com.centurylink.mdw.designer.display.Graph) SubGraph(com.centurylink.mdw.designer.display.SubGraph) JTextArea(javax.swing.JTextArea) Node(com.centurylink.mdw.designer.display.Node) GraphFragment(com.centurylink.mdw.designer.display.GraphFragment) Rectangle(java.awt.Rectangle) Label(com.centurylink.mdw.designer.display.Label) TextNote(com.centurylink.mdw.designer.display.TextNote) SubGraph(com.centurylink.mdw.designer.display.SubGraph) Link(com.centurylink.mdw.designer.display.Link)

Aggregations

Graph (com.centurylink.mdw.designer.display.Graph)31 SubGraph (com.centurylink.mdw.designer.display.SubGraph)31 Link (com.centurylink.mdw.designer.display.Link)9 Node (com.centurylink.mdw.designer.display.Node)9 ValidationException (com.centurylink.mdw.designer.utils.ValidationException)7 DataAccessException (com.centurylink.mdw.common.exception.DataAccessException)6 TextNote (com.centurylink.mdw.designer.display.TextNote)5 ProcessVO (com.centurylink.mdw.model.value.process.ProcessVO)5 RemoteException (java.rmi.RemoteException)5 ProcessInstanceVO (com.centurylink.mdw.model.value.process.ProcessInstanceVO)4 CodeTimer (com.centurylink.mdw.plugin.CodeTimer)4 FlowchartPage (com.centurylink.mdw.designer.pages.FlowchartPage)3 GraphFragment (com.centurylink.mdw.designer.display.GraphFragment)2 ProcessValidator (com.centurylink.mdw.designer.utils.ProcessValidator)2 ProcessWorker (com.centurylink.mdw.designer.utils.ProcessWorker)2 ActivityInstanceVO (com.centurylink.mdw.model.value.work.ActivityInstanceVO)2 WorkTransitionInstanceVO (com.centurylink.mdw.model.value.work.WorkTransitionInstanceVO)2 WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)2 Graphics2D (java.awt.Graphics2D)2 ArrayList (java.util.ArrayList)2