Esempio n. 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);
  }
Esempio n. 2
0
 private Element getLinkArrows(SVGDocument doc) {
   Element group = doc.createElementNS("http://www.w3.org/2000/svg", "g");
   if (links != null && !links.isEmpty()) {
     Set linksSet = links.entrySet();
     Iterator linksIterator = linksSet.iterator();
     while (linksIterator.hasNext()) {
       Map.Entry<String, Link> link = (Map.Entry<String, Link>) linksIterator.next();
       ActivityInterface startActivity = link.getValue().getSource();
       ActivityInterface endActivity = link.getValue().getTarget();
       String linkName = link.getKey();
       // Element pathGroup = doc.createElementNS("http://www.w3.org/2000/svg", "g");
       // group.setAttributeNS("xlink", "title", linkName);
       group.appendChild(
           drawLink(
               doc,
               startActivity.getExitArrowCoords().getXLeft(),
               startActivity.getExitArrowCoords().getYTop(),
               endActivity.getEntryArrowCoords().getXLeft(),
               endActivity.getEntryArrowCoords().getYTop(),
               startActivity.getStartIconWidth(),
               link.getKey(),
               linkName));
       // group.appendChild(pathGroup);
     }
   }
   return group;
 }
Esempio n. 3
0
  protected Element getArrows(SVGDocument doc) {
    Element group = doc.createElementNS("http://www.w3.org/2000/svg", "g");
    if (subActivities != null) {
      ActivityInterface startActivity = subActivities.get(0);
      ActivityInterface endActivity = subActivities.get(subActivities.size() - 1);

      startActivity = endActivity; // Should ignore event/fault handlers

      org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates exitCoords = getExitArrowCoords();
      group.appendChild(
          getArrowDefinition(
              doc,
              exitCoords.getXLeft(),
              exitCoords.getYTop(),
              startActivity.getEntryArrowCoords().getXLeft(),
              startActivity.getEntryArrowCoords().getYTop(),
              name,
              startActivity,
              endActivity));
      org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates entryCoords = getEndEntryArrowCoords();
      group.appendChild(
          getArrowDefinition(
              doc,
              endActivity.getExitArrowCoords().getXLeft(),
              endActivity.getExitArrowCoords().getYTop(),
              entryCoords.getXLeft(),
              entryCoords.getYTop(),
              name,
              startActivity,
              endActivity));
    }
    return group;
  }
Esempio n. 4
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;
  }