Exemple #1
0
  void tryToFinalize(boolean handleErrors) {
    if (actionFlowState.isAllDone()) {
      if (actionFlowState.isStartedProgress()) {
        model.stopProgress();
      }

      if (handleErrors) {
        handleErrors();
      }

      if (actionFlowState.getFinalAction() != null) {
        actionFlowState.getFinalAction().execute();
      }
    }
  }
Exemple #2
0
 private final void runAction(ActionFlowState actionFlowState) {
   this.actionFlowState = actionFlowState;
   if (finalAction != null) {
     actionFlowState.setFinalAction(finalAction);
   }
   runAction();
 }
Exemple #3
0
 void runNextAction() {
   if (getNextAction() != null) {
     getNextAction().runAction(actionFlowState);
   } else {
     actionFlowState.decBranchCounter();
     tryToFinalize(true);
   }
 }
Exemple #4
0
  /** The execution of the action should be done by calling this method. */
  public final void runAction() {
    if (actionFlowState == null) {
      actionFlowState = new ActionFlowState(1, finalAction);
    }

    if (model.getProgress() == null) {
      model.startProgress(null);
      actionFlowState.setStartedProgress(true);
    }

    if (parallelAction != null) {
      parallelAction.runParallelAction(actionFlowState);
    }

    if (shouldExecute()) {
      internalRunAction();
    } else {
      runNextAction();
    }
  }
Exemple #5
0
 /**
  * This method is used if the action should be added to an existing actions flow. The meaning of
  * adding to an existing flow is that for example <code>model.stopProgress()</code> and the <code>
  * finishAction</code> will be executed just after all the actions in the flow (including this
  * one) will be finished.
  *
  * @param actionFlowState the state of the flow this action wants to join.
  */
 public void runParallelAction(ActionFlowState actionFlowState) {
   actionFlowState.incBranchCounter();
   runAction(actionFlowState);
 }