Update docs

This commit is contained in:
Janne Valkealahti
2023-10-06 17:07:16 +01:00
parent 2819c1d367
commit 6f7eac435a
11 changed files with 18 additions and 18 deletions

View File

@@ -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.