本文整理汇总了Java中org.javarosa.core.model.QuestionDef.addSelectChoice方法的典型用法代码示例。如果您正苦于以下问题:Java QuestionDef.addSelectChoice方法的具体用法?Java QuestionDef.addSelectChoice怎么用?Java QuestionDef.addSelectChoice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.javarosa.core.model.QuestionDef
的用法示例。
在下文中一共展示了QuestionDef.addSelectChoice方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSelectChoiceIDsNoLocalizer
import org.javarosa.core.model.QuestionDef; //导入方法依赖的package包/类
@Test
public void testSelectChoiceIDsNoLocalizer() {
QuestionDef q = fpi.getFirstQuestionDef();
q.addSelectChoice(new SelectChoice("choice1 id", "val1"));
q.addSelectChoice(new SelectChoice("loc: choice2", "val2", false));
if (!fep.getSelectChoices().toString().equals("[{choice1 id} => val1, loc: choice2 => val2]")) {
fail("Could not add individual select choice ID" + fep.getSelectChoices().toString());
}
//clean up
q.removeSelectChoice(q.getChoices().elementAt(0));
q.removeSelectChoice(q.getChoices().elementAt(0));
}
示例2: setUp
import org.javarosa.core.model.QuestionDef; //导入方法依赖的package包/类
@BeforeClass
public static void setUp() {
question = new QuestionDef();
question.setID(57);
OrderedHashtable oh = new OrderedHashtable();
Vector v = new Vector();
for (int i = 0; i < 3; i++) {
question.addSelectChoice(new SelectChoice("", "Selection" + i, "Selection" + i, false));
}
one = new Selection("Selection1");
one.attachChoice(question);
two = new Selection("Selection2");
two.attachChoice(question);
}
示例3: testSelectChoicesNoLocalizer
import org.javarosa.core.model.QuestionDef; //导入方法依赖的package包/类
public void testSelectChoicesNoLocalizer () {
QuestionDef q = fpi.getFirstQuestionDef();
if (q.getNumChoices() != 0) {
fail("Select choices not empty on init");
}
// fpi.getNextQuestion();
String onetext = "choice";
String twotext = "stacey's";
SelectChoice one = new SelectChoice(null,onetext, "val", false);
q.addSelectChoice(one);
SelectChoice two = new SelectChoice(null,twotext, "mom", false);
q.addSelectChoice(two);
if(!fep.getSelectChoices().toString().equals("[choice => val, stacey's => mom]")) {
fail("Could not add individual select choice"+fep.getSelectChoices().toString());
}
Object a = onetext;
Object b = fep.getSelectChoiceText(one);
assertEquals("Invalid select choice text returned",a, b);
assertEquals("Invalid select choice text returned", twotext, fep.getSelectChoiceText(two));
assertNull("Form Entry Caption incorrectly contains Image Text", fep.getSpecialFormSelectChoiceText(one, FormEntryCaption.TEXT_FORM_IMAGE));
assertNull("Form Entry Caption incorrectly contains Audio Text", fep.getSpecialFormSelectChoiceText(one, FormEntryCaption.TEXT_FORM_AUDIO));
q.removeSelectChoice(q.getChoice(0));
q.removeSelectChoice(q.getChoice(0));
}
示例4: setUp
import org.javarosa.core.model.QuestionDef; //导入方法依赖的package包/类
public void setUp() throws Exception {
super.setUp();
question = new QuestionDef();
question.setID(57);
for (int i = 0; i < 3; i++) {
question.addSelectChoice(new SelectChoice("","Selection" + i, "Selection" + i, false));
}
one = new Selection("Selection1");
one.attachChoice(question);
two = new Selection("Selection2");
two.attachChoice(question);
}
示例5: setUp
import org.javarosa.core.model.QuestionDef; //导入方法依赖的package包/类
public void setUp() throws Exception {
super.setUp();
question = new QuestionDef();
for (int i = 0; i < 4; i++) {
question.addSelectChoice(new SelectChoice("","Selection" + i, "Selection " + i, false));
}
one = new Selection("Selection 1");
one.attachChoice(question);
two = new Selection("Selection 2");
two.attachChoice(question);
three = new Selection("Selection 3");
three.attachChoice(question);
firstTwo = new ArrayList<Selection>();
firstTwo.add(one);
firstTwo.add(two);
lastTwo = new ArrayList<Selection>();
lastTwo.add(two);
lastTwo.add(three);
invalid = new ArrayList<Object>();
invalid.add(three);
invalid.add(new Integer(12));
invalid.add(one);
}
示例6: testSelectChoicesNoLocalizer
import org.javarosa.core.model.QuestionDef; //导入方法依赖的package包/类
@Test
public void testSelectChoicesNoLocalizer() {
QuestionDef q = fpi.getFirstQuestionDef();
if (q.getNumChoices() != 0) {
fail("Select choices not empty on init");
}
// fpi.getNextQuestion();
String onetext = "choice";
String twotext = "stacey's";
SelectChoice one = new SelectChoice(null, onetext, "val", false);
q.addSelectChoice(one);
SelectChoice two = new SelectChoice(null, twotext, "mom", false);
q.addSelectChoice(two);
if (!fep.getSelectChoices().toString().equals("[choice => val, stacey's => mom]")) {
fail("Could not add individual select choice" + fep.getSelectChoices().toString());
}
Object b = fep.getSelectChoiceText(one);
assertEquals("Invalid select choice text returned", onetext, b);
assertEquals("Invalid select choice text returned", twotext, fep.getSelectChoiceText(two));
assertNull("Form Entry Caption incorrectly contains Image Text", fep.getSpecialFormSelectChoiceText(one, FormEntryCaption.TEXT_FORM_IMAGE));
assertNull("Form Entry Caption incorrectly contains Audio Text", fep.getSpecialFormSelectChoiceText(one, FormEntryCaption.TEXT_FORM_AUDIO));
q.removeSelectChoice(q.getChoice(0));
q.removeSelectChoice(q.getChoice(0));
}
示例7: setUp
import org.javarosa.core.model.QuestionDef; //导入方法依赖的package包/类
@BeforeClass
public static void setUp() {
question = new QuestionDef();
for (int i = 0; i < 4; i++) {
question.addSelectChoice(new SelectChoice("", "Selection" + i, "Selection " + i, false));
}
one = new Selection("Selection 1");
one.attachChoice(question);
two = new Selection("Selection 2");
two.attachChoice(question);
three = new Selection("Selection 3");
three.attachChoice(question);
firstTwo = new Vector();
firstTwo.addElement(one);
firstTwo.addElement(two);
lastTwo = new Vector();
lastTwo.addElement(two);
lastTwo.addElement(three);
invalid = new Vector();
invalid.addElement(three);
invalid.addElement(new Integer(12));
invalid.addElement(one);
}
示例8: setUp
import org.javarosa.core.model.QuestionDef; //导入方法依赖的package包/类
@BeforeClass
public static void setUp() {
question = new QuestionDef();
for (int i = 0; i < 4; i++) {
question.addSelectChoice(new SelectChoice("", "Selection" + i, "Selection " + i, false));
}
one = new Selection("Selection 1");
one.attachChoice(question);
two = new Selection("Selection 2");
two.attachChoice(question);
three = new Selection("Selection 3");
three.attachChoice(question);
firstTwo = new Vector<>();
firstTwo.addElement(one);
firstTwo.addElement(two);
lastTwo = new Vector<>();
lastTwo.addElement(two);
lastTwo.addElement(three);
invalid = new Vector();
invalid.addElement(three);
invalid.addElement(12);
invalid.addElement(one);
}
示例9: testSelectChoiceIDsNoLocalizer
import org.javarosa.core.model.QuestionDef; //导入方法依赖的package包/类
public void testSelectChoiceIDsNoLocalizer () {
QuestionDef q = fpi.getFirstQuestionDef();
q.addSelectChoice(new SelectChoice("choice1 id", "val1"));
q.addSelectChoice(new SelectChoice("loc: choice2", "val2", false));
if (!fep.getSelectChoices().toString().equals("[{choice1 id} => val1, loc: choice2 => val2]")) {
fail("Could not add individual select choice ID"+fep.getSelectChoices().toString());
}
//clean up
q.removeSelectChoice(q.getChoices().get(0));
q.removeSelectChoice(q.getChoices().get(0));
}