All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class guinea.ui.CheckboxChoice

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----guinea.awt.GPContainer
                           |
                           +----guinea.ui.CheckboxChoice

public class CheckboxChoice
extends GPContainer
implements QuestionInterface, PropertyLoader
The CheckboxChoice is used to select one of multiple choices as an answer to a question. Answers are user-defined and the corresponding labels shown to the subject can be set.


Constructor Index

· CheckboxChoice()
Construct a new CheckboxChoice with no choices.
· CheckboxChoice(Object[])
Construct a new CheckboxChoice with given answers.
· CheckboxChoice(Object[], String[])
Construct a new CheckboxChoice with given answers and corresponding labels.

Method Index

· addAnswerListener(AnswerListener)
Add a listener that is interested to receive answer events.
· getAnswer()
Get answer for question.
· getQuestion()
Get the text of the question.
· getQuestionID()
Get the ID of the question.
· isAnswered()
See if an answer has been given.
· isQuestionEnabled()
Test whether question is enabled or disabled.
· propertyLoad(Properties, String)
· removeAnswerListener(AnswerListener)
Removes the specified listener so it no longer receives value change events from this component.
· reset()
Reset question to default answer and/or to unanswered state.
· setAnswer(Object)
Set answer of question.
· setChoices(Object[])
Set the choices for this answering component.
· setChoices(Object[], String[])
Set the answers and corresponding labels for this answering component.
· setQuestion(String)
Set the text of the question.
· setQuestionEnabled(boolean)
Enable or disable question component.
· setQuestionID(String)
Set the ID of this question.

Constructors

· CheckboxChoice
 public CheckboxChoice()
Construct a new CheckboxChoice with no choices.

· CheckboxChoice
 public CheckboxChoice(Object answers[])
Construct a new CheckboxChoice with given answers. Corresponding labels are generated by calling the toString() method of the corresponding answer.

Parameters:
answers - Array of answers.
· CheckboxChoice
 public CheckboxChoice(Object answers[],
                       String labels[])
Construct a new CheckboxChoice with given answers and corresponding labels.

Parameters:
answers - Array of answers.
labels - Array of labels that are shown to the subject.

Methods

· setChoices
 public void setChoices(Object answers[])
Set the choices for this answering component. Corresponding labels are generated by calling the toString() method of the corresponding answer.

Parameters:
answers - Array of answers.
· setChoices
 public synchronized void setChoices(Object answers[],
                                     String labels[])
Set the answers and corresponding labels for this answering component.

Parameters:
answers - Array of answers.
labels - Array of labels that are shown to the subject.
· setQuestionEnabled
 public void setQuestionEnabled(boolean enabled)
Enable or disable question component. On checkbox choice component, this method does nothing.

Parameters:
enabled - Use true to enable, false to disable the question.
· isQuestionEnabled
 public boolean isQuestionEnabled()
Test whether question is enabled or disabled.

Returns:
In checkbox choice component, this method returns always true.
· getAnswer
 public Object getAnswer()
Get answer for question.

Returns:
The answer of the selected checkbox or null no choice has been selected.
· setAnswer
 public synchronized void setAnswer(Object answer)
Set answer of question.

Parameters:
answer - The checkbox to select that corresponds to this answer.
· reset
 public void reset()
Reset question to default answer and/or to unanswered state.

· isAnswered
 public boolean isAnswered()
See if an answer has been given.

Returns:
true if user has given an answer.
· setQuestion
 public void setQuestion(String question)
Set the text of the question.

Parameters:
question - text of the question.
· getQuestion
 public String getQuestion()
Get the text of the question.

Returns:
text of the question.
· setQuestionID
 public void setQuestionID(String id)
Set the ID of this question.

Parameters:
id - ID label of question.
· getQuestionID
 public String getQuestionID()
Get the ID of the question.

Returns:
ID label of the question.
· addAnswerListener
 public synchronized void addAnswerListener(AnswerListener listener)
Add a listener that is interested to receive answer events.

Parameters:
listener - A listener.
· removeAnswerListener
 public synchronized void removeAnswerListener(AnswerListener listener)
Removes the specified listener so it no longer receives value change events from this component.

Parameters:
listener - the listener.
· propertyLoad
 public void propertyLoad(Properties p,
                          String name) throws IllegalArgumentException

All Packages  Class Hierarchy  This Package  Previous  Next  Index