org.progeeks.util
Interface UserRequestHandler

All Known Implementing Classes:
AbstractRequestHandler, SwingRequestHandler

public interface UserRequestHandler

Provides UI-independant access to the user. Some standard request types are provided and a generic postRequest() method is provided that can take any UserRequest object. This allows UI-specific implementations to be developed.

Note: this concept is sort of experimental and I'm not sure if it will actually be useful in practice. It's all part of trying to factor the UI-specific code out of as many places as possible. This request brokering concept handles many cases where Swing-specific, etc. UIs might need to be called for very simple generic things. It may grow into something more generally useful though. That's part of the experiment.

Version:
$Revision: 1.7 $
Author:
Paul Speed

Method Summary
 java.lang.Object postRequest(UserRequest request)
          Presents the specified request to the user and returns the result.
 java.lang.Boolean requestConfirmation(java.lang.String title, java.lang.String message, boolean includeCancel)
          Requests confirmation from the user in the form of a yes/no question.
 java.io.File requestDirectory(java.lang.String title)
          Requests a directory selection from the user.
 java.io.File requestFile(java.lang.String title, java.lang.String typeDescription, java.lang.String extension, boolean forOpen)
          Requests a file selection from the user.
 java.io.File requestFile(java.lang.String title, java.lang.String typeDescription, java.lang.String extension, java.io.File initialValue, boolean forOpen)
          Requests a file selection from the user providing a default initial value.
 ProgressReporter requestProgressReporter(java.lang.String title, java.lang.String message, int min, int max)
          Returns an object that can be used to report the progress of some operation to the user.
 void requestShowError(java.lang.String title, java.lang.String message)
          Presents an error message tot he user.
 void requestShowMessage(java.lang.String message)
          Presents an informational message to the user.
 void requestShowMessage(java.lang.String title, java.lang.String message, int icon)
          Presents a titled message to the user with an optional icon.
 java.lang.String requestString(java.lang.String title, java.lang.String message, java.lang.String initialValue)
          Requests a String entry from the user.
 

Method Detail

requestConfirmation

java.lang.Boolean requestConfirmation(java.lang.String title,
                                      java.lang.String message,
                                      boolean includeCancel)
Requests confirmation from the user in the form of a yes/no question. Optionally, a cancel button can be included.

Returns:
Boolean.TRUE for yes, Boolean.FALSE for no, and null for cancel.

postRequest

java.lang.Object postRequest(UserRequest request)
Presents the specified request to the user and returns the result.


requestFile

java.io.File requestFile(java.lang.String title,
                         java.lang.String typeDescription,
                         java.lang.String extension,
                         boolean forOpen)
Requests a file selection from the user.


requestFile

java.io.File requestFile(java.lang.String title,
                         java.lang.String typeDescription,
                         java.lang.String extension,
                         java.io.File initialValue,
                         boolean forOpen)
Requests a file selection from the user providing a default initial value.


requestDirectory

java.io.File requestDirectory(java.lang.String title)
Requests a directory selection from the user.


requestString

java.lang.String requestString(java.lang.String title,
                               java.lang.String message,
                               java.lang.String initialValue)
Requests a String entry from the user.


requestShowMessage

void requestShowMessage(java.lang.String message)
Presents an informational message to the user.


requestShowMessage

void requestShowMessage(java.lang.String title,
                        java.lang.String message,
                        int icon)
Presents a titled message to the user with an optional icon. The icon parameter is mostly unsupported at the moment and should be -1 if no icon is desired.


requestShowError

void requestShowError(java.lang.String title,
                      java.lang.String message)
Presents an error message tot he user.


requestProgressReporter

ProgressReporter requestProgressReporter(java.lang.String title,
                                         java.lang.String message,
                                         int min,
                                         int max)
Returns an object that can be used to report the progress of some operation to the user. If the min and max values are -1 that tells the progress reporting view that the progress is indeterminate. The UI-specific class is then free to display progress in a different way that does not rely on progress updates.

Parameters:
title - The name of the over-all operation. Implementations of UserRequestHandler should consider aggregating the progress for the different reporters with the same title.
message - A modifiable message associated with the current part of the task.
min - The minimum value for the progress range.
max - The maximum value for the progress range.


Copyright © 2002-2003 Paul Speed. All Rights Reserved.