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