/*
 * @(#)ViewZoomFitPageAction.java  1.0  2008-09-20
 * 
 * Copyright (c) 2008 Werner Randelshofer, Immensee, Switzerland.
 * All rights reserved.
 *
 * You may not use, copy or modify this file, except in compliance with the
 * license agreement you entered into with Werner Randelshofer.
 * For details see accompanying license terms.
 */

package ch.randelshofer.pdf.action;

import ch.randelshofer.pdf.*;
import com.sun.pdfview.PDFPage;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import javax.swing.JViewport;

/**
 * ViewZoomFitPageAction.
 *
 * @author Werner Randelshofer
 * @version 1.0 2008-09
 */
public class ViewZoomFitPageAction extends AbstractJPDFFilePanelAction {
    public static String ID = "view.zoom.fitPage";

    public ViewZoomFitPageAction(JPDFFilePanel pdfPanel) {
        super(pdfPanel, ID);
    }

    public void actionPerformed(ActionEvent e) {
     pdfPanel.setZoomPolicy(ZoomPolicy.FIT_PAGE);
    }

    @Override
    protected void updateAction() {
        setEnabled(pdfPanel.getPDF() != null);
    }

}
