use of com.centurylink.mdw.designer.display.Graph in project mdw-designer by CenturyLinkCloud.
the class RunTimeDesignerCanvas method mouseReleased.
public void mouseReleased(MouseEvent arg0) {
if (arg0.getButton() == 1)
return;
if (!arg0.isPopupTrigger())
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 Selectable) {
// JPopupMenu popup = this.popup_activity; // TODO
// if (popup!=null) popup.show(this, arg0.getX(), arg0.getY());
} else if (obj instanceof Link) {
}
}
use of com.centurylink.mdw.designer.display.Graph in project mdw-designer by CenturyLinkCloud.
the class DesignerCanvas method paintComponent.
/* (non-Javadoc)
* @see javax.swing.JComponent#paintComponent(java.awt.Graphics)
*/
protected void paintComponent(Graphics g) {
Graph process = page.getProcess();
super.paintComponent(g);
if (g instanceof Graphics2D) {
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
if (process.zoom != 100) {
double scale = process.zoom / 100.0;
g2d.scale(scale, scale);
}
}
// draw graph itself
draw_graph(g, process, false);
// then draw dragging and selected stuff
super.paintDraggingAndSelection(g);
}
use of com.centurylink.mdw.designer.display.Graph in project mdw-designer by CenturyLinkCloud.
the class DesignerProxy method loadProcess.
public DesignerCanvas loadProcess(WorkflowProcess processVersion, FlowchartPage flowchartPage) {
CodeTimer timer = new CodeTimer("loadProcess()");
Graph graph = flowchartPage.loadProcess(processVersion.getId(), null);
flowchartPage.setProcess(graph);
if (project.isRemote() && project.isFilePersist()) {
graph.setReadonly(true);
}
processVersion.setProcessVO(graph.getProcessVO());
processVersion.setReadOnly(graph.isReadonly());
timer.stopAndLog();
return flowchartPage.canvas;
}
use of com.centurylink.mdw.designer.display.Graph in project mdw-designer by CenturyLinkCloud.
the class DesignerProxy method saveProcess.
/**
* Relies on classic designer page to update the processVO with the reloaded
* data.
*/
public void saveProcess(WorkflowProcess process, FlowchartPage flowchartPage, PersistType persistType, int version, boolean validate, boolean lock) throws ValidationException, DataAccessException, RemoteException {
CodeTimer timer = new CodeTimer("saveProcess()");
Graph graph = flowchartPage.getProcess();
graph.save_temp_vars();
// refresh variable type cache since Designer Classic uses a single,
// static cache
// calls
dataAccess.loadVariableTypes();
if (validate)
new ProcessValidator(process.getProcessVO()).validate(getNodeMetaInfo());
if (!process.getProject().checkRequiredVersion(5, 5))
flowchartPage.setProcessVersions(flowchartPage.getProcess(), // not
!process.getProject().checkRequiredVersion(5, 2));
// sure
// why
// this
// was
// ever
// needed
Map<String, String> overrideAttributes = null;
if (process.getProcessVO() != null && process.getProject().isFilePersist() && process.overrideAttributesApplied())
overrideAttributes = process.getProcessVO().getOverrideAttributes();
Graph reloaded = null;
try {
reloaded = flowchartPage.saveProcess(graph, mainFrame, persistType, version, lock);
} catch (ValidationException ex) {
graph.setDirtyLevel(Graph.DIRTY);
if (ex.getMessage() != null && ex.getMessage().contains(ORA_02292))
throw new ValidationException("There are instances associated with this process version.\n Please increment the version when saving.");
else
throw ex;
}
process.setProcessVO(reloaded.getProcessVO());
flowchartPage.setProcess(reloaded);
WorkflowPackage pkg = process.getPackage();
if (pkg != null && !pkg.isDefaultPackage() && persistType == PersistType.NEW_VERSION) {
if (project.isFilePersist()) {
pkg.setVersion(pkg.getVersion() + 1);
// exported not relevant for vcs
pkg.setExported(false);
// processes since pkg will be archived
// anyway
savePackage(pkg, true);
} else {
savePackage(pkg);
}
}
if (process.getProject().isFilePersist() && version != 0 && persistType == PersistType.NEW_VERSION && overrideAttributes != null && !overrideAttributes.isEmpty() && MdwPlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.PREFS_CARRY_FORWARD_OVERRIDE_ATTRS)) {
if (!process.overrideAttributesApplied())
throw new DataAccessException("Override attributes not applied");
reloaded.getProcessVO().applyOverrideAttributes(overrideAttributes);
getDesignerDataAccess().setOverrideAttributes(reloaded.getProcessVO());
}
cacheRefresh.fireRefresh(reloaded.getProcessVO().hasDynamicJavaActivity());
timer.stopAndLog();
}
use of com.centurylink.mdw.designer.display.Graph in project mdw-designer by CenturyLinkCloud.
the class DesignerProxy method loadProcessInstance.
public RunTimeDesignerCanvas loadProcessInstance(WorkflowProcess processVersion, ProcessInstancePage processInstancePage) {
CodeTimer timer = new CodeTimer("loadProcessInstance()");
ProcessInstanceVO processInstanceInfo = processVersion.getProcessInstance();
ProcessInstanceLoader instanceLoadThread = new ProcessInstanceLoader(processInstanceInfo, processInstancePage);
String errorMessage = null;
try {
Graph processGraph = dataAccess.getDesignerDataModel().findProcessGraph(processVersion.getId(), null);
if (processGraph == null)
processGraph = processInstancePage.loadProcess(processInstanceInfo.getProcessId(), null);
processVersion.setProcessVO(processGraph.getProcessVO());
DesignerDataAccess dao = processVersion.getDesignerDataAccess() == null ? processInstancePage.frame.dao : processVersion.getDesignerDataAccess();
Graph procInstGraph = instanceLoadThread.loadCompletionMap(processGraph.getProcessVO(), processInstanceInfo, dao);
ProcessInstanceTreeModel model = instanceLoadThread.createOrUpdateModel(null);
model.getCurrentProcess().setGraph(procInstGraph);
processInstancePage.setData(model, processInstancePage);
Map<Long, List<TaskInstanceVO>> taskInstances = new HashMap<>();
// embedded subprocesses
List<ProcessInstanceVO> embeddedSubs = new ArrayList<>();
if (procInstGraph.subgraphs != null) {
for (SubGraph instSubGraph : procInstGraph.subgraphs) {
if (instSubGraph.getInstances() != null) {
if (instSubGraph.nodes != null) {
List<Long> taskActivityIds = new ArrayList<>();
for (Node node : instSubGraph.nodes) {
if (node.isTaskActivity()) {
for (ProcessInstanceVO embeddedProcInst : instSubGraph.getInstances()) {
if (!embeddedProcInst.getActivityInstances(node.getActivityId()).isEmpty())
taskActivityIds.add(node.getActivityId());
}
}
}
if (!taskActivityIds.isEmpty()) {
for (ProcessInstanceVO embeddedProcInst : instSubGraph.getInstances()) {
ProcessVO embeddedProc = instSubGraph.getGraph().getProcessVO();
Map<Long, List<TaskInstanceVO>> embeddedTaskInsts = dao.getTaskInstances(embeddedProc, embeddedProcInst, taskActivityIds);
for (Map.Entry<Long, List<TaskInstanceVO>> embeddedTaskInst : embeddedTaskInsts.entrySet()) {
if (taskInstances.get(embeddedTaskInst.getKey()) == null)
taskInstances.put(embeddedTaskInst.getKey(), new ArrayList<TaskInstanceVO>());
taskInstances.get(embeddedTaskInst.getKey()).addAll(embeddedTaskInst.getValue());
}
}
}
}
embeddedSubs.addAll(instSubGraph.getInstances());
}
}
}
processVersion.setEmbeddedSubProcessInstances(embeddedSubs);
// manual task instances
if (processGraph.nodes != null) {
List<Long> taskActivityIds = new ArrayList<>();
for (Node node : processGraph.nodes) {
if (node.isTaskActivity() && !processInstanceInfo.getActivityInstances(node.getActivityId()).isEmpty())
taskActivityIds.add(node.getActivityId());
}
if (!taskActivityIds.isEmpty()) {
Map<Long, List<TaskInstanceVO>> taskInsts = dao.getTaskInstances(processVersion.getProcessVO(), processInstanceInfo, taskActivityIds);
for (Map.Entry<Long, List<TaskInstanceVO>> taskInst : taskInsts.entrySet()) {
if (taskInstances.get(taskInst.getKey()) == null)
taskInstances.put(taskInst.getKey(), new ArrayList<TaskInstanceVO>());
taskInstances.get(taskInst.getKey()).addAll(taskInst.getValue());
}
}
}
processVersion.setTaskInstances(taskInstances);
} catch (Exception ex) {
PluginMessages.log(ex);
errorMessage = PluginMessages.getUserMessage(ex);
}
if (errorMessage == null)
errorMessage = instanceLoadThread.getErrorMessage();
if (errorMessage != null) {
PluginMessages.uiError(errorMessage, "Load Process Instance");
}
timer.stopAndLog();
return processInstancePage.canvas;
}
Aggregations