Module com.googlecode.lanterna
Class ListSelectDialogBuilder<T>
- java.lang.Object
-
- com.googlecode.lanterna.gui2.dialogs.AbstractDialogBuilder<ListSelectDialogBuilder<T>,ListSelectDialog<T>>
-
- com.googlecode.lanterna.gui2.dialogs.ListSelectDialogBuilder<T>
-
public class ListSelectDialogBuilder<T> extends AbstractDialogBuilder<ListSelectDialogBuilder<T>,ListSelectDialog<T>>
Dialog builder for theListSelectDialog
class, use this to create instances of that class and to customize them
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
canCancel
private java.util.List<T>
content
private TerminalSize
listBoxSize
-
Fields inherited from class com.googlecode.lanterna.gui2.dialogs.AbstractDialogBuilder
description, extraWindowHints, title
-
-
Constructor Summary
Constructors Constructor Description ListSelectDialogBuilder()
Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ListSelectDialogBuilder<T>
addListItem(T item)
Adds an item to the list box at the endListSelectDialogBuilder<T>
addListItems(T... items)
Adds a list of items to the list box at the end, in the order they are passed inprotected ListSelectDialog<T>
buildDialog()
Builds the dialog according to the builder implementationTerminalSize
getListBoxSize()
Size of the list box in the dialog ornull
if the dialog will ask for enough space to draw all itemsjava.util.List<T>
getListItems()
Returns a copy of the list of items in the list boxboolean
isCanCancel()
Returnstrue
if the dialog can be cancelled once it's openedprotected ListSelectDialogBuilder<T>
self()
Helper method for casting this totype
parameterB
ListSelectDialogBuilder<T>
setCanCancel(boolean canCancel)
Sets if the dialog can be cancelled or not (default:true
)ListSelectDialogBuilder<T>
setListBoxSize(TerminalSize listBoxSize)
Sets the size of the list box in the dialog, scrollbars will be used if there is not enough space to draw all items.-
Methods inherited from class com.googlecode.lanterna.gui2.dialogs.AbstractDialogBuilder
build, getDescription, getExtraWindowHints, getTitle, setDescription, setExtraWindowHints, setTitle
-
-
-
-
Field Detail
-
content
private final java.util.List<T> content
-
listBoxSize
private TerminalSize listBoxSize
-
canCancel
private boolean canCancel
-
-
Method Detail
-
self
protected ListSelectDialogBuilder<T> self()
Description copied from class:AbstractDialogBuilder
Helper method for casting this totype
parameterB
- Specified by:
self
in classAbstractDialogBuilder<ListSelectDialogBuilder<T>,ListSelectDialog<T>>
- Returns:
this
asB
-
buildDialog
protected ListSelectDialog<T> buildDialog()
Description copied from class:AbstractDialogBuilder
Builds the dialog according to the builder implementation- Specified by:
buildDialog
in classAbstractDialogBuilder<ListSelectDialogBuilder<T>,ListSelectDialog<T>>
- Returns:
- New dialog object
-
setListBoxSize
public ListSelectDialogBuilder<T> setListBoxSize(TerminalSize listBoxSize)
Sets the size of the list box in the dialog, scrollbars will be used if there is not enough space to draw all items. If set tonull
, the dialog will ask for enough space to be able to draw all items.- Parameters:
listBoxSize
- Size of the list box in the dialog- Returns:
- Itself
-
getListBoxSize
public TerminalSize getListBoxSize()
Size of the list box in the dialog ornull
if the dialog will ask for enough space to draw all items- Returns:
- Size of the list box in the dialog or
null
if the dialog will ask for enough space to draw all items
-
setCanCancel
public ListSelectDialogBuilder<T> setCanCancel(boolean canCancel)
Sets if the dialog can be cancelled or not (default:true
)- Parameters:
canCancel
- Iftrue
, the user has the option to cancel the dialog, iffalse
there is no such button in the dialog- Returns:
- Itself
-
isCanCancel
public boolean isCanCancel()
Returnstrue
if the dialog can be cancelled once it's opened- Returns:
true
if the dialog can be cancelled once it's opened
-
addListItem
public ListSelectDialogBuilder<T> addListItem(T item)
Adds an item to the list box at the end- Parameters:
item
- Item to add to the list box- Returns:
- Itself
-
addListItems
@SafeVarargs public final ListSelectDialogBuilder<T> addListItems(T... items)
Adds a list of items to the list box at the end, in the order they are passed in- Parameters:
items
- Items to add to the list box- Returns:
- Itself
-
getListItems
public java.util.List<T> getListItems()
Returns a copy of the list of items in the list box- Returns:
- Copy of the list of items in the list box
-
-