public class ViewFlowContext extends AbstractContext
The flow context is the context for a defined flow. A flow is a linked map of different views. By using the context you can easily share your datamodel in all views of a flow.
How to use a context
A context has a defined life time and can hold the data model of your
aplication or of a part of your application. To do so you can easily register
objects to your context:
DataModel model = ...
context.register(model);
In your controller:
DataModel model = context.getRegisteredObject(DataModel.class);
If you need more than one instance of a class in your context you can simple register the by using string based keys:
DataModel model1 = ...
DataModel model2 = ...
context.register("firstModel", model);
context.register("secondModel", model);
In your controller:
DataModel firstModel = context.getRegisteredObject("firstModel");
A context can simple used in a controller by injecting the context. DataFX provides annotations to inject all different context types:
"@FXMLApplicationContext"
ApplicationContext myApplicationContext;
By doing so you can easily access all your data in your controller and share data between different controllers.
| ?????? |
|---|
ViewFlowContext()
Default constructor
|
| ?????? | ????? |
|---|---|
javafx.beans.property.ObjectProperty<ViewContext<?>> |
currentViewContextProperty() |
ApplicationContext |
getApplicationContext()
Returns the global application context
|
ViewContext<?> |
getCurrentViewContext()
Returns the context of the current view of the flow.
|
<T> void |
setCurrentViewContext(ViewContext<T> currentViewContext)
Sets the context of the current view in the flow of this context.
|
getId, getRegisteredObject, getRegisteredObject, register, register, register, toStringpublic javafx.beans.property.ObjectProperty<ViewContext<?>> currentViewContextProperty()
public <T> void setCurrentViewContext(ViewContext<T> currentViewContext)
currentViewContext - public ViewContext<?> getCurrentViewContext()
public ApplicationContext getApplicationContext()