本文整理汇总了Java中org.javarosa.core.model.IFormElement类的典型用法代码示例。如果您正苦于以下问题:Java IFormElement类的具体用法?Java IFormElement怎么用?Java IFormElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IFormElement类属于org.javarosa.core.model包,在下文中一共展示了IFormElement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: parseTabGroups
import org.javarosa.core.model.IFormElement; //导入依赖的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.IFormElement; //导入依赖的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.IFormElement; //导入依赖的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.IFormElement; //导入依赖的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: getCaptionHierarchy
import org.javarosa.core.model.IFormElement; //导入依赖的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
示例6: incrementIndex
import org.javarosa.core.model.IFormElement; //导入依赖的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
示例7: decrementIndex
import org.javarosa.core.model.IFormElement; //导入依赖的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
示例8: setRepeatNextMultiplicity
import org.javarosa.core.model.IFormElement; //导入依赖的package包/类
private boolean setRepeatNextMultiplicity(List<IFormElement> elements, List<Integer> multiplicities) {
// find out if node is repeatable
TreeReference nodeRef = form.getChildInstanceRef(elements, multiplicities);
TreeElement node = form.getMainInstance().resolveReference(nodeRef);
if (node == null || node.isRepeatable()) { // node == null if there are no
// instances of the repeat
int mult;
if (node == null) {
mult = 0; // no repeats; next is 0
} else {
String name = node.getName();
TreeElement parentNode = form.getMainInstance().resolveReference(nodeRef.getParentRef());
mult = parentNode.getChildMultiplicity(name);
}
multiplicities.set(multiplicities.size() - 1, Integer.valueOf(repeatStructure == REPEAT_STRUCTURE_NON_LINEAR ? TreeReference.INDEX_REPEAT_JUNCTURE : mult));
return true;
} else {
return false;
}
}
开发者ID:medic,项目名称:javarosa,代码行数:21,代码来源:FormEntryModel.java
示例9: containsRepeatGuesses
import org.javarosa.core.model.IFormElement; //导入依赖的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
示例10: parseUpload
import org.javarosa.core.model.IFormElement; //导入依赖的package包/类
protected QuestionDef parseUpload(IFormElement parent, Element e, int controlUpload) {
List<String> usedAtts = new ArrayList<String>();
usedAtts.add("mediatype");
// get media type value
String mediaType = e.getAttributeValue(null, "mediatype");
// parse the control
QuestionDef question = parseControl(parent, e, controlUpload, usedAtts);
// apply the media type value to the returned question def.
if ("image/*".equals(mediaType)) {
// NOTE: this could be further expanded.
question.setControlType(Constants.CONTROL_IMAGE_CHOOSE);
} else if("audio/*".equals(mediaType)) {
question.setControlType(Constants.CONTROL_AUDIO_CAPTURE);
} else if ("video/*".equals(mediaType)) {
question.setControlType(Constants.CONTROL_VIDEO_CAPTURE);
}
return question;
}
开发者ID:medic,项目名称:javarosa,代码行数:20,代码来源:XFormParser.java
示例11: getCaptionHierarchy
import org.javarosa.core.model.IFormElement; //导入依赖的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
示例12: containsRepeatGuesses
import org.javarosa.core.model.IFormElement; //导入依赖的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
示例13: parseAction
import org.javarosa.core.model.IFormElement; //导入依赖的package包/类
/**
* Generic parse method that all actions get passed through. Checks that the action element's
* event attribute and location in the xform are both valid, and then invokes the more specific
* handler that is provided.
*/
private void parseAction(Element e, Object parent, IElementHandler specificHandler) {
// Check that the event registered to trigger this action is a valid event that we support
String event = e.getAttributeValue(null, EVENT_ATTR);
if (!Action.isValidEvent(event)) {
throw new XFormParseException("An action was registered for an unsupported event: " + event);
}
// Check that the action was included in a valid place within the XForm
if (!(parent instanceof IFormElement)) {
// parent must either be a FormDef or QuestionDef, both of which are IFormElements
throw new XFormParseException("An action element occurred in an invalid location. " +
"Must be either a child of a control element, or a child of the <model>");
}
specificHandler.handle(this, e, parent);
}
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:22,代码来源:XFormParser.java
示例14: parseUpload
import org.javarosa.core.model.IFormElement; //导入依赖的package包/类
protected QuestionDef parseUpload(IFormElement parent, Element e, int controlUpload) {
Vector<String> usedAtts = new Vector<String>();
usedAtts.addElement("mediatype");
QuestionDef question = parseControl(parent, e, controlUpload, usedAtts);
String mediaType = e.getAttributeValue(null, "mediatype");
if ("image/*".equals(mediaType)) {
// NOTE: this could be further expanded.
question.setControlType(Constants.CONTROL_IMAGE_CHOOSE);
} else if ("audio/*".equals(mediaType)) {
question.setControlType(Constants.CONTROL_AUDIO_CAPTURE);
} else if ("video/*".equals(mediaType)) {
question.setControlType(Constants.CONTROL_VIDEO_CAPTURE);
}
return question;
}
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:19,代码来源:XFormParser.java
示例15: parseControlChildren
import org.javarosa.core.model.IFormElement; //导入依赖的package包/类
private void parseControlChildren(Element e, QuestionDef question, IFormElement parent,
boolean isSelect) {
for (int i = 0; i < e.getChildCount(); i++) {
int type = e.getType(i);
Element child = (type == Node.ELEMENT ? e.getElement(i) : null);
if (child == null) {
continue;
}
String childName = child.getName();
if (LABEL_ELEMENT.equals(childName) || HINT_ELEMENT.equals(childName)
|| HELP_ELEMENT.equals(childName) || CONSTRAINT_ELEMENT.equals(childName)) {
parseHelperText(question, child);
} else if (isSelect && "item".equals(childName)) {
parseItem(question, child);
} else if (isSelect && "itemset".equals(childName)) {
parseItemset(question, child);
} else if (actionHandlers.containsKey(childName)) {
actionHandlers.get(childName).handle(this, child, question);
}
}
}
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:23,代码来源:XFormParser.java
示例16: getEvent
import org.javarosa.core.model.IFormElement; //导入依赖的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
示例17: getCaptionHierarchy
import org.javarosa.core.model.IFormElement; //导入依赖的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
示例18: incrementIndex
import org.javarosa.core.model.IFormElement; //导入依赖的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
示例19: decrementIndex
import org.javarosa.core.model.IFormElement; //导入依赖的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
示例20: setRepeatNextMultiplicity
import org.javarosa.core.model.IFormElement; //导入依赖的package包/类
private boolean setRepeatNextMultiplicity(Vector<IFormElement> elements, Vector<Integer> multiplicities) {
// find out if node is repeatable
TreeReference nodeRef = form.getChildInstanceRef(elements, multiplicities);
TreeElement node = form.getMainInstance().resolveReference(nodeRef);
if (node == null || node.isRepeatable()) { // node == null if there are no
// instances of the repeat
int mult;
if (node == null) {
mult = 0; // no repeats; next is 0
} else {
String name = node.getName();
TreeElement parentNode = form.getMainInstance().resolveReference(nodeRef.getParentRef());
mult = parentNode.getChildMultiplicity(name);
}
multiplicities.setElementAt(new Integer(repeatStructure == REPEAT_STRUCTURE_NON_LINEAR ? TreeReference.INDEX_REPEAT_JUNCTURE : mult), multiplicities.size() - 1);
return true;
} else {
return false;
}
}
开发者ID:dimagi,项目名称:commcare-core,代码行数:21,代码来源:FormEntryModel.java
注:本文中的org.javarosa.core.model.IFormElement类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论