com.objectplanet.survey.plugin.api
Class QuestionDropdown

java.lang.Object
  extended by com.objectplanet.survey.plugin.api.Question
      extended by com.objectplanet.survey.plugin.api.QuestionDropdown

public class QuestionDropdown
extends Question

This class represents a dropdown question. Subclasses Question, and adds functionality to create/edit/delete a dropdown question.

Author:
Irina Brun
Created:
28. march 2003

Field Summary
 
Fields inherited from class com.objectplanet.survey.plugin.api.Question
ESSAY_FIELD_CHECKBOX, ESSAY_FIELD_DROPDOWN, ESSAY_FIELD_NUMERIC_DEC, ESSAY_FIELD_NUMERIC_INT, ESSAY_FIELD_TEXT, ESSAYFIELD_LENGTH, INTEXT_TYPE_CHECKBOX, INTEXT_TYPE_DROPDOWN, INTEXT_TYPE_NUMERIC_DEC, INTEXT_TYPE_NUMERIC_INT, INTEXT_TYPE_TEXT, QUESTION_DROPDOWN, QUESTION_MATRIX, QUESTION_MULTIPLE, QUESTION_NO_TYPE, QUESTION_NUMERIC, QUESTION_RATING, TAG_END, TAG_START, UPLOAD_IMAGE, UPLOAD_NONE
 
Method Summary
 int getItemCount()
          Get number of items.
 java.lang.String[] getItems()
          Gets the dropdown items as array of Strings.
 java.lang.String getLabel()
          Gets the dropdown label.
 java.lang.String getLabelValueSeparator()
          Gets the separator between dropdown item and value
 boolean getMultipleOn()
          Gets the multipleOn attribute.
 int getSize()
          Gets the dropdown size.
 boolean getSortOn()
          Gets the sortOn attribute.
 void keepBusinessObject()
          Get and keep business object.
 void releaseBusinessObject()
          Release business object.
 void setItems(java.lang.String itemsAsString)
          Sets the dropdown items (one item per line).
 void setLabel(java.lang.String dropdownLabel)
          Sets the dropdown label.
 void setMultipleOn(boolean multipleOn)
          Sets the multipleOn attribute of the Dropdown question.
 void setSize(int dropdownSize)
          Sets the dropdown size.
 void setSortOn(boolean sortOn)
          Sets the sorting attribute.
 
Methods inherited from class com.objectplanet.survey.plugin.api.Question
addEssayFieldCheckbox, addEssayFieldDecimal, addEssayFieldDropdown, addEssayFieldInteger, addEssayFieldText, addIntextCheckbox, addIntextDecimal, addIntextDropdown, addIntextInteger, addIntextText, deleteEssayField, deleteIntext, deleteValidator, deleteValidator, deleteValidator, deleteValidator, getAnswerRotation, getCustomId, getDisplayNo, getEssayFieldCount, getEssayFieldDropdownItems, getEssayFieldDropdownLabel, getEssayFieldDropdownSortOn, getEssayFieldSize, getEssayFieldType, getFreeTextColumns, getFreeTextLabel, getFreeTextMaxLength, getFreeTextRows, getIntextCount, getIntextDropdownItems, getIntextDropdownLabel, getIntextDropdownSortOn, getIntextIndex, getIntextName, getIntextSize, getIntextType, getQuestionId, getQuestionLayout, getQuestionText, getQuestionType, getTextAfter, getTextBefore, getUploadType, getValidatorErrorMessage, getValidatorErrorMessage, getValidatorErrorMessage, getValidatorErrorMessage, getValidatorParameter, getValidatorParameter, getValidatorParameter, getValidatorParameter, getWeight, hasBusinessObject, isFreeTextOn, isValidatorOn, isValidatorOn, isValidatorOn, isValidatorOn, setAnswerRotation, setDisplayNo, setFreeTextColumns, setFreeTextLabel, setFreeTextMaxLength, setFreeTextOn, setFreeTextRows, setQuestionLayout, setQuestionText, setTextAfter, setTextBefore, setUploadType, setValidator, setValidator, setValidator, setValidator, setWeight, updateAttribute, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setItems

public void setItems(java.lang.String itemsAsString)
              throws LockException,
                     RespondentsExistException,
                     SurveySecurityException,
                     SurveySystemException
Sets the dropdown items (one item per line). A dropdown list lets you distinguish between what is displayed in the list, and the values actually saved in the database. Use getLabelValueSeparator() to separate item label and item value. If no dropdown value entered, label is used as value:
  String separator = questionDropdown.getLabelValueSeparator();
  StringBuffer items = new StringBuffer();
  items.append("Norway").append(separator).append("no").append("\n");
  items.append("France").append(separator).append("fr").append("\n");
  items.append("USA").append("\n");
  
Three dropdown items wil be created:
1) Norway (response saved in database as 'no')
2) France (response saved in database as 'fr')
3) USA (response saved in database as 'USA')

Items will be automatically sorted if sortOn is set to true before setting items..

Parameters:
itemsAsString - The new dropdownItems value
Throws:
LockException - Thrown if the survey is locked and can't be edited. Not yet implemented. Use survey.isLocked() to be sure that the survey can be updated.
RespondentsExistException - Thrown if the survey has responses and can't be edited. Not yet implemented. Use survey.hasRespondents() to be sure that the survey can be updated.
SurveySecurityException - Thrown if the user is not authorized to call this method.
SurveySystemException - If an error occurs in the system.

setLabel

public void setLabel(java.lang.String dropdownLabel)
              throws LockException,
                     RespondentsExistException,
                     SurveySecurityException,
                     SurveySystemException
Sets the dropdown label. The label is the default item shown when no selections are made.

Parameters:
dropdownLabel - The new label
Throws:
LockException - Thrown if the survey is locked and can't be edited. Not yet implemented. Use survey.isLocked() to be sure that the survey can be updated.
RespondentsExistException - Thrown if the survey has responses and can't be edited. Not yet implemented. Use survey.hasRespondents() to be sure that the survey can be updated.
SurveySecurityException - Thrown if the user is not authorized to call this method.
SurveySystemException - If an error occurs in the system.

setMultipleOn

public void setMultipleOn(boolean multipleOn)
                   throws LockException,
                          RespondentsExistException,
                          SurveySecurityException,
                          SurveySystemException
Sets the multipleOn attribute of the Dropdown question. If set to true, the dropdown list allows multiple selections.

Parameters:
multipleOn - The new multipleOn value
Throws:
LockException - Thrown if the survey is locked and can't be edited. Not yet implemented. Use survey.isLocked() to be sure that the survey can be updated.
RespondentsExistException - Thrown if the survey has responses and can't be edited. Not yet implemented. Use survey.hasRespondents() to be sure that the survey can be updated.
SurveySecurityException - Thrown if the user is not authorized to call this method.
SurveySystemException - If an error occurs in the system.

setSize

public void setSize(int dropdownSize)
             throws LockException,
                    RespondentsExistException,
                    SurveySecurityException,
                    SurveySystemException
Sets the dropdown size. This is how many rows are displayed in the survey form.

Parameters:
dropdownSize - The new dropdown size
Throws:
LockException - Thrown if the survey is locked and can't be edited. Not yet implemented. Use survey.isLocked() to be sure that the survey can be updated.
RespondentsExistException - Thrown if the survey has responses and can't be edited. Not yet implemented. Use survey.hasRespondents() to be sure that the survey can be updated.
SurveySecurityException - Thrown if the user is not authorized to call this method.
SurveySystemException - If an error occurs in the system.

setSortOn

public void setSortOn(boolean sortOn)
               throws LockException,
                      RespondentsExistException,
                      SurveySecurityException,
                      SurveySystemException
Sets the sorting attribute. If false, the dropdown items are shown in the order they are entered, otherwise it is sorted alphabetically.

Parameters:
sortOn - The new sortOn value
Throws:
LockException - Thrown if the survey is locked and can't be edited. Not yet implemented. Use survey.isLocked() to be sure that the survey can be updated.
RespondentsExistException - Thrown if the survey has responses and can't be edited. Not yet implemented. Use survey.hasRespondents() to be sure that the survey can be updated.
SurveySecurityException - Thrown if the user is not authorized to call this method.
SurveySystemException - If an error occurs in the system.

getItemCount

public int getItemCount()
                 throws SurveySystemException
Get number of items.

Returns:
Number of items in the dropdown
Throws:
SurveySystemException - If an error occurs in the system.

getItems

public java.lang.String[] getItems()
                            throws SurveySystemException
Gets the dropdown items as array of Strings. Each array element is a dropdown item. If an item has both label and value, those will be separated with getLabelValueSeparator()

Returns:
The dropdown items or null if no items exist.
Throws:
SurveySystemException - If an error occurs in the system

getLabel

public java.lang.String getLabel()
                          throws SurveySystemException
Gets the dropdown label. The label is the default item shown when no selections are made.

Returns:
The dropdown label
Throws:
SurveySystemException - If an error occurs in the system

getLabelValueSeparator

public java.lang.String getLabelValueSeparator()
Gets the separator between dropdown item and value

Returns:
the separator

getMultipleOn

public boolean getMultipleOn()
                      throws SurveySystemException
Gets the multipleOn attribute. If true, the dropdown allows multiple selections.

Returns:
The multipleOn value
Throws:
SurveySystemException - If an error occurs in the system

getSize

public int getSize()
            throws SurveySystemException
Gets the dropdown size. This is how many rows are displayed in the survey form.

Returns:
The dropdownSize
Throws:
SurveySystemException - If an error occurs in the system

getSortOn

public boolean getSortOn()
                  throws SurveySystemException
Gets the sortOn attribute. If false, the dropdown items are shown in the order they are entered, otherwise it is sorted alphabetically.

Returns:
The sortOn value
Throws:
SurveySystemException - If an error occurs in the system

keepBusinessObject

public void keepBusinessObject()
                        throws SurveySystemException
Get and keep business object. See ATTENTION .

Overrides:
keepBusinessObject in class Question
Throws:
SurveySystemException - If an error occurs in the system.

releaseBusinessObject

public void releaseBusinessObject()
Release business object. See ATTENTION .

Overrides:
releaseBusinessObject in class Question

Copyright ? ObjectPlanet Inc. All Rights Reserved.

Built on December 20 2016