package dataTable;
import java.util.ArrayList;
import java.util.List;
import org.richfaces.component.html.HtmlDataGrid;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;

public class TestBean {

	private List<Table> tables = new ArrayList<Table>();
	private HtmlDataGrid myDataGrid = null;
	private String bindLabel;
	private String elements;

	public String getElements() {
		return elements;
	}

	public void setElements(String elements) {
		this.elements = elements;
	}

	public TestBean() {
		Table t1 = new Table();
		tables.add(t1);
		t1.getCells().add(new Cell());
		t1.getCells().add(new Cell());

		Table t2 = new Table();
		tables.add(t2);
		t2.getCells().add(new Cell());
		t2.getCells().add(new Cell());
		bindLabel = "not ready";
		elements = "0";
	}

	public String submit() {
		return null;
	}

	public void submitAjax() {
		
	}

	public void checkBinding(ActionEvent actionEvent){
		FacesContext context = FacesContext.getCurrentInstance();
		bindLabel = myDataGrid.getBaseClientId(context);
	}	
	
	public List<Table> getTables() {
		return tables;
	}

	public void setTables(List<Table> tables) {
		this.tables = tables;
	}

	public HtmlDataGrid getMyDataGrid() {
		return myDataGrid;
	}

	public void setMyDataGrid(HtmlDataGrid myDataGrid) {
		this.myDataGrid = myDataGrid;
	}

	public String getBindLabel() {
		return bindLabel;
	}

	public void setBindLabel(String bindLabel) {
		this.bindLabel = bindLabel;
	}
}
