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

import com.adobe.xfa.Arg;
import com.adobe.xfa.DependencyTracker;
import com.adobe.xfa.Element;
import com.adobe.xfa.Node;
import com.adobe.xfa.Obj;
import com.adobe.xfa.ScriptDynamicPropObj;
import com.adobe.xfa.ScriptTable;
import com.adobe.xfa.XFA;
import com.adobe.xfa.template.InstanceManager;
import com.adobe.xfa.template.containers.Container;
import com.adobe.xfa.template.containers.Subform;
import com.adobe.xfa.template.containers.SubformSetScript;
import org.xml.sax.Attributes;

public class SubformSet
extends Container {
    private static final ScriptDynamicPropObj getInstanceManagerScriptObj = new ScriptDynamicPropObj(21, 63){

        @Override
        public boolean invokeGetProp(Obj scriptThis, Arg retValue, String sPropertyName) {
            return SubformSet.getInstanceManagerFunc(scriptThis, retValue, sPropertyName);
        }
    };

    public SubformSet(Element parent, Node prevSibling) {
        super(parent, prevSibling, null, "subformSet", "subformSet", null, XFA.SUBFORMSETTAG, "subformSet");
        this.setTransparent(true);
    }

    public void reset() {
    }

    @Override
    public boolean isWidthGrowSupported() {
        return false;
    }

    @Override
    public boolean isHeightGrowSupported() {
        return false;
    }

    public int[][] getUsedTable() {
        return null;
    }

    protected int getInstanceIndex(DependencyTracker pDepTrack) {
        return 0;
    }

    public void setInstanceIndex(int nIndex) {
    }

    public Obj getInstanceManager() {
        return new InstanceManager(this);
    }

    @Override
    public ScriptTable getScriptTable() {
        return SubformSetScript.getScriptTable();
    }

    @Override
    protected ScriptDynamicPropObj getDynamicScriptProp(String sPropertyName, boolean bPropertyOverride, boolean bPeek) {
        String sNewName;
        Node oChild;
        if (sPropertyName.length() > 0 && sPropertyName.charAt(0) == '_' && (sNewName = sPropertyName.substring(1)).length() > 0 && ((oChild = this.locateChildByName(sNewName, 0)) instanceof Subform || oChild instanceof SubformSet)) {
            return getInstanceManagerScriptObj;
        }
        return super.getDynamicScriptProp(sPropertyName, bPropertyOverride, bPeek);
    }

    private static boolean getInstanceManagerFunc(Obj oObj, Arg oRetVal, String sProp) {
        SubformSet oSubSet = (SubformSet)oObj;
        oRetVal.setObject(oSubSet.getInstanceManager());
        return true;
    }

}