ModelScript.java 3.19 KB
/*
 * Decompiled with CFR 0_118.
 */
package com.adobe.xfa;

import com.adobe.xfa.*;
import com.adobe.xfa.ut.ExFull;
import com.adobe.xfa.ut.MsgFormatPos;
import com.adobe.xfa.ut.ResId;

public class ModelScript
extends ElementScript {
    protected static final ScriptTable moScriptTable = new ScriptTable(ElementScript.moScriptTable, "model", new ScriptPropObj[]{new ScriptPropObj(ModelScript.class, "aliasNode", "getAliasNode", "setSliasNode", 7, 10, 9, 0), new ScriptPropObj(ModelScript.class, "context", "getContext", "setContext", 7, 10, 0, 22), new ScriptPropObj(ModelScript.class, "name", "getName", "setName", 6, 10, 9, 0)}, new ScriptFuncObj[]{new ScriptFuncObj(ModelScript.class, "createNode", "createNode", 7, new int[]{6, 6, 6}, 1, 10, 9, 0), new ScriptFuncObj(ModelScript.class, "clearErrorList", "clearErrorList", 1, new int[0], 0, 10, 9, 0), new ScriptFuncObj(ModelScript.class, "isCompatibleNS", "isCompatibleNS", 3, new int[]{6}, 1, 10, 9, 0)});

    public static void getAliasNode(Obj pObj, Arg oRetVal) {
        oRetVal.setObject(((Model)pObj).getAliasNode());
    }

    public static void getContext(Obj pObj, Arg oRetVal) {
        oRetVal.setObject(((Model)pObj).getContext());
    }

    public static void setAliasNode(Obj pObj, Arg oArg) {
        Obj oObject = oArg.getObject();
        if (!(oObject instanceof Element)) {
            throw new ExFull(ResId.ArgumentMismatchException);
        }
        ((Model)pObj).setAliasNode((Element)oObject);
    }

    public static void getName(Obj pObj, Arg oRetVal) {
        oRetVal.setString(((Model)pObj).getName());
    }

    public static void setContext(Obj pObj, Arg oArg) {
        Obj oObject = oArg.getObject();
        if (!(oObject instanceof Node)) {
            throw new ExFull(ResId.ArgumentMismatchException);
        }
        ((Model)pObj).setContext((Node)oObject);
    }

    public static void setName(Obj pObj, Arg oArg) {
        MsgFormatPos oMessage = new MsgFormatPos(ResId.InvalidSetPropertyException);
        oMessage.format(((Model)pObj).getClassAtom()).format("name");
        throw new ExFull(oMessage);
    }

    public static void createNode(Obj pObj, Arg oRetVal, Arg[] pArgs) {
        int eTag;
        String aTagName = pArgs[0].getString();
        if (aTagName != null) {
            aTagName = aTagName.intern();
        }
        if ((eTag = XFA.getTag(aTagName)) != -1) {
            if (pArgs.length == 1) {
                oRetVal.setObject(((Model)pObj).createNode(eTag, null, "", "", true));
            } else if (pArgs.length == 2) {
                oRetVal.setObject(((Model)pObj).createNode(eTag, null, pArgs[1].getString(), "", true));
            } else if (pArgs.length == 3) {
                oRetVal.setObject(((Model)pObj).createNode(eTag, null, pArgs[1].getString(), pArgs[2].getString(), true));
            }
        }
    }

    public static void clearErrorList(Obj pObj, Arg oRetVal, Arg[] pArgs) {
        ((Model)pObj).clearErrorList();
    }

    public static void isCompatibleNS(Obj pObj, Arg oRetVal, Arg[] pArgs) {
        String aNS = pArgs[0].getString();
        oRetVal.setBool(((Model)pObj).isCompatibleNS(aNS));
    }

    public static ScriptTable getScriptTable() {
        return moScriptTable;
    }
}