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


Java FormIndex.isBeginningOfFormIndex方法代码示例

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


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

示例1: isIndexReadonly

import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
/**
 * @param index
 * @return true if the element at the specified index is read only
 */
public boolean isIndexReadonly(FormIndex index) {
    if (index.isBeginningOfFormIndex() || index.isEndOfFormIndex())
        return true;

    TreeReference ref = form.getChildInstanceRef(index);
    boolean isAskNewRepeat = (getEvent(index) == FormEntryController.EVENT_PROMPT_NEW_REPEAT ||
    						  getEvent(index) == FormEntryController.EVENT_REPEAT_JUNCTURE);

    if (isAskNewRepeat) {
        return false;
    } else {
        TreeElement node = form.getMainInstance().resolveReference(ref);
        return !node.isEnabled();
    }
}
 
开发者ID:medic,项目名称:javarosa,代码行数:20,代码来源:FormEntryModel.java

示例2: incrementIndex

import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
public FormIndex incrementIndex(FormIndex index, boolean descend) {
     List<Integer> indexes = new ArrayList<Integer>();
     List<Integer> multiplicities = new ArrayList<Integer>();
     List<IFormElement> elements = new ArrayList<IFormElement>();

	if (index.isEndOfFormIndex()) {
		return index;
	} else if (index.isBeginningOfFormIndex()) {
		if (form.getChildren() == null || form.getChildren().size() == 0) {
			return FormIndex.createEndOfFormIndex();
		}
	} else {
		form.collapseIndex(index, indexes, multiplicities, elements);
	}

	incrementHelper(indexes, multiplicities, elements, descend);

	if (indexes.size() == 0) {
		return FormIndex.createEndOfFormIndex();
	} else {
		return form.buildIndex(indexes, multiplicities, elements);
	}
}
 
开发者ID:medic,项目名称:javarosa,代码行数:24,代码来源:FormEntryModel.java

示例3: decrementIndex

import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
public FormIndex decrementIndex(FormIndex index) {
     List<Integer> indexes = new ArrayList<Integer>();
     List<Integer> multiplicities = new ArrayList<Integer>();
     List<IFormElement> elements = new ArrayList<IFormElement>();

	if (index.isBeginningOfFormIndex()) {
		return index;
	} else if (index.isEndOfFormIndex()) {
		if (form.getChildren() == null || form.getChildren().size() == 0) {
			return FormIndex.createBeginningOfFormIndex();
		}
	} else {
		form.collapseIndex(index, indexes, multiplicities, elements);
	}

	decrementHelper(indexes, multiplicities, elements);

	if (indexes.size() == 0) {
		return FormIndex.createBeginningOfFormIndex();
	} else {
		return form.buildIndex(indexes, multiplicities, elements);
	}
}
 
开发者ID:medic,项目名称:javarosa,代码行数:24,代码来源:FormEntryModel.java

示例4: isIndexReadonly

import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
/**
 * @return true if the element at the specified index is read only
 */
public boolean isIndexReadonly(FormIndex index) {
    if (index.isBeginningOfFormIndex() || index.isEndOfFormIndex())
        return true;

    TreeReference ref = form.getChildInstanceRef(index);
    boolean isAskNewRepeat = (getEvent(index) == FormEntryController.EVENT_PROMPT_NEW_REPEAT ||
            getEvent(index) == FormEntryController.EVENT_REPEAT_JUNCTURE);

    if (isAskNewRepeat) {
        return false;
    } else {
        TreeElement node = form.getMainInstance().resolveReference(ref);
        return !node.isEnabled();
    }
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:19,代码来源:FormEntryModel.java

示例5: incrementIndex

import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
public FormIndex incrementIndex(FormIndex index, boolean descend) {
    Vector indexes = new Vector();
    Vector multiplicities = new Vector();
    Vector elements = new Vector();

    if (index.isEndOfFormIndex()) {
        return index;
    } else if (index.isBeginningOfFormIndex()) {
        if (form.getChildren() == null || form.getChildren().size() == 0) {
            return FormIndex.createEndOfFormIndex();
        }
    } else {
        form.collapseIndex(index, indexes, multiplicities, elements);
    }

    incrementHelper(indexes, multiplicities, elements, descend);

    if (indexes.size() == 0) {
        return FormIndex.createEndOfFormIndex();
    } else {
        return form.buildIndex(indexes, multiplicities, elements);
    }
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:24,代码来源:FormEntryModel.java

示例6: decrementIndex

import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
public FormIndex decrementIndex(FormIndex index) {
    Vector indexes = new Vector();
    Vector multiplicities = new Vector();
    Vector elements = new Vector();

    if (index.isBeginningOfFormIndex()) {
        return index;
    } else if (index.isEndOfFormIndex()) {
        if (form.getChildren() == null || form.getChildren().size() == 0) {
            return FormIndex.createBeginningOfFormIndex();
        }
    } else {
        form.collapseIndex(index, indexes, multiplicities, elements);
    }

    decrementHelper(indexes, multiplicities, elements);

    if (indexes.size() == 0) {
        return FormIndex.createBeginningOfFormIndex();
    } else {
        return form.buildIndex(indexes, multiplicities, elements);
    }
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:24,代码来源:FormEntryModel.java

示例7: getEvent

import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
/**
 * Given a FormIndex, returns the event this FormIndex represents.
 *
 * @see FormEntryController
 */
public int getEvent(FormIndex index) {
    if (index.isBeginningOfFormIndex()) {
        return FormEntryController.EVENT_BEGINNING_OF_FORM;
    } else if (index.isEndOfFormIndex()) {
        return FormEntryController.EVENT_END_OF_FORM;
    }

    IFormElement element = form.getChild(index);
    if (element instanceof GroupDef) {
        if (((GroupDef)element).isRepeat()) {
            if (repeatStructure != REPEAT_STRUCTURE_NON_LINEAR && form.getMainInstance().resolveReference(form.getChildInstanceRef(index)) == null) {
                return FormEntryController.EVENT_PROMPT_NEW_REPEAT;
            } else if (repeatStructure == REPEAT_STRUCTURE_NON_LINEAR && index.getElementMultiplicity() == TreeReference.INDEX_REPEAT_JUNCTURE) {
                return FormEntryController.EVENT_REPEAT_JUNCTURE;
            } else {
                return FormEntryController.EVENT_REPEAT;
            }
        } else {
            return FormEntryController.EVENT_GROUP;
        }
    } else {
        return FormEntryController.EVENT_QUESTION;
    }
}
 
开发者ID:dimagi,项目名称:commcare-core,代码行数:30,代码来源:FormEntryModel.java

示例8: incrementIndex

import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
public FormIndex incrementIndex(FormIndex index, boolean descend) {
    Vector<Integer> indexes = new Vector<>();
    Vector<Integer> multiplicities = new Vector<>();
    Vector<IFormElement> elements = new Vector<>();

    if (index.isEndOfFormIndex()) {
        return index;
    } else if (index.isBeginningOfFormIndex()) {
        if (form.getChildren() == null || form.getChildren().size() == 0) {
            return FormIndex.createEndOfFormIndex();
        }
    } else {
        form.collapseIndex(index, indexes, multiplicities, elements);
    }

    incrementHelper(indexes, multiplicities, elements, descend);

    if (indexes.size() == 0) {
        return FormIndex.createEndOfFormIndex();
    } else {
        return form.buildIndex(indexes, multiplicities, elements);
    }
}
 
开发者ID:dimagi,项目名称:commcare-core,代码行数:24,代码来源:FormEntryModel.java

示例9: decrementIndex

import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
public FormIndex decrementIndex(FormIndex index) {
    Vector<Integer> indexes = new Vector<>();
    Vector<Integer> multiplicities = new Vector<>();
    Vector<IFormElement> elements = new Vector<>();

    if (index.isBeginningOfFormIndex()) {
        return index;
    } else if (index.isEndOfFormIndex()) {
        if (form.getChildren() == null || form.getChildren().size() == 0) {
            return FormIndex.createBeginningOfFormIndex();
        }
    } else {
        form.collapseIndex(index, indexes, multiplicities, elements);
    }

    decrementHelper(indexes, multiplicities, elements);

    if (indexes.size() == 0) {
        return FormIndex.createBeginningOfFormIndex();
    } else {
        return form.buildIndex(indexes, multiplicities, elements);
    }
}
 
开发者ID:dimagi,项目名称:commcare-core,代码行数:24,代码来源:FormEntryModel.java

示例10: getEvent

import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
/**
 * Given a FormIndex, returns the event this FormIndex represents.
 *
 * @see FormEntryController
 */
public int getEvent(FormIndex index) {
    if (index.isBeginningOfFormIndex()) {
        return FormEntryController.EVENT_BEGINNING_OF_FORM;
    } else if (index.isEndOfFormIndex()) {
        return FormEntryController.EVENT_END_OF_FORM;
    }

    // This came from chatterbox, and is unclear how correct it is,
    // commented out for now.
    // DELETEME: If things work fine
    // List defs = form.explodeIndex(index);
    // IFormElement last = (defs.size() == 0 ? null : (IFormElement)
    // defs.lastElement());
    IFormElement element = form.getChild(index);
    if (element instanceof GroupDef) {
        if (((GroupDef) element).getRepeat()) {
            if (repeatStructure != REPEAT_STRUCTURE_NON_LINEAR && form.getMainInstance().resolveReference(form.getChildInstanceRef(index)) == null) {
                return FormEntryController.EVENT_PROMPT_NEW_REPEAT;
            } else if (repeatStructure == REPEAT_STRUCTURE_NON_LINEAR && index.getElementMultiplicity() == TreeReference.INDEX_REPEAT_JUNCTURE) {
            	return FormEntryController.EVENT_REPEAT_JUNCTURE;
            } else {
                return FormEntryController.EVENT_REPEAT;
            }
        } else {
            return FormEntryController.EVENT_GROUP;
        }
    } else {
        return FormEntryController.EVENT_QUESTION;
    }
}
 
开发者ID:medic,项目名称:javarosa,代码行数:36,代码来源:FormEntryModel.java

示例11: getEvent

import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
/**
 * Given a FormIndex, returns the event this FormIndex represents.
 *
 * @see FormEntryController
 */
public int getEvent(FormIndex index) {
    if (index.isBeginningOfFormIndex()) {
        return FormEntryController.EVENT_BEGINNING_OF_FORM;
    } else if (index.isEndOfFormIndex()) {
        return FormEntryController.EVENT_END_OF_FORM;
    }

    // This came from chatterbox, and is unclear how correct it is,
    // commented out for now.
    // DELETEME: If things work fine
    // Vector defs = form.explodeIndex(index);
    // IFormElement last = (defs.size() == 0 ? null : (IFormElement)
    // defs.lastElement());
    IFormElement element = form.getChild(index);
    if (element instanceof GroupDef) {
        if (((GroupDef)element).getRepeat()) {
            if (repeatStructure != REPEAT_STRUCTURE_NON_LINEAR && form.getMainInstance().resolveReference(form.getChildInstanceRef(index)) == null) {
                return FormEntryController.EVENT_PROMPT_NEW_REPEAT;
            } else if (repeatStructure == REPEAT_STRUCTURE_NON_LINEAR && index.getElementMultiplicity() == TreeReference.INDEX_REPEAT_JUNCTURE) {
                return FormEntryController.EVENT_REPEAT_JUNCTURE;
            } else {
                return FormEntryController.EVENT_REPEAT;
            }
        } else {
            return FormEntryController.EVENT_GROUP;
        }
    } else {
        return FormEntryController.EVENT_QUESTION;
    }
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:36,代码来源:FormEntryModel.java

示例12: showPreviousView

import org.javarosa.core.model.FormIndex; //导入方法依赖的package包/类
/**
 * Determines what should be displayed between a question, or the start screen and displays the
 * appropriate view. Also saves answers to the data model without checking constraints.
 */
protected void showPreviousView(boolean showSwipeAnimation) {
    if (shouldIgnoreNavigationAction()) {
        return;
    }

    // The answer is saved on a back swipe, but question constraints are ignored.
    if (activity.currentPromptIsQuestion()) {
        activity.saveAnswersForCurrentScreen(FormEntryConstants.DO_NOT_EVALUATE_CONSTRAINTS);
    }

    // Any info stored about the last changed widget is useless when we move to a new view
    resetLastChangedWidget();

    FormIndex startIndex = FormEntryActivity.mFormController.getFormIndex();
    FormIndex lastValidIndex = startIndex;

    if (FormEntryActivity.mFormController.getEvent() != FormEntryController.EVENT_BEGINNING_OF_FORM) {
        int event = FormEntryActivity.mFormController.stepToPreviousEvent();

        //Step backwards until we either find a question, the beginning of the form,
        //or a field list with valid questions inside
        while (event != FormEntryController.EVENT_BEGINNING_OF_FORM
                && event != FormEntryController.EVENT_QUESTION
                && !(event == FormEntryController.EVENT_GROUP
                && FormEntryActivity.mFormController.indexIsInFieldList() && FormEntryActivity.mFormController
                .getQuestionPrompts().length != 0)) {
            event = FormEntryActivity.mFormController.stepToPreviousEvent();
            lastValidIndex = FormEntryActivity.mFormController.getFormIndex();
        }

        if (event == FormEntryController.EVENT_BEGINNING_OF_FORM) {
            // we can't go all the way back to the beginning, so we've
            // gotta hit the last index that was valid
            FormEntryActivity.mFormController.jumpToIndex(lastValidIndex);

            //Did we jump at all? (not sure how we could have, but there might be a mismatch)
            if (lastValidIndex.equals(startIndex)) {
                //If not, don't even bother changing the view. 
                //NOTE: This needs to be the same as the
                //exit condition below, in case either changes
                activity.triggerUserQuitInput();
            } else if (lastValidIndex.isBeginningOfFormIndex()) {
                //We might have walked all the way back still, which isn't great,
                //so keep moving forward again until we find it
                //there must be a repeat between where we started and the beginning of hte form, walk back up to it
                showNextView(true);
            }
        } else {
            AudioController.INSTANCE.releaseCurrentMediaEntity();
            QuestionsView next = createView();
            if (showSwipeAnimation) {
                showView(next, AnimationType.LEFT);
            } else {
                showView(next, AnimationType.FADE, false);
            }
        }
    } else {
        activity.triggerUserQuitInput();
    }
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:65,代码来源:FormEntryActivityUIController.java


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