package org.ajax4jsf.bean;

import javax.faces.event.ActionEvent;

public class A4JSupport {
	
	private String data = null;
	
	public static class Messages {
		public static final String FOR_LINK = "Link onclick passed";
		
		public static final String FOR_CHECKBOX = "Checkbox onchange passed";
		
		public static final String FOR_COMMAND = "Command onclick passed";
		
		public static final String FOR_SUBMIT = "Default listener";
		
		public static final String NO_DATA = "nodata";
	}
	
	public void linkListener (ActionEvent event) {
		data = Messages.FOR_LINK;
	}
	
	public void checkBoxListener (ActionEvent event) {
		data = Messages.FOR_CHECKBOX;
	}
	
	public void commandListener (ActionEvent event) {
		data = Messages.FOR_COMMAND;
	}

	public void listener (ActionEvent event) {
		data = Messages.FOR_SUBMIT;
	}


	/**
	 * @return the data
	 */
	public String getData() {
		return (data != null) ? data : Messages.NO_DATA;
	}

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