当前位置: 首页>>代码示例>>Java>>正文


Java FormIndex.isSubElement方法代码示例

本文整理汇总了Java中org.javarosa.core.model.FormIndex.isSubElement方法的典型用法代码示例。如果您正苦于以下问题:Java FormIndex.isSubElement方法的具体用法?Java FormIndex.isSubElement怎么用?Java FormIndex.isSubElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.javarosa.core.model.FormIndex的用法示例。


在下文中一共展示了FormIndex.isSubElement方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCompoundIndices

import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
public FormIndex[] getCompoundIndices(FormIndex container) {
	//ArrayLists are a no-go for J2ME
   List<FormIndex> indices = new ArrayList<FormIndex>();
	FormIndex walker = incrementIndex(container);
	while(FormIndex.isSubElement(container, walker)) {
		if(isIndexRelevant(walker)) {
			indices.add(walker);
		}
		walker = incrementIndex(walker);
	}
	FormIndex[] array = new FormIndex[indices.size()];
	for(int i = 0 ; i < indices.size() ; ++i) {
		array[i] = indices.get(i);
	}
	return array;
}
 
开发者ID:medic,项目名称:javarosa,代码行数:17,代码来源:FormEntryModel.java

示例2: updatePins

import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
private void updatePins(FormIndex questionIndex) {
    for (int i = 0; i < this.size(); ++i) {
        FormIndex index = this.questionIndexes.get(i);
        ChatterboxWidget cw = this.getWidgetAtIndex(i);

        //First reset everything by default
        cw.setPinned(false);

        if (cw.getViewState() == ChatterboxWidget.VIEW_LABEL) {
            if (FormIndex.isSubElement(index, questionIndex)) {
                cw.setPinned(true);
            } else {
                cw.setPinned(false);
            }
        }
    }
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:18,代码来源:Chatterbox.java

示例3: getCompoundIndices

import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
public FormIndex[] getCompoundIndices(FormIndex container) {
    //ArrayLists are a no-go for J2ME
    Vector<FormIndex> indices = new Vector<FormIndex>();
    FormIndex walker = incrementIndex(container);
    while (FormIndex.isSubElement(container, walker)) {
        if (isIndexRelevant(walker)) {
            indices.addElement(walker);
        }
        walker = incrementIndex(walker);
    }
    FormIndex[] array = new FormIndex[indices.size()];
    for (int i = 0; i < indices.size(); ++i) {
        array[i] = indices.elementAt(i);
    }
    return array;
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:17,代码来源:FormEntryModel.java

示例4: isCurrentIndexSubOf

import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
private boolean isCurrentIndexSubOf(FormIndex enclosingIndex) {
    if (enclosingIndex == null) {
        return true;
    }

    FormIndex currentIndex = FormEntryActivity.mFormController.getFormIndex();
    return FormIndex.isSubElement(enclosingIndex, currentIndex);
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:9,代码来源:FormHierarchyBuilder.java

示例5: getIndexPastGroup

import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
/**
 * From the given FormIndex which must be a group element,
 * find the next index which is outside of that group.
 *
 * @return FormIndex
 */
private FormIndex getIndexPastGroup(FormIndex index) {
    // Walk until the next index is outside of this one.
    FormIndex walker = index;
    while (FormIndex.isSubElement(index, walker)) {
        walker = getNextFormIndex(walker, false);
    }
    return walker;
}
 
开发者ID:dimagi,项目名称:commcare-core,代码行数:15,代码来源:FormController.java

示例6: getQuestionPrompts

import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
/**
 * Returns an array of relevant question prompts that should be displayed as a single screen.
 * If the given form index is a question, it is returned. Otherwise if the
 * given index is a field list (and _only_ when it is a field list)
 */
public FormEntryPrompt[] getQuestionPrompts(FormIndex currentIndex) throws RuntimeException {

    IFormElement element = this.getModel().getForm().getChild(currentIndex);

    //If we're in a group, we will collect of the questions in this group
    if (element instanceof GroupDef) {
        //Assert that this is a valid condition (only field lists return prompts)
        if (!this.isHostWithAppearance(currentIndex, FIELD_LIST)) {
            throw new RuntimeException("Cannot get question prompts from a non-field-list group");
        }

        // Questions to collect
        ArrayList<FormEntryPrompt> questionList = new ArrayList<>();

        //Step over all events in this field list and collect them
        FormIndex walker = currentIndex;

        int event = this.getModel().getEvent(currentIndex);
        while (FormIndex.isSubElement(currentIndex, walker)) {
            if (event == FormEntryController.EVENT_QUESTION) {
                questionList.add(this.getModel().getQuestionPrompt(walker));
            }

            if (event == FormEntryController.EVENT_PROMPT_NEW_REPEAT) {
                //TODO: What if there is a non-deterministic repeat up in the field list?
            }

            //this handles relevance for us
            walker = this.getNextIndex(walker);
            event = this.getModel().getEvent(walker);
        }

        FormEntryPrompt[] questions = new FormEntryPrompt[questionList.size()];
        //Populate the array with the collected questions
        questionList.toArray(questions);
        return questions;
    } else {
        // We have a question, so just get the one prompt
        return new FormEntryPrompt[]{this.getModel().getQuestionPrompt(currentIndex)};
    }
}
 
开发者ID:dimagi,项目名称:commcare-core,代码行数:47,代码来源:FormEntryController.java


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