Package com.sun.interview

This package provides a means for creating a set of questions to be asked by a "wizard".

See:
          Description

Interface Summary
FileFilter An interface for filtering files.
Interview.Observer An observer interface for receiving notifications as the state of the interview is updated.
TreeQuestion.Model An interface that provides the model for the tree whose nodes are selected by a TreeQuestion.
 

Class Summary
AllFilesFileFilter A filter which accepts all (non-directory) files.
Checklist A Checklist is a sorted collection of messages, for the purpose of providing a list of actions that must be performed in association with a completed interview.
Checklist.Item An Item contains a message to appear in a checklist.
ChoiceArrayQuestion A question to which the response is one of a number of choices.
ChoiceQuestion A question to which the response is one of a number of choices.
CompositeQuestion A specialized base class for questions which have more than one value to be manipulated by the user.
DirectoryFileFilter A filter which accepts directories.
ErrorQuestion A "null" question with no response.
ExtensionFileFilter A filter which accepts files based on their extension.
FileListQuestion A question to which the response is one or more filenames.
FileQuestion A question to which the response is a filename.
FilesAndDirectoriesFileFilter A filter which accepts all files and directories.
FinalQuestion A special type of question used to indicate the last of the questions of an interview.
FloatQuestion A question to which the response is an floating point number.
InetAddressQuestion A question to which the response is an IP address.
Interview The base class for an interview: a series of questions, to be presented to the user via some tool such as an assistant or wizard.
InterviewSet InterviewSet is an interview that is also a container for an ordered set of child interviews.
IntQuestion A question to which the response is an integer.
ListQuestion A question to support the construction of an open-ended set of complex values determined by a specified subinterview.
ListQuestion.Body A special subtype of Interview to use for the questions in the body of a loop.
NullQuestion A "null" question with no response.
Properties2 The Properties class represents a persistent set of properties.
PropertiesQuestion A question which consists of many key-value pairs.
PropertiesQuestion.BooleanConstraints Constraints allowing a value to be either a boolean or Yes/No response.
PropertiesQuestion.FilenameConstraints Constrains the response to filenames or paths, and allows chooser widgets to be rendered for the user when appropriate.
PropertiesQuestion.FloatConstraints Constraints specifying a floating point type.
PropertiesQuestion.IntConstraints  
PropertiesQuestion.StringConstraints Value restrictions for string type responses.
PropertiesQuestion.ValueConstraints  
Question Questions are the primary constituent elements of interviews.
StringListQuestion A question to which the response is an array of strings.
StringQuestion A question to which the response is a string.
TreeQuestion A question to which the response is a set of selected nodes within a tree.
WizEdit An API (with a basic front-end application) for batch editing an interview.
WizPrint An API (with a basic front-end application) for generating HTML printouts of an interview.
YesNoQuestion A question to which the response is yes or no.
 

Exception Summary
Interview.BadHelpFault This exception is to report problems found while opening a JavaHelp help set.
Interview.Fault This exception is to report problems that occur while updating an interview.
Interview.HelpNotFoundFault This exception is thrown when a named help set cannot be found.
Interview.NotOnPathFault This exception is thrown when a question is expected to be on the current path, and is not.
InterviewSet.CycleFault This exception will be thrown when an attempt to made to specify a dependency that would create a dependency cycle.
WizEdit.BadArgs This exception is used to indicate a problem with the command line arguments.
WizEdit.Fault This exception is to report problems that occur while editing the responses to questions in an interview.
WizPrint.BadArgs This exception is to report problems that occur with command line arguments.
WizPrint.Fault This exception is to report problems that occur while updating an interview.
 

Package com.sun.interview Description

This package provides a means for creating a set of questions to be asked by a "wizard".

A wizard is a tool that asks the user a series of simple questions, in order to achieve a complex goal, such as installing, configuring or using a complex piece of software. Each question is represented by an object which defines the text of the question to be asked, and the type of the response that is expected. Each question also specifies the next question to be asked, which may depend on the answers to any of the questions that have already been asked. All questions belong to an "interview", and the complete set of questions for a wizard may be grouped into one or more different interviews.

By design, questions are simple to write and do not have any dependence on any GUI API: the presentation of the questions of a wizard is left to a separate utility: more than one may be available.

Guide to writing wizards

The questions for a wizard are most conveniently written as a series of anonymous inner classes. Each question extends the appropriate subtype of Question, depending on the appropriate type of response. Normally, the arguments to the supertype constructor are the interview which contains the question, and a short name to identify the question. Anonymous initializers are used to complete the setup of the question, and each question defines a getNext method to define its successor. This method will be called whenever the response to the question changes, and may return different values depending on the response to this question and any other questions that have already been asked. If the user has not yet answered a question, or has answered it incorrectly, the getNext method may return null. This will prevent any tool processing the questions from moving beyond this question until a valid response has been given.
    Question name = new StringQuestion(interview, "name") {
        {
            setText("what is your name?");
        }

        protected Question getNext() {
            return age;
        }
    }

Questions can conveniently be created as fields within an implementation of Interview.

    Interview personal = new Interview("personal") {
        {
            setFirstQuestion(name);
            setTitle("personal questions");
        }

        private Question name = new StringQuestion(this, "name") {
            ...
        };

        private Question age = new IntQuestion(this, "int") {
            ...
        };

        private Question sex = new ChoiceQuestion(this, "sex") {
            ...
        };
    }
FinalQuestion is a special type of question that is used to indicate the end of an interview, and does not provide any response. You may still choose to set some text to be presented to the user, to announce that they have reached the last question.
    Question end = new FinalQuestion(interview, "end") {
        setText("This completes the interview.");
    };
You can invoke one interview from another by using the callInterview method, to recursively invoke a sub-interview before continuing to process to the next question in the current interview. The sub-interview will begin at the first question in that interview, and will proceed until an instance of FinalQuestion is found, at which point control will revert to the successor question given to callInterview.
    Question a5 = new ...Question(....) {
        ....

        protected Question getNext() {
            callInterview(subInterview, a6);
        }
    };

    // this question will be asked after the subInterview has been completed
    Question a6 = new ....Question(...) {
        ...
    };

Since:
1.0


Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.