本文整理汇总了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;
}
示例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);
}
}
}
}
示例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;
}
示例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);
}
示例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;
}
示例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)};
}
}