Search in sources :

Example 36 with SVGCoordinates

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

the class IfImpl method getStartIconElseArrowCoords.

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

Example 37 with SVGCoordinates

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

the class OnMessageImpl method getStartIconExitArrowCoords.

/**
 * At the start: xLeft=0, yTop=0
 * Calculates the coordinates of the arrow which leaves the start OnMessage 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 38 with SVGCoordinates

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

the class OnMessageImpl 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 OnMessage activity and its subActivities
 */
protected Element getArrows(SVGDocument doc) {
    Element subGroup = null;
    subGroup = doc.createElementNS(SVGNamespace.SVG_NAMESPACE, "g");
    // Checks for the subActivities
    if (subActivities != null) {
        ActivityInterface prevActivity = null;
        ActivityInterface activity = null;
        String id = null;
        // Gets the exit coordinates of the start icon
        SVGCoordinates myStartCoords = getStartIconExitArrowCoords();
        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();
                /*If the previous activity is not null, then arrow flow is from the previous activity to the
                    current activity
                      This gives the coordinates of the start point and the end point
                    */
                subGroup.appendChild(getArrowDefinition(doc, exitCoords.getXLeft(), exitCoords.getYTop(), entryCoords.getXLeft(), entryCoords.getYTop(), id));
            } else {
                // Get the entry arrow coordinates of the current activity
                entryCoords = activity.getEntryArrowCoords();
                /*If the previous activity is null, then arrow flow is directly from the startIcon to the activity
                      This gives the coordinates of the start point and the end point
                    */
                subGroup.appendChild(getArrowDefinition(doc, myStartCoords.getXLeft(), myStartCoords.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 39 with SVGCoordinates

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

the class ProcessImpl 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 Process and its subActivities
 */
protected Element getArrows(SVGDocument doc) {
    Element group = doc.createElementNS(SVGNamespace.SVG_NAMESPACE, "g");
    if (subActivities != null) {
        // Gets the start activity of the process
        ActivityInterface startActivity = subActivities.get(0);
        // Gets the end activity of the process
        ActivityInterface endActivity = subActivities.get(subActivities.size() - 1);
        // Get the coordinates of the entry arrow of the start activity
        SVGCoordinates exitCoords = getExitArrowCoords();
        // Define the arrow flow according to the coordinates
        group.appendChild(getArrowDefinition(doc, exitCoords.getXLeft(), exitCoords.getYTop(), startActivity.getEntryArrowCoords().getXLeft(), startActivity.getEntryArrowCoords().getYTop(), name));
        // Get the coordinates of the entry arrows of the end activity
        SVGCoordinates entryCoords = getEndEntryArrowCoords();
        // Define the arrow flow according to the coordinates
        group.appendChild(getArrowDefinition(doc, endActivity.getExitArrowCoords().getXLeft(), endActivity.getExitArrowCoords().getYTop(), entryCoords.getXLeft(), entryCoords.getYTop(), name));
    }
    return group;
}
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 40 with SVGCoordinates

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

the class ActivityImpl method getEndIconEntryArrowCoords.

/**
 * At the start: xLeft=0, yTop=0
 * Calculates the coordinates of the arrow which enters the activity
 *
 * @return coordinates of the entry arrow for the activity
 * 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)

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