cmu.survey.jsp.tags
Class QuestionWithVariable

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by cmu.survey.jsp.tags.TagSupportAndMore
          extended by cmu.survey.jsp.tags.QuestionTagStub
              extended by cmu.survey.jsp.tags.Question
                  extended by cmu.survey.jsp.tags.QuestionWithVariable
All Implemented Interfaces:
HasErrorInfo, HasErrorInfoAndSaves, QuestionTag, java.io.Serializable, java.lang.Cloneable, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.Tag, javax.servlet.jsp.tagext.TryCatchFinally
Direct Known Subclasses:
AbstractQuestion, CheckboxQuestion, DateTimeQuestion, HiddenQuestion, QuestionWithChoices, TextAreaQuestion, TextQuestion

public abstract class QuestionWithVariable
extends Question

See Also:
Serialized Form

Field Summary
protected  java.lang.String dbField
           
static boolean[] FieldTypeIsKey
           
static boolean[] FieldTypeIsNumeric
           
static java.lang.String[] FieldTypes
           
protected  java.lang.String type
           
 
Fields inherited from class cmu.survey.jsp.tags.Question
blankImageLocation, endQuestion, helpText, imageDirectory, question
 
Fields inherited from class cmu.survey.jsp.tags.TagSupportAndMore
dateFormatAmerican, dateTimeFormatAmerican, DAYS_OF_THE_WEEK, debug, MONTHS_OF_THE_YEAR, timeFormatAmerican
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
pageContext
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
QuestionWithVariable()
           
QuestionWithVariable(Survey survey)
           
 
Method Summary
 Answer getAnswer()
           
protected  java.lang.String getDbField()
           
 java.lang.String getExtraJavaScripts(boolean thisIsWrittenInJavaScript)
           
 java.lang.String getExtraJavaScripts(boolean thisIsWrittenInJavaScript, java.lang.String type, java.lang.String dbField)
           
 java.lang.String getFieldAndType()
           
static java.lang.String getFieldAndType(java.lang.String type, java.lang.String dbField)
           
 java.lang.String getTimeSpentInOnClickOrPressed(boolean thisIsWrittenInJavaScript)
           
 java.lang.String getTimeSpentInOnClickOrPressed(boolean thisIsWrittenInJavaScript, java.lang.String dbField)
           
protected  java.lang.String getType()
           
abstract  boolean hasVariable()
          Whether this has a standard "answer" variable, i.e. whether the Question needs to call "getAnswer()" to load and save the answer.
 boolean isTypeKey()
           
 boolean isTypeNumeric()
           
 boolean isTypeNumeric(java.lang.String type2)
           
static boolean isValidType(java.lang.String type)
           
 void printTimeSpentField()
           
 void reinit()
           
protected  void saveQuestionInfo()
          Designed to be overwritten by QuestionWithVariable.
 void setDbField(java.lang.String newDbField)
          This is the field in the database that the answer to this question is saved.
 void setDefaultValue(java.lang.String defaultValueToSet)
           
 void setType(java.lang.String newType)
           
 
Methods inherited from class cmu.survey.jsp.tags.Question
clone, doEndOfQuestion, doEndOfQuestionNoPrinting, doMiddleOfQuestion, doQuestion, doStartOfQuestion, doStartOfQuestion, getAutoSubmitWhenFinishedWithThisQuestion, getBackgroundColorHTMLText, getDatabaseQuery, getEndQuestion, getExtraErrorInfo, getHelpText, getID, getOtherQuestionInfoToSave, getQuestion, getSupplementalErrorInfo, print, print, printTimeSpentField, setAutoSubmitWhenFinishedWithThisQuestion, setBackgroundColor, setEndQuestion, setHelpText, setID, setNumberOfColumns, setOtherQuestionInfoToSave, setQuestion, setSupplementalErrorInfo
 
Methods inherited from class cmu.survey.jsp.tags.QuestionTagStub
doStartTag, getErrorInfo, getSurvey, initSurvey, saveErrorInfo
 
Methods inherited from class cmu.survey.jsp.tags.TagSupportAndMore
breakDownToArray, convertDayNameToNum, convertDayNumToName, convertDayNumToName, convertMonthNumToName, doCatch, doEndTag, doFinally, formatDateTimeViewable, formatDateTimeViewable, formatDateViewable, formatTimeNoSecondsViewable, formatTimeNoSecondsViewable, formatTimeNoSecondsViewable, getNumDaysInWeek, parseTimeNoSecondsFromViewable, println
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface cmu.survey.jsp.tags.HasErrorInfoAndSaves
saveErrorInfo
 
Methods inherited from interface cmu.survey.jsp.tags.HasErrorInfo
getErrorInfo
 

Field Detail

dbField

protected java.lang.String dbField

type

protected java.lang.String type

FieldTypes

public static final java.lang.String[] FieldTypes

FieldTypeIsNumeric

public static final boolean[] FieldTypeIsNumeric

FieldTypeIsKey

public static final boolean[] FieldTypeIsKey
Constructor Detail

QuestionWithVariable

public QuestionWithVariable()

QuestionWithVariable

public QuestionWithVariable(Survey survey)
Method Detail

setDbField

public void setDbField(java.lang.String newDbField)
This is the field in the database that the answer to this question is saved. It is stored in: Survey.getTable()+"."+Question.getDBField()


getDbField

protected java.lang.String getDbField()

isValidType

public static boolean isValidType(java.lang.String type)

setType

public void setType(java.lang.String newType)

getType

protected java.lang.String getType()

getAnswer

public Answer getAnswer()

isTypeNumeric

public boolean isTypeNumeric(java.lang.String type2)

isTypeNumeric

public boolean isTypeNumeric()

isTypeKey

public boolean isTypeKey()

getFieldAndType

public static java.lang.String getFieldAndType(java.lang.String type,
                                               java.lang.String dbField)

getFieldAndType

public java.lang.String getFieldAndType()

setDefaultValue

public void setDefaultValue(java.lang.String defaultValueToSet)

getExtraJavaScripts

public java.lang.String getExtraJavaScripts(boolean thisIsWrittenInJavaScript,
                                            java.lang.String type,
                                            java.lang.String dbField)

getExtraJavaScripts

public java.lang.String getExtraJavaScripts(boolean thisIsWrittenInJavaScript)

getTimeSpentInOnClickOrPressed

public java.lang.String getTimeSpentInOnClickOrPressed(boolean thisIsWrittenInJavaScript,
                                                       java.lang.String dbField)

getTimeSpentInOnClickOrPressed

public java.lang.String getTimeSpentInOnClickOrPressed(boolean thisIsWrittenInJavaScript)

printTimeSpentField

public void printTimeSpentField()

hasVariable

public abstract boolean hasVariable()
Whether this has a standard "answer" variable, i.e. whether the Question needs to call "getAnswer()" to load and save the answer. For example, headers do not have variables, short answers do. More complicated, AbstractQuestions should return false, despite having some variables -- they don't have any standard variables.

Returns:

saveQuestionInfo

protected void saveQuestionInfo()
Description copied from class: Question
Designed to be overwritten by QuestionWithVariable.

Overrides:
saveQuestionInfo in class Question

reinit

public void reinit()
Overrides:
reinit in class Question