use of com.centurylink.mdw.model.value.activity.ActivityImplementorVO in project mdw-designer by CenturyLinkCloud.
the class Graph method addSubGraph.
public SubGraph addSubGraph(int x, int y, String subtype, boolean recordchange) {
Long pProcessId = genNodeId();
String pDesc = null;
List<ExternalEventVO> pExtEvents = null;
ProcessVO subproc = new ProcessVO(pProcessId, subtype, pDesc, pExtEvents);
if (getProcessVO() != null && getProcessVO().isInRuleSet())
subproc.setInRuleSet(true);
List<AttributeVO> attributes = new ArrayList<AttributeVO>();
AttributeVO a = new AttributeVO(null, WorkAttributeConstant.PROCESS_VISIBILITY, ProcessVisibilityConstant.EMBEDDED);
attributes.add(a);
a = new AttributeVO(null, WorkAttributeConstant.EMBEDDED_PROCESS_TYPE, subtype);
attributes.add(a);
subproc.setAttributes(attributes);
subproc.setActivities(new ArrayList<ActivityVO>());
subproc.setTransitions(new ArrayList<WorkTransitionVO>());
subproc.setVariables(new ArrayList<VariableVO>());
List<ProcessVO> subprocs = processVO.getSubProcesses();
if (subprocs == null) {
subprocs = new ArrayList<ProcessVO>();
processVO.setSubProcesses(subprocs);
}
subprocs.add(subproc);
SubGraph subgraph = new SubGraph(subproc, this, metainfo, getIconFactory());
subgraph.x = x;
subgraph.y = y;
subgraph.w = 440;
subgraph.h = 120;
// need to add it before generating first node to avoid dup id
subgraphs.add(subgraph);
Node node1 = addNode(subgraph, metainfo.getStartActivity(), x + 40, y + 40, recordchange);
node1.nodet.setActivityName("Start");
if (subtype.equals(ProcessVisibilityConstant.EMBEDDED_ERROR_PROCESS)) {
ActivityImplementorVO nmi = metainfo.getTaskActivity();
Node node2 = addNode(subgraph, nmi, x + 170, y + 30, recordchange);
Node node3 = addNode(subgraph, metainfo.getStopActivity(), x + 340, y + 40, recordchange);
node3.nodet.setActivityName("Stop");
addLink(node1, node2, EventType.FINISH, Link.ELBOW, 2, recordchange);
addLink(node2, node3, EventType.FINISH, Link.ELBOW, 2, recordchange);
} else {
Node node3 = addNode(subgraph, metainfo.getStopActivity(), x + 340, y + 40, recordchange);
node3.nodet.setActivityName("Stop");
addLink(node1, node3, EventType.FINISH, Link.ELBOW, 2, recordchange);
}
if (recordchange)
subgraph.getChanges().setChangeType(Changes.NEW);
setDirtyLevel(DIRTY);
return subgraph;
}
use of com.centurylink.mdw.model.value.activity.ActivityImplementorVO in project mdw-designer by CenturyLinkCloud.
the class NodeChoicePane method init.
private void init() {
next_choice_y = 10;
int i, n = page.getDataModel().getNodeMetaInfo().count();
ActivityImplementorVO nmi;
node_y = new int[n];
icon = new javax.swing.Icon[n];
for (i = hidden_count; i < n; i++) {
nmi = page.getDataModel().getNodeMetaInfo().get(i);
if (nmi != null) {
node_y[i] = next_choice_y;
// next_choice_y += 10 + nmi.shape_h;
next_choice_y += row_height;
IconFactory iconFactory = page.frame.getIconFactory();
icon[i] = iconFactory.getIcon(nmi.getIconName(), page);
icon[i] = iconFactory.scaleIconToMax(icon[i], 24, 24);
}
}
setPreferredSize(new Dimension(300, next_choice_y));
selected_node = -1;
}
use of com.centurylink.mdw.model.value.activity.ActivityImplementorVO in project mdw-designer by CenturyLinkCloud.
the class NodeChoicePane method getToolTipText.
@Override
public String getToolTipText(MouseEvent event) {
if (!(page instanceof FlowchartPage) || !FlowchartPage.showtip)
return null;
int x = event.getX();
int y = event.getY();
int node = nodeAt(x, y);
if (node >= 0) {
ActivityImplementorVO nmi = page.getDataModel().getNodeMetaInfo().get(node);
return nmi.getImplementorClassName();
} else
return null;
}
use of com.centurylink.mdw.model.value.activity.ActivityImplementorVO in project mdw-designer by CenturyLinkCloud.
the class NodeChoicePane method paintComponent.
/* (non-Javadoc)
* @see javax.swing.JComponent#paintComponent(java.awt.Graphics)
*/
protected void paintComponent(Graphics g) {
Graphics2D g2d = null;
if (g instanceof Graphics2D) {
g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
}
super.paintComponent(g);
ActivityImplementorVO nmi;
int i, n = node_y.length;
for (i = hidden_count; i < n; i++) {
nmi = page.getDataModel().getNodeMetaInfo().get(i);
if (selected_node == i) {
g.setColor(Color.GRAY);
if (g2d != null) {
g2d.fillRoundRect(0, node_y[i] - 4, getWidth(), row_height, 4, 4);
} else {
g.fillRect(0, node_y[i] - 4, 200, row_height - 4);
}
}
if (icon[i] instanceof ImageIcon) {
Icon.drawImage(g, nmi, node_x, node_y[i], (ImageIcon) icon[i]);
} else
((Icon) icon[i]).draw(g, nmi.getLabel(), node_x, node_y[i]);
}
}
use of com.centurylink.mdw.model.value.activity.ActivityImplementorVO in project mdw-designer by CenturyLinkCloud.
the class DesignerProxy method savePackage.
public void savePackage(WorkflowPackage packageVersion, boolean newVersion) throws DataAccessException, RemoteException {
if (packageVersion.isDefaultPackage())
return;
CodeTimer timer = new CodeTimer("savePackage()");
packageVersion.syncProcessVos();
if (packageVersion.getPackageVO().getImplementors() != null) {
// remove non-existent activity impls
List<ActivityImplementorVO> toRemove = new ArrayList<>();
for (ActivityImplementorVO activityImpl : packageVersion.getPackageVO().getImplementors()) {
if (dataAccess.getActivityImplementor(activityImpl.getImplementorClassName()) == null)
toRemove.add(activityImpl);
}
for (ActivityImplementorVO remove : toRemove) packageVersion.getPackageVO().getImplementors().remove(remove);
}
WorkflowPackage prevPkg = new WorkflowPackage(packageVersion.getProject(), new PackageVO());
prevPkg.getPackageVO().setId(packageVersion.getId());
prevPkg.setName(packageVersion.getName());
prevPkg.getPackageVO().setVersion(packageVersion.getVersion());
prevPkg.setTags(packageVersion.getTags());
prevPkg.setModifyDate(packageVersion.getModifyDate());
if (packageVersion.getPackageVO() != null && packageVersion.getPackageVO().getAttributes() != null) {
for (AttributeVO attr : packageVersion.getPackageVO().getAttributes()) {
prevPkg.setAttribute(attr.getAttributeName(), attr.getAttributeValue());
}
}
Long pkgId;
if (// do not
!packageVersion.isLatest() || packageVersion.isArchived())
// create
// new
// version
pkgId = dataAccess.getDesignerDataAccess().savePackage(packageVersion.getPackageVO(), ProcessPersister.PersistType.UPDATE);
else
pkgId = dataAccess.getDesignerDataAccess().savePackage(packageVersion.getPackageVO());
if (prevPkg.getId() == null || newVersion || (pkgId.longValue() != prevPkg.getId().longValue())) {
packageVersion.getPackageVO().setPackageId(pkgId);
prevPkg.setArchived(true);
dataAccess.getPackages(false).add(packageVersion.getPackageVO());
packageVersion.getProject().newPackageVersion(packageVersion, prevPkg);
// update the tree
packageVersion.getProject().fireElementChangeEvent(packageVersion, ChangeType.VERSION_CHANGE, packageVersion.getVersionString());
// update other listeners
packageVersion.fireElementChangeEvent(ChangeType.VERSION_CHANGE, packageVersion.getVersionString());
}
timer.stopAndLog();
}
Aggregations