package smart_gs.swingui.toolbar.action;

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

import smart_gs.logical.Spread;
import smart_gs.swingui.AbstractGSWindow;

public class UndoActionListener implements ActionListener {
	AbstractGSWindow parent;

	public UndoActionListener(AbstractGSWindow parent) {
		this.parent = parent;
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		Spread spread = this.parent.getSpread();
		if (spread == null) {
			return;
		} else {
			spread.undoRegion();
			this.parent.validate();
			this.parent.repaint();
		}
	}
}