1 package com
.googlecode
.lanterna
.gui2
.dialogs
;
3 import com
.googlecode
.lanterna
.gui2
.*;
5 import java
.util
.Collections
;
6 import java
.util
.HashSet
;
10 * Thin layer on top of the {@code AbstractWindow} class that automatically sets properties and hints to the window to
11 * make it act more like a modal dialog window
13 public abstract class DialogWindow
extends AbstractWindow
{
15 private static final Set
<Hint
> GLOBAL_DIALOG_HINTS
=
16 Collections
.unmodifiableSet(new HashSet
<Hint
>(Collections
.singletonList(Hint
.MODAL
)));
19 * Default constructor, takes a title for the dialog and runs code shared for dialogs
22 protected DialogWindow(String title
) {
24 setHints(GLOBAL_DIALOG_HINTS
);
28 * Opens the dialog by showing it on the GUI and doesn't return until the dialog has been closed
29 * @param textGUI Text GUI to add the dialog to
30 * @return Depending on the {@code DialogWindow} implementation, by default {@code null}
32 public Object
showDialog(WindowBasedTextGUI textGUI
) {
33 textGUI
.addWindow(this);
35 //Wait for the window to close, in case the window manager doesn't honor the MODAL hint