|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.planet_ink.coffee_mud.Common.interfaces.Session.InputCallback
public abstract static class Session.InputCallback
The internal class to managing asynchronous user input. This class supports three types of input: open text (PROMPT), one-letter options (CHOOSE), and Y/N (CONFIRM).
Nested Class Summary | |
---|---|
static class |
Session.InputCallback.Type
The threa different types of user input processing supported by the abstract InputCallback class |
Field Summary | |
---|---|
protected boolean |
confirmed
|
protected java.lang.String |
input
|
protected boolean |
noTrim
|
protected long |
timeout
|
protected long |
timeoutMs
|
protected boolean |
waiting
|
Constructor Summary | |
---|---|
Session.InputCallback(Session.InputCallback.Type type)
Constructor. |
|
Session.InputCallback(Session.InputCallback.Type type,
long timeoutMs)
Constructor. |
|
Session.InputCallback(Session.InputCallback.Type type,
java.lang.String defaultInput)
Constructor. |
|
Session.InputCallback(Session.InputCallback.Type type,
java.lang.String defaultInput,
long timeoutMs)
Constructor. |
|
Session.InputCallback(Session.InputCallback.Type type,
java.lang.String defaultInput,
java.lang.String choicesStr,
long timeoutMs)
Full constructor. |
Method Summary | |
---|---|
abstract void |
callBack()
This method is called if the user hits ENTER, and their input data is valid (one of the choices for CHOOSE or CONFIRM), or anything else for PROMPT. |
boolean |
isTimedOut()
Returns true if a timeout was given, and this class has been active longer than that amount of time. |
Session.InputCallback |
reset()
This method allows reuse of a given InputCallback. |
void |
setInput(java.lang.String input)
Forces user-input into this class, potentially changing its user input waiting state. |
abstract void |
showPrompt()
This method is called by InputCallback before user input is requested. |
abstract void |
timedOut()
This method is call by InputCallback if a timeout value greater than 0 is given and that amount of time has been exceeded. |
boolean |
waitForInput()
Returns true if this class is currently waiting for user input. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final long timeoutMs
protected volatile long timeout
protected volatile java.lang.String input
protected volatile boolean confirmed
protected volatile boolean waiting
protected volatile boolean noTrim
Constructor Detail |
---|
public Session.InputCallback(Session.InputCallback.Type type, java.lang.String defaultInput, java.lang.String choicesStr, long timeoutMs)
type
- the type of processingdefaultInput
- default input valuechoicesStr
- list of one-character options (if CHOOSE Type)timeoutMs
- time, in ms, before the user is kickedpublic Session.InputCallback(Session.InputCallback.Type type, java.lang.String defaultInput, long timeoutMs)
type
- the type of processingdefaultInput
- default input valuetimeoutMs
- time, in ms, before the user is kickedpublic Session.InputCallback(Session.InputCallback.Type type, long timeoutMs)
type
- the type of processingtimeoutMs
- time, in ms, before the user is kickedpublic Session.InputCallback(Session.InputCallback.Type type)
type
- the type of processingpublic Session.InputCallback(Session.InputCallback.Type type, java.lang.String defaultInput)
type
- the type of processingdefaultInput
- default input valueMethod Detail |
---|
public boolean isTimedOut()
public void setInput(java.lang.String input)
input
- the user input to forcepublic boolean waitForInput()
public Session.InputCallback reset()
public abstract void showPrompt()
public abstract void timedOut()
public abstract void callBack()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |