Class DefaultGUICallbackHandler
- java.lang.Object
-
- org.glassfish.appclient.client.acc.callbackhandler.DefaultGUICallbackHandler
-
- All Implemented Interfaces:
CallbackHandler
public class DefaultGUICallbackHandler extends Object implements CallbackHandler
Example callback handler for displaying and gathering information from the user on behalf of the security system.This callback handler works with all known types of callback handlers (as of this writing). It basically builds a component for each callback that the caller provides and passes them all to a JOptionPane, which displays all the components and accepts the user's ending action (such as OK, Cancel, etc.).
Normally the caller passes a ConfirmationCallback to tell what kind of responses should be expected and accepted from the user (OK/Cancel, Yes/No, Yes/No/Cancel, etc.). If the caller does not provide one this handler uses a default ConfirmationCallback with "OK" as the only choice. In such a case the user has no option to cancel, although he or she can always simply close the option dialog box.
The dialog box includes a system-selected icon based on the message type specified when the JOptionPane is created. The message type for the dialog box (INFORMATION, WARNING, ERROR) is computed by choosing the most severe message type from ConfirmationCallbacks or TextOutputCallbacks passed by the caller.
Whenever the user dismisses the dialog box, whether by choosing one of the confirmation choices (such as OK or Cancel) or by closing the window, the handler updates each of the callbacks as appropriate with information from the corresponding U/I components. The caller should provide a ConfirmationCallback if it needs to distinguish among the possible responses from the user.
Each type of callback is associated with a corresponding type of callback-to-U/I binding. Each binding creates a JComponent, specific to its type of callback, that displays information from the callback or collects information from the user, perhaps using a prompt or initial value from the callback. Each type of binding also implements the finish method which updates the corresponding callback, if appropriate, with data from the U/I component.
- Author:
- tjquinn
-
-
Constructor Summary
Constructors Constructor Description DefaultGUICallbackHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
handle(Callback[] callbacks)
Handles the caller-requested callbacks.
-
-
-
Method Detail
-
handle
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException
Handles the caller-requested callbacks.- Specified by:
handle
in interfaceCallbackHandler
- Parameters:
callbacks
- the Callback objects to be processed- Throws:
IOException
UnsupportedCallbackException
- if this handler does not support the specified callback
-
-