Name
ConfirmationCallback
Synopsis
A
Callback of this type
represents a request to ask the user a yes/no or multiple-choice
question. A CallbackHandler should first call
getPrompt( )
to obtain the text of the question. It should also call
getMessageType(
)
to determine the message type
(INFORMATION, WARNING, or
ERROR) and present the question to the user in a
suitable manner based on that type.
Next, the CallbackHandler must determine the
appropriate set of responses to the question. It does this by calling
getOptionType( ). The return values have the
following meanings:
-
YES_NO_OPTION The
CallbackHandlershould allow the user to respond to the question with a “yes” or a “no” (or their localized equivalents).-
YES_NO_CANCEL_OPTION The
CallbackHandlershould allow “yes”, “no”, and “cancel” (or their localized equivalents) responses.-
OK_CANCEL_OPTION The
CallbackHandlershould allow “ok” and “cancel” (or their localized equivalents) responses.-
UNSPECIFIED_OPTION The
CallbackHandlershould callgetOptions( )and use present all strings it returns as possible responses.
In each of these cases, the CallbackHandler should
also call getDefaultOption( ) to determine which
response should be presented as the default response. If
getOptionType( ) returned
UNSPECIFIED_TYPE, then getDefaultOption(
) returns an index into the array of options returned by
getOptions( ). Otherwise
getDefaultOption( ) returns one of the constants
YES, NO, OK,
or CANCEL.
When the user has selected a response to the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access