當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。