PDFBead_First.java 4.13 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.adobe.internal.pdftoolkit.core.cos.CosObject
 *  com.adobe.internal.pdftoolkit.core.exceptions.PDFIOException
 *  com.adobe.internal.pdftoolkit.core.exceptions.PDFInvalidDocumentException
 *  com.adobe.internal.pdftoolkit.core.exceptions.PDFInvalidParameterException
 *  com.adobe.internal.pdftoolkit.core.exceptions.PDFSecurityException
 *  com.adobe.internal.pdftoolkit.core.types.ASName
 */
package com.adobe.internal.pdftoolkit.pdf.interactive.navigation;

import com.adobe.internal.pdftoolkit.core.cos.CosObject;
import com.adobe.internal.pdftoolkit.core.exceptions.PDFIOException;
import com.adobe.internal.pdftoolkit.core.exceptions.PDFInvalidDocumentException;
import com.adobe.internal.pdftoolkit.core.exceptions.PDFInvalidParameterException;
import com.adobe.internal.pdftoolkit.core.exceptions.PDFSecurityException;
import com.adobe.internal.pdftoolkit.core.types.ASName;
import com.adobe.internal.pdftoolkit.pdf.document.PDFCosObject;
import com.adobe.internal.pdftoolkit.pdf.document.PDFDocument;
import com.adobe.internal.pdftoolkit.pdf.graphics.PDFRectangle;
import com.adobe.internal.pdftoolkit.pdf.interactive.navigation.PDFBead;
import com.adobe.internal.pdftoolkit.pdf.interactive.navigation.PDFThread;
import com.adobe.internal.pdftoolkit.pdf.page.PDFPage;

public class PDFBead_First
extends PDFBead {
    PDFBead_First(CosObject cosObject) throws PDFInvalidDocumentException {
        super(cosObject);
    }

    PDFBead_First(PDFDocument pdfDoc) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
        super(pdfDoc);
    }

    public static PDFBead_First newInstance(PDFDocument pdfDocument, PDFRectangle key_Rectangle, PDFBead key_N, PDFPage key_Page, PDFThread key_Thread, PDFBead key_Previous) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException, PDFInvalidParameterException {
        if (key_Rectangle == null) {
            throw new PDFInvalidParameterException("Rectangle is required when creating newInstance of PDFBead_First.");
        }
        if (key_N == null) {
            throw new PDFInvalidParameterException("N is required when creating newInstance of PDFBead_First.");
        }
        if (key_Page == null) {
            throw new PDFInvalidParameterException("Page is required when creating newInstance of PDFBead_First.");
        }
        if (key_Thread == null) {
            throw new PDFInvalidParameterException("Thread is required when creating newInstance of PDFBead_First.");
        }
        if (key_Previous == null) {
            throw new PDFInvalidParameterException("Previous is required when creating newInstance of PDFBead_First.");
        }
        PDFBead_First pdfObject = new PDFBead_First(pdfDocument);
        pdfObject.setRect(key_Rectangle);
        pdfObject.setNext(key_N);
        pdfObject.setPage(key_Page);
        pdfObject.setThread(key_Thread);
        pdfObject.setPrevious(key_Previous);
        return pdfObject;
    }

    public static PDFBead_First getInstance(CosObject cosObject) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
        if (PDFCosObject.checkNullCosObject(cosObject) == null) {
            return null;
        }
        PDFBead_First pdfObject = PDFCosObject.getCachedInstance(cosObject, PDFBead_First.class);
        if (pdfObject == null) {
            pdfObject = new PDFBead_First(cosObject);
        }
        return pdfObject;
    }

    public void setThread(PDFThread value) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
        if (value == null) {
            throw new PDFInvalidDocumentException("Thread is a required key for the first bead and therefore cannot be removed.");
        }
        this.setDictionaryValue(ASName.k_T, value);
    }

    public PDFThread requireThread() throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
        PDFThread pdfObject = PDFThread.getInstance(this.getDictionaryCosObjectValue(ASName.k_T));
        if (pdfObject == null) {
            throw new PDFInvalidDocumentException("Could not get Thread");
        }
        return pdfObject;
    }
}