Search in sources :

Example 11 with SVGDimension

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

the class ActivityImpl method getDimensions.

/**
 * Get the dimensions of the SVG
 *
 * @return dimensions of the SVG i.e. height and width of the SVG
 */
public SVGDimension getDimensions() {
    SVGDimension obj = new SVGDimension();
    obj.setHeight(layoutManager.getSvgHeight());
    obj.setWidth(layoutManager.getSvgWidth());
    return obj;
}
Also used : SVGDimension(org.wso2.carbon.bpel.ui.bpel2svg.SVGDimension)

Example 12 with SVGDimension

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

the class EventHandlerImpl 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);
        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 the subActivities is added to the width of the 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();
        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 13 with SVGDimension

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

the class ProcessImpl 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;
        Iterator<ActivityInterface> itr = getSubActivities().iterator();
        try {
            // Iterate through the subActivities
            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 the Process 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();
            }
        } catch (NoSuchElementException e) {
            log.error("Invalid Element access", e);
        }
        /*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
        dimensions.setWidth(width);
        dimensions.setHeight(height);
        // Set the final SVG height and width
        layoutManager.setSvgHeight(height);
        layoutManager.setSvgWidth(width);
        // Check if the layout is vertical or not
        if (!layoutManager.isVerticalLayout()) {
            switchDimensionsToHorizontal();
        }
    }
    return dimensions;
}
Also used : ActivityInterface(org.wso2.carbon.bpel.ui.bpel2svg.ActivityInterface) SVGDimension(org.wso2.carbon.bpel.ui.bpel2svg.SVGDimension) NoSuchElementException(java.util.NoSuchElementException)

Example 14 with SVGDimension

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

the class TargetImpl method getDimensions.

/**
 * SVGDimensions (width and height) are set to zero as no icon is specified
 * @return dimensions of the SVG i.e. width and the height
 */
public SVGDimension getDimensions() {
    SVGDimension obj = new SVGDimension();
    obj.setHeight(0);
    obj.setWidth(0);
    return obj;
}
Also used : SVGDimension(org.wso2.carbon.bpel.ui.bpel2svg.SVGDimension)

Example 15 with SVGDimension

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

the class ForEachImpl 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 ForEach 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() * 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)

Aggregations

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