Class ActionListDialogBuilder
java.lang.Object
com.googlecode.lanterna.gui2.dialogs.AbstractDialogBuilder<ActionListDialogBuilder, ActionListDialog>
com.googlecode.lanterna.gui2.dialogs.ActionListDialogBuilder
public class ActionListDialogBuilder
extends AbstractDialogBuilder<ActionListDialogBuilder, ActionListDialog>
Dialog builder for the
ActionListDialog class, use this to create instances of that class and to customize
them-
Field Summary
FieldsFields inherited from class AbstractDialogBuilder
description, extraWindowHints, title -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds an additional action to theActionListBoxthat is to be displayed when the dialog is opened.Adds an additional action to theActionListBoxthat is to be displayed when the dialog is openedaddActions(Runnable... actions) Adds additional actions to theActionListBoxthat is to be displayed when the dialog is opened.protected ActionListDialogBuilds the dialog according to the builder implementationReturns a copy of the internal list of actions currently inside this builder that will be assigned to theActionListBoxin the dialog when builtReturns the specified size of the internalActionListBoxornullif there is no size and the list box will attempt to take up enough size to draw all itemsbooleanReturnstrueif the dialog can be cancelled once it's openedprotected ActionListDialogBuilderself()Helper method for casting this totypeparameterBsetCanCancel(boolean canCancel) Sets if the dialog can be cancelled or not (default:true)setCloseAutomaticallyOnAction(boolean closeAutomatically) Sets if clicking on an action automatically closes the dialog after the action is finished (default:true)setListBoxSize(TerminalSize listBoxSize) Sets the size of the internalActionListBoxin columns and rows, forcing scrollbars to appear if the space isn't big enough to contain all the itemsMethods inherited from class AbstractDialogBuilder
build, getDescription, getExtraWindowHints, getTitle, setDescription, setExtraWindowHints, setTitle
-
Field Details
-
actions
-
listBoxSize
-
canCancel
private boolean canCancel -
closeAutomatically
private boolean closeAutomatically
-
-
Constructor Details
-
ActionListDialogBuilder
public ActionListDialogBuilder()Default constructor
-
-
Method Details
-
self
Description copied from class:AbstractDialogBuilderHelper method for casting this totypeparameterB- Specified by:
selfin classAbstractDialogBuilder<ActionListDialogBuilder, ActionListDialog>- Returns:
thisasB
-
buildDialog
Description copied from class:AbstractDialogBuilderBuilds the dialog according to the builder implementation- Specified by:
buildDialogin classAbstractDialogBuilder<ActionListDialogBuilder, ActionListDialog>- Returns:
- New dialog object
-
setListBoxSize
Sets the size of the internalActionListBoxin columns and rows, forcing scrollbars to appear if the space isn't big enough to contain all the items- Parameters:
listBoxSize- Size of theActionListBox- Returns:
- Itself
-
getListBoxSize
Returns the specified size of the internalActionListBoxornullif 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
ActionListBoxornullif there is no size
-
setCanCancel
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
-
addAction
Adds an additional action to theActionListBoxthat 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
Adds an additional action to theActionListBoxthat 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
Adds additional actions to theActionListBoxthat 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 theActionListBox- Returns:
- Itself
-
getActions
-
setCloseAutomaticallyOnAction
Sets if clicking on an action automatically closes the dialog after the action is finished (default:true)- Parameters:
closeAutomatically- iftruedialog will be automatically closed after choosing and finish any of the action- Returns:
- Itself
-