Update docs
This commit is contained in:
@@ -8,7 +8,21 @@ _BoxView_ is a base implementation providing functionality to draw into a
|
||||
bounded _Rectancle_. Only direct use of it is its `drawFunction` which
|
||||
allows to do simple things without implementing a full custom `View`.
|
||||
|
||||
|
||||
[source, java, indent=0]
|
||||
----
|
||||
include::{snippets}/BoxViewSnippets.java[tag=sample]
|
||||
----
|
||||
|
||||
== Customisation
|
||||
_BoxView_ as mostly being a base class contains some useful features
|
||||
like if it should draw a border and what what are its paddings.
|
||||
Border can have a title and its color and focused color can be
|
||||
defined. It's also possible to explicitely set background color
|
||||
which will override one from styling.
|
||||
|
||||
== Default Bindings
|
||||
Does not have any default bindings.
|
||||
|
||||
== Events
|
||||
Does not have any events.
|
||||
|
||||
@@ -6,3 +6,52 @@ ifndef::snippets[:snippets: ../../../../../src/test/java/org/springframework/she
|
||||
|
||||
_ButtonView_ is a base implementation providing functionality to draw a button.
|
||||
Inherits xref:tui/views/box.adoc[].
|
||||
|
||||
[source, text]
|
||||
----
|
||||
┌──────┐
|
||||
│ text │
|
||||
└──────┘
|
||||
----
|
||||
|
||||
You can set a text for a button and action to do when button is selected.
|
||||
|
||||
[source, java, indent=0]
|
||||
----
|
||||
include::{snippets}/ButtonViewSnippets.java[tag=sample]
|
||||
----
|
||||
|
||||
== Default Bindings
|
||||
|
||||
Default _key bindigs_ are:
|
||||
|
||||
.Key
|
||||
|===
|
||||
|Command |Description
|
||||
|
||||
|Enter
|
||||
|Selects a button
|
||||
|
||||
|===
|
||||
|
||||
Default _mouse bindigs_ are:
|
||||
|
||||
.Mouse
|
||||
|===
|
||||
|Command |Description
|
||||
|
||||
|Released \| Button1
|
||||
|Selects a button
|
||||
|
||||
|===
|
||||
|
||||
== Events
|
||||
[[tui-views-list-events]]
|
||||
.ListView Events
|
||||
|===
|
||||
|Event |Description
|
||||
|
||||
|ButtonViewSelectEvent
|
||||
|Button is selected.
|
||||
|
||||
|===
|
||||
|
||||
@@ -6,3 +6,29 @@ ifndef::snippets[:snippets: ../../../../../src/test/java/org/springframework/she
|
||||
|
||||
_DialogView_ is a base implementation providing functionality to draw a dialog.
|
||||
Inherits xref:tui/views/box.adoc[].
|
||||
|
||||
[source, text]
|
||||
----
|
||||
┌──────────────────┐
|
||||
│ │
|
||||
│ <Main content> │
|
||||
│ │
|
||||
├──────────────────┤
|
||||
│ <Buttons> │
|
||||
└──────────────────┘
|
||||
----
|
||||
|
||||
== Default Bindings
|
||||
Does not have any default bindings.
|
||||
|
||||
== Events
|
||||
Events are sent depending on a used list type.
|
||||
|
||||
.DialogView Events
|
||||
|===
|
||||
|Event |Description
|
||||
|
||||
|DialogViewCloseEvent
|
||||
|Dialog requested to get closed.
|
||||
|
||||
|===
|
||||
|
||||
@@ -13,15 +13,15 @@ include::{snippets}/GridViewSnippets.java[tag=snippet1]
|
||||
|
||||
Will result layout of:
|
||||
|
||||
[source, text, indent=0]
|
||||
[source, text]
|
||||
----
|
||||
┌---┬---┐
|
||||
| | |
|
||||
| | |
|
||||
├---┼---┤
|
||||
| | |
|
||||
| | |
|
||||
└---┴---┘
|
||||
┌───┬───┐
|
||||
│ │ │
|
||||
│ │ │
|
||||
├───┼───┤
|
||||
│ │ │
|
||||
│ │ │
|
||||
└───┴───┘
|
||||
----
|
||||
|
||||
== Default Bindings
|
||||
|
||||
@@ -28,42 +28,6 @@ Supports `NOCHECK``, `CHECK`` and `RADIO``
|
||||
include::{snippets}/ListViewSnippets.java[tag=snippet2]
|
||||
----
|
||||
|
||||
== Default Bindings
|
||||
|
||||
Default _view commands_ are:
|
||||
|
||||
[[tui-views-list-viewcommands]]
|
||||
.ViewCommands
|
||||
|===
|
||||
|Command |Description
|
||||
|
||||
|LINE_UP
|
||||
|Selection moves up. Bound to _CursorUp_ and _WheelUp_.
|
||||
|
||||
|LINE_DOWN
|
||||
|Selection moves down. Bound to _CursorDown_ and _WheelDown_.
|
||||
|
||||
|===
|
||||
|
||||
_Enter_ is choosing an active item. _Space_ is changing selection state.
|
||||
|
||||
== Events
|
||||
|
||||
Events are sent depending on a used list type.
|
||||
|
||||
[[tui-views-list-events]]
|
||||
.ListView Events
|
||||
|===
|
||||
|Event |Description
|
||||
|
||||
|ListViewOpenSelectedItemEvent
|
||||
|Active item is requested to get opened.
|
||||
|
||||
|ListViewSelectedItemChangedEvent
|
||||
|Active item is changed.
|
||||
|
||||
|===
|
||||
|
||||
== Customisation
|
||||
|
||||
How individual cells are shown depends on a _CellFactory_. Default implementation
|
||||
@@ -82,3 +46,73 @@ And set it as a factory:
|
||||
----
|
||||
include::{snippets}/ListViewSnippets.java[tag=uselistcell]
|
||||
----
|
||||
|
||||
== Default Bindings
|
||||
Default _view commands_ are:
|
||||
|
||||
[[tui-views-list-viewcommands]]
|
||||
.ViewCommands
|
||||
|===
|
||||
|Command |Description
|
||||
|
||||
|LINE_UP
|
||||
|Selection moves up.
|
||||
|
||||
|LINE_DOWN
|
||||
|Selection moves down.
|
||||
|
||||
|===
|
||||
|
||||
Default _key bindigs_ are:
|
||||
|
||||
.Key
|
||||
|===
|
||||
|Command |Description
|
||||
|
||||
|CursorUp
|
||||
|Bound ViewCommand LINE_UP
|
||||
|
||||
|CursorDown
|
||||
|Bound ViewCommand LINE_DOWN
|
||||
|
||||
|Enter
|
||||
|Choose active item.
|
||||
|
||||
|Space
|
||||
|Change active item selection state.
|
||||
|
||||
|===
|
||||
|
||||
Default _mouse bindigs_ are:
|
||||
|
||||
.Mouse
|
||||
|===
|
||||
|Command |Description
|
||||
|
||||
|Wheel \| WheelUp
|
||||
|Bound ViewCommand LINE_UP
|
||||
|
||||
|Wheel \| WheelDown
|
||||
|Bound ViewCommand LINE_DOWN
|
||||
|
||||
|Released \| Button1
|
||||
|Choose item
|
||||
|
||||
|===
|
||||
|
||||
== Events
|
||||
|
||||
Events are sent depending on a used list type.
|
||||
|
||||
[[tui-views-list-events]]
|
||||
.ListView Events
|
||||
|===
|
||||
|Event |Description
|
||||
|
||||
|ListViewOpenSelectedItemEvent
|
||||
|Active item is requested to get opened.
|
||||
|
||||
|ListViewSelectedItemChangedEvent
|
||||
|Active item is changed.
|
||||
|
||||
|===
|
||||
|
||||
@@ -6,3 +6,54 @@ ifndef::snippets[:snippets: ../../../../../src/test/java/org/springframework/she
|
||||
|
||||
_MenuView_ is a base implementation providing functionality to draw a menu.
|
||||
Inherits xref:tui/views/box.adoc[].
|
||||
|
||||
== Default Bindings
|
||||
Default _key bindigs_ are:
|
||||
|
||||
.Key
|
||||
|===
|
||||
|Command |Description
|
||||
|
||||
|CursorUp
|
||||
|Move selection up
|
||||
|
||||
|CursorDown
|
||||
|Move selection down
|
||||
|
||||
|Enter
|
||||
|Choose active item.
|
||||
|
||||
|===
|
||||
|
||||
Default _mouse bindigs_ are:
|
||||
|
||||
.Mouse
|
||||
|===
|
||||
|Command |Description
|
||||
|
||||
|Wheel \| WheelUp
|
||||
|Move selection up
|
||||
|
||||
|Wheel \| WheelDown
|
||||
|Move selection down
|
||||
|
||||
|Released \| Button1
|
||||
|Choose item
|
||||
|
||||
|===
|
||||
|
||||
== Events
|
||||
|
||||
Events are sent depending on a used list type.
|
||||
|
||||
.ListView Events
|
||||
|===
|
||||
|Event |Description
|
||||
|
||||
|MenuViewOpenSelectedItemEvent
|
||||
|Active item is requested to get opened.
|
||||
|
||||
|MenuViewSelectedItemChangedEvent
|
||||
|Active item is changed.
|
||||
|
||||
|===
|
||||
|
||||
@@ -6,3 +6,32 @@ ifndef::snippets[:snippets: ../../../../../src/test/java/org/springframework/she
|
||||
|
||||
_MenuBarView_ is a base implementation providing functionality to draw a menu bar.
|
||||
Inherits xref:tui/views/box.adoc[].
|
||||
|
||||
== Default Bindings
|
||||
Default _key bindigs_ are:
|
||||
|
||||
.Key
|
||||
|===
|
||||
|Command |Description
|
||||
|
||||
|CursorLeft
|
||||
|Move selection left
|
||||
|
||||
|CursorRight
|
||||
|Move selection right
|
||||
|
||||
|===
|
||||
|
||||
Default _mouse bindigs_ are:
|
||||
|
||||
.Mouse
|
||||
|===
|
||||
|Command |Description
|
||||
|
||||
|Released \| Button1
|
||||
|Choose item
|
||||
|
||||
|===
|
||||
|
||||
== Events
|
||||
Does not have any events.
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.shell.docs;
|
||||
|
||||
import org.springframework.shell.component.view.control.ButtonView;
|
||||
|
||||
class ButtonViewSnippets {
|
||||
|
||||
class Dump1 {
|
||||
|
||||
void dump1() {
|
||||
// tag::sample[]
|
||||
ButtonView view = new ButtonView();
|
||||
view.setText("text");
|
||||
view.setAction(() -> {
|
||||
// do something when selected
|
||||
});
|
||||
// end::sample[]
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user