ExclGroupScript.java 7 KB
/*
 * Decompiled with CFR 0_118.
 */
package com.adobe.xfa.template.containers;

import com.adobe.xfa.AppModel;
import com.adobe.xfa.Arg;
import com.adobe.xfa.Node;
import com.adobe.xfa.NodeList;
import com.adobe.xfa.Obj;
import com.adobe.xfa.ScriptFuncObj;
import com.adobe.xfa.ScriptPropObj;
import com.adobe.xfa.ScriptTable;
import com.adobe.xfa.data.DataNode;
import com.adobe.xfa.template.containers.ContainerScript;
import com.adobe.xfa.template.containers.ExclGroup;

public class ExclGroupScript
extends ContainerScript {
    protected static final ScriptTable moScriptTable = new ScriptTable(ContainerScript.moScriptTable, "exclGroup", new ScriptPropObj[]{new ScriptPropObj(ExclGroupScript.class, "rawValue", "getRawValue", "setRawValue", 0, 21, 9, 0), new ScriptPropObj(ExclGroupScript.class, null, "getRawValue", "setRawValue", 0, 21, 9, 0), new ScriptPropObj(ExclGroupScript.class, "members", "getMembers", null, 7, 21, 9, 0), new ScriptPropObj(ExclGroupScript.class, "dataNode", "dataNode", null, 7, 21, 9, 0), new ScriptPropObj(ExclGroupScript.class, "validationMessage", "getValidationMessage", "setValidationMessage", 6, 21, 63, 0), new ScriptPropObj(ExclGroupScript.class, "mandatoryMessage", "getMandatoryMessage", "setMandatoryMessage", 6, 21, 63, 0), new ScriptPropObj(ExclGroupScript.class, "mandatory", "getMandatory", "setMandatory", 6, 21, 63, 0), new ScriptPropObj(ExclGroupScript.class, "fillColor", "getBackColor", "setBackColor", 6, 21, 63, 0), new ScriptPropObj(ExclGroupScript.class, "borderColor", "getBorderColor", "setBorderColor", 6, 21, 63, 0), new ScriptPropObj(ExclGroupScript.class, "borderWidth", "getBorderWidth", "setBorderWidth", 6, 21, 63, 0), new ScriptPropObj(ExclGroupScript.class, "errorText", "getErrorText", null, 6, 30, 63, 0)}, new ScriptFuncObj[]{new ScriptFuncObj(ExclGroupScript.class, "selectedMember", "selectedMember", 7, new int[]{6}, 0, 21, 9, "selectedMemberPermsCheck", 0), new ScriptFuncObj(ExclGroupScript.class, "execCalculate", "execCalculate", 1, new int[0], 0, 21, 63, 0), new ScriptFuncObj(ExclGroupScript.class, "execValidate", "execValidate", 3, new int[0], 0, 21, 63, 0), new ScriptFuncObj(ExclGroupScript.class, "execInitialize", "execInitialize", 1, new int[0], 0, 21, 63, 0), new ScriptFuncObj(ExclGroupScript.class, "execEvent", "execEvent", 1, new int[]{6}, 1, 21, 63, 0)});

    public static ScriptTable getScriptTable() {
        return moScriptTable;
    }

    public static void getRawValue(Obj pObj, Arg oRetVal) {
        if (((ExclGroup)pObj).getAppModel().getLegacySetting(AppModel.XFA_LEGACY_V29_SCRIPTING)) {
            oRetVal.setString(((ExclGroup)pObj).getRawValue());
        } else if (!((ExclGroup)pObj).getIsNull()) {
            ((ExclGroup)pObj).getTypedRawValue(oRetVal);
        } else {
            oRetVal.setNull();
        }
    }

    public static void setRawValue(Obj pObj, Arg propertyValue) {
        if (((ExclGroup)pObj).getAppModel().getLegacySetting(AppModel.XFA_LEGACY_V29_SCRIPTING)) {
            ((ExclGroup)pObj).setRawValue(propertyValue.getString());
        } else {
            String sValue = "";
            if (propertyValue.getArgType() != 2) {
                sValue = propertyValue.getAsString(false);
            }
            ((ExclGroup)pObj).setRawValue(sValue);
        }
    }

    public static void getMembers(Obj pObj, Arg oRetVal) {
        oRetVal.setObject(((ExclGroup)pObj).getMembers());
    }

    public static void getMandatory(Obj pObj, Arg oRetVal) {
        oRetVal.setString(((ExclGroup)pObj).getMandatory());
    }

    public static void setMandatory(Obj pObj, Arg propertyValue) {
        ((ExclGroup)pObj).setMandatory(propertyValue.getString());
    }

    public static void getValidationMessage(Obj pObj, Arg oRetVal) {
        oRetVal.setString(((ExclGroup)pObj).getMessage("scriptTest"));
    }

    public static void setValidationMessage(Obj pObj, Arg propertyValue) {
        ((ExclGroup)pObj).setMessage(propertyValue.getString(), "scriptTest");
    }

    public static void getMandatoryMessage(Obj pObj, Arg oRetVal) {
        oRetVal.setString(((ExclGroup)pObj).getMessage("nullTest"));
    }

    public static void setMandatoryMessage(Obj pObj, Arg propertyValue) {
        ((ExclGroup)pObj).setMessage(propertyValue.getString(), "nullTest");
    }

    public static void getBackColor(Obj pObj, Arg oRetVal) {
        oRetVal.setString(((ExclGroup)pObj).getBackColor());
    }

    public static void setBackColor(Obj pObj, Arg propertyValue) {
        ((ExclGroup)pObj).setBackColor(propertyValue.getString());
    }

    public static void getBorderColor(Obj pObj, Arg oRetVal) {
        oRetVal.setString(((ExclGroup)pObj).getBorderColor());
    }

    public static void setBorderColor(Obj pObj, Arg propertyValue) {
        ((ExclGroup)pObj).setBorderColor(propertyValue.getString());
    }

    public static void getBorderWidth(Obj pObj, Arg oRetVal) {
        oRetVal.setString(((ExclGroup)pObj).getBorderWidth());
    }

    public static void setBorderWidth(Obj pObj, Arg propertyValue) {
        ((ExclGroup)pObj).setBorderWidth(propertyValue.getString());
    }

    public static void dataNode(Obj pObj, Arg oRetVal) {
        oRetVal.setObject(((ExclGroup)pObj).getDataNode());
    }

    public static void getErrorText(Obj pObj, Arg oRetVal) {
        oRetVal.setString(((ExclGroup)pObj).getErrorText());
    }

    public static boolean selectedMemberPermsCheck(Obj obj, Arg[] args) {
        if (args.length != 0 && obj instanceof ExclGroup) {
            ExclGroup exclGroup = (ExclGroup)obj;
            if (!exclGroup.checkAncestorPerms()) {
                return false;
            }
            if (!exclGroup.getSelectedMember().checkDescendentPerms()) {
                return false;
            }
            NodeList members = exclGroup.getMembers();
            assert (members != null);
            Node onNode = exclGroup.resolveNode(args[0].getString());
            assert (onNode != null);
            int nLength = members.length();
            for (int nIndex = 0; nIndex < nLength; ++nIndex) {
                Node member = (Node)members.item(nIndex);
                assert (member != null);
                if (member != onNode || member.checkDescendentPerms()) continue;
                return false;
            }
        }
        return true;
    }

    public static void selectedMember(Obj pObj, Arg oRetVal, Arg[] pArgs) {
        if (pArgs.length == 1) {
            ((ExclGroup)pObj).setSelectedMember(pArgs[0].getString());
        }
        oRetVal.setObject(((ExclGroup)pObj).getSelectedMember());
    }

    public static void execCalculate(Obj pObj, Arg oRetVal, Arg[] pArgs) {
        ((ExclGroup)pObj).execEvent("calculate");
    }

    public static void execValidate(Obj pObj, Arg oRetVal, Arg[] pArgs) {
        oRetVal.setBool(((ExclGroup)pObj).execValidate());
    }

    public static void execInitialize(Obj pObj, Arg oRetVal, Arg[] pArgs) {
        ((ExclGroup)pObj).execEvent("initialize");
    }

    public static void execEvent(Obj pObj, Arg oRetVal, Arg[] pArgs) {
        ((ExclGroup)pObj).execEvent(pArgs[0].getString());
    }
}