当前位置: 首页>>代码示例>>Java>>正文


Java Condition.ACTION_SHOW属性代码示例

本文整理汇总了Java中org.javarosa.core.model.condition.Condition.ACTION_SHOW属性的典型用法代码示例。如果您正苦于以下问题:Java Condition.ACTION_SHOW属性的具体用法?Java Condition.ACTION_SHOW怎么用?Java Condition.ACTION_SHOW使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.javarosa.core.model.condition.Condition的用法示例。


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

示例1: printConditionalProperty

private static String printConditionalProperty (String property, FormDef f, TreeElement instanceNode) {
	int action = -1;
	String conditionHeader = null;
	boolean absolute = false;
	boolean absoluteReportable = false;
	String absoluteHeader = null;

	if (property.equals("relevant")) {
		action = Condition.ACTION_SHOW;
		conditionHeader = "Relevant if";
		absolute = instanceNode.isRelevant();
		absoluteReportable = false;
		absoluteHeader = "Never relevant";
	} else if (property.equals("required")) {
		action = Condition.ACTION_REQUIRE;
		conditionHeader = "Conditionally Required";
		absolute = instanceNode.isRequired();
		absoluteReportable = true;
		absoluteHeader = "Required";
	} else if (property.equals("readonly")) {
		action = Condition.ACTION_DISABLE;
		conditionHeader = "Conditionally Read-only";
		absolute = instanceNode.isEnabled();
		absoluteReportable = false;
		absoluteHeader = "Read-only";
	}

	IConditionExpr expr = f.getConditionExpressionForTrueAction(instanceNode, action);

	String line = null;
	if (expr != null) {
		line = conditionHeader + ": " + printCondition(expr);
	} else if (absolute == absoluteReportable) {
		line = absoluteHeader;
	}

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

示例2: printConditionalProperty

private static String printConditionalProperty (String property, FormDef f, TreeElement instanceNode) {
    int action = -1;
    String conditionHeader = null;
    boolean absolute = false;
    boolean absoluteReportable = false;
    String absoluteHeader = null;

    if (property.equals("relevant")) {
        action = Condition.ACTION_SHOW;
        conditionHeader = "Relevant if";
        absolute = instanceNode.isRelevant();
        absoluteReportable = false;
        absoluteHeader = "Never relevant";
    } else if (property.equals("required")) {
        action = Condition.ACTION_REQUIRE;
        conditionHeader = "Conditionally Required";
        absolute = instanceNode.isRequired();
        absoluteReportable = true;
        absoluteHeader = "Required";
    } else if (property.equals("readonly")) {
        action = Condition.ACTION_DISABLE;
        conditionHeader = "Conditionally Read-only";
        absolute = instanceNode.isEnabled();
        absoluteReportable = false;
        absoluteHeader = "Read-only";
    }

    IConditionExpr expr = null;

    triggerLoop:
    for (Enumeration<Triggerable> e = f.getTriggerables(); e.hasMoreElements();) {
        Triggerable trig = e.nextElement();
        // Clayton Sims - Jun 1, 2009 : Not sure how legitimate this
        // cast is. It might work now, but break later.
        // Clayton Sims - Jun 24, 2009 : Yeah, that change broke things.
        // For now, we won't bother to print out anything that isn't
        // a condition.
        if (trig instanceof Condition) {
            Condition c = (Condition)trig;

            if (c.trueAction == action) {
                for (TreeReference target : c.targets) {
                    if (instanceNode == getInstanceNode(f.getInstance(), new XPathReference(target))) {
                        expr = c.expr;
                        break triggerLoop;
                    }
                }
            }
        }
    }

    String line = null;
    if (expr != null) {
        line = conditionHeader + ": " + printCondition(expr);
    } else if (absolute == absoluteReportable) {
        line = absoluteHeader;
    }

    return line;
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:60,代码来源:FormOverview.java

示例3: printConditionalProperty

private static String printConditionalProperty (String property, FormDef f, TreeElement instanceNode) {
    int action = -1;
    String conditionHeader = null;
    boolean absolute = false;
    boolean absoluteReportable = false;
    String absoluteHeader = null;

    if (property.equals("relevant")) {
        action = Condition.ACTION_SHOW;
        conditionHeader = "Relevant if";
        absolute = instanceNode.isRelevant();
        absoluteReportable = false;
        absoluteHeader = "Never relevant";
    } else if (property.equals("required")) {
        action = Condition.ACTION_REQUIRE;
        conditionHeader = "Conditionally Required";
        absolute = instanceNode.isRequired();
        absoluteReportable = true;
        absoluteHeader = "Required";
    } else if (property.equals("readonly")) {
        action = Condition.ACTION_DISABLE;
        conditionHeader = "Conditionally Read-only";
        absolute = instanceNode.isEnabled();
        absoluteReportable = false;
        absoluteHeader = "Read-only";
    }

    IConditionExpr expr = null;

    triggerLoop:
    for (Iterator<Triggerable> e = f.getTriggerables(); e.hasNext();) {
        Triggerable trig = e.next();
        // Clayton Sims - Jun 1, 2009 : Not sure how legitimate this
        // cast is. It might work now, but break later.
        // Clayton Sims - Jun 24, 2009 : Yeah, that change broke things.
        // For now, we won't bother to print out anything that isn't
        // a condition.
        if (trig instanceof Condition) {
            Condition c = (Condition)trig;

            if (c.trueAction == action) {
                for (TreeReference target : c.targets) {
                    if (instanceNode == getInstanceNode(f.getInstance(), new XPathReference(target))) {
                        expr = c.expr;
                        break triggerLoop;
                    }
                }
            }
        }
    }

    String line = null;
    if (expr != null) {
        line = conditionHeader + ": " + printCondition(expr);
    } else if (absolute == absoluteReportable) {
        line = absoluteHeader;
    }

    return line;
}
 
开发者ID:dimagi,项目名称:commcare-core,代码行数:60,代码来源:FormOverview.java


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