PDFJavaScriptEvent.java 2.05 KB
/*
 * Decompiled with CFR 0_118.
 */
package com.adobe.internal.pdftoolkit.pdf.interactive.action;

import com.adobe.internal.pdftoolkit.pdf.document.PDFCosObject;
import com.adobe.internal.pdftoolkit.pdf.interactive.action.PDFActionJavaScript;
import com.adobe.internal.pdftoolkit.pdf.interactive.forms.PDFField;

public class PDFJavaScriptEvent {
    private PDFCosObject pdfObject;
    private String eventName;
    private String eventType;
    private PDFActionJavaScript pdfJSAction;
    public static final String fieldEventType = "Field";

    protected PDFJavaScriptEvent(PDFField field, String eventName, String type, PDFActionJavaScript action) {
        this.setParent(field);
        this.setEventType(type);
        this.setPdfJSAction(action);
        this.setEventName(eventName);
    }

    public PDFJavaScriptEvent(PDFField field, PDFActionJavaScript action, String eventType) {
        this.setParent(field);
        this.setEventType("Field");
        this.setPdfJSAction(action);
        if (eventType.equalsIgnoreCase("c")) {
            this.setEventName("Calculate");
        }
        if (eventType.equalsIgnoreCase("f")) {
            this.setEventName("Format");
        }
        if (eventType.equalsIgnoreCase("v")) {
            this.setEventName("Validate");
        }
        if (eventType.equalsIgnoreCase("k")) {
            this.setEventName("KeystrokeMouse");
        }
    }

    public PDFCosObject getParent() {
        return this.pdfObject;
    }

    public void setParent(PDFField parent) {
        this.pdfObject = parent;
    }

    public PDFActionJavaScript getPdfJSAction() {
        return this.pdfJSAction;
    }

    public void setPdfJSAction(PDFActionJavaScript pdfJSAction) {
        this.pdfJSAction = pdfJSAction;
    }

    public String getEventType() {
        return this.eventType;
    }

    public void setEventType(String type) {
        this.eventType = type;
    }

    public String getEventName() {
        return this.eventName;
    }

    public void setEventName(String eventName) {
        this.eventName = eventName;
    }
}