public class FormEntryController extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
ANSWER_CONSTRAINT_VIOLATED |
static int |
ANSWER_OK |
static int |
ANSWER_REQUIRED_BUT_EMPTY |
static int |
EVENT_BEGINNING_OF_FORM |
static int |
EVENT_END_OF_FORM |
static int |
EVENT_GROUP |
static int |
EVENT_PROMPT_NEW_REPEAT |
static int |
EVENT_QUESTION |
static int |
EVENT_REPEAT |
static int |
EVENT_REPEAT_JUNCTURE |
| Constructor and Description |
|---|
FormEntryController(FormEntryModel model)
Creates a new form entry controller for the model provided
|
| Modifier and Type | Method and Description |
|---|---|
void |
addPostProcessor(FormEntryFinalizationProcessor formEntryFinalizationProcessor) |
int |
answerQuestion(FormIndex index,
IAnswerData data,
boolean midSurvey)
Attempts to save the answer at the given
FormIndex into the instance
and returns one of three possible int attempt result codes:
ANSWER_OK
ANSWER_REQUIRED_BUT_EMPTY
ANSWER_CONSTRAINT_VIOLATED
|
int |
answerQuestion(IAnswerData data,
boolean midSurvey)
Attempts to save answer at the current FormIndex into the datamodel.
|
FormIndex |
deleteRepeat()
Deletes a repeated instance of a group referenced by the current
FormIndex.
|
FormIndex |
deleteRepeat(FormIndex questionIndex)
Deletes a repeated instance of a group referenced by the specified
FormIndex.
|
void |
deleteRepeat(int n) |
FormIndex |
descendIntoNewRepeat() |
FormIndex |
descendIntoRepeat(int n) |
void |
finalizeFormEntry() |
FormEntryModel |
getModel() |
int |
jumpToIndex(FormIndex index)
Jumps to a given FormIndex.
|
void |
jumpToNewRepeatPrompt()
Jump to the prompt to add a new repeat for the repeat the controller is currently in.
|
void |
newRepeat()
Creates a new repeated instance of the group referenced by the current
FormIndex.
|
void |
newRepeat(FormIndex questionIndex)
Creates a new repeated instance of the group referenced by the specified
FormIndex.
|
boolean |
saveAnswer(FormIndex index,
IAnswerData data,
boolean midSurvey)
saveAnswer attempts to save the current answer into the data model
without doing any constraint checking.
|
boolean |
saveAnswer(IAnswerData data,
boolean midSurvey)
saveAnswer attempts to save the current answer into the data model
without doing any constraint checking.
|
void |
setLanguage(String language)
Sets the current language.
|
int |
stepToNextEvent()
Navigates forward in the form.
|
int |
stepToPreviousEvent()
Navigates backward in the form.
|
public static final int ANSWER_OK
public static final int ANSWER_REQUIRED_BUT_EMPTY
public static final int ANSWER_CONSTRAINT_VIOLATED
public static final int EVENT_BEGINNING_OF_FORM
public static final int EVENT_END_OF_FORM
public static final int EVENT_PROMPT_NEW_REPEAT
public static final int EVENT_QUESTION
public static final int EVENT_GROUP
public static final int EVENT_REPEAT
public static final int EVENT_REPEAT_JUNCTURE
public FormEntryController(FormEntryModel model)
model - public FormEntryModel getModel()
public int answerQuestion(IAnswerData data, boolean midSurvey)
data - public int answerQuestion(FormIndex index, IAnswerData data, boolean midSurvey)
FormIndex into the instance
and returns one of three possible int attempt result codes:
Side effects: When it returns ANSWER_OK, it mutates
the TreeElement corresponding to the given FormIndex by
setting its value to the given IAnswerData or by copying an
itemset answer if the question is complex.
index - The index of the question/prompt that is being currently evaluateddata - The data to attempt to answer the question with.int result codeRuntimeException - when the question is complex and it has constraints.
See inline comments.QuestionDef.isComplex()public boolean saveAnswer(FormIndex index, IAnswerData data, boolean midSurvey)
index - data - public boolean saveAnswer(IAnswerData data, boolean midSurvey)
data - public int stepToNextEvent()
public int stepToPreviousEvent()
public void finalizeFormEntry()
public void addPostProcessor(FormEntryFinalizationProcessor formEntryFinalizationProcessor)
public int jumpToIndex(FormIndex index)
index - public FormIndex descendIntoRepeat(int n)
public FormIndex descendIntoNewRepeat()
public void newRepeat(FormIndex questionIndex)
questionIndex - public void newRepeat()
public FormIndex deleteRepeat(FormIndex questionIndex)
questionIndex - public FormIndex deleteRepeat()
public void deleteRepeat(int n)
public void setLanguage(String language)
language - public void jumpToNewRepeatPrompt()
Copyright © 2023. All rights reserved.