Search in sources :

Example 51 with SVGCoordinates

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

the class SequenceImpl 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 Sequence activity and its subActivities
 */
protected Element getArrows(SVGDocument doc) {
    Element subGroup = null;
    // Creating an SVG Container "g" to place the activities
    subGroup = doc.createElementNS(SVGNamespace.SVG_NAMESPACE, "g");
    // Checks for the subActivities
    if (subActivities != null) {
        ActivityInterface prevActivity = null;
        ActivityInterface activity = null;
        String id = null;
        SVGCoordinates exitCoords = null;
        SVGCoordinates entryCoords = null;
        Iterator<ActivityInterface> itr = subActivities.iterator();
        // Iterates through all the subActivities
        while (itr.hasNext()) {
            activity = itr.next();
            // Checks whether the previous activity is null
            if (prevActivity != null) {
                // Get the exit arrow coordinates of the previous activity
                exitCoords = prevActivity.getExitArrowCoords();
                // Get the entry arrow coordinates of the current activity
                entryCoords = activity.getEntryArrowCoords();
                // id is assigned with the id of the previous activity + id of the current activity
                id = prevActivity.getId() + "-" + activity.getId();
                /*Check whether the activity is a Throw activity, if so setCheck()= true
                      This check is done to remove the exit arrow coming from the Throw activity,as when the process
                      reaches
                       a Throw activity, the process terminates.
                    */
                if (activity instanceof ThrowImpl) {
                    setCheck(true);
                }
                if (prevActivity instanceof SourcesImpl || prevActivity instanceof SourceImpl || prevActivity instanceof TargetImpl || prevActivity instanceof TargetsImpl || activity instanceof SourcesImpl || activity instanceof SourceImpl || activity instanceof TargetImpl || activity instanceof TargetsImpl || prevActivity instanceof ThrowImpl) {
                // No exit arrow for Source or Target as it doesn't have an icon specified.
                // Checks whether the previous activity is a Throw activity, if so no exit arrow
                } else {
                    subGroup.appendChild(getArrowDefinition(doc, exitCoords.getXLeft(), exitCoords.getYTop(), entryCoords.getXLeft(), entryCoords.getYTop(), id));
                }
            }
            prevActivity = activity;
        }
    }
    return subGroup;
}
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 52 with SVGCoordinates

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

the class ForEachImpl method getStartIconExitArrowCoords.

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

Example 53 with SVGCoordinates

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

the class ForEachImpl method getEndIconEntryArrowCoords.

/**
 * At the start: xLeft=0, yTop=0
 * Calculates the coordinates of the arrow which enters the end icon
 *
 * @return coordinates of the entry arrow for the end icon
 * After Calculations(Vertical Layout): xLeft= Xleft of Icon + (width of icon)/2 , yTop= Ytop of the Icon
 */
protected SVGCoordinates getEndIconEntryArrowCoords() {
    int xLeft = 0;
    int yTop = 0;
    if (layoutManager.isVerticalLayout()) {
        xLeft = getEndIconXLeft() + (getEndIconWidth() / 2);
        yTop = getEndIconYTop();
    } else {
        xLeft = getEndIconXLeft();
        yTop = getEndIconYTop() + (getEndIconHeight() / 2);
    }
    // Returns the calculated coordinate points of the entry arrow of the endIcon
    SVGCoordinates coords = new SVGCoordinates(xLeft, yTop);
    return coords;
}
Also used : SVGCoordinates(org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates)

Example 54 with SVGCoordinates

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

the class ScopeImpl method getEntryArrowCoords.

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

Example 55 with SVGCoordinates

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

the class ScopeImpl method getStartEventCoords.

/**
 * At the start: xLeft=0, yTop=0
 * Calculates the coordinates of the start arrow of the EventHandler
 *
 * @return coordinates of the start arrow of the EventHandler
 */
protected SVGCoordinates getStartEventCoords() {
    int xLeft = 0;
    int yTop = 0;
    if (layoutManager.isVerticalLayout()) {
        xLeft = getCoreDimensions().getXLeft() + getCoreDimensions().getWidth();
        yTop = getCoreDimensions().getYTop() + getHandlerConnectorSpacing() + (getYSpacing() / 2);
    } else {
        xLeft = getCoreDimensions().getXLeft() + getHandlerConnectorSpacing() + (getYSpacing() / 2);
        yTop = getCoreDimensions().getYTop() + getCoreDimensions().getHeight();
    }
    // Returns the calculated coordinate points of the start arrow of the EventHandler
    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