FormModelScript.java 2.95 KB
/*
 * Decompiled with CFR 0_118.
 */
package com.adobe.xfa.form;

import com.adobe.xfa.Arg;
import com.adobe.xfa.Element;
import com.adobe.xfa.ModelScript;
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.form.FormModel;
import com.adobe.xfa.ut.ExFull;
import com.adobe.xfa.ut.ResId;

public class FormModelScript
extends ModelScript {
    protected static final ScriptTable moScriptTable = new ScriptTable(ModelScript.moScriptTable, "formModel", null, new ScriptFuncObj[]{new ScriptFuncObj(FormModelScript.class, "recalculate", "recalculate", 1, new int[]{3}, 1, 21, 9, 0), new ScriptFuncObj(FormModelScript.class, "execCalculate", "execCalculate", 1, new int[0], 0, 21, 63, 0), new ScriptFuncObj(FormModelScript.class, "execValidate", "execValidate", 3, new int[0], 0, 21, 63, 0), new ScriptFuncObj(FormModelScript.class, "execInitialize", "execInitialize", 1, new int[0], 0, 21, 63, 0), new ScriptFuncObj(FormModelScript.class, "remerge", "remerge", 1, new int[0], 0, 21, 9, 0), new ScriptFuncObj(FormModelScript.class, "formNodes", "formNodes", 7, new int[]{7}, 1, 21, 9, 0), new ScriptFuncObj(FormModelScript.class, "metaData", "metaData", 6, new int[0], 0, 26, 9, 0)});

    public static ScriptTable getScriptTable() {
        return moScriptTable;
    }

    public static void recalculate(Obj obj, Arg retVal, Arg[] args) {
        FormModel formModel = (FormModel)obj;
        FormModel.Validate validate = formModel.getDefaultValidate();
        formModel.recalculate(args[0].getBool(), validate, false);
    }

    public static void execCalculate(Obj obj, Arg retVal, Arg[] args) {
        FormModel formModel = (FormModel)obj;
        FormModel.Validate validate = formModel.getDefaultValidate();
        formModel.recalculate(true, validate, false);
    }

    public static void execValidate(Obj obj, Arg retVal, Arg[] args) {
        FormModel formModel = (FormModel)obj;
        FormModel.Validate validate = formModel.getDefaultValidate();
        formModel.validate(validate, null, true, false);
        if (validate != null && validate.getFailCount() > 0) {
            retVal.setBool(Boolean.FALSE);
        } else {
            retVal.setBool(Boolean.TRUE);
        }
    }

    public static void execInitialize(Obj obj, Arg retVal, Arg[] args) {
        ((FormModel)obj).initialize();
    }

    public static void remerge(Obj obj, Arg retVal, Arg[] args) {
        ((FormModel)obj).remerge();
    }

    public static void formNodes(Obj obj, Arg retVal, Arg[] args) {
        Obj object = args[0].getObject();
        if (!(object instanceof Node)) {
            throw new ExFull(ResId.ArgumentMismatchException);
        }
        retVal.setObject(((FormModel)obj).getFormNodes((Node)object));
    }

    public static void metaData(Obj obj, Arg retVal, Arg[] args) {
        retVal.setString(((FormModel)obj).metaData(0));
    }
}