public class ActionListDialogBuilder extends AbstractDialogBuilder<ActionListDialogBuilder,ActionListDialog>
ActionListDialog
class, use this to create instances of that class and to customize
themdescription, extraWindowHints, title
Constructor | Description |
---|---|
ActionListDialogBuilder() |
Default constructor
|
Modifier and Type | Method | Description |
---|---|---|
ActionListDialogBuilder |
addAction(Runnable action) |
Adds an additional action to the
ActionListBox that is to be displayed when the dialog is opened. |
ActionListDialogBuilder |
addAction(String label,
Runnable action) |
Adds an additional action to the
ActionListBox that is to be displayed when the dialog is opened |
ActionListDialogBuilder |
addActions(Runnable... actions) |
Adds additional actions to the
ActionListBox that is to be displayed when the dialog is opened. |
protected ActionListDialog |
buildDialog() |
Builds the dialog according to the builder implementation
|
List<Runnable> |
getActions() |
Returns a copy of the internal list of actions currently inside this builder that will be assigned to the
ActionListBox in the dialog when built |
TerminalSize |
getListBoxSize() |
Returns the specified size of the internal
ActionListBox or null if there is no size and the list
box will attempt to take up enough size to draw all items |
boolean |
isCanCancel() |
Returns
true if the dialog can be cancelled once it's opened |
protected ActionListDialogBuilder |
self() |
Helper method for casting this to
type parameter B |
ActionListDialogBuilder |
setCanCancel(boolean canCancel) |
Sets if the dialog can be cancelled or not (default:
true ) |
ActionListDialogBuilder |
setCloseAutomaticallyOnAction(boolean closeAutomatically) |
Sets if clicking on an action automatically closes the dialog after the action is finished (default:
true ) |
ActionListDialogBuilder |
setListBoxSize(TerminalSize listBoxSize) |
Sets the size of the internal
ActionListBox in columns and rows, forcing scrollbars to appear if the
space isn't big enough to contain all the items |
build, getDescription, getExtraWindowHints, getTitle, setDescription, setExtraWindowHints, setTitle
protected ActionListDialogBuilder self()
AbstractDialogBuilder
type
parameter B
self
in class AbstractDialogBuilder<ActionListDialogBuilder,ActionListDialog>
this
as B
protected ActionListDialog buildDialog()
AbstractDialogBuilder
buildDialog
in class AbstractDialogBuilder<ActionListDialogBuilder,ActionListDialog>
public ActionListDialogBuilder setListBoxSize(TerminalSize listBoxSize)
ActionListBox
in columns and rows, forcing scrollbars to appear if the
space isn't big enough to contain all the itemslistBoxSize
- Size of the ActionListBox
public TerminalSize getListBoxSize()
ActionListBox
or null
if there is no size and the list
box will attempt to take up enough size to draw all itemsActionListBox
or null
if there is no sizepublic ActionListDialogBuilder setCanCancel(boolean canCancel)
true
)canCancel
- If true
, the user has the option to cancel the dialog, if false
there is no such
button in the dialogpublic boolean isCanCancel()
true
if the dialog can be cancelled once it's openedtrue
if the dialog can be cancelled once it's openedpublic ActionListDialogBuilder addAction(String label, Runnable action)
ActionListBox
that is to be displayed when the dialog is openedlabel
- Label of the new actionaction
- Action to perform if the user selects this itempublic ActionListDialogBuilder addAction(Runnable action)
ActionListBox
that is to be displayed when the dialog is opened. The
label of this item will be derived by calling toString()
on the runnableaction
- Action to perform if the user selects this itempublic ActionListDialogBuilder addActions(Runnable... actions)
ActionListBox
that is to be displayed when the dialog is opened. The
label of the items will be derived by calling toString()
on each runnableactions
- Items to add to the ActionListBox
public List<Runnable> getActions()
ActionListBox
in the dialog when builtpublic ActionListDialogBuilder setCloseAutomaticallyOnAction(boolean closeAutomatically)
true
)closeAutomatically
- if true
dialog will be automatically closed after choosing and finish any of the actionCopyright © 2020. All rights reserved.