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

Java FormEntryCaption类代码示例

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

本文整理汇总了Java中org.javarosa.form.api.FormEntryCaption的典型用法代码示例。如果您正苦于以下问题:Java FormEntryCaption类的具体用法?Java FormEntryCaption怎么用?Java FormEntryCaption使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FormEntryCaption类属于org.javarosa.form.api包,在下文中一共展示了FormEntryCaption类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: parseTabGroups

import org.javarosa.form.api.FormEntryCaption; //导入依赖的package包/类
private void parseTabGroups(GroupDef tabGroupElement, FormIndex groupIndex, FormEntryCaption tabGroupCaption, String tabGroupName) {
	IFormElement element;
	String archEntType = tabGroupCaption.getFormElement().getAdditionalAttribute(null, "faims_archent_type");
	String relType = tabGroupCaption.getFormElement().getAdditionalAttribute(null, "faims_rel_type");

	String tabGroupLabel = tabGroupCaption.getQuestionText();
	String tabGroupRef = tabGroupName;
	TabGroupGenerator tabGroupGen = new TabGroupGenerator(tabGroupRef, tabGroupLabel, archEntType, relType);
	tabGroupGeneratorList.add(tabGroupGen);
	
	// descend into group
	FormIndex tabIndex = this.fem.getModel().incrementIndex(groupIndex,true);

	int tabs = tabGroupElement.getChildren().size();
	for (int i = 0; i < tabs; i++) {
		element = this.fem.getModel().getForm().getChild(tabIndex);

		if (element instanceof GroupDef) {
			parseTab(element, tabIndex, tabGroupRef, tabGroupGen);
		}

		tabIndex = this.fem.getModel().incrementIndex(tabIndex, false);
	}
}
 
开发者ID:FAIMS,项目名称:faims-android,代码行数:25,代码来源:UIRenderer.java


示例2: parseTab

import org.javarosa.form.api.FormEntryCaption; //导入依赖的package包/类
private void parseTab(IFormElement element, FormIndex tabIndex, String tabGroupRef, TabGroupGenerator tabGroupGen) {
	GroupDef tabElement = (GroupDef) element;
	FormEntryCaption tabCaption = this.fem.getModel().getCaptionPrompt(tabIndex);

	String tabName = tabCaption.getIndex().getReference().getNameLast();
	boolean faims_hidden = "true".equals(tabElement.getAdditionalAttribute(null, "faims_hidden"));
	boolean faims_scrollable = !"false".equals(tabElement.getAdditionalAttribute(null, "faims_scrollable"));
	String tabRef = tabGroupRef + "/" + tabName; 
	
	TabGenerator tabGen = new TabGenerator(tabRef, tabName, tabCaption.getQuestionText(), faims_hidden, faims_scrollable, activityRef);
	tabGroupGen.addTabGenerator(tabGen);

	// descend into group
	FormIndex containerIndex = this.fem.getModel().incrementIndex(tabIndex, true);

	for (int i = 0; i < tabElement.getChildren().size(); i++) {
		element = this.fem.getModel().getForm().getChild(containerIndex);

		if (element instanceof GroupDef) {
			parseContainer(element, containerIndex, tabRef, tabGen, null);
		} else {
			parseInput(element, containerIndex, tabRef, tabGen, null);
		}
		containerIndex = this.fem.getModel().incrementIndex(containerIndex, false);
	}
}
 
开发者ID:FAIMS,项目名称:faims-android,代码行数:27,代码来源:UIRenderer.java


示例3: parseContainer

import org.javarosa.form.api.FormEntryCaption; //导入依赖的package包/类
private void parseContainer(IFormElement element, FormIndex childIndex, String tabRef, TabGenerator tabGen, ContainerGenerator parentContainerGen) {
	GroupDef childContainerElement = (GroupDef) element;
	String style = childContainerElement.getAdditionalAttribute(null,"faims_style");
	FormEntryCaption viewCaption = this.fem.getModel().getCaptionPrompt(childIndex);
	String viewName = viewCaption.getIndex().getReference().getNameLast();
	String viewRef = parentContainerGen != null ? parentContainerGen.getRef() + "/" + viewName : tabRef + "/" + viewName;
	FormIndex inputIndex = this.fem.getModel().incrementIndex(childIndex,true);
			
	ContainerGenerator containerGen = new ContainerGenerator(viewRef, style);
	if (parentContainerGen != null) {
		parentContainerGen.addViewContainer(containerGen);
	} else {
		tabGen.addViewContainer(containerGen);
	}
	
	for (int i = 0; i < childContainerElement.getChildren().size(); i++) {
		element = this.fem.getModel().getForm().getChild(inputIndex);
		
		if (element instanceof GroupDef) {
			parseContainer(element, inputIndex, tabRef, tabGen, containerGen);
		} else {
			parseInput(element, inputIndex, tabRef, tabGen, containerGen);
		}
		inputIndex = this.fem.getModel().incrementIndex(inputIndex, false);
	}
}
 
开发者ID:FAIMS,项目名称:faims-android,代码行数:27,代码来源:UIRenderer.java


示例4: parseStyle

import org.javarosa.form.api.FormEntryCaption; //导入依赖的package包/类
private void parseStyle(GroupDef tabGroupElement, FormIndex groupIndex) {
	FormIndex tabIndex = this.fem.getModel().incrementIndex(groupIndex,true);

	int tabs = tabGroupElement.getChildren().size();
	for (int i = 0; i < tabs; i++) {
		IFormElement element = this.fem.getModel().getForm().getChild(tabIndex);
		if (element instanceof GroupDef) {
			GroupDef tabElement = (GroupDef) element;
			FormEntryCaption tabCaption = this.fem.getModel().getCaptionPrompt(tabIndex);
			String styleName = tabCaption.getIndex().getReference().getNameLast();
			FormIndex inputIndex = this.fem.getModel().incrementIndex(tabIndex, true);
			Map<String, String> attributes = new HashMap<String, String>();
			for (int j = 0; j < tabElement.getChildren().size(); j++) {
				FormEntryPrompt input = this.fem.getModel().getQuestionPrompt(inputIndex);
				String attributeName = input.getIndex().getReference().getNameLast();
				String attributeValue = input.getQuestionText();
				attributes.put(attributeName, attributeValue);
				inputIndex = this.fem.getModel().incrementIndex(inputIndex, false);
			}
			styles.put(styleName, attributes);
		}

		tabIndex = this.fem.getModel().incrementIndex(tabIndex, false);
	}
}
 
开发者ID:FAIMS,项目名称:faims-android,代码行数:26,代码来源:UIRenderer.java


示例5: indexIsInFieldList

import org.javarosa.form.api.FormEntryCaption; //导入依赖的package包/类
/**
 * Tests if the FormIndex 'index' is located inside a group that is marked as a "field-list"
 *
 * @param index
 * @return true if index is in a "field-list". False otherwise.
 */
private boolean indexIsInFieldList(FormIndex index) {
    int event = getEvent(index);
    if (event == FormEntryController.EVENT_QUESTION) {
        // caption[0..len-1]
        // caption[len-1] == the question itself
        // caption[len-2] == the first group it is contained in.
        FormEntryCaption[] captions = getCaptionHierarchy(index);
        if (captions.length < 2) {
            // no group
            return false;
        }
        FormEntryCaption grp = captions[captions.length - 2];
        return groupIsFieldList(grp.getIndex());
    } else if (event == FormEntryController.EVENT_GROUP) {
        return groupIsFieldList(index);
    } else if (event == FormEntryController.EVENT_REPEAT) {
    	return repeatIsFieldList(index);
    } else {
        // right now we only test Questions and Groups. Should we also handle
        // repeats?
        return false;
    }

}
 
开发者ID:Last-Mile-Health,项目名称:ODK-Liberia,代码行数:31,代码来源:FormController.java


示例6: getGroupsForCurrentIndex

import org.javarosa.form.api.FormEntryCaption; //导入依赖的package包/类
/**
 * Returns an array of FormEntryCaptions for current FormIndex.
 *
 * @return
 */
public FormEntryCaption[] getGroupsForCurrentIndex() {
    // return an empty array if you ask for something impossible
    if (!(getEvent() == FormEntryController.EVENT_QUESTION
            || getEvent() == FormEntryController.EVENT_PROMPT_NEW_REPEAT
            || getEvent() == FormEntryController.EVENT_GROUP
            || getEvent() == FormEntryController.EVENT_REPEAT)) {
        return new FormEntryCaption[0];
    }

    // the first caption is the question, so we skip it if it's an EVENT_QUESTION
    // otherwise, the first caption is a group so we start at index 0
    int lastquestion = 1;
    if (getEvent() == FormEntryController.EVENT_PROMPT_NEW_REPEAT
            || getEvent() == FormEntryController.EVENT_GROUP
            || getEvent() == FormEntryController.EVENT_REPEAT) {
        lastquestion = 0;
    }

    FormEntryCaption[] v = getCaptionHierarchy();
    FormEntryCaption[] groups = new FormEntryCaption[v.length - lastquestion];
    for (int i = 0; i < v.length - lastquestion; i++) {
        groups[i] = v[i];
    }
    return groups;
}
 
开发者ID:Last-Mile-Health,项目名称:ODK-Liberia,代码行数:31,代码来源:FormController.java


示例7: getHeaderText

import org.javarosa.form.api.FormEntryCaption; //导入依赖的package包/类
private String getHeaderText(FormEntryCaption[] hierachy) {
    String headertext = "";
    for (FormEntryCaption caption : hierachy) {
        String c = caption.getLongText();
        if(c != null) {
            headertext += c;

            if (caption.getIndex().getInstanceIndex() > -1) {
                headertext += " " + (caption.getMultiplicity() + 1);
            }

            headertext += ": ";
        }
    }
    if (headertext.endsWith(": "))
        headertext = headertext.substring(0, headertext.length() - 2);

    return headertext;
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:20,代码来源:FormSummaryView.java


示例8: createHeaderForElement

import org.javarosa.form.api.FormEntryCaption; //导入依赖的package包/类
private void createHeaderForElement(FormIndex questionIndex, boolean newRepeat) {
    FormEntryCaption prompt = model.getCaptionPrompt(questionIndex);

    String headerText; //decide what text form to use.

    boolean isNew = uncommittedRepeats.contains(model.decrementIndex(questionIndex)); //this is ghetto
    headerText = prompt.getRepetitionText(isNew); //droos: this doesn't feel right... should this if/else be wrapped up in the caption?
    if (headerText == null)
        headerText = prompt.getLongText();

    if(headerText != null) {
        if (newRepeat) {
            removeFrame(activeQuestionIndex);
        }

        ChatterboxWidget headerWidget = widgetFactory.getNewLabelWidget(questionIndex, headerText);
        //If there is no valid header, there's no valid header. Possibly no label.
        this.append(headerWidget);
        this.questionIndexes.add(questionIndex);
        headerWidget.setPinned(true);
    }
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:23,代码来源:Chatterbox.java


示例9: getRepeatJunctureWidget

import org.javarosa.form.api.FormEntryCaption; //导入依赖的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


示例10: getNextQuestion

import org.javarosa.form.api.FormEntryCaption; //导入依赖的package包/类
/**
 * @return the next question in the form (QuestionDef), or null if the end of the form has been reached.
 */
public QuestionDef getNextQuestion() {
    // jump to next event and check for end of form
    if (fec.stepToNextEvent() == FormEntryController.EVENT_END_OF_FORM) {
        return null;
    }

    FormEntryCaption fep = this.getFormEntryModel().getCaptionPrompt();

    do {
        if (fep.getFormElement() instanceof QuestionDef)
            return (QuestionDef)fep.getFormElement();
    } while (fec.stepToNextEvent() != FormEntryController.EVENT_END_OF_FORM);

    return null;
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:19,代码来源:FormParseInit.java


示例11: createHelpLayout

import org.javarosa.form.api.FormEntryCaption; //导入依赖的package包/类
/**
 * Build MediaLayout for displaying any help associated with given FormEntryPrompt.
 */
private MediaLayout createHelpLayout() {
    TextView text = new TextView(getContext());

    String markdownText = mPrompt.getHelpMultimedia(FormEntryCaption.TEXT_FORM_MARKDOWN);

    if (markdownText != null) {
        text.setText(forceMarkdown(markdownText));
        text.setMovementMethod(LinkMovementMethod.getInstance());
    } else {
        text.setText(mPrompt.getHelpText());
    }
    text.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mQuestionFontSize);
    int padding = (int)getResources().getDimension(R.dimen.help_text_padding);
    text.setPadding(0, 0, 0, 7);
    text.setId(38475483); // assign random id

    MediaLayout helpLayout = MediaLayout.buildAudioImageVisualLayout(getContext(), text,
            mPrompt.getHelpMultimedia(FormEntryCaption.TEXT_FORM_AUDIO),
            mPrompt.getHelpMultimedia(FormEntryCaption.TEXT_FORM_IMAGE),
            mPrompt.getHelpMultimedia(FormEntryCaption.TEXT_FORM_VIDEO),
            null);
    helpLayout.setPadding(padding, padding, padding, padding);

    return helpLayout;
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:29,代码来源:QuestionWidget.java


示例12: indexIsInFieldList

import org.javarosa.form.api.FormEntryCaption; //导入依赖的package包/类
/**
 * Tests if the FormIndex 'index' is located inside a group that is marked as a "field-list"
 * 
 * @param index
 * @return true if index is in a "field-list". False otherwise.
 */
private boolean indexIsInFieldList(FormIndex index) {
    int event = getEvent(index);
    if (event == FormEntryController.EVENT_QUESTION) {
        // caption[0..len-1]
        // caption[len-1] == the question itself
        // caption[len-2] == the first group it is contained in.
        FormEntryCaption[] captions = getCaptionHierarchy(index);
        if (captions.length < 2) {
            // no group
            return false;
        }
        FormEntryCaption grp = captions[captions.length - 2];
        return groupIsFieldList(grp.getIndex());
    } else if (event == FormEntryController.EVENT_GROUP) {
        return groupIsFieldList(index);
    } else if (event == FormEntryController.EVENT_REPEAT) {
    	return repeatIsFieldList(index);
    } else {
        // right now we only test Questions and Groups. Should we also handle
        // repeats?
        return false;
    }

}
 
开发者ID:sages-health,项目名称:sagesmobile-mCollect,代码行数:31,代码来源:FormController.java


示例13: getGroupsForCurrentIndex

import org.javarosa.form.api.FormEntryCaption; //导入依赖的package包/类
/**
 * Returns an array of FormEntryCaptions for current FormIndex.
 * 
 * @return
 */
public FormEntryCaption[] getGroupsForCurrentIndex() {
    // return an empty array if you ask for something impossible
    if (!(getEvent() == FormEntryController.EVENT_QUESTION
            || getEvent() == FormEntryController.EVENT_PROMPT_NEW_REPEAT 
            || getEvent() == FormEntryController.EVENT_GROUP
            || getEvent() == FormEntryController.EVENT_REPEAT)) {
        return new FormEntryCaption[0];
    }

    // the first caption is the question, so we skip it if it's an EVENT_QUESTION
    // otherwise, the first caption is a group so we start at index 0
    int lastquestion = 1;
    if (getEvent() == FormEntryController.EVENT_PROMPT_NEW_REPEAT
            || getEvent() == FormEntryController.EVENT_GROUP
            || getEvent() == FormEntryController.EVENT_REPEAT) {
        lastquestion = 0;
    }

    FormEntryCaption[] v = getCaptionHierarchy();
    FormEntryCaption[] groups = new FormEntryCaption[v.length - lastquestion];
    for (int i = 0; i < v.length - lastquestion; i++) {
        groups[i] = v[i];
    }
    return groups;
}
 
开发者ID:sages-health,项目名称:sagesmobile-mCollect,代码行数:31,代码来源:FormController.java


示例14: answerQuestion

import org.javarosa.form.api.FormEntryCaption; //导入依赖的package包/类
public boolean answerQuestion(QuestionDef qd, IAnswerData answer) {

		int event = controller.jumpToIndex(FormIndex.createBeginningOfFormIndex());
		do {
			FormEntryCaption fec = fem.getCaptionPrompt();
			if(fec.getFormElement() instanceof QuestionDef && ((QuestionDef) fec.getFormElement()).equals(qd)) {
				try {
					if(answer.getValue() != null && !answer.getValue().equals("null")) {
						//Log.d(LOG, "fyi answer data: " + answer.hashCode() + " (" + answer.getValue() + ")");
						controller.answerQuestion(answer);

						return controller.saveAnswer(answer);
					}
				} catch(NullPointerException e) {
					Log.d(LOG, e.toString());
					e.printStackTrace();
				}

			}

		} while((event = controller.stepToNextEvent()) != FormEntryController.EVENT_END_OF_FORM);

		return false;
	}
 
开发者ID:guardianproject,项目名称:CameraV,代码行数:25,代码来源:FormWrapper.java


示例15: parseSchema

import org.javarosa.form.api.FormEntryCaption; //导入依赖的package包/类
public void parseSchema(String path) {
fem = FileUtil.readXmlContent(path);

  	FormIndex currentIndex = fem.getModel().getFormIndex();
  	
  	IFormElement element = fem.getModel().getForm().getChild(currentIndex);
  	FormIndex groupIndex = fem.getModel().incrementIndex(currentIndex, true);
  	
  	int groups = element.getChildren().size();
  	for (int i = 0; i < groups; i++) {
  		
  		element = fem.getModel().getForm().getChild(groupIndex);
   	if (element instanceof GroupDef) {
   		
   		GroupDef tabGroupElement = (GroupDef) element;
   		FormEntryCaption tabGroupCaption = fem.getModel().getCaptionPrompt(groupIndex);
   		
   		String tabGroupName = tabGroupCaption.getIndex().getReference().getNameLast();

   		if("style".equals(tabGroupName)){
   			parseStyle(tabGroupElement, groupIndex);
   		}else{
   			parseTabGroups(tabGroupElement, groupIndex, tabGroupCaption, tabGroupName);
   		}
   	
   		groupIndex = fem.getModel().incrementIndex(groupIndex, false);
   	}
  	}
  	
  }
 
开发者ID:FAIMS,项目名称:faims-android,代码行数:31,代码来源:UIRenderer.java


示例16: addGroupText

import org.javarosa.form.api.FormEntryCaption; //导入依赖的package包/类
/**
 * // * Add a TextView containing the hierarchy of groups to which the question belongs. //
 */
private void addGroupText(FormEntryCaption[] groups) {
    StringBuilder s = new StringBuilder("");
    String t = "";
    int i;
    // list all groups in one string
    for (FormEntryCaption g : groups) {
        i = g.getMultiplicity() + 1;
        t = g.getLongText();
        if (t != null) {
            s.append(t);
            if (g.repeats() && i > 0) {
                s.append(" (" + i + ")");
            }
            s.append(" > ");
        }
    }

    // build view
    if (s.length() > 0) {
        TextView tv = new TextView(getContext());
        tv.setText(s.substring(0, s.length() - 3));
        int questionFontsize = Collect.getQuestionFontsize();
        tv.setTextSize(TypedValue.COMPLEX_UNIT_DIP, questionFontsize - 4);
        tv.setPadding(0, 0, 0, 5);
        mView.addView(tv, mLayout);
    }
}
 
开发者ID:Last-Mile-Health,项目名称:ODK-Liberia,代码行数:31,代码来源:ODKView.java


示例17: indexContainsRepeatableGroup

import org.javarosa.form.api.FormEntryCaption; //导入依赖的package包/类
/**
 * This is used to enable/disable the "Delete Repeat" menu option.
 *
 * @return
 */
public boolean indexContainsRepeatableGroup() {
    FormEntryCaption[] groups = getCaptionHierarchy();
    if (groups.length == 0) {
        return false;
    }
    for (int i = 0; i < groups.length; i++) {
        if (groups[i].repeats())
            return true;
    }
    return false;
}
 
开发者ID:Last-Mile-Health,项目名称:ODK-Liberia,代码行数:17,代码来源:FormController.java


示例18: getLastRepeatedGroupRepeatCount

import org.javarosa.form.api.FormEntryCaption; //导入依赖的package包/类
/**
 * The count of the closest group that repeats or -1.
 */
public int getLastRepeatedGroupRepeatCount() {
    FormEntryCaption[] groups = getCaptionHierarchy();
    if (groups.length > 0) {
        for (int i = groups.length - 1; i > -1; i--) {
            if (groups[i].repeats()) {
                return groups[i].getMultiplicity();

            }
        }
    }
    return -1;
}
 
开发者ID:Last-Mile-Health,项目名称:ODK-Liberia,代码行数:16,代码来源:FormController.java


示例19: getLastRepeatedGroupName

import org.javarosa.form.api.FormEntryCaption; //导入依赖的package包/类
/**
 * The name of the closest group that repeats or null.
 */
public String getLastRepeatedGroupName() {
    FormEntryCaption[] groups = getCaptionHierarchy();
    // no change
    if (groups.length > 0) {
        for (int i = groups.length - 1; i > -1; i--) {
            if (groups[i].repeats()) {
                return groups[i].getLongText();
            }
        }
    }
    return null;
}
 
开发者ID:Last-Mile-Health,项目名称:ODK-Liberia,代码行数:16,代码来源:FormController.java


示例20: getLastGroup

import org.javarosa.form.api.FormEntryCaption; //导入依赖的package包/类
/**
 * The closest group the prompt belongs to.
 *
 * @return FormEntryCaption
 */
private FormEntryCaption getLastGroup() {
    FormEntryCaption[] groups = getCaptionHierarchy();
    if (groups == null || groups.length == 0)
        return null;
    else
        return groups[groups.length - 1];
}
 
开发者ID:Last-Mile-Health,项目名称:ODK-Liberia,代码行数:13,代码来源:FormController.java



注:本文中的org.javarosa.form.api.FormEntryCaption类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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