/**
 * 
 */
package org.ajax4jsf;

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

import javax.faces.event.ValueChangeEvent;

/**
 * @author asmirnov
 *
 */
public class DataBean {
	private List detail = new ArrayList();
	
	private String mounth;
	
	private int total;
	
	private int price;

	private boolean checked=true;
	/**
	 * 
	 */
	public DataBean() {
		// TODO Auto-generated constructor stub
	}

	/**
	 * @return the detail
	 */
	public List getDetail() {
		return this.detail;
	}

	/**
	 * @param detail the detail to set
	 */
	public void setDetail(List detail) {
		this.detail = detail;
	}

	/**
	 * @return the mounth
	 */
	public String getMounth() {
		return this.mounth;
	}

	/**
	 * @param mounth the mounth to set
	 */
	public void setMounth(String mounth) {
		this.mounth = mounth;
	}

	/**
	 * @return the total
	 */
	public int getTotal() {
		return this.total;
	}

	/**
	 * @param total the total to set
	 */
	public void setTotal(int total) {
		this.total = total;
	}

	/**
	 * @return the checked
	 */
	public boolean isChecked() {
		System.out.println("Invoke get checked for mounth "+getMounth()+", checked:"+checked);
		return this.checked;
	}

	/**
	 * @param checked the checked to set
	 */
	public void setChecked(boolean checked) {
		System.out.println("Invoke set checked for mounth "+getMounth()+", checked:"+checked);
		this.checked = checked;
	}
	
	public String check(){
		checked = !checked;
		System.out.println("Invoke check action for mounth "+getMounth()+", checked:"+checked);
		return null;
	}
	
	public String inc(){
		total++;
		return null;
	}
	
	public void checkChanged(ValueChangeEvent event) {
		System.out.println("Checked changed for mounth "+getMounth());		
	}

	/**
	 * @return the price
	 */
	public int getPrice() {
	    return price;
	}

	/**
	 * @param price the price to set
	 */
	public void setPrice(int price) {
	    this.price = price;
	}

}
