org.gudy.azureus2.pluginsimpl.local.ui
Class AbstractUIInputReceiver

java.lang.Object
  extended by org.gudy.azureus2.pluginsimpl.local.ui.AbstractUIInputReceiver
All Implemented Interfaces:
UIInputReceiver
Direct Known Subclasses:
AbstractUISWTInputReceiver

public abstract class AbstractUIInputReceiver
extends java.lang.Object
implements UIInputReceiver

Abstract class to make it easy for class to implement UIInputReceiver classes. The common convention is that it has all the necessary set methods needed, and all settings passed are accessible through protected attributes. Checks are made to ensure only certain methods are called at the right time.


Field Summary
protected  boolean allow_empty_input
           
protected  boolean maintain_whitespace
           
protected  java.lang.String[] messages
           
protected  boolean multiline_mode
           
protected  java.lang.String preentered_text
           
protected  UIInputReceiverListener receiver_listener
           
protected  java.lang.String title
           
protected  UIInputValidator validator
           
 
Constructor Summary
AbstractUIInputReceiver()
           
 
Method Summary
 void allowEmptyInput(boolean empty_input)
          Indicates whether blank input can be entered.
protected  void assertPostPrompt()
           
protected  void assertPrePrompt()
           
 java.lang.String getSubmittedInput()
          Returns the string if the user submitted any data - you should check for this by calling UIInputReceiver.hasSubmittedInput() first.
 boolean hasSubmittedInput()
          Returns true if the user submitted any data.
protected  boolean isResultRecorded()
           
protected  java.lang.String localise(java.lang.String key)
           
 void maintainWhitespace(boolean keep_whitespace)
          Indicates whether to keep whitespace are kept when input is entered, or whether to strip it out.
 void prompt()
          This prompts the user for input.
 void prompt(UIInputReceiverListener receiver_listener)
          This prompts the user for input and returns immediately.
protected abstract  void promptForInput()
          Subclasses must override this method to receive input from the user.
protected  void recordUserAbort()
           
protected  void recordUserInput(java.lang.String input)
           
 void setInputValidator(UIInputValidator validator)
          Sets the UIInputValidator for this object.
 void setLocalisedMessage(java.lang.String message)
          Sets the message to display for the text entry input.
 void setLocalisedMessages(java.lang.String[] messages)
          Sets the message to display for the text entry input.
 void setLocalisedTitle(java.lang.String title)
          Sets the title for the text entry input.
 void setMessage(java.lang.String message)
          Sets the message to display for the text entry input.
 void setMessages(java.lang.String[] messages)
          Sets the message to display for the text entry input.
 void setMultiLine(boolean multiline)
          Indicates whether to allow multi-line input.
 void setPreenteredText(java.lang.String text, boolean as_suggested)
          This sets a value to be displayed as pre-entered text for the input.
 void setTitle(java.lang.String title)
          Sets the title for the text entry input.
 void triggerReceiverListener()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.gudy.azureus2.plugins.ui.UIInputReceiver
setTextLimit
 

Field Detail

messages

protected java.lang.String[] messages

title

protected java.lang.String title

multiline_mode

protected boolean multiline_mode

preentered_text

protected java.lang.String preentered_text

validator

protected UIInputValidator validator

receiver_listener

protected UIInputReceiverListener receiver_listener

maintain_whitespace

protected boolean maintain_whitespace

allow_empty_input

protected boolean allow_empty_input
Constructor Detail

AbstractUIInputReceiver

public AbstractUIInputReceiver()
Method Detail

assertPrePrompt

protected final void assertPrePrompt()

assertPostPrompt

protected final void assertPostPrompt()

setLocalisedMessage

public void setLocalisedMessage(java.lang.String message)
Description copied from interface: UIInputReceiver
Sets 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(java.lang.String[]).

Specified by:
setLocalisedMessage in interface UIInputReceiver

setLocalisedMessages

public void setLocalisedMessages(java.lang.String[] messages)
Description copied from interface: UIInputReceiver
Sets 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:
setLocalisedMessages in interface UIInputReceiver

setLocalisedTitle

public void setLocalisedTitle(java.lang.String title)
Description copied from interface: UIInputReceiver
Sets 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:
setLocalisedTitle in interface UIInputReceiver

setMessage

public void setMessage(java.lang.String message)
Description copied from interface: UIInputReceiver
Sets 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(java.lang.String[]).

Specified by:
setMessage in interface UIInputReceiver

setMessages

public void setMessages(java.lang.String[] messages)
Description copied from interface: UIInputReceiver
Sets 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:
setMessages in interface UIInputReceiver

setMultiLine

public void setMultiLine(boolean multiline)
Description copied from interface: UIInputReceiver
Indicates whether to allow multi-line input. Default behaviour is to not allow multiple lines.

Specified by:
setMultiLine in interface UIInputReceiver

setPreenteredText

public void setPreenteredText(java.lang.String text,
                              boolean as_suggested)
Description copied from interface: UIInputReceiver
This 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:
setPreenteredText in interface UIInputReceiver
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

public void setTitle(java.lang.String title)
Description copied from interface: UIInputReceiver
Sets 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:
setTitle in interface UIInputReceiver

setInputValidator

public void setInputValidator(UIInputValidator validator)
Description copied from interface: UIInputReceiver
Sets 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:
setInputValidator in interface UIInputReceiver
See Also:
UIInputValidator

prompt

public final void prompt()
Description copied from interface: UIInputReceiver
This prompts the user for input. This method will not return until the user has either entered valid input, or signalled they want to cancel entering any data.

Specified by:
prompt in interface UIInputReceiver

isResultRecorded

protected boolean isResultRecorded()

prompt

public final void prompt(UIInputReceiverListener receiver_listener)
Description copied from interface: UIInputReceiver
This prompts the user for input and returns immediately. When the user has closed the input ui, the UIInputReceiverListener will be triggered

Specified by:
prompt in interface UIInputReceiver

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

protected final void recordUserInput(java.lang.String input)

recordUserAbort

protected final void recordUserAbort()

hasSubmittedInput

public boolean hasSubmittedInput()
Description copied from interface: UIInputReceiver
Returns true if the user submitted any data.

Specified by:
hasSubmittedInput in interface UIInputReceiver

getSubmittedInput

public java.lang.String getSubmittedInput()
Description copied from interface: UIInputReceiver
Returns the string if the user submitted any data - you should check for this by calling UIInputReceiver.hasSubmittedInput() first.

Specified by:
getSubmittedInput in interface UIInputReceiver

maintainWhitespace

public void maintainWhitespace(boolean keep_whitespace)
Description copied from interface: UIInputReceiver
Indicates whether to keep whitespace are kept when input is entered, or whether to strip it out. Default behaviour is to strip whitespace.

Specified by:
maintainWhitespace in interface UIInputReceiver

allowEmptyInput

public void allowEmptyInput(boolean empty_input)
Description copied from interface: UIInputReceiver
Indicates whether blank input can be entered.

Specified by:
allowEmptyInput in interface UIInputReceiver

localise

protected final java.lang.String localise(java.lang.String key)