package smart_gs.swingui.toolbar.action;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import smart_gs.swingui.AbstractGSWindow;

public class ZoomInOutActionListener implements ActionListener {
	
	private String kind = new String();
	private AbstractGSWindow parent;

	public ZoomInOutActionListener(AbstractGSWindow parent,String kind) {
		this.kind = kind;
		this.parent = parent;
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		if (this.parent.getSpread() == null) return;
		if (this.kind.equals("ZoomIn")) {
			this.parent.getSpreadCanvas().zoomIn();
		} else if (this.kind.equals("ZoomOut")) {
			this.parent.getSpreadCanvas().zoomOut();
		} else if (this.kind.equals("FullSize")) {
			this.parent.getSpreadCanvas().fullSize();
		} else if (this.kind.equals("FitWidth")) {
			this.parent.getSpreadCanvas().fitWidth();
		} else if (this.kind.equals("FitHeight")) {
			this.parent.getSpreadCanvas().fitHeight();
		}

	}

}
