sbr.items
Class NewQuestion

java.lang.Object
  extended by sbr.items.NewQuestion

public class NewQuestion
extends java.lang.Object

Contains the methods to create the html code for each of the question times other than visual analog scales.

Version:
0.3
Author:
John H. Krantz, Ph.D.

Constructor Summary
NewQuestion()
           
 
Method Summary
 java.lang.String checkBox(java.lang.String quest, java.lang.String[] items, boolean horz, int questNum)
          Create the html code for a new checkbox question type which allows only one option to be selected.
 java.lang.String[] doDemographics(boolean[] whichDemo, int start)
          Add the standard formatted demographics to the survey.
 java.lang.String getHTML(java.lang.String[][][] items, int start)
          This method will take the information to create all of the items in the survey and transform it into html.
 java.lang.String likert(java.lang.String quest, int numItems, java.lang.String lAnchor, java.lang.String rAnchor, int questNum)
          Create the html code for a new Likert question type.
 java.lang.String longText(java.lang.String quest, int rows, int cols, int questNum)
          Add a question which allows for unlimited text entry.
 java.lang.String menu(java.lang.String quest, java.lang.String[] items, boolean notDo, int questNum)
          Create a new drop-down menu question type which allows only one option to be selected.
 java.lang.String radio(java.lang.String quest, java.lang.String[] items, boolean horz, int questNum)
          Create the html code for a new radio button question type which allows only one option to be selected.
 java.lang.String shortText(java.lang.String text, int length, int max, int questNum)
          Add a short test item that limits the number of characters in the entry
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NewQuestion

public NewQuestion()
Method Detail

likert

public java.lang.String likert(java.lang.String quest,
                               int numItems,
                               java.lang.String lAnchor,
                               java.lang.String rAnchor,
                               int questNum)
Create the html code for a new Likert question type.

Parameters:
quest - The text of the item
numItems - the number of options in the question
lAnchor - the left side anchor
rAnchor - the right side anchor
questNum - the current question number, used in giving the variable name
Returns:
String html. the html form code for a Likert type question.

radio

public java.lang.String radio(java.lang.String quest,
                              java.lang.String[] items,
                              boolean horz,
                              int questNum)
Create the html code for a new radio button question type which allows only one option to be selected.

Parameters:
quest - The text of the item
items - the text to be included next to each button. Also indicates the number of items in the question
horz - the direction of the scale true means horizontal
questNum - the current question number, used in giving the variable name
Returns:
String html. the text for the web page

checkBox

public java.lang.String checkBox(java.lang.String quest,
                                 java.lang.String[] items,
                                 boolean horz,
                                 int questNum)
Create the html code for a new checkbox question type which allows only one option to be selected.

Parameters:
quest - The text of the item
items - the text to be included next to each button. Also indicates the number of items in the question
horz - the direction of the scale true means horizontal
questNum - the current question number, used in giving the variable name
Returns:
String html. the text for the web page

menu

public java.lang.String menu(java.lang.String quest,
                             java.lang.String[] items,
                             boolean notDo,
                             int questNum)
Create a new drop-down menu question type which allows only one option to be selected.

Parameters:
quest - The text of the item
items - the text to be included next to each button. Also indicates the number of items in the question
notDo - option to indicate if add option for user to decline to answer
questNum - the current question number, used in giving the variable name
Returns:
String html. the text for the web page

shortText

public java.lang.String shortText(java.lang.String text,
                                  int length,
                                  int max,
                                  int questNum)
Add a short test item that limits the number of characters in the entry

Parameters:
text - the text of the question
length - the length of the field
max - the maximum number of characters that can be entered
questNum - the question number in the survey
Returns:
String html. The code for the web page.

longText

public java.lang.String longText(java.lang.String quest,
                                 int rows,
                                 int cols,
                                 int questNum)
Add a question which allows for unlimited text entry.

Parameters:
quest - the text of the question
rows - the number of rows for the text area
cols - the width of the text area
questNum - the number of the question
Returns:
String html. The html code for a long text type of question.

doDemographics

public java.lang.String[] doDemographics(boolean[] whichDemo,
                                         int start)
Add the standard formatted demographics to the survey.

Parameters:
whichDemo - flags to indicate which demographic questions to do.
lastNum - the last number used in the survey
Returns:
String [] html. this is in to parts. the 0 string returns the html for the survey. The 1 string returns the last question number used.

getHTML

public java.lang.String getHTML(java.lang.String[][][] items,
                                int start)
This method will take the information to create all of the items in the survey and transform it into html. Each item in the first index of items is a new survey item. The first

Parameters:
items - This is the array of the survey items to be converted into html code.
Returns:
String html the html form code for the webpage.