Exemplo n.º 1
0
 private Collection<EnforceabilityProblem> checkStartEventTypes(
     ChoreographySubProcess subProcess) {
   Collection<EnforceabilityProblem> problems = new HashSet<EnforceabilityProblem>();
   for (ProcessNode node : subProcess.getProcessNodes()) {
     if ((node instanceof StartEvent) && !(node.getClass().equals(StartEvent.class))) {
       problems.add(new EnforceabilityProblem(DESC_OnlyNoneStartEvents, node, subProcess));
     }
   }
   return problems;
 }
Exemplo n.º 2
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.º 3
0
 @Override
 public boolean equals(Object obj) {
   if (f_node == null) return false;
   if (obj instanceof ProcessNodeAdapter) {
     return f_node.equals(((ProcessNodeAdapter) obj).getNode());
   }
   return false;
 }
Exemplo n.º 4
0
 @Override
 public void addContext(ProcessModel context) {
   super.addContext(context);
   if (f_parent == null) {
     f_parent = (Tool) context.getNodeById(getProperty(PROP_PARENT_ID));
     if (f_parent != null) // can happen with legacy models
     f_parent.setErrorConnector(this, getNumber());
   }
 }
Exemplo n.º 5
0
 @Override
 public String toString() {
   return f_node.toString();
 }
Exemplo n.º 6
0
 @Override
 public void setPos(int x, int y) {
   f_node.setProperty(ProcessNode.PROP_XPOS, "" + x);
   f_node.setProperty(ProcessNode.PROP_YPOS, "" + y);
 }
Exemplo n.º 7
0
 @Override
 public String getText() {
   return f_node.getText();
 }
Exemplo n.º 8
0
 @Override
 public Dimension getSize() {
   return f_node.getBoundingBox().getSize();
 }
Exemplo n.º 9
0
 @Override
 public Point getPos() {
   return f_node.getPos();
 }
Exemplo n.º 10
0
 @Override
 public int hashCode() {
   return f_node.hashCode();
 }
Exemplo n.º 11
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);
                  }
                }
              }
            }
          }
        }
      }
    }
  }