Search in sources :

Example 1 with ITaskDialogFactory

use of org.whole.lang.workflows.ui.dialogs.ITaskDialogFactory in project whole by wholeplatform.

the class WorkflowsIDEInterpreterVisitor method visit.

@Override
public void visit(Task entity) {
    entity.getLabel().accept(this);
    String title = PrettyPrinterOperation.toPrettyPrintString(getResult());
    entity.getDescription().accept(this);
    String description = PrettyPrinterOperation.toPrettyPrintString(getResult());
    Assignments assignments = EntityUtils.clone(entity.getAssignments());
    Variable factoryVariable = entity.getFactory();
    ITaskDialogFactory factory;
    if (EntityUtils.isNotResolver(factoryVariable)) {
        factoryVariable.accept(this);
        factory = (ITaskDialogFactory) getResultValue();
    } else if (EntityUtils.isNotResolver(assignments)) {
        factory = AssignmentsDialogFactory.instance();
    } else
        factory = ConfirmationDialogFactory.instance();
    if (EntityUtils.isNotResolver(assignments)) {
        stagedVisit(assignments, 1);
        assignments = (Assignments) getResult();
    }
    if (!TaskDialogHelper.showTaskDialog(factory, title, description, assignments, getBindings()))
        throw new OperationCanceledException(new VisitException("task not completed: " + description));
    assignments.accept(this);
}
Also used : ITaskDialogFactory(org.whole.lang.workflows.ui.dialogs.ITaskDialogFactory) Variable(org.whole.lang.workflows.model.Variable) OperationCanceledException(org.whole.lang.operations.OperationCanceledException) VisitException(org.whole.lang.visitors.VisitException) Assignments(org.whole.lang.workflows.model.Assignments)

Aggregations

OperationCanceledException (org.whole.lang.operations.OperationCanceledException)1 VisitException (org.whole.lang.visitors.VisitException)1 Assignments (org.whole.lang.workflows.model.Assignments)1 Variable (org.whole.lang.workflows.model.Variable)1 ITaskDialogFactory (org.whole.lang.workflows.ui.dialogs.ITaskDialogFactory)1