本文整理汇总了Java中org.javarosa.core.model.QuestionDef.setHelpTextID方法的典型用法代码示例。如果您正苦于以下问题:Java QuestionDef.setHelpTextID方法的具体用法?Java QuestionDef.setHelpTextID怎么用?Java QuestionDef.setHelpTextID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.javarosa.core.model.QuestionDef
的用法示例。
在下文中一共展示了QuestionDef.setHelpTextID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseHint
import org.javarosa.core.model.QuestionDef; //导入方法依赖的package包/类
private void parseHint (QuestionDef q, Element e) {
List<String> usedAtts = new ArrayList<String>();
usedAtts.add(REF_ATTR);
String hint = getXMLText(e, true);
String hintInnerText = getLabel(e);
String ref = e.getAttributeValue("", REF_ATTR);
if (ref != null) {
if (ref.startsWith(ITEXT_OPEN) && ref.endsWith(ITEXT_CLOSE)) {
String textRef = ref.substring(ITEXT_OPEN.length(), ref.indexOf(ITEXT_CLOSE));
verifyTextMappings(textRef, "<hint>", false);
q.setHelpTextID(textRef);
} else {
throw new RuntimeException("malformed ref [" + ref + "] for <hint>");
}
} else {
q.setHelpInnerText(hintInnerText);
q.setHelpText(hint);
}
if(XFormUtils.showUnusedAttributeWarning(e, usedAtts)){
reporter.warning(XFormParserReporter.TYPE_UNKNOWN_MARKUP, XFormUtils.unusedAttWarning(e, usedAtts), getVagueLocation(e));
}
}
示例2: testPromptsWithLocalizer
import org.javarosa.core.model.QuestionDef; //导入方法依赖的package包/类
public void testPromptsWithLocalizer () {
Localizer l = new Localizer();
TableLocaleSource table = new TableLocaleSource();
l.addAvailableLocale("locale");
l.setDefaultLocale("locale");
table.setLocaleMapping("prompt;long", "loc: long text");
table.setLocaleMapping("prompt;short", "loc: short text");
table.setLocaleMapping("help", "loc: help text");
l.registerLocaleResource("locale", table);
l.setLocale("locale");
QuestionDef q = new QuestionDef();
q.setHelpTextID("help");
FormEntryPrompt fep = new DummyFormEntryPrompt(l,"prompt",q);
if (!"loc: long text".equals(fep.getLongText())) {
fail("Long text did not localize properly");
}
if (!"loc: short text".equals(fep.getShortText())){
fail("Short text did not localize properly");
}
}
示例3: testPromptIDsNoLocalizer
import org.javarosa.core.model.QuestionDef; //导入方法依赖的package包/类
public void testPromptIDsNoLocalizer () {
QuestionDef q = new QuestionDef();
q.setTextID("long text id");
if (!"long text id".equals(q.getTextID())) {
fail("Long text ID getter/setter broken");
}
q.setHelpTextID("help text id");
if (!"help text id".equals(q.getHelpTextID()) || q.getHelpText() != null) {
fail("Help text ID getter/setter broken");
}
}