Search in sources :

Example 56 with SVGCoordinates

use of org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates in project carbon-business-process by wso2.

the class ScopeImpl method getArrows.

/**
 * Get the arrow coordinates of the activities
 *
 * @param doc SVG document which defines the components including shapes, gradients etc. of the activity
 * @return An element which contains the arrow coordinates of the Scope activity and its subActivities
 */
protected Element getArrows(SVGDocument doc) {
    if (subActivities != null) {
        Element subGroup = doc.createElementNS(SVGNamespace.SVG_NAMESPACE, "g");
        ActivityInterface prevActivity = null;
        ActivityInterface activity = null;
        String id = null;
        // Coordinates of the start icon exit arrow
        SVGCoordinates myStartCoords = getStartIconExitArrowCoords();
        // Coordinates of the end icon entry arrow
        SVGCoordinates myExitCoords = getEndIconEntryArrowCoords();
        // Coordinates of the start arrow of the EventHandler
        SVGCoordinates myStartEventCoords = getStartEventCoords();
        // Coordinates of the start arrow of the TerminationHandler
        SVGCoordinates myStartTerminationCoords = getStartTerminationCoords();
        // Coordinates of the start arrow of the CompensationHandler
        SVGCoordinates myStartCompensationCoords = getStartCompensationCoords();
        // Coordinates of the start arrow of the FaultHandler
        SVGCoordinates myStartFaultCoords = getStartFaultCoords();
        SVGCoordinates activityEntryCoords = null;
        SVGCoordinates activityExitCoords = null;
        Iterator<ActivityInterface> itr = subActivities.iterator();
        // Iterates through the subActivities
        while (itr.hasNext()) {
            activity = itr.next();
            // Gets the entry and exit coordinates of the iterated activity
            activityEntryCoords = activity.getEntryArrowCoords();
            activityExitCoords = activity.getExitArrowCoords();
            // id is assigned with the id of the previous activity + id of the current activity
            id = getId() + "-" + activity.getId();
            // defined.
            if (activity instanceof FaultHandlerImpl) {
                subGroup.appendChild(getArrowDefinition(doc, myStartFaultCoords.getXLeft(), myStartFaultCoords.getYTop(), activityEntryCoords.getXLeft(), activityEntryCoords.getYTop(), id));
            } else if (activity instanceof TerminationHandlerImpl) {
                subGroup.appendChild(getArrowDefinition(doc, myStartTerminationCoords.getXLeft(), myStartTerminationCoords.getYTop(), activityEntryCoords.getXLeft(), activityEntryCoords.getYTop(), id));
            } else if (activity instanceof CompensationHandlerImpl) {
                subGroup.appendChild(getArrowDefinition(doc, myStartCompensationCoords.getXLeft(), myStartCompensationCoords.getYTop(), activityEntryCoords.getXLeft(), activityEntryCoords.getYTop(), id));
            } else if (activity instanceof EventHandlerImpl) {
                subGroup.appendChild(getArrowDefinition(doc, myStartEventCoords.getXLeft(), myStartEventCoords.getYTop(), activityEntryCoords.getXLeft(), activityEntryCoords.getYTop(), id));
            } else {
                // If the activity is not a handler type, then the entry and the exit coordinates of the activity
                // are defined
                subGroup.appendChild(getArrowDefinition(doc, myStartCoords.getXLeft(), myStartCoords.getYTop(), activityEntryCoords.getXLeft(), activityEntryCoords.getYTop(), id));
                subGroup.appendChild(getArrowDefinition(doc, activityExitCoords.getXLeft(), activityExitCoords.getYTop(), myExitCoords.getXLeft(), myExitCoords.getYTop(), id));
            }
        }
        return subGroup;
    }
    return null;
}
Also used : ActivityInterface(org.wso2.carbon.bpel.ui.bpel2svg.ActivityInterface) OMElement(org.apache.axiom.om.OMElement) Element(org.w3c.dom.Element) SVGCoordinates(org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates)

Example 57 with SVGCoordinates

use of org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates in project carbon-business-process by wso2.

the class ScopeImpl method getEventHandlerIcon.

/**
 * At start: xLeft=0, yTop=0
 *
 * @param doc SVG document which defines the components including shapes, gradients etc. of the activity
 * @return Element(represents an element in a XML) which contains the EventHandler icon and arrow flows
 */
public Element getEventHandlerIcon(SVGDocument doc) {
    // Get the coordinates of the start arrow of the EventHandler
    SVGCoordinates coords = getStartEventCoords();
    int xLeft = 0;
    int yTop = 0;
    if (layoutManager.isVerticalLayout()) {
        xLeft = coords.getXLeft() - getHandlerIconWidth();
        yTop = coords.getYTop() - (getHandlerIconHeight() / 2);
    } else {
        xLeft = coords.getXLeft() - (getHandlerIconWidth() / 2);
        yTop = coords.getYTop() - getHandlerIconHeight();
    }
    // Gets the icon path of the activity
    String iconPath = BPEL2SVGIcons.EVENTHANDLER_ICON;
    // width
    return getImageDefinition(doc, iconPath, xLeft, yTop, getHandlerIconWidth(), getHandlerIconHeight(), getId());
}
Also used : SVGCoordinates(org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates)

Example 58 with SVGCoordinates

use of org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates in project carbon-business-process by wso2.

the class ScopeImpl method getCompensationHandlerIcon.

/**
 * At start: xLeft=0, yTop=0
 *
 * @param doc SVG document which defines the components including shapes, gradients etc. of the activity
 * @return Element(represents an element in a XML) which contains the CompensationHandler icon and arrow flows
 */
public Element getCompensationHandlerIcon(SVGDocument doc) {
    // Get the coordinates of the start arrow of the CompensationHandler
    SVGCoordinates coords = getStartCompensationCoords();
    int xLeft = 0;
    int yTop = 0;
    if (layoutManager.isVerticalLayout()) {
        xLeft = coords.getXLeft() - getHandlerIconWidth();
        yTop = coords.getYTop() - (getHandlerIconHeight() / 2);
    } else {
        xLeft = coords.getXLeft() - (getHandlerIconWidth() / 2);
        yTop = coords.getYTop() - getHandlerIconHeight();
    }
    // Gets the icon path of the activity
    String iconPath = BPEL2SVGIcons.COMPENSATIONHANDLER_ICON;
    // width
    return getImageDefinition(doc, iconPath, xLeft, yTop, getHandlerIconWidth(), getHandlerIconHeight(), getId());
}
Also used : SVGCoordinates(org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates)

Example 59 with SVGCoordinates

use of org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates in project carbon-business-process by wso2.

the class SimpleActivityImpl method getExitArrowCoords.

/**
 * At the start: xLeft=Xleft of Icon + (width of icon)/2, yTop=Ytop of the Icon+ height of the icon
 * Calculates the coordinates of the arrow which leaves an activity
 *
 * @return coordinates/exit point of the exit arrow for the activities
 * After Calculations(Vertical Layout): xLeft=Xleft of Icon + width of startIcon , yTop= Ytop of the Icon +
 * (height of startIcon)/2
 */
@Override
public SVGCoordinates getExitArrowCoords() {
    int xLeft = getStartIconXLeft() + (getStartIconWidth() / 2);
    int yTop = getStartIconYTop() + getStartIconHeight();
    if (!layoutManager.isVerticalLayout()) {
        xLeft = getStartIconXLeft() + getStartIconWidth();
        yTop = getStartIconYTop() + (getStartIconHeight() / 2);
    }
    // Returns the calculated coordinate points of the exit arrow
    SVGCoordinates coords = new SVGCoordinates(xLeft, yTop);
    return coords;
}
Also used : SVGCoordinates(org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates)

Aggregations

SVGCoordinates (org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates)59 ActivityInterface (org.wso2.carbon.bpel.ui.bpel2svg.ActivityInterface)14 OMElement (org.apache.axiom.om.OMElement)10 Element (org.w3c.dom.Element)10