ScriptDispatcher.java 1.19 KB
/*
 * Decompiled with CFR 0_118.
 */
package com.adobe.xfa;

import com.adobe.xfa.Dispatcher;
import com.adobe.xfa.Element;
import com.adobe.xfa.EventManager;

public class ScriptDispatcher
extends Dispatcher {
    private final String msContentType;
    private final String msScript;

    public ScriptDispatcher(Element poScriptContextNode, String sEventContext, int nEventID, EventManager poEventManager, String sScript, String sContentType) {
        super(poScriptContextNode, sEventContext, nEventID, poEventManager);
        this.msScript = sScript;
        this.msContentType = sContentType;
    }

    @Override
    public void dispatch() {
        this.getActionContextNode().evaluate(this.msScript, this.msContentType, 0, true);
    }

    public String getContentType() {
        return this.msContentType;
    }

    @Override
    public String getDispatcherType() {
        return "script";
    }

    @Override
    public String getParameter(int nParam) {
        if (nParam == 0) {
            return this.getContentType();
        }
        if (nParam == 1) {
            return this.getScript();
        }
        return "";
    }

    public String getScript() {
        return this.msScript;
    }
}