/*
 * @(#)ViewOpenInNewWindowAction.java  1.0  2008-10-05
 * 
 * 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.JPDFFilePanel;
import java.awt.event.ActionEvent;

/**
 * ViewOpenInNewWindowAction.
 *
 * @author Werner Randelshofer, Hausmatt 10, CH-6405 Immensee
 * @version 1.0 2008-10-05 Created.
 */
public class ViewOpenInNewWindowAction extends AbstractJPDFFilePanelAction {
    public static String ID = "view.openInNewWindow";

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

    public void actionPerformed(ActionEvent e) {
        pdfPanel.getAppletContext().showDocument(pdfPanel.getDocumentURL(), "_blank");
    }

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

}
