public class FormEntryController
extends java.lang.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 |
(package private) FormEntryModel |
model |
Constructor and Description |
---|
FormEntryController(FormEntryModel model)
Creates a new form entry controller for the model provided
|
Modifier and Type | Method and Description |
---|---|
int |
answerQuestion(FormIndex index,
IAnswerData data,
boolean midSurvey)
Attempts to save the answer at the specified FormIndex into the
datamodel.
|
int |
answerQuestion(IAnswerData data,
boolean midSurvey)
Attempts to save answer at the current FormIndex into the datamodel.
|
private boolean |
commitAnswer(TreeElement element,
FormIndex index,
IAnswerData data,
boolean midSurvey)
commitAnswer actually saves the data 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) |
FormEntryModel |
getModel() |
int |
jumpToIndex(FormIndex index)
Jumps to a given FormIndex.
|
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(java.lang.String language)
Sets the current language.
|
private int |
stepEvent(boolean forward)
Moves the current FormIndex to the next/previous relevant position.
|
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
FormEntryModel model
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)
index
- data
- public boolean saveAnswer(FormIndex index, IAnswerData data, boolean midSurvey)
index
- data
- public boolean saveAnswer(IAnswerData data, boolean midSurvey)
data
- private boolean commitAnswer(TreeElement element, FormIndex index, IAnswerData data, boolean midSurvey)
element
- index
- data
- public int stepToNextEvent()
public int stepToPreviousEvent()
private int stepEvent(boolean forward)
forward
- 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(java.lang.String language)
language
-