use of org.javarosa.core.model.data.IAnswerData in project collect by opendatakit.
the class ExDecimalWidget method getDoubleAnswerValue.
private Double getDoubleAnswerValue() {
IAnswerData dataHolder = getFormEntryPrompt().getAnswerValue();
Double d = null;
if (dataHolder != null) {
Object dataValue = dataHolder.getValue();
if (dataValue != null) {
if (dataValue instanceof Integer) {
d = (double) (Integer) dataValue;
} else {
d = (Double) dataValue;
}
}
}
return d;
}
use of org.javarosa.core.model.data.IAnswerData in project collect by opendatakit.
the class ExIntegerWidget method getIntegerAnswerValue.
private Integer getIntegerAnswerValue() {
IAnswerData dataHolder = getFormEntryPrompt().getAnswerValue();
Integer d = null;
if (dataHolder != null) {
Object dataValue = dataHolder.getValue();
if (dataValue != null) {
if (dataValue instanceof Double) {
d = ((Double) dataValue).intValue();
} else {
d = (Integer) dataValue;
}
}
}
return d;
}
use of org.javarosa.core.model.data.IAnswerData in project collect by opendatakit.
the class IntegerWidget method getIntegerAnswerValue.
private Integer getIntegerAnswerValue() {
IAnswerData dataHolder = getFormEntryPrompt().getAnswerValue();
Integer d = null;
if (dataHolder != null) {
Object dataValue = dataHolder.getValue();
if (dataValue != null) {
if (dataValue instanceof Double) {
d = ((Double) dataValue).intValue();
} else {
d = (Integer) dataValue;
}
}
}
return d;
}
use of org.javarosa.core.model.data.IAnswerData in project collect by opendatakit.
the class TriggerWidgetTest method checkingTheTriggerBoxShouldSetTheAnswer.
@Test
public void checkingTheTriggerBoxShouldSetTheAnswer() {
TriggerWidget widget = getWidget();
assertNull(widget.getAnswer());
CheckBox triggerButton = widget.getTriggerButton();
assertFalse(triggerButton.isChecked());
triggerButton.setChecked(true);
triggerButton.callOnClick();
IAnswerData answer = widget.getAnswer();
assertEquals(answer.getDisplayText(), TriggerWidget.OK_TEXT);
}
use of org.javarosa.core.model.data.IAnswerData in project collect by opendatakit.
the class BinaryWidgetTest method settingANewAnswerShouldRemoveTheOldAnswer.
@Test
public void settingANewAnswerShouldRemoveTheOldAnswer() {
A answer = getInitialAnswer();
when(formEntryPrompt.getAnswerText()).thenReturn(answer.getDisplayText());
W widget = getWidget();
A newAnswer = getNextAnswer();
Object binaryData = createBinaryData(newAnswer);
widget.setBinaryData(binaryData);
IAnswerData answerData = widget.getAnswer();
assertNotNull(answerData);
assertEquals(answerData.getDisplayText(), newAnswer.getDisplayText());
}
Aggregations