ca.sqlpower.architect
Interface UserPrompter

All Known Implementing Classes:
AlwaysOKUserPrompter, ModalDialogUserPrompter

public interface UserPrompter

The UserPrompter interface is a UI-neutral way for core business objects to solicit a response from the user. When operating in a GUI environment, the UserPrompter implementation could use a modal dialog to prompt the user. When operating in a command line environment, a textual prompt could be used. In a headless environment where prompting is not possible, the responses can be hardwired to a reasonable default. For example, the AlwaysOKUserPrompter always responds as if the user said OK.

An example use case is when a file to be created but already exists. The business logic can be implemented to ask the user how to handle the problem, such as overwriting, not overwriting, or canceling the operation completely. The advantage of using this interface is that the business logic remains uncommitted to any particular user interface library.


Nested Class Summary
static class UserPrompter.UserPromptResponse
          An enumeration of all the possible responses from the user.
 
Method Summary
 UserPrompter.UserPromptResponse promptUser(java.lang.Object... formatArgs)
          Obtains the decision for how a given operation should proceed.
 

Method Detail

promptUser

UserPrompter.UserPromptResponse promptUser(java.lang.Object... formatArgs)
Obtains the decision for how a given operation should proceed. When possible, this will be done by prompting the user. If there is no user available (for example, in a headless environment), a reasonable default response will be provided.

Parameters:
formatArgs - The arguments to the insert into the format string in the question. See MessageFormat for details.


Copyright © 2003-2007 SQL Power Group Inc. www.sqlpower.ca