Skip to content

Commit f4eec7b

Browse files
committed
Update docs
1 parent b6d1958 commit f4eec7b

File tree

3 files changed

+72
-0
lines changed

3 files changed

+72
-0
lines changed

spring-shell-docs/modules/ROOT/nav.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
*** xref:tui/views/box.adoc[]
6060
*** xref:tui/views/button.adoc[]
6161
*** xref:tui/views/dialog.adoc[]
62+
*** xref:tui/views/grid.adoc[]
6263
*** xref:tui/views/list.adoc[]
6364
*** xref:tui/views/menu.adoc[]
6465
*** xref:tui/views/menubar.adoc[]
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
= GridView
2+
:page-section-summary-toc: 1
3+
4+
ifndef::snippets[:snippets: ../../../../../src/test/java/org/springframework/shell/docs]
5+
6+
_GridView_ is a special type of view and its purpose is to layout other views
7+
using a grid layout algorithms. Inherits xref:tui/views/box.adoc[].
8+
9+
[source, java, indent=0]
10+
----
11+
include::{snippets}/GridViewSnippets.java[tag=snippet1]
12+
----
13+
14+
Will result layout of:
15+
16+
[source, text, indent=0]
17+
----
18+
┌---┬---┐
19+
| | |
20+
| | |
21+
├---┼---┤
22+
| | |
23+
| | |
24+
└---┴---┘
25+
----
26+
27+
== Default Bindings
28+
Does not have any default bindings.
29+
30+
== Events
31+
Does not have any events.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright 2023 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.shell.docs;
17+
18+
import org.springframework.shell.component.view.control.BoxView;
19+
import org.springframework.shell.component.view.control.GridView;
20+
21+
class GridViewSnippets {
22+
23+
class Dump1 {
24+
25+
void dump1() {
26+
// tag::snippet1[]
27+
GridView grid = new GridView();
28+
grid.setShowBorders(true);
29+
grid.setRowSize(0, 0);
30+
grid.setColumnSize(0, 0);
31+
32+
grid.addItem(new BoxView(), 0, 0, 1, 1, 0, 0);
33+
grid.addItem(new BoxView(), 0, 1, 1, 1, 0, 0);
34+
grid.addItem(new BoxView(), 1, 0, 1, 1, 0, 0);
35+
grid.addItem(new BoxView(), 1, 1, 1, 1, 0, 0);
36+
// end::snippet1[]
37+
}
38+
}
39+
40+
}

0 commit comments

Comments
 (0)