com.smartgwt.client.util.workflow

## Class UserTask

- java.lang.Object
- - com.smartgwt.client.core.BaseClass
  - - com.smartgwt.client.util.workflow.ProcessElement
    - - com.smartgwt.client.util.workflow.Task
      - - com.smartgwt.client.util.workflow.UserTask

- All Implemented Interfaces:
    com.google.gwt.event.shared.HasHandlers

      public class UserTask
      extends Task

  A task that involves showing a user interface to the end user allowing the user to view and input data and press a button (or do some other UI gesture) to complete the task.

  A UserTask takes the following steps:

  - Optionally show() or otherwise make visible the `targetView`
  - Provide values to either a `DynamicForm` designated as the `targetForm` or to a `ValuesManager` designated as the `targetVM`, via `setValues()`
  - Waits for notification of completion or cancellation. The UserTask is notified of completion if a `SubmitItem` is pressed in either the `targetForm` or any form that is a member of the `targetVM`. Likewise a CancelItem triggers cancellation. Direct calls to `DynamicForm.cancelEditing()` or `DynamicForm.completeEditing()` achieve the same result.
  - if cancellation occurs, the process continues to the `cancelElement`
  - if completion occurs, values are retrieved from the form or valuesManager and applied to the process state

- - ### Field Summary

    - ### Fields inherited from class com.smartgwt.client.core.BaseClass

      `config, configOnly, factoryCreated, factoryProperties, id, scClassName`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UserTask()`
    `UserTask(com.google.gwt.core.client.JavaScriptObject jsObj)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `cancelEditing()` Revert any changes made in a form and finish this userTask execution.
    `void` | `completeEditing()` Finish editing and store edited values in `process state`.
    `com.google.gwt.core.client.JavaScriptObject` | `create()`
    `java.lang.String` | `getCancelElement()` Next element to proceed to if the task is cancelled because the `targetForm` or `targetVM` had `cancelEditing()` called on it.
    `Canvas` | `getInlineView()` An inline definition of the form.
    `static UserTask` | `getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)`
    `java.lang.String` | `getPreviousElement()` Previous workflow `sequence` or `element` that is helpful for wizards.
    `java.lang.Boolean` | `getSaveToServer()` If saveToServer is set then associated form will perform the normal `DynamicForm.submit()` actions when called (typically from a `SubmitItem`).
    `DynamicForm` | `getTargetForm()` DynamicForm that should be populated with data and that should provide the data for the task outputs.
    `Canvas` | `getTargetView()` Optional widget that should be shown to allow user input.
    `ValuesManager` | `getTargetVM()` Optional ValuesManager which will receive task inputs and provide task outputs.
    `java.lang.Boolean` | `getWizard()` If wizard is set then associated form will be hidden after user goes to next or prev step of current workflow.
    `void` | `goToPrevious()` Set `previousElement` as next element of workflow.
    `void` | `setCancelElement(java.lang.String cancelElement)` Next element to proceed to if the task is cancelled because the `targetForm` or `targetVM` had `cancelEditing()` called on it.
    `void` | `setInlineView(Canvas inlineView)` An inline definition of the form.
    `void` | `setPreviousElement(java.lang.String previousElement)` Previous workflow `sequence` or `element` that is helpful for wizards.
    `void` | `setSaveToServer(java.lang.Boolean saveToServer)` If saveToServer is set then associated form will perform the normal `DynamicForm.submit()` actions when called (typically from a `SubmitItem`).
    `void` | `setTargetForm(DynamicForm targetForm)` DynamicForm that should be populated with data and that should provide the data for the task outputs.
    `void` | `setTargetView(Canvas targetView)` Optional widget that should be shown to allow user input.
    `void` | `setTargetView(java.lang.String targetView)` Optional widget that should be shown to allow user input.
    `void` | `setTargetVM(java.lang.String targetVM)` Optional ValuesManager which will receive task inputs and provide task outputs.
    `void` | `setTargetVM(ValuesManager targetVM)` Optional ValuesManager which will receive task inputs and provide task outputs.
    `void` | `setWizard(java.lang.Boolean wizard)` If wizard is set then associated form will be hidden after user goes to next or prev step of current workflow.

    - ### Methods inherited from class com.smartgwt.client.util.workflow.Task

      `getInputField, getInputFieldList, getOutputField, getOutputFieldList, setInputField, setInputFieldList, setOutputField, setOutputFieldList`

    - ### Methods inherited from class com.smartgwt.client.util.workflow.ProcessElement

      `convertToJavaScriptArray, getID, getJsObj, getNextElement, getOrCreateJsObj, getProcessElements, isCreated, onInit, setAttribute, setID, setJavaScriptObject, setNextElement`

    - ### Methods inherited from class com.smartgwt.client.core.BaseClass

      `applyFactoryProperties, asSGWTComponent, createJsObj, destroy, doAddHandler, doInit, error, error, errorIfNotCreated, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsElement, getAttributeAsFloat, getAttributeAsInt, getAttributeAsJavaScriptObject, getAttributeAsMap, getAttributeAsString, getAttributeAsStringArray, getClassName, getConfig, getHandlerCount, getRef, getScClassName, getTestInstance, hasAutoAssignedID, internalSetID, internalSetID, isConfigOnly, isFactoryCreated, onBind, registerID, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setConfig, setConfigOnly, setFactoryCreated, setProperty, setProperty, setProperty, setProperty, setScClassName`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### UserTask

          public UserTask()

    - #### UserTask

          public UserTask(com.google.gwt.core.client.JavaScriptObject jsObj)

  - ### Method Detail

    - #### getOrCreateRef

          public static UserTask getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)

    - #### create

          public com.google.gwt.core.client.JavaScriptObject create()

      Overrides:
        `create` in class `Task`

    - #### setCancelElement

          public void setCancelElement(java.lang.String cancelElement)
                                throws java.lang.IllegalStateException

      Next element to proceed to if the task is cancelled because the `targetForm` or `targetVM` had `cancelEditing()` called on it.
      Parameters:
        `cancelElement` - New cancelElement value. Default value is null
      Throws:
        `java.lang.IllegalStateException` - this property cannot be changed after the underlying component has been created

    - #### getCancelElement

          public java.lang.String getCancelElement()

      Next element to proceed to if the task is cancelled because the `targetForm` or `targetVM` had `cancelEditing()` called on it.
      Returns:
        Current cancelElement value. Default value is null

    - #### setInlineView

          public void setInlineView(Canvas inlineView)

      An inline definition of the form. Could be used to encode form directly in process xml.
      Parameters:
        `inlineView` - New inlineView value. Default value is null

    - #### getInlineView

          public Canvas getInlineView()

      An inline definition of the form. Could be used to encode form directly in process xml.
      Returns:
        Current inlineView value. Default value is null

    - #### setPreviousElement

          public void setPreviousElement(java.lang.String previousElement)
                                  throws java.lang.IllegalStateException

      Previous workflow `sequence` or `element` that is helpful for wizards. This element will be executed if `goToPrevious()` method of userTask will be invoked. You can get userTask for attached form by using `userTask` property.
      Parameters:
        `previousElement` - New previousElement value. Default value is null
      Throws:
        `java.lang.IllegalStateException` - this property cannot be changed after the underlying component has been created

    - #### getPreviousElement

          public java.lang.String getPreviousElement()

      Previous workflow `sequence` or `element` that is helpful for wizards. This element will be executed if `goToPrevious()` method of userTask will be invoked. You can get userTask for attached form by using `userTask` property.
      Returns:
        Current previousElement value. Default value is null

    - #### setSaveToServer

          public void setSaveToServer(java.lang.Boolean saveToServer)
                               throws java.lang.IllegalStateException

      If saveToServer is set then associated form will perform the normal `DynamicForm.submit()` actions when called (typically from a `SubmitItem`). By default the form submit action is bypassed.
      Parameters:
        `saveToServer` - New saveToServer value. Default value is false
      Throws:
        `java.lang.IllegalStateException` - this property cannot be changed after the underlying component has been created

    - #### getSaveToServer

          public java.lang.Boolean getSaveToServer()

      If saveToServer is set then associated form will perform the normal `DynamicForm.submit()` actions when called (typically from a `SubmitItem`). By default the form submit action is bypassed.
      Returns:
        Current saveToServer value. Default value is false

    - #### setTargetForm

          public void setTargetForm(DynamicForm targetForm)
                             throws java.lang.IllegalStateException

      DynamicForm that should be populated with data and that should provide the data for the task outputs.

      Use `targetVM` to use a `ValuesManager` instead.

      Parameters:
        `targetForm` - New targetForm value. Default value is null
      Throws:
        `java.lang.IllegalStateException` - this property cannot be changed after the underlying component has been created

    - #### getTargetForm

          public DynamicForm getTargetForm()

      DynamicForm that should be populated with data and that should provide the data for the task outputs.

      Use `targetVM` to use a `ValuesManager` instead.

      Returns:
        Current targetForm value. Default value is null

    - #### setWizard

          public void setWizard(java.lang.Boolean wizard)
                         throws java.lang.IllegalStateException

      If wizard is set then associated form will be hidden after user goes to next or prev step of current workflow.
      Parameters:
        `wizard` - New wizard value. Default value is false
      Throws:
        `java.lang.IllegalStateException` - this property cannot be changed after the underlying component has been created

    - #### getWizard

          public java.lang.Boolean getWizard()

      If wizard is set then associated form will be hidden after user goes to next or prev step of current workflow.
      Returns:
        Current wizard value. Default value is false

    - #### cancelEditing

          public void cancelEditing()

      Revert any changes made in a form and finish this userTask execution. `cancelElement` will be proceed as the next element of current process.

    - #### completeEditing

          public void completeEditing()

      Finish editing and store edited values in `process state`.

    - #### goToPrevious

          public void goToPrevious()

      Set `previousElement` as next element of workflow. This method could be used to create wizard-like UI behavior.

    - #### setTargetView

          public void setTargetView(Canvas targetView)

      Optional widget that should be shown to allow user input. If this widget is a DynamicForm, it will also be automatically used as the `targetForm` unless either `targetForm` or `targetVM` is set.

      `UserTask` will automatically handle various scenarios of the `targetView` being not currently visible or draw()n, according to the following rules:

      - if the view itself is marked hidden, it will be show()n
      - if the view is inside a hidden parent, the parent will be show()n
      - if the view is the `pane` of a tab in a TabSet, the tab will be selected
      - if the view is listed in `items` for a which is either collapsed or hidden section, the section will be shown and expanded
      - if the view is listed in `items` for a Window, the Window will be shown
      - if any of these conditions apply to any parent of the targetView, the rules will be applied to that parent as well. For example, the targetView is in a collapsed section inside a tab which is not selected, the section will be expanded and the tab selected
      Parameters:
        `targetView` - targetView Default value is null

    - #### getTargetView

          public Canvas getTargetView()

      Optional widget that should be shown to allow user input. If this widget is a DynamicForm, it will also be automatically used as the `targetForm` unless either `targetForm` or `targetVM` is set.

      `UserTask` will automatically handle various scenarios of the `targetView` being not currently visible or draw()n, according to the following rules:

      - if the view itself is marked hidden, it will be show()n
      - if the view is inside a hidden parent, the parent will be show()n
      - if the view is the `pane` of a tab in a TabSet, the tab will be selected
      - if the view is listed in `items` for a which is either collapsed or hidden section, the section will be shown and expanded
      - if the view is listed in `items` for a Window, the Window will be shown
      - if any of these conditions apply to any parent of the targetView, the rules will be applied to that parent as well. For example, the targetView is in a collapsed section inside a tab which is not selected, the section will be expanded and the tab selected
      Returns:
        Canvas

    - #### setTargetView

          public void setTargetView(java.lang.String targetView)

      Optional widget that should be shown to allow user input. If this widget is a DynamicForm, it will also be automatically used as the `targetForm` unless either `targetForm` or `targetVM` is set.

      `UserTask` will automatically handle various scenarios of the `targetView` being not currently visible or draw()n, according to the following rules:

      - if the view itself is marked hidden, it will be show()n
      - if the view is inside a hidden parent, the parent will be show()n
      - if the view is the `pane` of a tab in a TabSet, the tab will be selected
      - if the view is listed in `items` for a which is either collapsed or hidden section, the section will be shown and expanded
      - if the view is listed in `items` for a Window, the Window will be shown
      - if any of these conditions apply to any parent of the targetView, the rules will be applied to that parent as well. For example, the targetView is in a collapsed section inside a tab which is not selected, the section will be expanded and the tab selected
      Parameters:
        `targetView` - targetView Default value is null

    - #### setTargetVM

          public void setTargetVM(ValuesManager targetVM)

      Optional ValuesManager which will receive task inputs and provide task outputs. Use `targetForm` instead of you want to use a DynamicForm.
      Parameters:
        `targetVM` - targetVM Default value is null

    - #### getTargetVM

          public ValuesManager getTargetVM()

      Optional ValuesManager which will receive task inputs and provide task outputs. Use `targetForm` instead of you want to use a DynamicForm.
      Returns:
        ValuesManager

    - #### setTargetVM

          public void setTargetVM(java.lang.String targetVM)

      Optional ValuesManager which will receive task inputs and provide task outputs. Use `targetForm` instead of you want to use a DynamicForm.
      Parameters:
        `targetVM` - targetVM Default value is null