Esempio n. 1
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);
  }
Esempio n. 2
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);
  }