/*
Tiamat - a role-playing game framework
ActionSelectPanel.java - panel to select an action for an Event
 
 Copyright  (C) 2006 Hugues Johnson
 
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
the GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

package com.huguesjohnson.tiamat.tools;

import javax.swing.BoxLayout;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;

import com.huguesjohnson.tiamat.IAdventureCommands;

public class ActionSelectPanel extends JPanel{
	/* Determines if a de-serialized file is compatible with this class. See <a href="http://java.sun.com/j2se/1.5.0/docs/guide/serialization/spec/class.html">Java Object Serialization Specifications</a>. */
	private static final long serialVersionUID=-3665265442021845060L;

	private JComboBox actionBox;
	
	public ActionSelectPanel(){
		this.initComponents();
	}
	
	private void initComponents(){
		this.setLayout(new BoxLayout(this,BoxLayout.X_AXIS));
		this.add(new JLabel("Action: "));
		this.actionBox=new JComboBox();
		this.actionBox.setEditable(false);
		int count=IAdventureCommands.Actions.values().length;
		for(int index=0;index<count;index++){
			this.actionBox.addItem(IAdventureCommands.Actions.values()[index].value());
		}
		this.add(this.actionBox);
	}
	
	public String getAction(){
		return((String)this.actionBox.getSelectedItem());
	}
	
	public void setAction(String action){
		this.actionBox.setSelectedItem(action);
	}
}