/*
 * @(#)AbstractJPDFFilePanelAction.java  1.0  2008-00-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.JPDFFilePanel;
import org.jhotdraw.util.ResourceBundleUtil;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.AbstractAction;

/**
 *
 * @author werni
 */
public abstract class AbstractJPDFFilePanelAction extends AbstractAction {
    protected JPDFFilePanel pdfPanel;
    private PropertyChangeListener changeListener = new PropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent evt) {
            updateAction();
        }

    };
    
    public AbstractJPDFFilePanelAction(JPDFFilePanel pdfPanel, String id) {
        this.pdfPanel = pdfPanel;
       ResourceBundleUtil labels = ResourceBundleUtil.getBundle("ch.randelshofer.pdf.Labels");
       labels.configureAction(this, id);
        pdfPanel.addPropertyChangeListener(changeListener);
    }

    protected abstract void updateAction();
}
