|
31 | 31 | import org.springframework.shell.component.view.TerminalUI;
|
32 | 32 | import org.springframework.shell.component.view.control.AppView;
|
33 | 33 | import org.springframework.shell.component.view.control.AppView.AppViewEvent;
|
| 34 | +import org.springframework.shell.component.view.control.BoxView; |
| 35 | +import org.springframework.shell.component.view.control.ButtonView; |
| 36 | +import org.springframework.shell.component.view.control.DialogView; |
34 | 37 | import org.springframework.shell.component.view.control.GridView;
|
35 | 38 | import org.springframework.shell.component.view.control.ListView;
|
36 | 39 | import org.springframework.shell.component.view.control.ListView.ListViewOpenSelectedItemEvent;
|
|
47 | 50 | import org.springframework.shell.component.view.event.KeyEvent;
|
48 | 51 | import org.springframework.shell.component.view.event.KeyEvent.Key;
|
49 | 52 | import org.springframework.shell.component.view.event.KeyEvent.KeyMask;
|
| 53 | +import org.springframework.shell.component.view.geom.HorizontalAlign; |
50 | 54 | import org.springframework.shell.component.view.geom.Rectangle;
|
| 55 | +import org.springframework.shell.component.view.geom.VerticalAlign; |
51 | 56 | import org.springframework.shell.component.view.message.ShellMessageBuilder;
|
52 | 57 | import org.springframework.shell.component.view.screen.Screen;
|
53 | 58 | import org.springframework.shell.component.view.screen.Screen.Writer;
|
@@ -273,7 +278,30 @@ private Runnable styleAction(String style) {
|
273 | 278 | return () -> setStyle(style);
|
274 | 279 | }
|
275 | 280 |
|
| 281 | + private DialogView buildAboutDialog() { |
| 282 | + ButtonView button = new ButtonView("OK"); |
| 283 | + button.setThemeResolver(themeResolver); |
| 284 | + button.setThemeName(activeThemeName); |
| 285 | + button.setEventLoop(eventLoop); |
| 286 | + |
| 287 | + BoxView content = new BoxView(); |
| 288 | + content.setDrawFunction((screen, rect) -> { |
| 289 | + screen.writerBuilder().layer(1).build().text("Catalog Sample App", rect, HorizontalAlign.CENTER, VerticalAlign.CENTER); |
| 290 | + return rect; |
| 291 | + }); |
| 292 | + DialogView dialog = new DialogView(content, button); |
| 293 | + dialog.setThemeResolver(themeResolver); |
| 294 | + dialog.setThemeName(activeThemeName); |
| 295 | + dialog.setEventLoop(eventLoop); |
| 296 | + dialog.setViewService(ui); |
| 297 | + |
| 298 | + dialog.setTransparent(false); |
| 299 | + return dialog; |
| 300 | + } |
| 301 | + |
276 | 302 | private void about() {
|
| 303 | + DialogView dialog = buildAboutDialog(); |
| 304 | + ui.setModal(dialog); |
277 | 305 | }
|
278 | 306 |
|
279 | 307 | private MenuBarView buildMenuBar(EventLoop eventLoop) {
|
|
0 commit comments