本文整理汇总了Java中org.javarosa.core.model.instance.TreeElement.getName方法的典型用法代码示例。如果您正苦于以下问题:Java TreeElement.getName方法的具体用法?Java TreeElement.getName怎么用?Java TreeElement.getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.javarosa.core.model.instance.TreeElement
的用法示例。
在下文中一共展示了TreeElement.getName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setRepeatNextMultiplicity
import org.javarosa.core.model.instance.TreeElement; //导入方法依赖的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;
}
}
示例2: checkRepeatsForTemplate
import org.javarosa.core.model.instance.TreeElement; //导入方法依赖的package包/类
private static void checkRepeatsForTemplate (TreeElement repeatTreeNode, TreeReference ref, FormInstance instance, List<TreeReference> missing) {
String name = repeatTreeNode.getName();
int mult = (repeatTreeNode.isRepeatable() ? TreeReference.INDEX_TEMPLATE : 0);
ref = ref.extendRef(name, mult);
if (repeatTreeNode.isRepeatable()) {
TreeElement template = instance.resolveReference(ref);
if (template == null) {
missing.add(ref);
}
}
for (int i = 0; i < repeatTreeNode.getNumChildren(); i++) {
checkRepeatsForTemplate(repeatTreeNode.getChildAt(i), ref, instance, missing);
}
}
示例3: createBugRuntimeException
import org.javarosa.core.model.instance.TreeElement; //导入方法依赖的package包/类
private RuntimeException createBugRuntimeException(TreeElement treeElement, String textVal) {
return new RuntimeException("The appearance column of the field " + treeElement.getName() + " contains a search() call and the field type is " + treeElement.getDataType() + " and the saved answer is " + textVal);
}
示例4: schemizeInstance
import org.javarosa.core.model.instance.TreeElement; //导入方法依赖的package包/类
private static Element schemizeInstance (TreeElement node) {
String name = node.getName();
boolean terminal = node.isLeaf();
boolean repeatable = node.isRepeatable();
if (repeatable && node.getMult() != TreeReference.INDEX_TEMPLATE) {
return null;
}
Element e = new Element();
e.setName("element");
e.setAttribute(null, "name", name);
e.setAttribute(null, "minOccurs", "0"); //technically only needed if node has a 'relevant' attribute bound to it, but no easy way to tell
if (repeatable) {
e.setAttribute(null, "maxOccurs", "unbounded");
}
if (!terminal) {
Element ct = new Element();
ct.setName("complexType");
e.addChild(Node.ELEMENT, ct);
Element seq = new Element();
seq.setName("sequence");
ct.addChild(Node.ELEMENT, seq);
for (int i = 0; i < node.getNumChildren(); i++) {
Element child = schemizeInstance((TreeElement)node.getChildAt(i));
if (child != null) {
seq.addChild(Node.ELEMENT, child);
}
}
} else {
String type;
switch (node.getDataType()) {
case Constants.DATATYPE_NULL:
case Constants.DATATYPE_TEXT:
type = "string";
break;
case Constants.DATATYPE_INTEGER: type = "integer"; break;
case Constants.DATATYPE_LONG: type = "long"; break;
case Constants.DATATYPE_DECIMAL: type = "decimal"; break;
case Constants.DATATYPE_BOOLEAN: type = "boolean"; break;
case Constants.DATATYPE_DATE: type = "date"; break;
case Constants.DATATYPE_DATE_TIME: type = "dateTime"; break;
case Constants.DATATYPE_TIME: type = "time"; break;
case Constants.DATATYPE_CHOICE:
case Constants.DATATYPE_CHOICE_LIST:
type = (String)choiceTypeMapping.get(node);
if (type == null) {
System.err.println("can't find choices for select-type question [" + node.getName() + "]");
}
break;
case Constants.DATATYPE_GEOPOINT: type = "jr:geopoint"; break;
case Constants.DATATYPE_GEOSHAPE: type = "jr:geoshape"; break;
case Constants.DATATYPE_GEOTRACE: type = "jr:geotrace"; break;
default:
type = null;
System.err.println("unrecognized type [" + node.getDataType() + ";" + node.getName() + "]");
break;
}
if (type != null) {
e.setAttribute(null, "type", type);
}
}
return e;
}
示例5: serializeNode
import org.javarosa.core.model.instance.TreeElement; //导入方法依赖的package包/类
public String serializeNode(TreeElement instanceNode) {
StringBuilder b = new StringBuilder();
// don't serialize template nodes or non-relevant nodes
if (!instanceNode.isRelevant()
|| instanceNode.getMult() == TreeReference.INDEX_TEMPLATE)
return null;
if (instanceNode.getValue() != null) {
Object serializedAnswer = serializer.serializeAnswerData(
instanceNode.getValue(), instanceNode.getDataType());
if (serializedAnswer instanceof Element) {
// DON"T handle this.
throw new RuntimeException("Can't handle serialized output for"
+ instanceNode.getValue().toString() + ", "
+ serializedAnswer);
} else if (serializedAnswer instanceof String) {
Element e = new Element();
e.addChild(Node.TEXT, (String) serializedAnswer);
String tag = instanceNode.getAttributeValue("", "tag");
if ( tag != null ) {
b.append(tag);
}
else {
String name = instanceNode.getName();
if ( name != null ) {
b.append(name);
}
}
b.append(delimiter);
for (int k = 0; k < e.getChildCount(); k++) {
b.append(e.getChild(k).toString().replace("\\", "\\\\").replace(delimiter, "\\" + delimiter));
b.append(delimiter);
}
} else {
throw new RuntimeException("Can't handle serialized output for"
+ instanceNode.getValue().toString() + ", "
+ serializedAnswer);
}
if (serializer.containsExternalData(instanceNode.getValue())
.booleanValue()) {
IDataPointer[] pointer = serializer
.retrieveExternalDataPointer(instanceNode.getValue());
for (int i = 0; i < pointer.length; ++i) {
dataPointers.add(pointer[i]);
}
}
}
return b.toString();
}