void tryToFinalize(boolean handleErrors) { if (actionFlowState.isAllDone()) { if (actionFlowState.isStartedProgress()) { model.stopProgress(); } if (handleErrors) { handleErrors(); } if (actionFlowState.getFinalAction() != null) { actionFlowState.getFinalAction().execute(); } } }
private final void runAction(ActionFlowState actionFlowState) { this.actionFlowState = actionFlowState; if (finalAction != null) { actionFlowState.setFinalAction(finalAction); } runAction(); }
void runNextAction() { if (getNextAction() != null) { getNextAction().runAction(actionFlowState); } else { actionFlowState.decBranchCounter(); tryToFinalize(true); } }
/** 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(); } }
/** * 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); }