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;
}
}
}
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);
}
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);
}
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);
}
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
}
}
}
Aggregations