Class AbstractUIInputReceiver
- All Implemented Interfaces:
UIInputReceiver
- Direct Known Subclasses:
AbstractUISWTInputReceiver
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected booleanprotected String[]protected booleanprotected Stringprivate booleanprotected UIInputReceiverListenerprivate Stringprivate booleanprivate booleanprotected Stringprotected UIInputValidator -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidallowEmptyInput(boolean empty_input) Indicates whether blank input can be entered.protected final voidprotected final voidReturns the string if the user submitted any data - you should check for this by callingUIInputReceiver.hasSubmittedInput()first.booleanReturns true if the user submitted any data.protected booleanprotected final StringvoidmaintainWhitespace(boolean keep_whitespace) Indicates whether to keep whitespace are kept when input is entered, or whether to strip it out.final voidprompt(UIInputReceiverListener receiver_listener) This prompts the user for input and returns immediately.protected abstract voidSubclasses must override this method to receive input from the user.protected final voidprotected final voidrecordUserInput(String input) voidsetInputValidator(UIInputValidator validator) Sets the UIInputValidator for this object.voidsetLocalisedMessage(String message) Sets the message to display for the text entry input.voidsetLocalisedMessages(String[] messages) Sets the message to display for the text entry input.voidsetLocalisedTitle(String title) Sets the title for the text entry input.voidsetMessage(String message) Sets the message to display for the text entry input.voidsetMessages(String[] messages) Sets the message to display for the text entry input.voidsetMultiLine(boolean multiline) Indicates whether to allow multi-line input.voidsetPreenteredText(String text, boolean as_suggested) This sets a value to be displayed as pre-entered text for the input.voidSets the title for the text entry input.final voidMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface UIInputReceiver
setEnableSpecialEscapeHandling, setTextLimit, userHitEscape
-
Field Details
-
prompted
private boolean prompted -
messages
-
title
-
multiline_mode
protected boolean multiline_mode -
preentered_text
-
validator
-
result_recorded
private boolean result_recorded -
receiver_listener
-
result_input_submitted
private boolean result_input_submitted -
result_input
-
maintain_whitespace
protected boolean maintain_whitespace -
allow_empty_input
protected boolean allow_empty_input
-
-
Constructor Details
-
AbstractUIInputReceiver
public AbstractUIInputReceiver()
-
-
Method Details
-
assertPrePrompt
protected final void assertPrePrompt() -
assertPostPrompt
protected final void assertPostPrompt() -
setLocalisedMessage
Description copied from interface:UIInputReceiverSets the message to display for the text entry input. This will normally be displayed near the position where the text will be entered - this method is usually used to present the user with an indication of what to enter.For multiple lines, see
UIInputReceiver.setLocalisedMessages(String[]).- Specified by:
setLocalisedMessagein interfaceUIInputReceiver
-
setLocalisedMessages
Description copied from interface:UIInputReceiverSets the message to display for the text entry input. This will normally be displayed near the position where the text will be entered - this method is usually used to present the user with an indication of what to enter.The value passed here will be an array of strings - each string will be usually outputted on its own line. The last value in the array will usually be the message displayed closest to the users prompt.
- Specified by:
setLocalisedMessagesin interfaceUIInputReceiver
-
setLocalisedTitle
Description copied from interface:UIInputReceiverSets the title for the text entry input. For some interfaces, this means that a window will be presented, and the title of the window will be the value passed here.- Specified by:
setLocalisedTitlein interfaceUIInputReceiver
-
setMessage
Description copied from interface:UIInputReceiverSets the message to display for the text entry input. This will normally be displayed near the position where the text will be entered - this method is usually used to present the user with an indication of what to enter.For multiple lines, see
UIInputReceiver.setMessages(String[]).- Specified by:
setMessagein interfaceUIInputReceiver
-
setMessages
Description copied from interface:UIInputReceiverSets the message to display for the text entry input. This will normally be displayed near the position where the text will be entered - this method is usually used to present the user with an indication of what to enter.The value passed here will be an array of strings - each string will be usually outputted on its own line. The last value in the array will usually be the message displayed closest to the users prompt.
- Specified by:
setMessagesin interfaceUIInputReceiver
-
setMultiLine
public void setMultiLine(boolean multiline) Description copied from interface:UIInputReceiverIndicates whether to allow multi-line input. Default behaviour is to not allow multiple lines.- Specified by:
setMultiLinein interfaceUIInputReceiver
-
setPreenteredText
Description copied from interface:UIInputReceiverThis sets a value to be displayed as pre-entered text for the input. This may be called if the caller wants to suggest a value for the user to use, or if the caller wants to provide a previous value (for example).The text may appear in the same location as the text should be entered (allowing it to be directly overwritten or submitted immediately) - but some interfaces may not support this.
A flag should be passed indicating whether the pre-entered text is being entered as a suggestion for a value, or whether it is an old value being currently stored. Some interfaces may choose to differentiate between the two.
- Specified by:
setPreenteredTextin interfaceUIInputReceiver- Parameters:
text- The text to pre-enter.as_suggested- true if the value is a suggested input value, false if it is an old value.
-
setTitle
Description copied from interface:UIInputReceiverSets the title for the text entry input. For some interfaces, this means that a window will be presented, and the title of the window will be the value passed here.- Specified by:
setTitlein interfaceUIInputReceiver
-
setInputValidator
Description copied from interface:UIInputReceiverSets the UIInputValidator for this object. This allows an external object to validate or reject input submitted by the user.By default, there is no input validator associated with a UIInputReceiver, meaning all input is allowed.
- Specified by:
setInputValidatorin interfaceUIInputReceiver- See Also:
-
isResultRecorded
protected boolean isResultRecorded() -
prompt
Description copied from interface:UIInputReceiverThis prompts the user for input and returns immediately. When the user has closed the input ui, theUIInputReceiverListenerwill be triggered- Specified by:
promptin interfaceUIInputReceiver- Parameters:
receiver_listener-
-
triggerReceiverListener
public final void triggerReceiverListener() -
promptForInput
protected abstract void promptForInput()Subclasses must override this method to receive input from the user. This method must call either recordUserInput or recordUserAbort before returning. -
recordUserInput
-
recordUserAbort
protected final void recordUserAbort() -
hasSubmittedInput
public boolean hasSubmittedInput()Description copied from interface:UIInputReceiverReturns true if the user submitted any data.- Specified by:
hasSubmittedInputin interfaceUIInputReceiver
-
getSubmittedInput
Description copied from interface:UIInputReceiverReturns the string if the user submitted any data - you should check for this by callingUIInputReceiver.hasSubmittedInput()first.- Specified by:
getSubmittedInputin interfaceUIInputReceiver
-
maintainWhitespace
public void maintainWhitespace(boolean keep_whitespace) Description copied from interface:UIInputReceiverIndicates whether to keep whitespace are kept when input is entered, or whether to strip it out. Default behaviour is to strip whitespace.- Specified by:
maintainWhitespacein interfaceUIInputReceiver
-
allowEmptyInput
public void allowEmptyInput(boolean empty_input) Description copied from interface:UIInputReceiverIndicates whether blank input can be entered.- Specified by:
allowEmptyInputin interfaceUIInputReceiver
-
localise
-