/* $Id: ReadSearchListAction.java 1062 2016-01-21 16:58:30Z yuta-hashimoto $ */
package smart_gs.spread_selection;

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

import javax.swing.JOptionPane;

import smart_gs.logical.SpreadSelectionList;
import smart_gs.logical.SpreadSelectionListManager;

class ReadSpreadSelectionListAction implements ActionListener {
	String SpreadSelectionListName = "";
	SetScopePanel callingSetScopePanel;

	public ReadSpreadSelectionListAction (SetScopePanel setScopePanel) {
		this.callingSetScopePanel = setScopePanel;
		}
	
//	@Override
	public void actionPerformed(ActionEvent e) {
		ArrayList<SpreadSelectionList> SpreadSelectionLists = SpreadSelectionListManager.getInstance().getSpreadSelectionLists();


		SpreadSelectionListName = JOptionPane.showInputDialog("Input SpreadSelectionList name","");
		String selectionList = SpreadSelectionListManager.getInstance().getSpreadSelectionListString(SpreadSelectionListName);
		if (selectionList == null) {
			JOptionPane.showMessageDialog(null, "Spread Selection List " + SpreadSelectionListName + " does not exist");
			return;
		}
		this.callingSetScopePanel.getPageSelectField().setText(selectionList);
		this.callingSetScopePanel.getPageSelectField().repaint();
	}
}
