Search in sources :

Example 6 with SVGDimension

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

the class ElseImpl method getDimensions.

/**
 * At the start: width=0, height=0
 *
 * @return dimensions of the composite activity i.e. the final width and height after doing calculations by
 * iterating
 * through the dimensions of the subActivities
 */
@Override
public SVGDimension getDimensions() {
    if (dimensions == null) {
        int width = 0;
        int height = 0;
        // Set the dimensions at the start to (0,0)
        dimensions = new SVGDimension(width, height);
        // Dimensons of the subActivities
        SVGDimension subActivityDim = null;
        ActivityInterface activity = null;
        // Iterates through the subActivites inside the composite activity
        Iterator<ActivityInterface> itr = getSubActivities().iterator();
        while (itr.hasNext()) {
            activity = itr.next();
            // Gets the dimensions of each subActivity separately
            subActivityDim = activity.getDimensions();
            // Checks whether the width of the subActivity is greater than zero
            if (subActivityDim.getWidth() > width) {
                width += subActivityDim.getWidth();
            }
            /*As Else should increase in height when the number of subActivities increase, height of each
                subActivity
                  is added to the height of the main/composite activity
                */
            height += subActivityDim.getHeight();
        }
        /*After iterating through all the subActivities and altering the dimensions of the composite activity
              to get more spacing , Xspacing and Yspacing is added to the height and the width of the composite activity
            */
        height += getYSpacing() + getStartIconHeight();
        width += getXSpacing();
        // Set the Calculated dimensions for the SVG height and width
        dimensions.setWidth(width);
        dimensions.setHeight(height);
    }
    return dimensions;
}
Also used : ActivityInterface(org.wso2.carbon.bpel.ui.bpel2svg.ActivityInterface) SVGDimension(org.wso2.carbon.bpel.ui.bpel2svg.SVGDimension)

Example 7 with SVGDimension

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

the class ElseIfImpl method getDimensions.

/**
 * At the start: width=0, height=0
 *
 * @return dimensions of the composite activity i.e. the final width and height after doing calculations by
 * iterating
 * through the dimensions of the subActivities
 */
@Override
public SVGDimension getDimensions() {
    if (dimensions == null) {
        int width = 0;
        int height = 0;
        dimensions = new SVGDimension(width, height);
        // Dimensons of the subActivities
        SVGDimension subActivityDim = null;
        ActivityInterface activity = null;
        // Iterates through the subActivites inside the composite activity
        Iterator<ActivityInterface> itr = getSubActivities().iterator();
        while (itr.hasNext()) {
            activity = itr.next();
            // Gets the dimensions of each subActivity separately
            subActivityDim = activity.getDimensions();
            // Checks whether the width of the subActivity is greater than zero
            if (subActivityDim.getWidth() > width) {
                width += subActivityDim.getWidth();
            }
            /*As ElseIf should increase in height when the number of subActivities increase, height of each
                subActivity
                  is added to the height of the main/composite activity
                */
            height += subActivityDim.getHeight();
        }
        /*After iterating through all the subActivities and altering the dimensions of the composite activity
              to get more spacing Xspacing and Yspacing is added to the height and the width of the composite activity
            */
        height += getYSpacing() + getStartIconHeight();
        width += getXSpacing();
        // Set the Calculated dimensions for the SVG height and width
        dimensions.setWidth(width);
        dimensions.setHeight(height);
    }
    return dimensions;
}
Also used : ActivityInterface(org.wso2.carbon.bpel.ui.bpel2svg.ActivityInterface) SVGDimension(org.wso2.carbon.bpel.ui.bpel2svg.SVGDimension)

Example 8 with SVGDimension

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

the class FlowImpl method getDimensions.

/**
 * At the start: width=0, height=0
 *
 * @return dimensions of the composite activity i.e. the final width and height after doing calculations by
 * iterating
 * through the dimensions of the subActivities
 */
@Override
public SVGDimension getDimensions() {
    if (dimensions == null) {
        int width = 0;
        int height = 0;
        // Set the dimensions at the start to (0,0)
        dimensions = new SVGDimension(width, height);
        // Dimensons of the subActivities
        SVGDimension subActivityDim = null;
        ActivityInterface activity = null;
        // Iterates through the subActivites inside the composite activity
        Iterator<ActivityInterface> itr = getSubActivities().iterator();
        while (itr.hasNext()) {
            activity = itr.next();
            // Gets the dimensions of each subActivity separately
            subActivityDim = activity.getDimensions();
            // Checks whether the height of the subActivity is greater than zero
            if (subActivityDim.getHeight() > height) {
                height += subActivityDim.getHeight();
            }
            // Width of each subActivity is added to the final width of the main/composite activity
            width += subActivityDim.getWidth();
        }
        /*After iterating through all the subActivities and altering the dimensions of the composite activity
              to get more spacing , Xspacing and Yspacing is added to the height and the width of the composite activity
            */
        height += (getYSpacing() * 2) + getStartIconHeight() + getEndIconHeight();
        width += getXSpacing();
        // Set the Calculated dimensions for the SVG height and width
        dimensions.setWidth(width);
        dimensions.setHeight(height);
    }
    return dimensions;
}
Also used : ActivityInterface(org.wso2.carbon.bpel.ui.bpel2svg.ActivityInterface) SVGDimension(org.wso2.carbon.bpel.ui.bpel2svg.SVGDimension)

Example 9 with SVGDimension

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

the class IfImpl method getDimensions.

/**
 * At the start: width=0, height=0
 *
 * @return dimensions of the composite activity i.e. the final width and height after doing calculations by
 * iterating
 * through the dimensions of the subActivities
 */
@Override
public SVGDimension getDimensions() {
    if (dimensions == null) {
        int width = 0;
        int height = 0;
        int coreWidth = 0;
        int coreHeight = 0;
        int conWidth = 0;
        int conHeight = 0;
        // Set the dimensions at the start to (0,0)
        dimensions = new SVGDimension(coreWidth, coreHeight);
        coreDimensions = new SVGDimension(coreWidth, coreHeight);
        conditionalDimensions = new SVGDimension(conWidth, conHeight);
        // Dimensons of the subActivities
        SVGDimension subActivityDim = null;
        ActivityInterface activity = null;
        // Iterates through the subActivites inside the composite activity
        Iterator<ActivityInterface> itr = getSubActivities().iterator();
        while (itr.hasNext()) {
            activity = itr.next();
            // Gets the dimensions of each subActivity separately
            subActivityDim = activity.getDimensions();
            // Checks whether the subActivity is a ElseIf or Else activity
            if (activity instanceof ElseIfImpl || activity instanceof ElseImpl) {
                // Checks whether the icon height is greater than the conditional height
                if (subActivityDim.getHeight() > conHeight) {
                    // height of the icon is added to the conditional height
                    conHeight += subActivityDim.getHeight();
                }
                // width of the subActivities added to the conditional width
                conWidth += subActivityDim.getWidth();
            } else {
                // If the subActivites are not instances of ElseIf and Else
                if (subActivityDim.getWidth() > coreWidth) {
                    // width of the subActivities added to the core width
                    coreWidth += subActivityDim.getWidth();
                }
                // height of the subActivities added to the core height
                coreHeight += subActivityDim.getHeight();
            }
        }
        // Spacing the core height by adding ySpacing + startIcon height + endIcon height
        coreHeight += getYSpacing() + getStartIconHeight() + getEndIconHeight();
        /* The ElseIf spacing or adjustment is added to the conditional height as the conditional dimensions are
            associated
               with ElseIf and Else activities
            */
        conHeight += getElseIfAdjustment();
        // Setting the core dimensions after calculations
        coreDimensions.setHeight(coreHeight);
        coreDimensions.setWidth(coreWidth);
        // Setting the conditional dimensions after calculations
        conditionalDimensions.setHeight(conHeight);
        conditionalDimensions.setWidth(conWidth);
        // Checks if the core height is greater than the conditional height
        if (coreHeight > conHeight) {
            height = coreHeight;
        } else {
            height = conHeight;
        }
        // core width and conditional width is added to the final width of the composite activity
        width = coreWidth + conWidth;
        height += getYSpacing();
        width += getXSpacing();
        // Set the Calculated dimensions for the SVG height and width
        dimensions.setWidth(width);
        dimensions.setHeight(height);
    }
    return dimensions;
}
Also used : ActivityInterface(org.wso2.carbon.bpel.ui.bpel2svg.ActivityInterface) SVGDimension(org.wso2.carbon.bpel.ui.bpel2svg.SVGDimension)

Example 10 with SVGDimension

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

the class OnMessageImpl method getDimensions.

/**
 * At the start: width=0, height=0
 *
 * @return dimensions of the activity i.e. the final width and height after doing calculations by iterating
 * through the dimensions of the subActivities
 */
@Override
public SVGDimension getDimensions() {
    if (dimensions == null) {
        int width = 0;
        int height = 0;
        // Set the dimensions at the start to (0,0)
        dimensions = new SVGDimension(width, height);
        // Dimensons of the subActivities
        SVGDimension subActivityDim = null;
        ActivityInterface activity = null;
        // Iterates through the subActivites inside the activity
        Iterator<ActivityInterface> itr = getSubActivities().iterator();
        while (itr.hasNext()) {
            activity = itr.next();
            // Gets the dimensions of each subActivity separately
            subActivityDim = activity.getDimensions();
            // Checks whether the width of the subActivity is greater than zero
            if (subActivityDim.getWidth() > width) {
                width += subActivityDim.getWidth();
            }
            /*As OnMessage should increase in height when the number of subActivities increase, height of each
                subActivity
                  is added to the height of the main activity
                */
            height += subActivityDim.getHeight();
        }
        /*After iterating through all the subActivities and altering the dimensions of the  activity
              to get more spacing , Xspacing and Yspacing is added to the height and the width of the  activity
            */
        height += getYSpacing() + getStartIconHeight() + (getYSpacing() / 2);
        width += getXSpacing();
        // Set the Calculated dimensions for the SVG height and width
        dimensions.setWidth(width);
        dimensions.setHeight(height);
    }
    return dimensions;
}
Also used : ActivityInterface(org.wso2.carbon.bpel.ui.bpel2svg.ActivityInterface) SVGDimension(org.wso2.carbon.bpel.ui.bpel2svg.SVGDimension)

Aggregations

SVGDimension (org.wso2.carbon.bpel.ui.bpel2svg.SVGDimension)16 ActivityInterface (org.wso2.carbon.bpel.ui.bpel2svg.ActivityInterface)10 NoSuchElementException (java.util.NoSuchElementException)1