本文整理汇总了Java中org.javarosa.core.model.data.SelectMultiData类的典型用法代码示例。如果您正苦于以下问题:Java SelectMultiData类的具体用法?Java SelectMultiData怎么用?Java SelectMultiData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SelectMultiData类属于org.javarosa.core.model.data包,在下文中一共展示了SelectMultiData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getAnswer
import org.javarosa.core.model.data.SelectMultiData; //导入依赖的package包/类
@Override
public IAnswerData getAnswer() {
List<Selection> vc = new ArrayList<Selection>();
for (int i = 0; i < mCheckboxes.size(); i++) {
CheckBox c = mCheckboxes.get(i);
if (c.isChecked()) {
vc.add(new Selection(mItems.get(i)));
}
}
if (vc.size() == 0) {
return null;
} else {
return new SelectMultiData(vc);
}
}
开发者ID:Last-Mile-Health,项目名称:ODK-Liberia,代码行数:18,代码来源:ListMultiWidget.java
示例2: getAnswer
import org.javarosa.core.model.data.SelectMultiData; //导入依赖的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.data.SelectMultiData; //导入依赖的package包/类
@Override
public IAnswerData getAnswer() {
List<Selection> vc = new ArrayList<Selection>();
for ( int i = 0; i < mCheckboxes.size() ; ++i ) {
CheckBox c = mCheckboxes.get(i);
if ( c.isChecked() ) {
vc.add(new Selection(mItems.get(i)));
}
}
if (vc.size() == 0) {
return null;
} else {
return new SelectMultiData(vc);
}
}
开发者ID:Last-Mile-Health,项目名称:ODK-Liberia,代码行数:18,代码来源:SelectMultiWidget.java
示例4: getAnswer
import org.javarosa.core.model.data.SelectMultiData; //导入依赖的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
示例5: classForDataType
import org.javarosa.core.model.data.SelectMultiData; //导入依赖的package包/类
/**
* map xforms data types to the Class that represents that data in a FormInstance
* @param dataType
* @return
*/
public static Class classForDataType (int dataType) {
switch (dataType) {
case Constants.DATATYPE_NULL: return StringData.class;
case Constants.DATATYPE_TEXT: return StringData.class;
case Constants.DATATYPE_INTEGER: return IntegerData.class;
case Constants.DATATYPE_LONG: return LongData.class;
case Constants.DATATYPE_DECIMAL: return DecimalData.class;
case Constants.DATATYPE_BOOLEAN: return BooleanData.class;
case Constants.DATATYPE_DATE: return DateData.class;
case Constants.DATATYPE_TIME: return TimeData.class;
case Constants.DATATYPE_DATE_TIME: return DateTimeData.class;
case Constants.DATATYPE_CHOICE: return SelectOneData.class;
case Constants.DATATYPE_CHOICE_LIST: return SelectMultiData.class;
case Constants.DATATYPE_GEOPOINT: return GeoPointData.class;
case Constants.DATATYPE_GEOSHAPE: return GeoShapeData.class;
case Constants.DATATYPE_GEOTRACE: return GeoTraceData.class;
default: return null;
}
}
开发者ID:medic,项目名称:javarosa,代码行数:25,代码来源:CompactInstanceWrapper.java
示例6: wrapIndeterminedObject
import org.javarosa.core.model.data.SelectMultiData; //导入依赖的package包/类
/**
* Note: This method is a hack to fix the problem that we don't know what
* data type we're using when we have a preloader. That should get fixed,
* and this method should be removed.
* @param o
* @return
*/
public static IAnswerData wrapIndeterminedObject(Object o) {
if(o == null) {
return null;
}
//TODO: Replace this all with an uncast data
if(o instanceof String) {
return new StringData((String)o);
} else if(o instanceof Date) {
return new DateData((Date)o);
} else if (o instanceof Integer) {
return new IntegerData((Integer)o);
} else if (o instanceof Long) {
return new LongData((Long)o);
} else if (o instanceof Double) {
return new DecimalData((Double)o);
} else if(o instanceof List) {
return new SelectMultiData((List<Selection>)o);
} else if(o instanceof IAnswerData) {
return (IAnswerData)o;
}
return new StringData(o.toString());
}
开发者ID:medic,项目名称:javarosa,代码行数:31,代码来源:PreloadUtils.java
示例7: getDataType
import org.javarosa.core.model.data.SelectMultiData; //导入依赖的package包/类
public static int getDataType (Object o) {
int dataType = -1;
if (o instanceof String) {
dataType = Constants.DATATYPE_TEXT;
} else if (o instanceof Integer) {
dataType = Constants.DATATYPE_INTEGER;
} else if (o instanceof Long) {
dataType = Constants.DATATYPE_LONG;
} else if (o instanceof Float || o instanceof Double) {
dataType = Constants.DATATYPE_DECIMAL;
} else if (o instanceof Date) {
dataType = Constants.DATATYPE_DATE;
} else if (o instanceof Boolean) {
dataType = Constants.DATATYPE_BOOLEAN; //booleans are serialized as a literal 't'/'f'
} else if (o instanceof SelectMultiData) {
dataType = Constants.DATATYPE_CHOICE_LIST;
}
return dataType;
}
开发者ID:medic,项目名称:javarosa,代码行数:20,代码来源:RestoreUtils.java
示例8: testVectorImmutability
import org.javarosa.core.model.data.SelectMultiData; //导入依赖的package包/类
public void testVectorImmutability() {
SelectMultiData data = new SelectMultiData(firstTwo);
Selection[] copy = new Selection[firstTwo.size()];
firstTwo.toArray(copy);
firstTwo.set(0, two);
firstTwo.remove(1);
List<Selection> internal = (List<Selection>)data.getValue();
assertVectorIdentity("External Reference: ", internal, copy);
data.setValue(lastTwo);
List<Selection> start = (List<Selection>)data.getValue();
Selection[] external = new Selection[start.size()];
start.toArray(external);
start.remove(1);
start.set(0, one);
assertVectorIdentity("Internal Reference: ", (List<Selection>)data.getValue(), external);
}
开发者ID:medic,项目名称:javarosa,代码行数:23,代码来源:SelectMultiDataTests.java
示例9: wrapIndeterminedObject
import org.javarosa.core.model.data.SelectMultiData; //导入依赖的package包/类
/**
* Note: This method is a hack to fix the problem that we don't know what
* data type we're using when we have a preloader. That should get fixed,
* and this method should be removed.
*/
public static IAnswerData wrapIndeterminedObject(Object o) {
if (o == null) {
return null;
}
//TODO: Replace this all with an uncast data
if (o instanceof String) {
return new StringData((String)o);
} else if (o instanceof Date) {
return new DateData((Date)o);
} else if (o instanceof Integer) {
return new IntegerData((Integer)o);
} else if (o instanceof Long) {
return new LongData((Long)o);
} else if (o instanceof Double) {
return new DecimalData((Double)o);
} else if (o instanceof Vector) {
return new SelectMultiData((Vector)o);
} else if (o instanceof IAnswerData) {
return (IAnswerData)o;
}
return new StringData(o.toString());
}
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:29,代码来源:PreloadUtils.java
示例10: serializeAnswerData
import org.javarosa.core.model.data.SelectMultiData; //导入依赖的package包/类
/**
* @param data The AnswerDataObject to be serialized
* @return A string containing the xforms compliant format
* for a <select> tag, a string containing a list of answers
* separated by space characters.
*/
public Object serializeAnswerData(SelectMultiData data) {
Vector selections = (Vector)data.getValue();
Enumeration en = selections.elements();
StringBuffer selectString = new StringBuffer();
while (en.hasMoreElements()) {
Selection selection = (Selection)en.nextElement();
if (selectString.length() > 0)
selectString.append(DELIMITER);
selectString.append(selection.getValue());
}
//As Crazy, and stupid, as it sounds, this is the XForms specification
//for storing multiple selections.
return selectString.toString();
}
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:22,代码来源:XFormAnswerDataSerializer.java
示例11: testVectorImmutability
import org.javarosa.core.model.data.SelectMultiData; //导入依赖的package包/类
@Test
public void testVectorImmutability() {
SelectMultiData data = new SelectMultiData(firstTwo);
Selection[] copy = new Selection[firstTwo.size()];
firstTwo.copyInto(copy);
firstTwo.setElementAt(two, 0);
firstTwo.removeElementAt(1);
Vector internal = (Vector)data.getValue();
assertVectorIdentity("External Reference: ", internal, copy);
data.setValue(lastTwo);
Vector start = (Vector)data.getValue();
Selection[] external = new Selection[start.size()];
start.copyInto(external);
start.removeElementAt(1);
start.setElementAt(one, 0);
assertVectorIdentity("Internal Reference: ", (Vector)data.getValue(), external);
}
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:24,代码来源:SelectMultiDataTests.java
示例12: getAnswer
import org.javarosa.core.model.data.SelectMultiData; //导入依赖的package包/类
@Override
public IAnswerData getAnswer() {
Vector<Selection> vc = new Vector<>();
for (int i = 0; i < mItems.size(); i++) {
CheckBox c = ((CheckBox)findViewById(CHECKBOX_ID + i));
if (c.isChecked()) {
vc.add(new Selection(mItems.get(i)));
}
}
if (vc.size() == 0) {
return null;
} else {
return new SelectMultiData(vc);
}
}
开发者ID:dimagi,项目名称:commcare-android,代码行数:19,代码来源:ListMultiWidget.java
示例13: getAnswer
import org.javarosa.core.model.data.SelectMultiData; //导入依赖的package包/类
@Override
public IAnswerData getAnswer() {
Vector<Selection> vc = new Vector<>();
for (int i = 0; i < mItems.size(); i++) {
CheckBox c = ((CheckBox)findViewById(buttonIdBase + i));
if (c.isChecked()) {
vc.add(new Selection(mItems.get(i)));
}
}
if (vc.size() == 0) {
return null;
} else {
return new SelectMultiData(vc);
}
}
开发者ID:dimagi,项目名称:commcare-android,代码行数:17,代码来源:SelectMultiWidget.java
示例14: getAnswer
import org.javarosa.core.model.data.SelectMultiData; //导入依赖的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
示例15: testVectorImmutability
import org.javarosa.core.model.data.SelectMultiData; //导入依赖的package包/类
@Test
public void testVectorImmutability() {
SelectMultiData data = new SelectMultiData(firstTwo);
Selection[] copy = new Selection[firstTwo.size()];
firstTwo.copyInto(copy);
firstTwo.setElementAt(two, 0);
firstTwo.removeElementAt(1);
Vector internal = (Vector)data.getValue();
assertVectorIdentity("External Reference: ", internal, copy);
data.setValue(lastTwo);
Vector<Selection> start = data.getValue();
Selection[] external = new Selection[start.size()];
start.copyInto(external);
start.removeElementAt(1);
start.setElementAt(one, 0);
assertVectorIdentity("Internal Reference: ", (Vector)data.getValue(), external);
}
开发者ID:dimagi,项目名称:commcare-core,代码行数:24,代码来源:SelectMultiDataTests.java
示例16: getAnswer
import org.javarosa.core.model.data.SelectMultiData; //导入依赖的package包/类
@Override
public IAnswerData getAnswer() {
Vector<Selection> vc = new Vector<Selection>();
for (int i = 0; i < mCheckboxes.size(); i++) {
CheckBox c = mCheckboxes.get(i);
if (c.isChecked()) {
vc.add(new Selection(mItems.get(i)));
}
}
if (vc.size() == 0) {
return null;
} else {
return new SelectMultiData(vc);
}
}
开发者ID:sages-health,项目名称:sagesmobile-mCollect,代码行数:18,代码来源:ListMultiWidget.java
示例17: getAnswer
import org.javarosa.core.model.data.SelectMultiData; //导入依赖的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
示例18: getAnswer
import org.javarosa.core.model.data.SelectMultiData; //导入依赖的package包/类
@Override
public IAnswerData getAnswer() {
Vector<Selection> vc = new Vector<Selection>();
for ( int i = 0; i < mCheckboxes.size() ; ++i ) {
CheckBox c = mCheckboxes.get(i);
if ( c.isChecked() ) {
vc.add(new Selection(mItems.get(i)));
}
}
if (vc.size() == 0) {
return null;
} else {
return new SelectMultiData(vc);
}
}
开发者ID:sages-health,项目名称:sagesmobile-mCollect,代码行数:18,代码来源:SelectMultiWidget.java
示例19: getAnswer
import org.javarosa.core.model.data.SelectMultiData; //导入依赖的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
示例20: unpackValue
import org.javarosa.core.model.data.SelectMultiData; //导入依赖的package包/类
public static Object unpackValue (IAnswerData val) {
if (val == null) {
return "";
} else if (val instanceof UncastData) {
return val.getValue();
} else if (val instanceof IntegerData) {
return new Double(((Integer)val.getValue()).doubleValue());
} else if (val instanceof LongData) {
return new Double(((Long)val.getValue()).doubleValue());
} else if (val instanceof DecimalData) {
return val.getValue();
} else if (val instanceof StringData) {
return val.getValue();
} else if (val instanceof SelectOneData) {
return ((Selection)val.getValue()).getValue();
} else if (val instanceof SelectMultiData) {
return (new XFormAnswerDataSerializer()).serializeAnswerData(val);
} else if (val instanceof DateData) {
return val.getValue();
} else if (val instanceof BooleanData) {
return val.getValue();
} else if (val instanceof GeoPointData) {
// we have no access fns that interact with double[4] arrays (the getValue() data type)...
return val.getDisplayText();
} else if (val instanceof GeoShapeData) {
// we have no access fns that interact with GeoShape objects (the getValue() data type)...
return val.getDisplayText();
} else if (val instanceof GeoTraceData) {
// we have no access fns that interact with GeoTrace objects (the getValue() data type)...
return val.getDisplayText();
} else {
System.out.println("warning: unrecognized data type in xpath expr: " + val.getClass().getName());
return val.getValue(); //is this a good idea?
}
}
开发者ID:medic,项目名称:javarosa,代码行数:36,代码来源:XPathPathExpr.java
注:本文中的org.javarosa.core.model.data.SelectMultiData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论