/* $Id: GUIReadSpreadSelectionListAction.java 125 2011-03-09 09:49:51Z ohura $ */
package smart_gs.spread_selection;

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

import javax.swing.JOptionPane;

import smart_gs.logical.SpreadSelectionListManager;
import smart_gs.spread_selection.SpreadSelectionTree;

public class GUIReadSpreadSelectionListAction implements ActionListener {
	
	private SpreadSelectionTree tree;
	
	public GUIReadSpreadSelectionListAction(SpreadSelectionTree givenTree) {
		super();
		tree = givenTree;
	}

//	@Override
	public void actionPerformed(ActionEvent arg0) {
		SpreadSelectionListManager maneger = SpreadSelectionListManager.getInstance();
		String SpreadSelectionListName = JOptionPane.showInputDialog("Input SpreadSelectionList name","");
		String selectionList = maneger.getSpreadSelectionListString(SpreadSelectionListName);
		if (selectionList == null) {
			JOptionPane.showMessageDialog(null, "Spread Selection List " + SpreadSelectionListName + " does not exist");
			return;
		}
		(new SelectionListCheckBoxSelector(tree.getRootNode())).select(selectionList);
		tree.repaint();
	}

}
