Package adams.terminal.core
Class MenuListDialogBuilder
- java.lang.Object
-
- com.googlecode.lanterna.gui2.dialogs.AbstractDialogBuilder<MenuListDialogBuilder,MenuListDialog>
-
- adams.terminal.core.MenuListDialogBuilder
-
public class MenuListDialogBuilder extends com.googlecode.lanterna.gui2.dialogs.AbstractDialogBuilder<MenuListDialogBuilder,MenuListDialog>
Dialog builder for theMenuListDialog
class, use this to create instances of that class and to customize them- Author:
- Martin
-
-
Constructor Summary
Constructors Constructor Description MenuListDialogBuilder()
Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MenuListDialogBuilder
addAction(Runnable action)
Adds an additional action to theMenuListBox
that is to be displayed when the dialog is opened.MenuListDialogBuilder
addAction(String label, Runnable action)
Adds an additional action to theMenuListBox
that is to be displayed when the dialog is openedMenuListDialogBuilder
addActions(Runnable... actions)
Adds additional actions to theMenuListBox
that is to be displayed when the dialog is opened.protected MenuListDialog
buildDialog()
List<Runnable>
getActions()
Returns a copy of the internal list of actions currently inside this builder that will be assigned to theMenuListBox
in the dialog when builtcom.googlecode.lanterna.TerminalSize
getListBoxSize()
Returns the specified size of the internalMenuListBox
ornull
if there is no size and the list box will attempt to take up enough size to draw all itemsprotected MenuListDialogBuilder
self()
MenuListDialogBuilder
setListBoxSize(com.googlecode.lanterna.TerminalSize listBoxSize)
Sets the size of the internalMenuListBox
in columns and rows, forcing scrollbars to appear if the space isn't big enough to contain all the items
-
-
-
Method Detail
-
self
protected MenuListDialogBuilder self()
- Specified by:
self
in classcom.googlecode.lanterna.gui2.dialogs.AbstractDialogBuilder<MenuListDialogBuilder,MenuListDialog>
-
buildDialog
protected MenuListDialog buildDialog()
- Specified by:
buildDialog
in classcom.googlecode.lanterna.gui2.dialogs.AbstractDialogBuilder<MenuListDialogBuilder,MenuListDialog>
-
setListBoxSize
public MenuListDialogBuilder setListBoxSize(com.googlecode.lanterna.TerminalSize listBoxSize)
Sets the size of the internalMenuListBox
in columns and rows, forcing scrollbars to appear if the space isn't big enough to contain all the items- Parameters:
listBoxSize
- Size of theMenuListBox
- Returns:
- Itself
-
getListBoxSize
public com.googlecode.lanterna.TerminalSize getListBoxSize()
Returns the specified size of the internalMenuListBox
ornull
if there is no size and the list box will attempt to take up enough size to draw all items- Returns:
- Specified size of the internal
MenuListBox
ornull
if there is no size
-
addAction
public MenuListDialogBuilder addAction(String label, Runnable action)
Adds an additional action to theMenuListBox
that is to be displayed when the dialog is opened- Parameters:
label
- Label of the new actionaction
- Action to perform if the user selects this item- Returns:
- Itself
-
addAction
public MenuListDialogBuilder addAction(Runnable action)
Adds an additional action to theMenuListBox
that is to be displayed when the dialog is opened. The label of this item will be derived by callingtoString()
on the runnable- Parameters:
action
- Action to perform if the user selects this item- Returns:
- Itself
-
addActions
public MenuListDialogBuilder addActions(Runnable... actions)
Adds additional actions to theMenuListBox
that is to be displayed when the dialog is opened. The label of the items will be derived by callingtoString()
on each runnable- Parameters:
actions
- Items to add to theMenuListBox
- Returns:
- Itself
-
-