use of org.javarosa.core.model.FormDef in project javarosa by opendatakit.
the class FormParseInit method printStuff.
/*
* Makes an 'extremely basic' print out of the xform model.
*/
public String printStuff() {
String stuff = "";
// go to the beginning of the form
fec.jumpToIndex(FormIndex.createBeginningOfFormIndex());
do {
FormEntryCaption fep = femodel.getCaptionPrompt();
boolean choiceFlag = false;
if (fep.getFormElement() instanceof QuestionDef) {
stuff += "\t[Type:QuestionDef, ";
List<SelectChoice> s = ((QuestionDef) fep.getFormElement()).getChoices();
stuff += "ContainsChoices: " + ((s != null && s.size() > 0) ? "true " : "false") + ", ";
if (s != null && s.size() > 0)
choiceFlag = true;
} else if (fep.getFormElement() instanceof FormDef) {
stuff += "\t[Type:FormDef, ";
} else if (fep.getFormElement() instanceof GroupDef) {
stuff += "\t[Type:GroupDef, ";
} else {
stuff += "\t[Type:Unknown]\n";
continue;
}
stuff += "ID:" + fep.getFormElement().getID() + ", TextID:" + fep.getFormElement().getTextID() + ",InnerText:" + fep.getFormElement().getLabelInnerText();
if (choiceFlag) {
stuff += "] \n\t\t---Choices:" + ((QuestionDef) fep.getFormElement()).getChoices().toString() + "\n";
} else {
stuff += "]\n";
}
} while (fec.stepToNextEvent() != fec.EVENT_END_OF_FORM);
return stuff;
}
Aggregations