Search in sources :

Example 1 with GraphCommon

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

Aggregations

Graph (com.centurylink.mdw.designer.display.Graph)1 GraphCommon (com.centurylink.mdw.designer.display.GraphCommon)1 Node (com.centurylink.mdw.designer.display.Node)1 SubGraph (com.centurylink.mdw.designer.display.SubGraph)1