org.araneaframework.framework
Interface FlowContext

All Superinterfaces:
Serializable
All Known Subinterfaces:
FlowContextWidget, RootFlowContext
All Known Implementing Classes:
PopupFlowWrapperWidget, RootFlowContainerWidget, StandardFlowContainerWidget

public interface FlowContext
extends Serializable

This context provides support for flow navigation and nesting. A flow is started using start(Widget, org.araneaframework.framework.FlowContext.Configurator, org.araneaframework.framework.FlowContext.Handler) and continues to be active until it explicitly returns control to the caller using finish(Object) or cancel().

Author:
"Toomas Römer" , Jevgeni Kabanov (ekabanov at araneaframework dot org)
See Also:
StandardFlowContainerWidget

Nested Class Summary
static interface FlowContext.Configurator
          Configurator runs when FlowContext starts flow.
static interface FlowContext.FlowReference
          Deprecated. to be removed in Aranea 2.0
static interface FlowContext.Handler
          Callback that will be run when flow has finished some way.
static interface FlowContext.TransitionHandler
          Performs the flow transitions in FlowContext.
 
Field Summary
static int TRANSITION_CANCEL
           
static int TRANSITION_FINISH
           
static int TRANSITION_REPLACE
           
static int TRANSITION_RESET
           
static int TRANSITION_START
           
 
Method Summary
 void addNestedEnvironmentEntry(ApplicationWidget scope, Object entryId, Object envEntry)
          Adds an environment entry that is visible in all subflows.
 void cancel()
          Finished the current flow passing control back to the calling flow.
 void finish(Object result)
          Finisheds the current flow passing control back to the calling flow.
 FlowContext.FlowReference getCurrentReference()
          Deprecated. to be removed in Aranea 2.0. Also see FlowContext.FlowReference
 FlowContext.TransitionHandler getTransitionHandler()
          Returns currently active FlowContext.TransitionHandler.
 boolean isNested()
          Returns whether the current flow is nested, that is has a caller flow.
 void replace(Widget flow)
          Destroys the current flow and starts a new one.
 void replace(Widget flow, FlowContext.Configurator configurator)
          Destroys the current flow and starts a new one.
 void reset(EnvironmentAwareCallback callback)
          Resets all currently running flows and calls the callback allowing to start new flows.
 void setTransitionHandler(FlowContext.TransitionHandler handler)
          Sets the FlowContext.TransitionHandler which performs the flow navigation.
 void start(Widget flow)
          Starts a new nested subflow.
 void start(Widget flow, FlowContext.Configurator configurator, FlowContext.Handler handler)
          Starts a new nested subflow, that can be configured using the configurator.
 void start(Widget flow, FlowContext.Handler handler)
          Starts a new nested subflow.
 

Field Detail

TRANSITION_START

public static final int TRANSITION_START
Since:
1.1
See Also:
Constant Field Values

TRANSITION_FINISH

public static final int TRANSITION_FINISH
Since:
1.1
See Also:
Constant Field Values

TRANSITION_CANCEL

public static final int TRANSITION_CANCEL
Since:
1.1
See Also:
Constant Field Values

TRANSITION_REPLACE

public static final int TRANSITION_REPLACE
Since:
1.1
See Also:
Constant Field Values

TRANSITION_RESET

public static final int TRANSITION_RESET
Since:
1.1
See Also:
Constant Field Values
Method Detail

start

public void start(Widget flow)
Starts a new nested subflow. Current flow becomes inactive untils subflow calls finish(Object) or cancel().

Since:
1.0.9

start

public void start(Widget flow,
                  FlowContext.Handler handler)
Starts a new nested subflow. Current flow becomes inactive untils subflow calls finish(Object) or cancel(). FlowContext.Handler allows to receive notification, when the subflow ends execution.

Since:
1.0.9

start

public void start(Widget flow,
                  FlowContext.Configurator configurator,
                  FlowContext.Handler handler)
Starts a new nested subflow, that can be configured using the configurator. Current flow becomes inactive untils subflow calls finish(Object) or cancel(). FlowContext.Handler allows to receive notification, when the subflow ends execution.


replace

public void replace(Widget flow)
Destroys the current flow and starts a new one. When the new flow will end execution it will return control to the caller of the current flow (if there is one).


replace

public void replace(Widget flow,
                    FlowContext.Configurator configurator)
Destroys the current flow and starts a new one. When the new flow ends execution it will return control to the caller of the current flow (if there is one). Started subflow can be configured using the configurator.

Since:
1.0.9

finish

public void finish(Object result)
Finisheds the current flow passing control back to the calling flow. Optionally may return some value that can be interpreted by the calling flow as the result of the call.


cancel

public void cancel()
Finished the current flow passing control back to the calling flow. Should be interpreted by the calling flow as a unsuccessful return.


isNested

public boolean isNested()
Returns whether the current flow is nested, that is has a caller flow.


reset

public void reset(EnvironmentAwareCallback callback)
Resets all currently running flows and calls the callback allowing to start new flows. Useful e.g. in a menu, when selecting a new menu item and reseting the old stack.


getCurrentReference

public FlowContext.FlowReference getCurrentReference()
Deprecated. to be removed in Aranea 2.0. Also see FlowContext.FlowReference

Returns a reference to the current flow that can be used later to manipulate the current flow.


addNestedEnvironmentEntry

public void addNestedEnvironmentEntry(ApplicationWidget scope,
                                      Object entryId,
                                      Object envEntry)
Adds an environment entry that is visible in all subflows.


setTransitionHandler

public void setTransitionHandler(FlowContext.TransitionHandler handler)
Sets the FlowContext.TransitionHandler which performs the flow navigation.

Since:
1.1

getTransitionHandler

public FlowContext.TransitionHandler getTransitionHandler()
Returns currently active FlowContext.TransitionHandler.

Since:
1.1