package Action;

import IHM.WorkingImage;
import Window.Interface;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;

public class ActionZoom extends AbstractAction {
    public ActionZoom(String name, String desc, Integer mnemonic) {
        super(name);
        putValue(SHORT_DESCRIPTION, desc);
        putValue(Action.MNEMONIC_KEY, mnemonic);
        if (WorkingImage.getInstance().getImages().size() == 0)
            setEnabled(false);
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        if (this.getValue(NAME) == "Zoom In")
            WorkingImage.getInstance().zoomIn();
        else if (this.getValue(NAME) == "Zoom Out")
            WorkingImage.getInstance().zoomOut();
        Interface.getInstance().showWindow();
    }
}