import java.util.ArrayList;

import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JCheckBox;
import javax.swing.JPanel;


public class InstallConfig {
	private ArrayList<String> sections = new ArrayList<String>();
	private String name, desc;
	private JCheckBox selectbox;
	
	public InstallConfig(THFileIO configfile) {
		if (configfile.readFromFile().equals("NAME")) {
			name = configfile.readFromFile();
		}
		String line = configfile.readFromFile();
		while (!line.equals("END")) {
			sections.add(line);
			line = configfile.readFromFile();
		}
		selectbox = new JCheckBox(name);
		ConfigPage configpage = (ConfigPage) FreeSpaceOpenInstaller.GUI().getPage(ConfigPage.class);
		selectbox.addActionListener(configpage);
		selectbox.setActionCommand(name);
	}
	public String name() {
		return name;
	}
	public ArrayList<String> getSections() {
		return sections;
	}
	public JPanel getPanel()
	{
		JPanel panel = new JPanel();
		panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
		panel.add(selectbox);
		panel.add(Box.createHorizontalGlue());
		return panel;
	}
	public boolean isSelected()
	{
		return selectbox.isSelected();		
	}

}
