Module com.googlecode.lanterna
Class TextInputDialogBuilder
- java.lang.Object
-
- com.googlecode.lanterna.gui2.dialogs.AbstractDialogBuilder<TextInputDialogBuilder,TextInputDialog>
-
- com.googlecode.lanterna.gui2.dialogs.TextInputDialogBuilder
-
public class TextInputDialogBuilder extends AbstractDialogBuilder<TextInputDialogBuilder,TextInputDialog>
Dialog builder for theTextInputDialogclass, use this to create instances of that class and to customize them
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringinitialContentprivate booleanpasswordInputprivate TerminalSizetextBoxSizeprivate TextInputDialogResultValidatorvalidator-
Fields inherited from class com.googlecode.lanterna.gui2.dialogs.AbstractDialogBuilder
description, extraWindowHints, title
-
-
Constructor Summary
Constructors Constructor Description TextInputDialogBuilder()Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected TextInputDialogbuildDialog()Builds the dialog according to the builder implementationjava.lang.StringgetInitialContent()Returns the initial content the dialog will haveTerminalSizegetTextBoxSize()Returns the size of the text box the dialog will haveTextInputDialogResultValidatorgetValidator()Returns the validator that will be attached to the text box in the dialogbooleanisPasswordInput()Returnstrueif the text box the dialog will have contains a password and should be maskedprotected TextInputDialogBuilderself()Helper method for casting this totypeparameterBTextInputDialogBuildersetInitialContent(java.lang.String initialContent)Sets the initial content the dialog will haveTextInputDialogBuildersetPasswordInput(boolean passwordInput)Sets if the text box the dialog will have contains a password and should be masked (default:false)TextInputDialogBuildersetTextBoxSize(TerminalSize textBoxSize)Sets the size of the text box the dialog will haveTextInputDialogBuildersetValidationPattern(java.util.regex.Pattern pattern, java.lang.String errorMessage)Helper method that assigned a validator to the text box the dialog will have which matches the pattern suppliedTextInputDialogBuildersetValidator(TextInputDialogResultValidator validator)Sets the validator that will be attached to the text box in the dialog-
Methods inherited from class com.googlecode.lanterna.gui2.dialogs.AbstractDialogBuilder
build, getDescription, getExtraWindowHints, getTitle, setDescription, setExtraWindowHints, setTitle
-
-
-
-
Field Detail
-
initialContent
private java.lang.String initialContent
-
textBoxSize
private TerminalSize textBoxSize
-
validator
private TextInputDialogResultValidator validator
-
passwordInput
private boolean passwordInput
-
-
Method Detail
-
self
protected TextInputDialogBuilder self()
Description copied from class:AbstractDialogBuilderHelper method for casting this totypeparameterB- Specified by:
selfin classAbstractDialogBuilder<TextInputDialogBuilder,TextInputDialog>- Returns:
thisasB
-
buildDialog
protected TextInputDialog buildDialog()
Description copied from class:AbstractDialogBuilderBuilds the dialog according to the builder implementation- Specified by:
buildDialogin classAbstractDialogBuilder<TextInputDialogBuilder,TextInputDialog>- Returns:
- New dialog object
-
setInitialContent
public TextInputDialogBuilder setInitialContent(java.lang.String initialContent)
Sets the initial content the dialog will have- Parameters:
initialContent- Initial content the dialog will have- Returns:
- Itself
-
getInitialContent
public java.lang.String getInitialContent()
Returns the initial content the dialog will have- Returns:
- Initial content the dialog will have
-
setTextBoxSize
public TextInputDialogBuilder setTextBoxSize(TerminalSize textBoxSize)
Sets the size of the text box the dialog will have- Parameters:
textBoxSize- Size of the text box the dialog will have- Returns:
- Itself
-
getTextBoxSize
public TerminalSize getTextBoxSize()
Returns the size of the text box the dialog will have- Returns:
- Size of the text box the dialog will have
-
setValidator
public TextInputDialogBuilder setValidator(TextInputDialogResultValidator validator)
Sets the validator that will be attached to the text box in the dialog- Parameters:
validator- Validator that will be attached to the text box in the dialog- Returns:
- Itself
-
getValidator
public TextInputDialogResultValidator getValidator()
Returns the validator that will be attached to the text box in the dialog- Returns:
- validator that will be attached to the text box in the dialog
-
setValidationPattern
public TextInputDialogBuilder setValidationPattern(java.util.regex.Pattern pattern, java.lang.String errorMessage)
Helper method that assigned a validator to the text box the dialog will have which matches the pattern supplied- Parameters:
pattern- Pattern to validate the text boxerrorMessage- Error message to show when the pattern doesn't match- Returns:
- Itself
-
setPasswordInput
public TextInputDialogBuilder setPasswordInput(boolean passwordInput)
Sets if the text box the dialog will have contains a password and should be masked (default:false)- Parameters:
passwordInput-trueif the text box should be password masked,falseotherwise- Returns:
- Itself
-
isPasswordInput
public boolean isPasswordInput()
Returnstrueif the text box the dialog will have contains a password and should be masked- Returns:
trueif the text box the dialog will have contains a password and should be masked
-
-