Package org.enhydra.shark.xpdl.elements

Examples of org.enhydra.shark.xpdl.elements.Activity


     */
    protected boolean startEditing(Object cell, MouseEvent event) {
        if (cell instanceof WorkflowElement) {
            XMLElement el = ((WorkflowElement) cell).getPropertyObject();
            if (el instanceof Activity) {
                Activity act = (Activity) el;
                if (act.getActivityType() == XPDLConstants.ACTIVITY_TYPE_SUBFLOW) {
                    //CUSTOM
                    JaWEManager.getInstance().getJaWEController().getJaWEActions().getAction(JaWEActions.EDIT_PROPERTIES_ACTION).actionPerformed(null);
                    //END CUSTOM
                    return true;
                } else if (act.getActivityType() == XPDLConstants.ACTIVITY_TYPE_BLOCK) {
                    //CUSTOM
                    JaWEManager.getInstance().getJaWEController().getJaWEActions().getAction(JaWEActions.EDIT_PROPERTIES_ACTION).actionPerformed(null);
                    //END CUSTOM
                    return true;
                }
View Full Code Here


                    while (it.hasNext()) {
                        XMLElement toCopyOrCut = (XMLElement) it.next();
                        if (!(toCopyOrCut instanceof Activity)) {
                            continue;
                        }
                        Activity a = (Activity) toCopyOrCut;
                        GraphActivityInterface ga = gm.getGraphActivity(a);
                        if (ga != null) {
                            CopiedActivityInfo ai = new CopiedActivityInfo(
                                    GraphUtilities.getParticipantId(a),
                                    GraphUtilities.getOffsetPoint(a));
View Full Code Here

                    return false;
                }
            }

            Activity a = (Activity) sourceActivity.getUserObject();
            Activity b = (Activity) targetActivity.getUserObject();
            List status = new ArrayList(1);

            if (!JaWEManager.getInstance().getTransitionHandler().allowsConnection(a, b, t, isExceptionalTrans, status)) {
                String errorMsg = "WarningSourceActivityCannotHaveMoreOutgoingTransitions";
                boolean isError = false;
View Full Code Here

                        null);
                Point partLoc = getGraphManager().getBounds(gpar, null).getBounds().getLocation();
                Point off = new Point(whereTo.x - partLoc.x, whereTo.y - partLoc.y);
                String partId = gpar.getPropertyObject().get("Id").toValue();
                Activities acts = (Activities) getGraph().getXPDLObject().get("Activities");
                Activity act = JaWEManager.getInstance().getXPDLObjectFactory().createXPDLObject(acts, subType, false);
                GraphUtilities.setOffsetPoint(act, off);
                GraphUtilities.setParticipantId(act, partId);
                int acttype = act.getActivityType();
                if (acttype == XPDLConstants.ACTIVITY_TYPE_NO || acttype == XPDLConstants.ACTIVITY_TYPE_TOOL) {
                    if (!partId.equals(FreeTextExpressionParticipant.getInstance().getId())) {
                        act.setPerformer(partId);
                    }
                }
                graphController.setUpdateInProgress(true);
                JaWEManager.getInstance().getJaWEController().startUndouableChange();
                acts.add(act);
View Full Code Here

                    } else {
                        breakpoints.addAll(points);
                        points.clear();
                    }

                    Activity act = (Activity) ((GraphPortInterface) firstPort.getCell()).getActivity().getPropertyObject();

                    Transitions tras = (Transitions) getGraph().getXPDLObject().get("Transitions");
                    Transition tra = JaWEManager.getInstance().getXPDLObjectFactory().createXPDLObject(tras, subType, false);
                    tra.setFrom(act.getId());
                    tra.setTo(act.getId());
                    GraphUtilities.setStyle(tra, GraphEAConstants.EA_JAWE_GRAPH_TRANSITION_STYLE_VALUE_NO_ROUTING_BEZIER);
                    GraphUtilities.setBreakpoints(tra, breakpoints);
                    getGraphController().setUpdateInProgress(true);
                    JaWEManager.getInstance().getJaWEController().startUndouableChange();
                    tras.add(tra);
View Full Code Here

        return el;
    }

    protected void toString(XMLElement el) {
        if (el instanceof Activity) {
            Activity act = (Activity) el;
            String str = "\n\tId=" + act.getId();
            str += "\n\tName=" + act.getName();
            str += "\n\tType=" + act.getActivityType();
            Tools ts = act.getActivityTypes().getImplementation().getImplementationTypes().getTools();
            if (ts.size() > 0) {
                Tool t = (Tool) ts.get(0);
                str += "\n\tToolId=" + t.getId();
                Iterator it = t.getActualParameters().toElements().iterator();
                int i = 1;
View Full Code Here

        int actH = GraphUtilities.getGraphController().getGraphSettings().getActivityHeight();
        int shadowWidth = GraphUtilities.getGraphController().getGraphSettings().getShadowWidth();
        boolean showShadow = GraphUtilities.getGraphController().getGraphSettings().isShadowEnabled();

        GraphActivityInterface gact = (GraphActivityInterface) view.getCell();
        Activity act = (Activity) gact.getUserObject();
        boolean frontJoin = false;
        if (XMLUtil.isANDTypeSplitOrJoin(act, 1)) {
            frontJoin = true;
        }
        boolean backJoin = false;
        if (XMLUtil.isANDTypeSplitOrJoin(act, 0)) {
            backJoin = true;
        }

        Color bckgC = getFillColor();
        if (selected) {
            bckgC = GraphUtilities.getGraphController().getGraphSettings().getSelectedActivityColor();
        }

        // CUSTOM
        String displayName = getDisplayName();
        Dimension dim = DefaultGraphActivityRenderer.calculateWidthAndHeight(displayName, actW, actH);
        actW = (int)dim.getWidth();
        actH = (int)dim.getHeight();
        int actType = act.getActivityType();
        if (actType == XPDLConstants.ACTIVITY_TYPE_ROUTE) {
            g.setColor(bordercolor);
            boolean inclusive = act.isAndTypeJoin() || act.isAndTypeSplit();
            String gatewayImage = (inclusive) ? "/org/enhydra/jawe/images/gateway_inclusive.gif" : "/org/enhydra/jawe/images/gateway_exclusive.gif";
            g.drawImage(new ImageIcon(getClass().getResource(gatewayImage)).getImage(), 10, 0, null);
            if (selected) {
                // draw border
                g.setColor(Color.LIGHT_GRAY);
                ((Graphics2D) g).setStroke(borderStroke);
                g.drawRoundRect(0, 0, actW - 1 - shadowWidth, actH - 1 - shadowWidth + 2, arc, arc);
            }
            return;
        } else {
            Rectangle tempClipRect = new Rectangle(0, 0, actW, actH);
            g.setClip(tempClipRect);
        }
        // CUSTOM

        // fill activity
        g.setColor(bckgC);
        g.fillRoundRect(0, 0, actW - shadowWidth, actH - shadowWidth, arc, arc);

        // drawing panel
        super.setOpaque(false);
        Graphics gl = g.create(5, 5, actW - 9 - shadowWidth, actH - 9 - shadowWidth);
        Rectangle panelRect = new Rectangle(0, 0, actW - 9 - shadowWidth, actH - 9 - shadowWidth);
        super.setBounds(panelRect);
        graph.setHighlightColor(bckgC);
        setBorder(BorderFactory.createLineBorder(bckgC, 0));
        super.paint(gl);
        setBorder(BorderFactory.createLineBorder(bordercolor, 0));
        setForeground(bordercolor);

        // display limit
        String limit = act.getLimit();
        if (limit != null && limit.trim().length() > 0) {
            WorkflowProcess process = (WorkflowProcess)act.getParent().getParent();
            String durationUnit = process.getProcessHeader().getDurationUnit();
            if (durationUnit == null) {
                durationUnit = "";
            } else {
                durationUnit = durationUnit.toLowerCase();
            }
            g.setColor(Color.GRAY);
            g.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 8));
            g.drawString(limit + durationUnit, 5, 35);
        }

        // shadow
        if (showShadow) {
            g.setColor(new Color(192, 192, 192));
            ((Graphics2D) g).setStroke(new BasicStroke(shadowWidth,
                    BasicStroke.CAP_BUTT,
                    BasicStroke.JOIN_ROUND));
            g.drawLine(shadowWidth, actH - shadowWidth, actW - shadowWidth, actH - shadowWidth);
            if (!backJoin) {
                g.drawLine(actW - shadowWidth,
                        actH - shadowWidth,
                        actW - shadowWidth,
                        shadowWidth);
            }
        }

        // draw border
        g.setColor(bordercolor);
        ((Graphics2D) g).setStroke(borderStroke);
        g.drawRoundRect(0, 0, actW - 1 - shadowWidth, actH - 1 - shadowWidth, arc, arc);

        // add > to front
        Color gCol = GraphUtilities.getGraphController().getGraphSettings().getBackgroundColor();
        if (frontJoin) {
            g.setColor(gCol);
            int[] x = {
                0, 4, 0
            };
            int[] y = {
                arc, actH / 2, actH - arc
            };
            g.fillPolygon(x, y, 3);
            g.setColor(bordercolor);
            ((Graphics2D) g).setStroke(borderStroke);
            g.drawLine(x[0], y[0], x[1], y[1]);
            g.drawLine(x[1], y[1], x[2], y[2]);
        }
        // add > to back
        if (backJoin) {
            g.setColor(gCol);
            // clean
            int[] x = {
                actW - shadowWidth - 4,
                actW,
                actW,
                actW - shadowWidth - 4,
                actW - shadowWidth
            };
            int[] y = {
                0, 0, actH, actH, actH / 2
            };
            g.fillPolygon(x, y, 5);
            g.setColor(new Color(192, 192, 192));
            ((Graphics2D) g).setStroke(new BasicStroke(shadowWidth,
                    BasicStroke.CAP_BUTT,
                    BasicStroke.JOIN_ROUND));
            g.drawLine(x[0] + 1, y[0], x[4] + 1, y[4]);
            g.drawLine(x[4] + 1, y[4], x[3] + 1, y[3] - shadowWidth);
            g.setColor(bordercolor);
            ((Graphics2D) g).setStroke(borderStroke);
            g.drawLine(x[0], y[0], x[4], y[4]);
            g.drawLine(x[4], y[4], x[3], y[3] - shadowWidth);
        }

        int type = act.getActivityType();
        if (type == XPDLConstants.ACTIVITY_TYPE_BLOCK && GraphUtilities.getGraphController().getGraphSettings().shouldDrawBlockLines()) {
            g.setColor(bordercolor);
            g.drawLine(3, 0, 3, actH - 2 - shadowWidth);
            g.drawLine(actW - 4 - shadowWidth, 0, actW - 4 - shadowWidth, actH - 2 - shadowWidth);
        } else if (type == XPDLConstants.ACTIVITY_TYPE_SUBFLOW && GraphUtilities.getGraphController().getGraphSettings().shouldDrawSubflowLines()) {
View Full Code Here

            g.drawImage(new ImageIcon(getClass().getResource("/org/enhydra/jawe/images/subflowsmall.gif")).getImage(), actW / 2 - 7, actH - 20, null);
        }
    }

    protected Color getFillColor() {
        Activity act = (Activity) ((GraphActivityInterface) view.getCell()).getUserObject();
        Color c = JaWEManager.getInstance().getJaWEController().getTypeResolver().getJaWEType(act).getColor();
        GraphSettings gv = GraphUtilities.getGraphController().getGraphSettings();
        if (!gv.shouldUseBubbles()) {
            boolean isStartingAct = JaWEManager.getInstance().getXPDLUtils().isStartingActivity(act);
            boolean isEndingAct = JaWEManager.getInstance().getXPDLUtils().isEndingActivity(act);
View Full Code Here

        }
        return c;
    }

    public ImageIcon getIcon() {
        Activity act = (Activity) ((GraphActivityInterface) view.getCell()).getUserObject();

        String icon = act.getIcon().replaceAll(".gif", "graph.gif");

        ImageIcon ii = null;
        if (!icon.equals("")) {
            ii = (ImageIcon) Utils.getOriginalActivityIconsMap().get(icon);
        }
View Full Code Here

        int actW = GraphUtilities.getGraphController().getGraphSettings().getRouteWidth();
        int actH = GraphUtilities.getGraphController().getGraphSettings().getRouteHeight();
        int shadowWidth = GraphUtilities.getGraphController().getGraphSettings().getShadowWidth();

        GraphActivityInterface gact = (GraphActivityInterface) view.getCell();
        Activity act = (Activity) gact.getUserObject();

        g.setColor(bordercolor);
        boolean inclusive = act.isAndTypeJoin() || act.isAndTypeSplit();
        String gatewayImage = (inclusive) ? "/org/enhydra/jawe/images/gateway_inclusive.gif" : "/org/enhydra/jawe/images/gateway_exclusive.gif";
        g.drawImage(new ImageIcon(getClass().getResource(gatewayImage)).getImage(), 10, 0, null);
        if (selected) {
            // draw border
            g.setColor(Color.LIGHT_GRAY);
View Full Code Here

TOP

Related Classes of org.enhydra.shark.xpdl.elements.Activity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.