本文整理汇总了Java中org.javarosa.core.model.SelectChoice类的典型用法代码示例。如果您正苦于以下问题:Java SelectChoice类的具体用法?Java SelectChoice怎么用?Java SelectChoice使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SelectChoice类属于org.javarosa.core.model包,在下文中一共展示了SelectChoice类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onCheckedChanged
import org.javarosa.core.model.SelectChoice; //导入依赖的package包/类
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (!isChecked) {
// If it got unchecked, we don't care.
return;
}
for (RadioButton button : buttons ) {
if (button.isChecked() && !(buttonView == button)) {
button.setChecked(false);
}
}
SelectChoice choice = mItems.get((Integer)buttonView.getTag());
if ( choice != null ) {
Collect.getInstance().getActivityLogger().logInstanceAction(this, "onCheckedChanged",
choice.getValue(), mPrompt.getIndex());
} else {
Collect.getInstance().getActivityLogger().logInstanceAction(this, "onCheckedChanged",
"<no matching choice>", mPrompt.getIndex());
}
}
开发者ID:Last-Mile-Health,项目名称:ODK-Liberia,代码行数:24,代码来源:SelectOneWidget.java
示例2: getAnswer
import org.javarosa.core.model.SelectChoice; //导入依赖的package包/类
@Override
public IAnswerData getAnswer() {
clearFocus();
List<Selection> vc = new ArrayList<Selection>();
for (int i = 0; i < mItems.size(); i++) {
if (selections[i]) {
SelectChoice sc = mItems.get(i);
vc.add(new Selection(sc));
}
}
if (vc.size() == 0) {
return null;
} else {
return new SelectMultiData(vc);
}
}
开发者ID:Last-Mile-Health,项目名称:ODK-Liberia,代码行数:18,代码来源:SpinnerMultiWidget.java
示例3: getAnswer
import org.javarosa.core.model.SelectChoice; //导入依赖的package包/类
@Override
public IAnswerData getAnswer() {
List<Selection> vc = new ArrayList<Selection>();
for (int i = 0; i < mItems.size(); i++) {
if (selected[i]) {
SelectChoice sc = mItems.get(i);
vc.add(new Selection(sc));
}
}
if (vc.size() == 0) {
return null;
} else {
return new SelectMultiData(vc);
}
}
开发者ID:Last-Mile-Health,项目名称:ODK-Liberia,代码行数:17,代码来源:GridMultiWidget.java
示例4: getAnswer
import org.javarosa.core.model.SelectChoice; //导入依赖的package包/类
@Override
public IAnswerData getAnswer() {
clearFocus();
String response = autocomplete.getText().toString();
for (SelectChoice sc : mItems) {
if (response.equals(mPrompt.getSelectChoiceText(sc))) {
return new SelectOneData(new Selection(sc));
}
}
// If the user has typed text into the autocomplete box that doesn't match any answer, warn
// them that their
// solution didn't count.
if (!response.equals("")) {
Toast.makeText(getContext(),
"Warning: \"" + response + "\" does not match any answers. No answer recorded.",
Toast.LENGTH_LONG).show();
}
return null;
}
开发者ID:Last-Mile-Health,项目名称:ODK-Liberia,代码行数:21,代码来源:AutoCompleteWidget.java
示例5: writeChoices
import org.javarosa.core.model.SelectChoice; //导入依赖的package包/类
private static void writeChoices (Element e, String typeName, List<SelectChoice> choices) {
Element st = new Element();
st.setName("simpleType");
st.setAttribute(null, "name", typeName);
e.addChild(Node.ELEMENT, st);
Element restr = new Element();
restr.setName("restriction");
restr.setAttribute(null, "base", "string");
st.addChild(Node.ELEMENT, restr);
for (int i = 0; i < choices.size(); i++) {
String value = choices.get(i).getValue();
Element choice = new Element();
choice.setName("enumeration");
choice.setAttribute(null, "value", value);
restr.addChild(Node.ELEMENT, choice);
}
}
开发者ID:medic,项目名称:javarosa,代码行数:21,代码来源:InstanceSchema.java
示例6: attachChoice
import org.javarosa.core.model.SelectChoice; //导入依赖的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() + ".");
}
}
开发者ID:medic,项目名称:javarosa,代码行数:20,代码来源:Selection.java
示例7: getRepeatJunctureWidget
import org.javarosa.core.model.SelectChoice; //导入依赖的package包/类
public ChatterboxWidget getRepeatJunctureWidget (FormIndex index, FormEntryModel model, Chatterbox cbox) {
FormEntryCaption capt = model.getCaptionPrompt(index);
Vector<String> choices = capt.getRepetitionsText();
FormEntryCaption.RepeatOptions repopt = capt.getRepeatOptions();
FakedFormEntryPrompt prompt = new FakedFormEntryPrompt(repopt.header, Constants.CONTROL_SELECT_ONE, Constants.DATATYPE_TEXT);
for (int i = 0; i < choices.size(); i++) {
prompt.addSelectChoice(new SelectChoice(null, choices.elementAt(i), "rep" + i, false));
}
if (repopt.add != null) {
prompt.addSelectChoice(new SelectChoice(null, repopt.add, "new", false));
}
if (repopt.delete != null) {
prompt.addSelectChoice(new SelectChoice(null, repopt.delete, "del", false));
}
prompt.addSelectChoice(new SelectChoice(null, repopt.done, "done", false));
return new ChatterboxWidget(cbox, prompt, ChatterboxWidget.VIEW_EXPANDED, new CollapsedWidget(), new SelectOneEntryWidget(ChoiceGroup.EXCLUSIVE));
}
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:21,代码来源:ChatterboxWidgetFactory.java
示例8: question
import org.javarosa.core.model.SelectChoice; //导入依赖的package包/类
private void question(FormEntryPrompt fep) {
String text = fep.getQuestionText();
out.println(text);
Vector<SelectChoice> choices = fep.getSelectChoices();
if (choices != null) {
initSelectList(fep);
for (int i = 0; i < choices.size(); ++i) {
String prefix = "";
if (fep.getControlType() == Constants.CONTROL_SELECT_MULTI) {
prefix = "[" + (mCurrentSelectList[i] ? "X" : " ") + "] ";
}
System.out.println(prefix + (i + 1) + ") " + fep.getSelectChoiceText(choices.elementAt(i)));
}
}
if (fep.getControlType() == Constants.CONTROL_TRIGGER) {
System.out.println("Press Return to Proceed");
}
}
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:21,代码来源:XFormPlayer.java
示例9: writeChoices
import org.javarosa.core.model.SelectChoice; //导入依赖的package包/类
private static void writeChoices (Element e, String typeName, Vector<SelectChoice> choices) {
Element st = new Element();
st.setName("simpleType");
st.setAttribute(null, "name", typeName);
e.addChild(Node.ELEMENT, st);
Element restr = new Element();
restr.setName("restriction");
restr.setAttribute(null, "base", "string");
st.addChild(Node.ELEMENT, restr);
for (int i = 0; i < choices.size(); i++) {
String value = choices.elementAt(i).getValue();
Element choice = new Element();
choice.setName("enumeration");
choice.setAttribute(null, "value", value);
restr.addChild(Node.ELEMENT, choice);
}
}
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:21,代码来源:InstanceSchema.java
示例10: attachChoice
import org.javarosa.core.model.SelectChoice; //导入依赖的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() + ".");
}
}
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:20,代码来源:Selection.java
示例11: testSelectChoiceIDsNoLocalizer
import org.javarosa.core.model.SelectChoice; //导入依赖的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));
}
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:18,代码来源:TextFormTests.java
示例12: setUp
import org.javarosa.core.model.SelectChoice; //导入依赖的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);
}
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:17,代码来源:SelectOneDataTests.java
示例13: getAnswer
import org.javarosa.core.model.SelectChoice; //导入依赖的package包/类
@Override
public IAnswerData getAnswer() {
Vector<Selection> vc = new Vector<>();
for (int i = 0; i < mItems.size(); i++) {
if (selected[i]) {
SelectChoice sc = mItems.get(i);
vc.add(new Selection(sc));
}
}
if (vc.size() == 0) {
return null;
} else {
return new SelectMultiData(vc);
}
}
开发者ID:dimagi,项目名称:commcare-android,代码行数:17,代码来源:GridMultiWidget.java
示例14: attachChoice
import org.javarosa.core.model.SelectChoice; //导入依赖的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() + ".");
}
}
开发者ID:dimagi,项目名称:commcare-core,代码行数:22,代码来源:Selection.java
示例15: getAnswer
import org.javarosa.core.model.SelectChoice; //导入依赖的package包/类
@Override
public IAnswerData getAnswer() {
clearFocus();
Vector<Selection> vc = new Vector<Selection>();
for (int i = 0; i < mItems.size(); i++) {
if (selections[i]) {
SelectChoice sc = mItems.get(i);
vc.add(new Selection(sc));
}
}
if (vc.size() == 0) {
return null;
} else {
return new SelectMultiData(vc);
}
}
开发者ID:sages-health,项目名称:sagesmobile-mCollect,代码行数:18,代码来源:SpinnerMultiWidget.java
示例16: getAnswer
import org.javarosa.core.model.SelectChoice; //导入依赖的package包/类
@Override
public IAnswerData getAnswer() {
Vector<Selection> vc = new Vector<Selection>();
for (int i = 0; i < mItems.size(); i++) {
if (selected[i]) {
SelectChoice sc = mItems.get(i);
vc.add(new Selection(sc));
}
}
if (vc.size() == 0) {
return null;
} else {
return new SelectMultiData(vc);
}
}
开发者ID:sages-health,项目名称:sagesmobile-mCollect,代码行数:17,代码来源:GridMultiWidget.java
示例17: parseFromInput
import org.javarosa.core.model.SelectChoice; //导入依赖的package包/类
public static FormInputDef parseFromInput(FormEntryPrompt input) {
FormInputDef inputDef = new FormInputDef();
inputDef.controlType = input.getControlType();
inputDef.dataType = input.getDataType();
inputDef.questionText = input.getQuestionText();
inputDef.questionType = input.getQuestion().getAdditionalAttribute(null, "type");
inputDef.questionAppearance = input.getQuestion().getAppearanceAttr();
inputDef.map = "true".equalsIgnoreCase(input.getQuestion().getAdditionalAttribute(null, "faims_map"));
inputDef.table = "true".equalsIgnoreCase(input.getQuestion().getAdditionalAttribute(null, "faims_table"));
inputDef.web = "true".equalsIgnoreCase(input.getQuestion().getAdditionalAttribute(null, "faims_web"));
inputDef.sync = "true".equalsIgnoreCase(input.getQuestion().getAdditionalAttribute(null, "faims_sync"));
inputDef.name = input.getQuestion().getAdditionalAttribute(null, "faims_attribute_name");
inputDef.type = input.getQuestion().getAdditionalAttribute(null, "faims_attribute_type");
inputDef.styleClass = input.getQuestion().getAdditionalAttribute(null, "faims_style_class");
if (inputDef.type == null) inputDef.type = Attribute.FREETEXT;
inputDef.certainty = !"false".equalsIgnoreCase(input.getQuestion().getAdditionalAttribute(null, "faims_certainty"));
inputDef.annotation = !"false".equalsIgnoreCase(input.getQuestion().getAdditionalAttribute(null, "faims_annotation"));
inputDef.info = !"false".equalsIgnoreCase(input.getQuestion().getAdditionalAttribute(null, "faims_info"));
inputDef.readOnly = "true".equalsIgnoreCase(input.getQuestion().getAdditionalAttribute(null, "faims_read_only"));
inputDef.htmlDescription = "true".equalsIgnoreCase(input.getQuestion().getAdditionalAttribute(null, "faims_html_description"));
Vector<SelectChoice> choices = input.getSelectChoices();
if (choices != null) {
ArrayList<NameValuePair> pairs = new ArrayList<NameValuePair>();
for (SelectChoice choice : choices) {
pairs.add(new NameValuePair(choice.getLabelInnerText(), choice.getValue()));
}
inputDef.selectChoices = pairs;
}
return inputDef;
}
开发者ID:FAIMS,项目名称:faims-android,代码行数:37,代码来源:FormInputDef.java
示例18: getAnswer
import org.javarosa.core.model.SelectChoice; //导入依赖的package包/类
@Override
public IAnswerData getAnswer() {
int i = getCheckedId();
if (i == -1) {
return null;
} else {
SelectChoice sc = mItems.get(i);
return new SelectOneData(new Selection(sc));
}
}
开发者ID:Last-Mile-Health,项目名称:ODK-Liberia,代码行数:11,代码来源:ListWidget.java
示例19: getAnswer
import org.javarosa.core.model.SelectChoice; //导入依赖的package包/类
@Override
public IAnswerData getAnswer() {
int i = getCheckedId();
if (i == -1) {
return null;
} else {
SelectChoice sc = mItems.get(i);
return new SelectOneData(new Selection(sc));
}
}
开发者ID:Last-Mile-Health,项目名称:ODK-Liberia,代码行数:11,代码来源:SelectOneWidget.java
示例20: getAnswer
import org.javarosa.core.model.SelectChoice; //导入依赖的package包/类
@Override
public IAnswerData getAnswer() {
for (int i = 0; i < choices.length; ++i) {
if (selected[i]) {
SelectChoice sc = mItems.get(i);
return new SelectOneData(new Selection(sc));
}
}
return null;
}
开发者ID:Last-Mile-Health,项目名称:ODK-Liberia,代码行数:11,代码来源:GridWidget.java
注:本文中的org.javarosa.core.model.SelectChoice类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论