• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SelectMultiData类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CustomEditorConfigurer类代码示例发布时间:2022-05-23
下一篇:
Java WriteResponse类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap