Update docs
This commit is contained in:
@@ -4,4 +4,14 @@
|
||||
|
||||
ifndef::snippets[:snippets: ../../../../../src/test/java/org/springframework/shell/docs]
|
||||
|
||||
tbd
|
||||
Views have their own default bindings which can be changed.
|
||||
|
||||
You can subscribe into all key events:
|
||||
|
||||
[source, java, indent=0]
|
||||
----
|
||||
include::{snippets}/KeyHandlingSnippets.java[tag=sample]
|
||||
----
|
||||
|
||||
`KeyEvent` is a record containing info about a binding coming out
|
||||
from a terminal.
|
||||
|
||||
@@ -4,4 +4,12 @@
|
||||
|
||||
ifndef::snippets[:snippets: ../../../../../src/test/java/org/springframework/shell/docs]
|
||||
|
||||
tbd
|
||||
You can subscribe into all mouse events:
|
||||
|
||||
[source, java, indent=0]
|
||||
----
|
||||
include::{snippets}/MouseHandlingSnippets.java[tag=sample]
|
||||
----
|
||||
|
||||
`MouseEvent` is a record wrapping _x_ and _Y_ coordinates and
|
||||
`org.jline.terminal.MouseEvent` from JLine library.
|
||||
|
||||
@@ -7,13 +7,8 @@ ifndef::snippets[:snippets: ../../../../../src/test/java/org/springframework/she
|
||||
Lets start with a simple app which prints "hello world" in a view.
|
||||
[source, java, indent=0]
|
||||
----
|
||||
include::{snippets}/TerminalUiSnippets.java[tag=snippet1]
|
||||
include::{snippets}/TerminalUiSnippets.java[tag=introsample]
|
||||
----
|
||||
|
||||
There is not much to see here other than `TerminalUI` is a class handling
|
||||
all logic aroung views and uses `View` as it's root view.
|
||||
|
||||
[source, java, indent=0]
|
||||
----
|
||||
include::{snippets}/TerminalUiSnippets.java[tag=snippet2]
|
||||
----
|
||||
|
||||
@@ -4,7 +4,33 @@
|
||||
ifndef::snippets[:snippets: ../../../../../src/test/java/org/springframework/shell/docs]
|
||||
|
||||
`TerminalUI` is a main implementation to drive ui execution logic.
|
||||
Running `TerminalUI` execution loop is a blocking operation.
|
||||
|
||||
== Create TerminalUI
|
||||
You can build `TerminalUI` manually but recommended way is to use `TerminalUIBuilder`
|
||||
build is autoconfigured for you and will set needed services.
|
||||
|
||||
[source, java, indent=0]
|
||||
----
|
||||
include::{snippets}/TerminalUiSnippets.java[tag=uibuilderautowire]
|
||||
----
|
||||
|
||||
== Configuring Views
|
||||
`TerminalUI` has a helper method _configure(View)_ which can be used to set
|
||||
needed integrations into _eventloop_ and other services.
|
||||
|
||||
[source, java, indent=0]
|
||||
----
|
||||
include::{snippets}/TerminalUiSnippets.java[tag=configureview]
|
||||
----
|
||||
|
||||
== Running UI Loop
|
||||
Running `TerminalUI` execution loop is a blocking operation. You're going to need
|
||||
a way to exit from a loop, for example <<Exiting App>>.
|
||||
|
||||
[source, java, indent=0]
|
||||
----
|
||||
include::{snippets}/TerminalUiSnippets.java[tag=uirun]
|
||||
----
|
||||
|
||||
== Exiting App
|
||||
|
||||
@@ -13,5 +39,5 @@ events and request _interrupt_.
|
||||
|
||||
[source, java, indent=0]
|
||||
----
|
||||
include::{snippets}/TerminalUiSnippets.java[tag=snippet3]
|
||||
include::{snippets}/TerminalUiSnippets.java[tag=exitingfromloop]
|
||||
----
|
||||
|
||||
Reference in New Issue
Block a user