Beispiel #1
0
  protected void addImplicitTransitions(Activity activity) {
    List activities = getActivities();
    int activityCount = activities.size();
    End end = getEnd();

    if (activityCount > 0) {
      Activity lastActivity = (Activity) activities.get(activityCount - 1);
      lastActivity.disconnect(end);
      lastActivity.connect(activity);
    } else getBegin().connect(activity);

    activity.connect(end);
  }
Beispiel #2
0
  protected void removeImplicitTransitions(Activity activity) {
    Transition leaving = activity.getDefaultLeavingTransition();
    Transition arriving = activity.getDefaultArrivingTransition();

    activity.removeArrivingTransition(arriving);
    activity.removeLeavingTransition(leaving);

    Activity successor = (Activity) leaving.getTo();
    successor.removeArrivingTransition(leaving);
    successor.addArrivingTransition(arriving);
  }
Beispiel #3
0
  public void reorderNode(int oldIndex, int newIndex) {
    // remove activity from its old position and disconnect it from other nodes
    List activities = getActivities();
    Activity reorderedActivity = (Activity) activities.remove(oldIndex);
    removeImplicitTransitions(reorderedActivity);

    // connect activity to its new predecessor and successor
    Activity predecessor = (newIndex == 0 ? getBegin() : (Activity) activities.get(newIndex - 1));
    Activity successor =
        newIndex == activities.size() ? getEnd() : (Activity) activities.get(newIndex);

    Transition leaving = predecessor.getDefaultLeavingTransition();
    successor.removeArrivingTransition(leaving);
    reorderedActivity.addArrivingTransition(leaving);
    reorderedActivity.connect(successor);

    activities.add(newIndex, reorderedActivity);
  }
Beispiel #4
0
 protected boolean isChildInitial(Activity child) {
   return child.equals(getNodes().get(0));
 }