Add multiinput scenario

- InputView using viewcommands and has event for text change.
- Experimental way to handle tab navigation in a layout views.
- New viewcommands for tab navigation and moving cursor.
- Mouse click takes focus in AbstractView if no view command
  binding.
- MultiInputViewScenario now shows tab navigation.
- Fixes #917
This commit is contained in:
Janne Valkealahti
2023-11-07 08:25:47 +00:00
parent 21d1ce8599
commit ccf6d771d9
13 changed files with 387 additions and 15 deletions

View File

@@ -61,6 +61,7 @@
*** xref:tui/views/button.adoc[]
*** xref:tui/views/dialog.adoc[]
*** xref:tui/views/grid.adoc[]
*** xref:tui/views/input.adoc[]
*** xref:tui/views/list.adoc[]
*** xref:tui/views/menu.adoc[]
*** xref:tui/views/menubar.adoc[]

View File

@@ -0,0 +1,66 @@
= InputView
:page-section-summary-toc: 1
ifndef::snippets[:snippets: ../../../../../src/test/java/org/springframework/shell/docs]
_InputView_ is a base implementation providing functionality to draw and modify
text in a bounded _Rectancle_.
[source, java, indent=0]
----
include::{snippets}/InputViewSnippets.java[tag=sample]
----
== Default Bindings
Default _view commands_ are:
.ViewCommands
|===
|Command |Description
|LEFT
|Cursor moves left
|RIGHT
|Cursor moves right
|DELETE_CHAR_LEFT
|Delete character left
|DELETE_CHAR_RIGHT
|Delete character right
|===
Default _key bindigs_ are:
.Key
|===
|Command |Description
|CursorLeft
|Bound ViewCommand LEFT
|CursorRight
|Bound ViewCommand RIGHT
|Backspace
|Bound ViewCommand DELETE_CHAR_LEFT
|Delete
|Bound ViewCommand DELETE_CHAR_RIGHT
|===
== Events
Events are sent depending on a used list type.
.InputView Events
|===
|Event |Description
|InputViewTextChangeEvent
|Input text has changed
|===

View File

@@ -0,0 +1,33 @@
/*
* 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.InputView;
class InputViewSnippets {
class Dump1 {
@SuppressWarnings("unused")
void dump1() {
// tag::sample[]
InputView input = new InputView();
String text = input.getInputText();
// end::sample[]
}
}
}