Search in sources :

Example 1 with ActivityImplementorVO

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;
}
Also used : WorkTransitionVO(com.centurylink.mdw.model.value.work.WorkTransitionVO) AttributeVO(com.centurylink.mdw.model.value.attribute.AttributeVO) ActivityVO(com.centurylink.mdw.model.value.activity.ActivityVO) ExternalEventVO(com.centurylink.mdw.model.value.event.ExternalEventVO) MbengNode(com.qwest.mbeng.MbengNode) ArrayList(java.util.ArrayList) ActivityImplementorVO(com.centurylink.mdw.model.value.activity.ActivityImplementorVO) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) VariableVO(com.centurylink.mdw.model.value.variable.VariableVO)

Example 2 with ActivityImplementorVO

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;
}
Also used : ActivityImplementorVO(com.centurylink.mdw.model.value.activity.ActivityImplementorVO) Dimension(java.awt.Dimension) Point(java.awt.Point) IconFactory(com.centurylink.mdw.designer.icons.IconFactory)

Example 3 with ActivityImplementorVO

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;
}
Also used : ActivityImplementorVO(com.centurylink.mdw.model.value.activity.ActivityImplementorVO) Point(java.awt.Point)

Example 4 with ActivityImplementorVO

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]);
    }
}
Also used : ImageIcon(javax.swing.ImageIcon) ActivityImplementorVO(com.centurylink.mdw.model.value.activity.ActivityImplementorVO) Point(java.awt.Point) Graphics2D(java.awt.Graphics2D)

Example 5 with ActivityImplementorVO

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();
}
Also used : ActivityImplementorVO(com.centurylink.mdw.model.value.activity.ActivityImplementorVO) WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) PackageVO(com.centurylink.mdw.model.value.process.PackageVO) AttributeVO(com.centurylink.mdw.model.value.attribute.AttributeVO) ArrayList(java.util.ArrayList) CodeTimer(com.centurylink.mdw.plugin.CodeTimer)

Aggregations

ActivityImplementorVO (com.centurylink.mdw.model.value.activity.ActivityImplementorVO)24 ArrayList (java.util.ArrayList)12 ProcessVO (com.centurylink.mdw.model.value.process.ProcessVO)9 RuleSetVO (com.centurylink.mdw.model.value.attribute.RuleSetVO)6 ExternalEventVO (com.centurylink.mdw.model.value.event.ExternalEventVO)6 PackageVO (com.centurylink.mdw.model.value.process.PackageVO)5 Point (java.awt.Point)5 ActivityVO (com.centurylink.mdw.model.value.activity.ActivityVO)4 ActivityImpl (com.centurylink.mdw.plugin.designer.model.ActivityImpl)4 AttributeVO (com.centurylink.mdw.model.value.attribute.AttributeVO)3 ActionCancelledException (com.centurylink.mdw.common.utilities.timer.ActionCancelledException)2 Selectable (com.centurylink.mdw.designer.display.Selectable)2 ImportItem (com.centurylink.mdw.designer.utils.ImportItem)2 VariableVO (com.centurylink.mdw.model.value.variable.VariableVO)2 CodeTimer (com.centurylink.mdw.plugin.CodeTimer)2 WorkflowPackage (com.centurylink.mdw.plugin.designer.model.WorkflowPackage)2 Combo (org.eclipse.swt.widgets.Combo)2 ProcessExporter (com.centurylink.mdw.dataaccess.ProcessExporter)1 ProcessPersister (com.centurylink.mdw.dataaccess.ProcessPersister)1 IconFactory (com.centurylink.mdw.designer.icons.IconFactory)1