package com.javahonk.action;

import java.util.ArrayList;
import java.util.List;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;

import com.opensymphony.xwork2.ActionSupport;

@Results({ @Result(name = "error", location = "/input.jsp"),
		@Result(name = "success", location = "/success.jsp"),
		@Result(name = "input", location = "/input.jsp") })
public class AllFromValueAction extends ActionSupport {

	private static final long serialVersionUID = 1L;
	private String firstName;
	private String lastName;
	private String password;
	private String checkbox;
	private String combobox;
	private String textArea;
	private String selectedRadionButton;
	private String selectedValue;
	private List<String> radioButtonList = new ArrayList<String>();
	private List<String> comboBoxList = new ArrayList<String>();
	private List<String> selectList = new ArrayList<String>();

	public AllFromValueAction() {

		radioButtonList.add("NY");
		radioButtonList.add("NJ");
		radioButtonList.add("MA");
		comboBoxList = radioButtonList;
		selectList = radioButtonList;
		setRadioButtonList(radioButtonList);
		setComboBoxList(comboBoxList);
		setSelectList(selectList);
	}

	@Override
	@Action(value = "/allFromValueAction")
	public String execute() throws Exception {
		return ActionSupport.SUCCESS;
	}

	@Action(value = "/displayAction")
	public String displayPage() {
		return ActionSupport.INPUT;
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public String getTextArea() {
		return textArea;
	}

	public void setTextArea(String textArea) {
		this.textArea = textArea;
	}

	public List<String> getRadioButtonList() {
		return radioButtonList;
	}

	public void setRadioButtonList(List<String> radioButtonList) {
		this.radioButtonList = radioButtonList;
	}

	public List<String> getComboBoxList() {
		return comboBoxList;
	}

	public void setComboBoxList(List<String> comboBoxList) {
		this.comboBoxList = comboBoxList;
	}

	public List<String> getSelectList() {
		return selectList;
	}

	public void setSelectList(List<String> selectList) {
		this.selectList = selectList;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getCheckbox() {
		return checkbox;
	}

	public void setCheckbox(String checkbox) {
		this.checkbox = checkbox;
	}

	public String getCombobox() {
		return combobox;
	}

	public void setCombobox(String combobox) {
		this.combobox = combobox;
	}

	public String getSelectedRadionButton() {
		return selectedRadionButton;
	}

	public void setSelectedRadionButton(String selectedRadionButton) {
		this.selectedRadionButton = selectedRadionButton;
	}

	public String getSelectedValue() {
		return selectedValue;
	}

	public void setSelectedValue(String selectedValue) {
		this.selectedValue = selectedValue;
	}

}
