DataNodeScript.java 2.87 KB
/*
 * Decompiled with CFR 0_118.
 */
package com.adobe.xfa.data;

import com.adobe.xfa.Arg;
import com.adobe.xfa.ElementScript;
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.DataModel;
import com.adobe.xfa.data.DataNode;
import com.adobe.xfa.ut.BooleanHolder;

public class DataNodeScript
extends ElementScript {
    protected static final ScriptTable moScriptTable = new ScriptTable(ElementScript.moScriptTable, "dataValue", new ScriptPropObj[]{new ScriptPropObj(DataNodeScript.class, "value", "getValue", "setValue", 0, 10, 9, 0), new ScriptPropObj(DataNodeScript.class, null, "getValue", "setValue", 0, 10, 9, 0), new ScriptPropObj(DataNodeScript.class, "contains", "getContains", "setContains", 6, 10, 9, 0), new ScriptPropObj(DataNodeScript.class, "contentType", "getContentType", "setContentType", 6, 10, 9, 0), new ScriptPropObj(DataNodeScript.class, "isNull", "getIsNull", "setIsNull", 3, 10, 9, 0)}, null);
    static final String patentRef = "AdobePatentID=\"B1082\"";

    public static ScriptTable getScriptTable() {
        return moScriptTable;
    }

    public static void getContains(Obj pObj, Arg oRetVal) {
        oRetVal.setString(((DataNode)pObj).getContains());
    }

    public static void getContentType(Obj pObj, Arg oRetVal) {
        oRetVal.setString(((DataNode)pObj).getContentType());
    }

    public static void getIsNull(Obj pObj, Arg oRetVal) {
        boolean bIsNull = ((DataNode)pObj).getIsNull();
        oRetVal.setBool(bIsNull);
    }

    public static void getValue(Obj pObj, Arg oRetVal) {
        if (!((DataNode)pObj).getIsNull()) {
            oRetVal.setString(((DataNode)pObj).getValue());
        } else {
            oRetVal.setNull();
        }
    }

    public static void setContains(Obj pObj, Arg propertyValue) {
        ((DataNode)pObj).setContains(propertyValue.getString());
    }

    public static void setContentType(Obj pObj, Arg propertyValue) {
        ((DataNode)pObj).setContentType(propertyValue.getString());
    }

    public static void setIsNull(Obj pObj, Arg propertyValue) {
        ((DataNode)pObj).setIsNull(propertyValue.getBool(), true);
    }

    public static void setValue(Obj pObj, Arg propertyValue) {
        ((DataNode)pObj).setValue(propertyValue.getString(), true);
    }

    public static boolean scriptPropResolveAssociation(Obj obj, Arg retVal, String aAssociationName) {
        DataNode dataNode = (DataNode)obj;
        BooleanHolder bFoundNullAssociation = new BooleanHolder();
        Obj ret = DataModel.resolveAssociation(dataNode, aAssociationName, bFoundNullAssociation);
        if (ret != null) {
            retVal.setObject(ret, true);
            return true;
        }
        if (bFoundNullAssociation.value) {
            retVal.setObject(null, true);
            return true;
        }
        return false;
    }
}