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

Java GroupDef类代码示例

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

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



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

示例1: parseTabGroups

import org.javarosa.core.model.GroupDef; //导入依赖的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.core.model.GroupDef; //导入依赖的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.core.model.GroupDef; //导入依赖的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.core.model.GroupDef; //导入依赖的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: stepOverGroup

import org.javarosa.core.model.GroupDef; //导入依赖的package包/类
/**
 * If using a view like HierarchyView that doesn't support multi-question per screen, step over
 * the group represented by the FormIndex.
 *
 * @return
 */
private int stepOverGroup() {
    ArrayList<FormIndex> indicies = new ArrayList<FormIndex>();
    GroupDef gd =
        (GroupDef) mFormEntryController.getModel().getForm()
                .getChild(getFormIndex());
    FormIndex idxChild =
        mFormEntryController.getModel().incrementIndex(
            getFormIndex(), true); // descend into group
    for (int i = 0; i < gd.getChildren().size(); i++) {
        indicies.add(idxChild);
        // don't descend
        idxChild = mFormEntryController.getModel().incrementIndex(idxChild, false);
    }

    // jump to the end of the group
    mFormEntryController.jumpToIndex(indicies.get(indicies.size() - 1));
    return stepToNextEvent(STEP_OVER_GROUP);
}
 
开发者ID:Last-Mile-Health,项目名称:ODK-Liberia,代码行数:25,代码来源:FormController.java


示例6: getCaptionHierarchy

import org.javarosa.core.model.GroupDef; //导入依赖的package包/类
/**
 * Returns a hierarchical list of FormEntryCaption objects for the given
 * FormIndex
 *
 * @param index
 * @return list of FormEntryCaptions in hierarchical order
 */
public FormEntryCaption[] getCaptionHierarchy(FormIndex index) {
    List<FormEntryCaption> captions = new ArrayList<FormEntryCaption>();
    FormIndex remaining = index;
    while (remaining != null) {
        remaining = remaining.getNextLevel();
        FormIndex localIndex = index.diff(remaining);
        IFormElement element = form.getChild(localIndex);
        if (element != null) {
            FormEntryCaption caption = null;
            if (element instanceof GroupDef)
                caption = new FormEntryCaption(getForm(), localIndex);
            else if (element instanceof QuestionDef)
                caption = new FormEntryPrompt(getForm(), localIndex);

            if (caption != null) {
                captions.add(caption);
            }
        }
    }
    FormEntryCaption[] captionArray = new FormEntryCaption[captions.size()];
    return captions.toArray(captionArray);
}
 
开发者ID:medic,项目名称:javarosa,代码行数:30,代码来源:FormEntryModel.java


示例7: containsRepeatGuesses

import org.javarosa.core.model.GroupDef; //导入依赖的package包/类
/**
 * This method does a recursive check of whether there are any repeat guesses
 * in the element or its subtree. This is a necessary step when initializing
 * the model to be able to identify whether new repeats can be used.
 *
 * @param parent The form element to begin checking
 * @return true if the element or any of its descendants is a repeat
 * which has a count guess, false otherwise.
 */
   private boolean containsRepeatGuesses(IFormElement parent) {
	if(parent instanceof GroupDef) {
		GroupDef g = (GroupDef)parent;
		if (g.getRepeat() && g.getCountReference() != null) {
			return true;
		}
	}

   	List<IFormElement> children = parent.getChildren();
   	if(children == null) { return false; }
      for (IFormElement child : children) {
   		if(containsRepeatGuesses(child)) {return true;}
   	}
   	return false;
}
 
开发者ID:medic,项目名称:javarosa,代码行数:25,代码来源:FormEntryModel.java


示例8: createSimpleGroupReference

import org.javarosa.core.model.GroupDef; //导入依赖的package包/类
public static FormDef createSimpleGroupReference() {
	FormDef theform = new FormDef();
	
	QuestionDef question1 = new QuestionDef();
	GroupDef group1 = new GroupDef();
	QuestionDef question11 = new QuestionDef();
	QuestionDef question12 = new QuestionDef();
	group1.addChild(question11);
	group1.addChild(question12);
	QuestionDef question2 = new QuestionDef();
	theform.addChild(question1);
	theform.addChild(group1);
	theform.addChild(question2);
	
	return theform;
}
 
开发者ID:medic,项目名称:javarosa,代码行数:17,代码来源:FormDefConstructionUtils.java


示例9: getCaptionHierarchy

import org.javarosa.core.model.GroupDef; //导入依赖的package包/类
/**
 * Returns a hierarchical list of FormEntryCaption objects for the given
 * FormIndex
 *
 * @return list of FormEntryCaptions in hierarchical order
 */
public FormEntryCaption[] getCaptionHierarchy(FormIndex index) {
    Vector<FormEntryCaption> captions = new Vector<FormEntryCaption>();
    FormIndex remaining = index;
    while (remaining != null) {
        remaining = remaining.getNextLevel();
        FormIndex localIndex = index.diff(remaining);
        IFormElement element = form.getChild(localIndex);
        if (element != null) {
            FormEntryCaption caption = null;
            if (element instanceof GroupDef)
                caption = new FormEntryCaption(getForm(), localIndex);
            else if (element instanceof QuestionDef)
                caption = new FormEntryPrompt(getForm(), localIndex);

            if (caption != null) {
                captions.addElement(caption);
            }
        }
    }
    FormEntryCaption[] captionArray = new FormEntryCaption[captions.size()];
    captions.copyInto(captionArray);
    return captionArray;
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:30,代码来源:FormEntryModel.java


示例10: containsRepeatGuesses

import org.javarosa.core.model.GroupDef; //导入依赖的package包/类
/**
 * This method does a recursive check of whether there are any repeat guesses
 * in the element or its subtree. This is a necessary step when initializing
 * the model to be able to identify whether new repeats can be used.
 *
 * @param parent The form element to begin checking
 * @return true if the element or any of its descendants is a repeat
 * which has a count guess, false otherwise.
 */
private boolean containsRepeatGuesses(IFormElement parent) {
    if (parent instanceof GroupDef) {
        GroupDef g = (GroupDef)parent;
        if (g.getRepeat() && g.getCountReference() != null) {
            return true;
        }
    }

    Vector<IFormElement> children = parent.getChildren();
    if (children == null) {
        return false;
    }
    for (Enumeration en = children.elements(); en.hasMoreElements(); ) {
        if (containsRepeatGuesses((IFormElement)en.nextElement())) {
            return true;
        }
    }
    return false;
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:29,代码来源:FormEntryModel.java


示例11: getEvent

import org.javarosa.core.model.GroupDef; //导入依赖的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


示例12: getCaptionHierarchy

import org.javarosa.core.model.GroupDef; //导入依赖的package包/类
/**
 * Returns a hierarchical list of FormEntryCaption objects for the given
 * FormIndex
 *
 * @return list of FormEntryCaptions in hierarchical order
 */
public FormEntryCaption[] getCaptionHierarchy(FormIndex index) {
    Vector<FormEntryCaption> captions = new Vector<>();
    FormIndex remaining = index;
    while (remaining != null) {
        remaining = remaining.getNextLevel();
        FormIndex localIndex = index.diff(remaining);
        IFormElement element = form.getChild(localIndex);
        if (element != null) {
            FormEntryCaption caption = null;
            if (element instanceof GroupDef)
                caption = new FormEntryCaption(getForm(), localIndex);
            else if (element instanceof QuestionDef)
                caption = new FormEntryPrompt(getForm(), localIndex);

            if (caption != null) {
                captions.addElement(caption);
            }
        }
    }
    FormEntryCaption[] captionArray = new FormEntryCaption[captions.size()];
    captions.copyInto(captionArray);
    return captionArray;
}
 
开发者ID:dimagi,项目名称:commcare-core,代码行数:30,代码来源:FormEntryModel.java


示例13: createModelForGroup

import org.javarosa.core.model.GroupDef; //导入依赖的package包/类
private static void createModelForGroup(GroupDef g, FormIndex index, FormDef form) {
    if (g.isRepeat() && g.getCountReference() != null) {
        TreeReference countRef = g.getConextualizedCountReference(index.getReference());
        IAnswerData count = form.getMainInstance().resolveReference(countRef).getValue();
        if (count != null) {
            int fullcount;
            try {
                fullcount = ((Integer)new IntegerData().cast(count.uncast()).getValue());
            } catch (IllegalArgumentException iae) {
                throw new XPathTypeMismatchException("The repeat count value \""
                        + count.uncast().getString() + "\" at "
                        + g.getConextualizedCountReference(index.getReference()).toString()
                        + " must be a number!");
            }

            createModelIfBelowMaxCount(index, form, fullcount);
        }
    }
}
 
开发者ID:dimagi,项目名称:commcare-core,代码行数:20,代码来源:FormEntryModel.java


示例14: containsRepeatGuesses

import org.javarosa.core.model.GroupDef; //导入依赖的package包/类
/**
 * This method does a recursive check of whether there are any repeat guesses
 * in the element or its subtree. This is a necessary step when initializing
 * the model to be able to identify whether new repeats can be used.
 *
 * @param parent The form element to begin checking
 * @return true if the element or any of its descendants is a repeat
 * which has a count guess, false otherwise.
 */
private boolean containsRepeatGuesses(IFormElement parent) {
    if (parent instanceof GroupDef) {
        GroupDef g = (GroupDef)parent;
        if (g.isRepeat() && g.getCountReference() != null) {
            return true;
        }
    }

    Vector<IFormElement> children = parent.getChildren();
    if (children == null) {
        return false;
    }
    for (Enumeration en = children.elements(); en.hasMoreElements(); ) {
        if (containsRepeatGuesses((IFormElement)en.nextElement())) {
            return true;
        }
    }
    return false;
}
 
开发者ID:dimagi,项目名称:commcare-core,代码行数:29,代码来源:FormEntryModel.java


示例15: stepOverGroup

import org.javarosa.core.model.GroupDef; //导入依赖的package包/类
/**
 * If using a view like HierarchyView that doesn't support multi-question per screen, step over
 * the group represented by the FormIndex.
 * 
 * @return
 */
private int stepOverGroup() {
    ArrayList<FormIndex> indicies = new ArrayList<FormIndex>();
    GroupDef gd =
        (GroupDef) mFormEntryController.getModel().getForm()
                .getChild(getFormIndex());
    FormIndex idxChild =
        mFormEntryController.getModel().incrementIndex(
            getFormIndex(), true); // descend into group
    for (int i = 0; i < gd.getChildren().size(); i++) {
        indicies.add(idxChild);
        // don't descend
        idxChild = mFormEntryController.getModel().incrementIndex(idxChild, false);
    }

    // jump to the end of the group
    mFormEntryController.jumpToIndex(indicies.get(indicies.size() - 1));
    return stepToNextEvent(STEP_OVER_GROUP);
}
 
开发者ID:sages-health,项目名称:sagesmobile-mCollect,代码行数:25,代码来源:FormController.java


示例16: parseSchema

import org.javarosa.core.model.GroupDef; //导入依赖的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


示例17: groupIsFieldList

import org.javarosa.core.model.GroupDef; //导入依赖的package包/类
/**
 * A convenience method for determining if the current FormIndex is in a group that is/should be
 * displayed as a multi-question view. This is useful for returning from the formhierarchy view
 * to a selected index.
 *
 * @param index
 * @return
 */
private boolean groupIsFieldList(FormIndex index) {
    // if this isn't a group, return right away
	IFormElement element = mFormEntryController.getModel().getForm().getChild(index);
    if (!(element instanceof GroupDef)) {
        return false;
    }

    GroupDef gd = (GroupDef) element; // exceptions?
    return (ODKView.FIELD_LIST.equalsIgnoreCase(gd.getAppearanceAttr()));
}
 
开发者ID:Last-Mile-Health,项目名称:ODK-Liberia,代码行数:19,代码来源:FormController.java


示例18: repeatIsFieldList

import org.javarosa.core.model.GroupDef; //导入依赖的package包/类
private boolean repeatIsFieldList(FormIndex index) {
    // if this isn't a group, return right away
	IFormElement element = mFormEntryController.getModel().getForm().getChild(index);
    if (!(element instanceof GroupDef)) {
        return false;
    }

    GroupDef gd = (GroupDef) element; // exceptions?
    return (ODKView.FIELD_LIST.equalsIgnoreCase(gd.getAppearanceAttr()));
}
 
开发者ID:Last-Mile-Health,项目名称:ODK-Liberia,代码行数:11,代码来源:FormController.java


示例19: addGroupNotSupported

import org.javarosa.core.model.GroupDef; //导入依赖的package包/类
public void addGroupNotSupported(String error_msg_id, StringBuilder fieldErrors, GroupDef groupDef)
{
	StringBuilder errorMsg = new StringBuilder(SecureAppGeneratorApplication.getLocalizedErrorMessageNoPrefix(error_msg_id));
	errorMsg.append(" : ID=");
	errorMsg.append(groupDef.getID());
	errorMsg.append(" : LABEL=");
	errorMsg.append(groupDef.getLabelInnerText());
	addErrorToListOfErrors(fieldErrors, errorMsg);
    			return;
}
 
开发者ID:benetech,项目名称:Secure-App-Generator,代码行数:11,代码来源:ObtainXFormController.java


示例20: listQuestions

import org.javarosa.core.model.GroupDef; //导入依赖的package包/类
private static void listQuestions (FormDef f, int indent, StringBuilder sb) {
		//using fec to walk through form (instead of old recursive algorithm)
		FormEntryModel femodel = new FormEntryModel(f);
		FormEntryController fec = new FormEntryController(femodel);
		fec.jumpToIndex(FormIndex.createBeginningOfFormIndex());
		IFormElement fe;
		do{
			fe = femodel.getCaptionPrompt().getFormElement();
			if(fe instanceof QuestionDef){
				listQuestion(f,(QuestionDef)fe,fec,indent,sb);
			}else if(fe instanceof GroupDef){
				if (listGroup(f, (GroupDef)fe, indent, sb)) {
					indent += 1;
				}
			}

		}while(fec.stepToNextEvent()!=fec.EVENT_END_OF_FORM);

		//Old Recursive Algorithm
//		if (fe instanceof QuestionDef) {
//			listQuestion(f, (QuestionDef)fe, indent, sb);
//		} else {
//			if (fe instanceof GroupDef) {
//				if (listGroup(f, (GroupDef)fe, indent, sb)) {
//					indent += 1;
//				}
//			}
//
//			for (int i = 0; i < fe.getChildren().size(); i++) {
//				listQuestions(f, fe.getChild(i), indent, sb);
//			}
//		}

	}
 
开发者ID:medic,项目名称:javarosa,代码行数:35,代码来源:FormOverview.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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