Update docs
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
[[using-shell-components-flow]]
|
||||
= Flow
|
||||
|
||||
ifndef::snippets[:snippets: ../../test/java/org/springframework/shell/docs]
|
||||
|
||||
When you use xref:components/ui/index.adoc[Flow Components] to build something that involves
|
||||
use of a multiple components, your implementation may become a bit cluttered.
|
||||
To ease these use cases, we added a
|
||||
`ComponentFlow` that can hook multiple component executions together
|
||||
as a "`flow`".
|
||||
|
||||
The following listings show examples of flows and their output in a shell:
|
||||
|
||||
[source, java, indent=0]
|
||||
----
|
||||
include::{snippets}/FlowComponentSnippets.java[tag=snippet1]
|
||||
----
|
||||
|
||||
image::component-flow-showcase-1.svg[text input]
|
||||
|
||||
Normal execution order of a components is same as defined with a builder. It's
|
||||
possible to conditionally choose where to jump in a flow by using a `next`
|
||||
function and returning target _component id_. If this returned id is aither _null_
|
||||
or doesn't exist flow is essentially stopped right there.
|
||||
|
||||
[source, java, indent=0]
|
||||
----
|
||||
include::{snippets}/FlowComponentSnippets.java[tag=snippet2]
|
||||
----
|
||||
|
||||
image::component-flow-conditional-1.svg[text input]
|
||||
|
||||
TIP: The result from running a flow returns `ComponentFlowResult`, which you can
|
||||
use to do further actions.
|
||||
Reference in New Issue
Block a user