org.apache.myfaces.trinidaddemo.survey
Class SurveyBean

java.lang.Object
  extended by org.apache.myfaces.trinidaddemo.survey.SurveyBean
All Implemented Interfaces:
Serializable

public class SurveyBean
extends Object
implements Serializable

class SurveyBean This is the main backing bean for the Survey Demo project. It represents a multiple-choice survey. It contains state about the list of questions to ask in the survey and the user's responses to these questions. It also has methods that help with application navigation.

See Also:
Serialized Form

Constructor Summary
SurveyBean()
          Class constructor (no arguments).
SurveyBean(String bundleName)
          Class constructor.
 
Method Summary
 void advanceToNextQuestion()
          increments question index to next question.
 String back()
          moves the survey to the previous question.
 String check()
          called to advance to the results page.
 String finish()
          called when the first run through the survey is completed.
 String getA0()
           
 String getA1()
           
 String getA2()
           
 String getA3()
           
 boolean getA30()
           
 boolean getA31()
           
 boolean getA32()
           
 boolean getA33()
           
 String getA4()
           
 String getCorrect()
          a hack to return the String "correct" inside a binding using EL
 String getCurrentQuestionNumber()
          determines the number of the current question in the survey.
 boolean getDone()
          determines whether we have reached the end of the survey
 String getEmptyString()
          a hack to return the empty String "" inside a binding using EL
 String getError()
          a hack to return the String "error" inside a binding using EL
 String getIncorrect()
          a hack to return the String "incorrect" inside a binding using EL
 String getNone()
          a hack to return the String "none" inside a binding using EL
 String getNumQuestions()
          advances the survey to the next question.
 List<SurveyPage> getPages()
           
 MultChoiceQuestionBean getQ0()
          IDE generated accessors
 TextQuestionBean getQ1()
           
 MultChoiceQuestionBean getQ2()
           
 CheckboxQuestionBean getQ3()
           
 MultChoiceQuestionBean getQ4()
           
 void goToPreviousQuestion()
          decrements question index to previous question.
 void initSurveyState()
          Initializes various survey state.
 String next()
          advances the survey to the next question.
 void setA0(String a0)
           
 void setA1(String a1)
           
 void setA2(String a2)
           
 void setA3(String a3)
           
 void setA30(boolean a30)
           
 void setA31(boolean a31)
           
 void setA32(boolean a32)
           
 void setA33(boolean a33)
           
 void setA4(String a4)
           
 String start()
          called to go back to beginning of survey and clears all previous responses.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SurveyBean

public SurveyBean()
Class constructor (no arguments).


SurveyBean

public SurveyBean(String bundleName)
Class constructor.

Parameters:
bundleName - the path of a bundle file
Method Detail

initSurveyState

public void initSurveyState()
Initializes various survey state. Should be called for each new sesion through the survey.


next

public String next()
advances the survey to the next question.

Returns:
a String object, "next"

back

public String back()
moves the survey to the previous question.

Returns:
a String object, "back"

finish

public String finish()
called when the first run through the survey is completed.

Returns:
a String object, "finish"

check

public String check()
called to advance to the results page.

Returns:
a String object, "check"

start

public String start()
called to go back to beginning of survey and clears all previous responses.

Returns:
a String object, "start"

getNumQuestions

public String getNumQuestions()
advances the survey to the next question.

Returns:
a String object representing the number of questions in the survey

getDone

public boolean getDone()
determines whether we have reached the end of the survey

Returns:
a boolean that is true if we have reached the end of the survey

getCurrentQuestionNumber

public String getCurrentQuestionNumber()
determines the number of the current question in the survey.

Returns:
a String that represents the number of the current question

advanceToNextQuestion

public void advanceToNextQuestion()
increments question index to next question.


goToPreviousQuestion

public void goToPreviousQuestion()
decrements question index to previous question.


getError

public String getError()
a hack to return the String "error" inside a binding using EL

Returns:
the literal String, "error"

getNone

public String getNone()
a hack to return the String "none" inside a binding using EL

Returns:
the literal String, "none"

getEmptyString

public String getEmptyString()
a hack to return the empty String "" inside a binding using EL

Returns:
the empty String, ""

getCorrect

public String getCorrect()
a hack to return the String "correct" inside a binding using EL

Returns:
the literal String, "correct"

getIncorrect

public String getIncorrect()
a hack to return the String "incorrect" inside a binding using EL

Returns:
the literal String, "incorrect"

getQ0

public MultChoiceQuestionBean getQ0()
IDE generated accessors


getQ1

public TextQuestionBean getQ1()

getQ2

public MultChoiceQuestionBean getQ2()

getQ3

public CheckboxQuestionBean getQ3()

getQ4

public MultChoiceQuestionBean getQ4()

setA0

public void setA0(String a0)

getA0

public String getA0()

setA1

public void setA1(String a1)

getA1

public String getA1()

setA2

public void setA2(String a2)

getA2

public String getA2()

setA3

public void setA3(String a3)

getA3

public String getA3()

setA4

public void setA4(String a4)

getA4

public String getA4()

setA30

public void setA30(boolean a30)

getA30

public boolean getA30()

setA31

public void setA31(boolean a31)

getA31

public boolean getA31()

setA32

public void setA32(boolean a32)

getA32

public boolean getA32()

setA33

public void setA33(boolean a33)

getA33

public boolean getA33()

getPages

public List<SurveyPage> getPages()


Copyright © 2001-2011 The Apache Software Foundation. All Rights Reserved.