本文整理汇总了Java中org.javarosa.core.model.QuestionDef.getDynamicChoices方法的典型用法代码示例。如果您正苦于以下问题:Java QuestionDef.getDynamicChoices方法的具体用法?Java QuestionDef.getDynamicChoices怎么用?Java QuestionDef.getDynamicChoices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.javarosa.core.model.QuestionDef
的用法示例。
在下文中一共展示了QuestionDef.getDynamicChoices方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: attachChoice
import org.javarosa.core.model.QuestionDef; //导入方法依赖的package包/类
public void attachChoice (QuestionDef q) {
if (q.getDynamicChoices() != null) //can't attach dynamic choices because they aren't guaranteed to exist yet
return;
SelectChoice choice = null;
if (index != -1 && index < q.getNumChoices()) {
choice = q.getChoice(index);
} else if (xmlValue != null && xmlValue.length() > 0) {
choice = q.getChoiceForValue(xmlValue);
}
if (choice != null) {
attachChoice(choice);
} else {
throw new XPathTypeMismatchException("value " + xmlValue + " could not be loaded into question " + q.getTextID()
+ ". Check to see if value " + xmlValue + " is a valid option for question " + q.getTextID() + ".");
}
}
示例2: attachChoice
import org.javarosa.core.model.QuestionDef; //导入方法依赖的package包/类
public void attachChoice(QuestionDef q) {
if (q.getDynamicChoices() != null) //can't attach dynamic choices because they aren't guaranteed to exist yet
return;
SelectChoice choice = null;
if (index != -1 && index < q.getNumChoices()) {
choice = q.getChoice(index);
} else if (xmlValue != null && xmlValue.length() > 0) {
choice = q.getChoiceForValue(xmlValue);
}
if (choice != null) {
attachChoice(choice);
} else {
throw new XPathTypeMismatchException("value " + xmlValue + " could not be loaded into question " + q.getTextID()
+ ". Check to see if value " + xmlValue + " is a valid option for question " + q.getTextID() + ".");
}
}
示例3: attachChoice
import org.javarosa.core.model.QuestionDef; //导入方法依赖的package包/类
public void attachChoice(QuestionDef q) {
if (q.getDynamicChoices() != null) {
// can't attach dynamic choices because they aren't guaranteed to exist yet
return;
}
SelectChoice choice = null;
if (index != -1 && index < q.getNumChoices()) {
choice = q.getChoice(index);
} else if (xmlValue != null && xmlValue.length() > 0) {
choice = q.getChoiceForValue(xmlValue);
}
if (choice != null) {
attachChoice(choice);
} else {
throw new XPathTypeMismatchException("value " + xmlValue + " could not be loaded into question " + q.getTextID()
+ ". Check to see if value " + xmlValue + " is a valid option for question " + q.getTextID() + ".");
}
}
示例4: processSelectChoices
import org.javarosa.core.model.QuestionDef; //导入方法依赖的package包/类
private static void processSelectChoices (Element e, IFormElement fe, FormDef form) {
if (fe instanceof QuestionDef) {
QuestionDef q = (QuestionDef)fe;
int controlType = q.getControlType();
TreeReference ref = (TreeReference)q.getBind().getReference();
if (controlType == Constants.CONTROL_SELECT_ONE || controlType == Constants.CONTROL_SELECT_MULTI) {
String choiceTypeName = getChoiceTypeName(ref);
List<SelectChoice> choices;
//Figure out the choices involved if they are complex
ItemsetBinding itemset = q.getDynamicChoices();
if (itemset != null) {
form.populateDynamicChoices(itemset, ref);
choices = itemset.getChoices();
} else { //static choices
choices = q.getChoices();
}
writeChoices(e, choiceTypeName, choices);
if (controlType == Constants.CONTROL_SELECT_MULTI) {
writeListType(e, choiceTypeName);
}
choiceTypeMapping.put(form.getInstance().getTemplatePath(ref),
(controlType == Constants.CONTROL_SELECT_MULTI ? "list." : "") + choiceTypeName);
}
} else {
for (int i = 0; i < fe.getChildren().size(); i++) {
processSelectChoices(e, fe.getChild(i), form);
}
}
}
示例5: getSelectChoices
import org.javarosa.core.model.QuestionDef; //导入方法依赖的package包/类
public List<SelectChoice> getSelectChoices() {
QuestionDef q = getQuestion();
ItemsetBinding itemset = q.getDynamicChoices();
if (itemset != null) {
if (!dynamicChoicesPopulated) {
form.populateDynamicChoices(itemset, mTreeElement.getRef());
dynamicChoicesPopulated = true;
}
return itemset.getChoices();
} else { //static choices
return q.getChoices();
}
}
示例6: getSelectChoices
import org.javarosa.core.model.QuestionDef; //导入方法依赖的package包/类
public Vector<SelectChoice> getSelectChoices(boolean shouldAttemptDynamicPopulation) {
QuestionDef q = getQuestion();
ItemsetBinding itemset = q.getDynamicChoices();
if (itemset != null) {
if (populatedDynamicChoices == null && shouldAttemptDynamicPopulation) {
form.populateDynamicChoices(itemset, mTreeElement.getRef());
populatedDynamicChoices = itemset.getChoices();
}
return populatedDynamicChoices;
} else {
// static choices
return q.getChoices();
}
}
示例7: processSelectChoices
import org.javarosa.core.model.QuestionDef; //导入方法依赖的package包/类
private static void processSelectChoices (Element e, IFormElement fe, FormDef form) {
if (fe instanceof QuestionDef) {
QuestionDef q = (QuestionDef)fe;
int controlType = q.getControlType();
TreeReference ref = q.getBind().getReference();
if (controlType == Constants.CONTROL_SELECT_ONE || controlType == Constants.CONTROL_SELECT_MULTI) {
String choiceTypeName = getChoiceTypeName(ref);
Vector<SelectChoice> choices;
//Figure out the choices involved if they are complex
ItemsetBinding itemset = q.getDynamicChoices();
if (itemset != null) {
if(itemset.nodesetRef.getInstanceName() != null) {
//CTS: We can't really do this right for external instance references right now.
choices = new Vector();
} else {
form.populateDynamicChoices(itemset, ref);
choices = itemset.getChoices();
}
} else { //static choices
choices = q.getChoices();
}
writeChoices(e, choiceTypeName, choices);
if (controlType == Constants.CONTROL_SELECT_MULTI) {
writeListType(e, choiceTypeName);
}
choiceTypeMapping.put(form.getInstance().getTemplatePath(ref),
(controlType == Constants.CONTROL_SELECT_MULTI ? "list." : "") + choiceTypeName);
}
} else {
for (int i = 0; i < fe.getChildren().size(); i++) {
processSelectChoices(e, fe.getChild(i), form);
}
}
}