本文整理汇总了Java中org.javarosa.core.model.instance.TreeElement.removeChildAt方法的典型用法代码示例。如果您正苦于以下问题:Java TreeElement.removeChildAt方法的具体用法?Java TreeElement.removeChildAt怎么用?Java TreeElement.removeChildAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.javarosa.core.model.instance.TreeElement
的用法示例。
在下文中一共展示了TreeElement.removeChildAt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeInvalidTemplates
import org.javarosa.core.model.instance.TreeElement; //导入方法依赖的package包/类
private boolean removeInvalidTemplates (TreeElement instanceNode, TreeElement repeatTreeNode, boolean templateAllowed) {
int mult = instanceNode.getMult();
boolean repeatable = (repeatTreeNode == null ? false : repeatTreeNode.isRepeatable());
if (mult == TreeReference.INDEX_TEMPLATE) {
if (!templateAllowed) {
reporter.warning(XFormParserReporter.TYPE_INVALID_STRUCTURE, "Template nodes for sub-repeats must be located within the template node of the parent repeat; ignoring template... [" + instanceNode.getName() + "]", null);
return true;
} else if (!repeatable) {
reporter.warning(XFormParserReporter.TYPE_INVALID_STRUCTURE, "Warning: template node found for ref that is not repeatable; ignoring... [" + instanceNode.getName() + "]", null);
return true;
}
}
if (repeatable && mult != TreeReference.INDEX_TEMPLATE)
templateAllowed = false;
for (int i = 0; i < instanceNode.getNumChildren(); i++) {
TreeElement child = instanceNode.getChildAt(i);
TreeElement rchild = (repeatTreeNode == null ? null : repeatTreeNode.getChild(child.getName(), 0));
if (removeInvalidTemplates(child, rchild, templateAllowed)) {
instanceNode.removeChildAt(i);
i--;
}
}
return false;
}
示例2: trimRepeatChildren
import org.javarosa.core.model.instance.TreeElement; //导入方法依赖的package包/类
private static void trimRepeatChildren (TreeElement node) {
for (int i = 0; i < node.getNumChildren(); i++) {
TreeElement child = node.getChildAt(i);
if (child.isRepeatable()) {
node.removeChildAt(i);
i--;
} else {
trimRepeatChildren(child);
}
}
}