예제 #1
0
  private void layoutHorizontal(int startXLeft, int startYTop) {
    int centreOfMyLayout = startYTop + (dimensions.getHeight() / 2);
    int xLeft = startXLeft + (getYSpacing() / 2);
    int yTop = centreOfMyLayout - (getStartIconHeight() / 2);
    int endXLeft = startXLeft + dimensions.getWidth() - getEndIconWidth() - (getYSpacing() / 2);
    int endYTop = centreOfMyLayout - (getEndIconHeight() / 2);

    ActivityInterface activity = null;
    Iterator<ActivityInterface> itr = getSubActivities().iterator();
    int childXLeft = xLeft + getStartIconWidth() + (getYSpacing() / 2);
    int childYTop = startYTop + (getXSpacing() / 2);
    while (itr.hasNext()) {
      activity = itr.next();
      activity.layout(childXLeft, childYTop);
      childXLeft += activity.getDimensions().getWidth();
    }

    // Set the values
    setStartIconXLeft(xLeft);
    setStartIconYTop(yTop);
    setEndIconXLeft(endXLeft);
    setEndIconYTop(endYTop);
    getDimensions().setXLeft(startXLeft);
    getDimensions().setYTop(startYTop);
  }
예제 #2
0
  @Override
  public SVGDimension getDimensions() {
    if (dimensions == null) {
      int width = 0;
      int height = 0;
      dimensions = new SVGDimension(width, height);

      org.wso2.carbon.bpel.ui.bpel2svg.SVGDimension subActivityDim = null;
      ActivityInterface activity = null;
      Iterator<ActivityInterface> itr = getSubActivities().iterator();
      try {
        while (itr.hasNext()) {
          activity = itr.next();
          subActivityDim = activity.getDimensions();
          if (subActivityDim.getWidth() > width) {
            width += subActivityDim.getWidth();
          }
          height += subActivityDim.getHeight();
        }
      } catch (NoSuchElementException e) {
        log.error("Invalid Element access", e);
        // throw new Exception("Error in reading Dimensions", e);
      }

      height += ((getYSpacing() * 2) + getStartIconHeight() + getEndIconHeight());
      width += getXSpacing();

      dimensions.setWidth(width);
      dimensions.setHeight(height);

      layoutManager.setSvgHeight(height);
      layoutManager.setSvgWidth(width);

      if (!layoutManager.isVerticalLayout()) {
        switchDimensionsToHorizontal();
      }
    }
    return dimensions;
  }