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 theListSelectDialogclass, use this to create instances of that class and to customize them
-
-
Field Summary
Fields Modifier and Type Field Description private booleancanCancelprivate java.util.List<T>contentprivate TerminalSizelistBoxSize-
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 implementationTerminalSizegetListBoxSize()Size of the list box in the dialog ornullif 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 boxbooleanisCanCancel()Returnstrueif the dialog can be cancelled once it's openedprotected ListSelectDialogBuilder<T>self()Helper method for casting this totypeparameterBListSelectDialogBuilder<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:AbstractDialogBuilderHelper method for casting this totypeparameterB- Specified by:
selfin classAbstractDialogBuilder<ListSelectDialogBuilder<T>,ListSelectDialog<T>>- Returns:
thisasB
-
buildDialog
protected ListSelectDialog<T> buildDialog()
Description copied from class:AbstractDialogBuilderBuilds the dialog according to the builder implementation- Specified by:
buildDialogin 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 ornullif the dialog will ask for enough space to draw all items- Returns:
- Size of the list box in the dialog or
nullif 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, iffalsethere is no such button in the dialog- Returns:
- Itself
-
isCanCancel
public boolean isCanCancel()
Returnstrueif the dialog can be cancelled once it's opened- Returns:
trueif 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
-
-