Пример #1
0
  public static void updateConnections(
      IFeatureProvider fp, AnchorContainer ac, List<Connection> alreadyUpdated) {
    for (int ai = 0; ai < ac.getAnchors().size(); ++ai) {
      Anchor a = ac.getAnchors().get(ai);
      for (int ci = 0; ci < a.getIncomingConnections().size(); ++ci) {
        Connection c = a.getIncomingConnections().get(ci);
        if (c instanceof FreeFormConnection) {
          if (!alreadyUpdated.contains(c)) {
            updateConnection(fp, c, true);
            alreadyUpdated.add(c);
          }
        }
      }
    }

    for (int ai = 0; ai < ac.getAnchors().size(); ++ai) {
      Anchor a = ac.getAnchors().get(ai);
      for (int ci = 0; ci < a.getOutgoingConnections().size(); ++ci) {
        Connection c = a.getOutgoingConnections().get(ci);
        if (c instanceof FreeFormConnection) {
          if (!alreadyUpdated.contains(c)) {
            updateConnection(fp, c, true);
            alreadyUpdated.add(c);
          }
        }
      }
    }
  }
Пример #2
0
 /**
  * Collects all Shapes and any Connections attached to them, that are children or descendants of
  * the given Lane or Pool container. Only Shapes that are NOT Lanes are collected.
  *
  * @param containerShape the current Pool or Lane shape. This method is recursive and is initially
  *     invoked for the root container.
  * @param descendants the list of descendant Shapes and attached Connections
  * @param includeLanes if true, includes all Lane shapes in the results list
  */
 public static void collectChildren(
     ContainerShape containerShape, List<PictogramElement> descendants, boolean includeLanes) {
   for (PictogramElement pe : containerShape.getChildren()) {
     if (pe instanceof ContainerShape) {
       if (isLane(pe)) {
         if (includeLanes) descendants.add(pe);
         collectChildren((ContainerShape) pe, descendants, includeLanes);
       } else {
         if (isBpmnShape(pe)) {
           descendants.add(pe);
           for (Anchor a : ((ContainerShape) pe).getAnchors()) {
             for (Connection c : a.getIncomingConnections()) {
               if (c instanceof FreeFormConnection && !descendants.contains(c)) {
                 descendants.add(c);
               }
             }
             for (Connection c : a.getOutgoingConnections()) {
               if (c instanceof FreeFormConnection && !descendants.contains(c)) {
                 descendants.add(c);
               }
             }
           }
         }
       }
     }
   }
 }
Пример #3
0
  public static void setContainerChildrenVisible(
      IFeatureProvider fp, ContainerShape container, boolean visible) {
    List<PictogramElement> list = new ArrayList<PictogramElement>();
    list.addAll(container.getChildren());
    for (PictogramElement pe : list) {
      if (ShapeDecoratorUtil.isActivityBorder(pe)) continue;

      if (ShapeDecoratorUtil.isEventSubProcessDecorator(pe)) {
        pe.setVisible(!visible);
      } else pe.setVisible(visible);

      if (visible) FeatureSupport.updateLabel(fp, pe, null);
      if (pe instanceof AnchorContainer) {
        AnchorContainer ac = (AnchorContainer) pe;
        for (Anchor a : ac.getAnchors()) {
          for (Connection c : a.getOutgoingConnections()) {
            c.setVisible(visible);
            if (visible) FeatureSupport.updateLabel(fp, c, null);
            for (ConnectionDecorator decorator : c.getConnectionDecorators()) {
              decorator.setVisible(visible);
            }
          }
        }
      }
    }
  }
Пример #4
0
  public static void updateCategoryValues(IFeatureProvider fp, List<ContainerShape> shapes) {
    // Update CategoryValues for SequenceFlows also
    List<Connection> connections = new ArrayList<Connection>();
    for (ContainerShape cs : shapes) {
      updateCategoryValues(fp, cs);

      for (Anchor a : cs.getAnchors()) {
        for (Connection c : a.getIncomingConnections()) {
          if (!connections.contains(c)) connections.add(c);
        }
        for (Connection c : a.getOutgoingConnections()) {
          if (!connections.contains(c)) connections.add(c);
        }
      }
    }
    for (Connection c : connections) {
      updateCategoryValues(fp, c);
    }
  }