Exemplo n.º 1
0
  /** Returns whether a certain ProcessNode is graphically contained or not. */
  @Override
  public boolean isContainedGraphically(
      List<ProcessNode> nodes, ProcessNode node, boolean onTopRequired) {
    if (node == null) return false;
    // Check boundaries for floating Lane
    if (!getProperty(PROP_FLOATING).equals("0")) {
      return super.isContainedGraphically(nodes, node, true);
    }
    // Check boundaries for non-floating Lane
    if ((node.getPos().y >= (this.getPos().y - this.getSize().height / 2))
        && (node.getPos().y <= (this.getPos().y + this.getSize().height / 2))) {
      return true;
    }

    return false;
  }
Exemplo n.º 2
0
 @Override
 public Point getPos() {
   return f_node.getPos();
 }
Exemplo n.º 3
0
  public static void drawStereotype(Graphics2D g2, ProcessNode n) {
    if (n.getStereotype().length() > 0) {
      g2.setFont(BPMNUtils.defaultFont.deriveFont(Font.ITALIC));

      // Check if stereotype is "SERVICE"
      if (n.getStereotype().toLowerCase().equals(Activity.TYPE_SERVICE.toLowerCase())) {
        Activity.drawService(
            g2,
            n.getPos().x - n.getSize().width / 2 + Activity.STEREOTYPE_ICON_SIZE / 2,
            n.getPos().y - n.getSize().height / 2 + Activity.STEREOTYPE_ICON_SIZE / 2);
      } else {
        // "SEND"
        if (n.getStereotype().toLowerCase().equals(Activity.TYPE_SEND.toLowerCase())) {
          Activity.drawMessage(
              g2,
              n.getPos().x - n.getSize().width / 2 + Activity.STEREOTYPE_ICON_SIZE / 2 + 5,
              n.getPos().y - n.getSize().height / 2 + Activity.STEREOTYPE_ICON_SIZE / 2,
              Color.BLACK,
              Color.WHITE);
        } else {
          // "RECEIVE"
          if (n.getStereotype().toLowerCase().equals(Activity.TYPE_RECEIVE.toLowerCase())) {
            Activity.drawMessage(
                g2,
                n.getPos().x - n.getSize().width / 2 + Activity.STEREOTYPE_ICON_SIZE / 2 + 5,
                n.getPos().y - n.getSize().height / 2 + Activity.STEREOTYPE_ICON_SIZE / 2,
                Color.WHITE,
                Color.BLACK);
          } else {
            // "USER"
            if (n.getStereotype().toLowerCase().equals(Activity.TYPE_USER.toLowerCase())) {
              BPMNUtils.drawImage(
                  "/bpmn/user_task.png", g2, n.getTopLeftPos().x + 3, n.getTopLeftPos().y + 2);
            } else {
              // "MANUAL"
              if (n.getStereotype().toLowerCase().equals(Activity.TYPE_MANUAL.toLowerCase())) {
                BPMNUtils.drawImage(
                    "/bpmn/manual_task.png", g2, n.getTopLeftPos().x + 3, n.getTopLeftPos().y + 4);
              } else {
                // "RULE"
                if (n.getStereotype().toLowerCase().equals(Activity.TYPE_RULE.toLowerCase())) {
                  BPMNUtils.drawImage(
                      "/bpmn/rule_task.png", g2, n.getTopLeftPos().x + 3, n.getTopLeftPos().y + 4);
                } else {
                  // "SCRIPT"
                  if (n.getStereotype().toLowerCase().equals(Activity.TYPE_SCRIPT.toLowerCase())) {
                    BPMNUtils.drawImage(
                        "/bpmn/script_task.png",
                        g2,
                        n.getTopLeftPos().x + 3,
                        n.getTopLeftPos().y + 4);
                  } else {
                    // Draw Stereotype as text
                    g2.setPaint(Color.DARK_GRAY);
                    BPMNUtils.drawText(
                        g2,
                        n.getPos().x,
                        n.getPos().y - (n.getSize().height / 2),
                        n.getSize().width - 8,
                        "<<" + n.getStereotype() + ">>",
                        BPMNUtils.Orientation.TOP);
                  }
                }
              }
            }
          }
        }
      }
    }
  }