
package com.sun.ts.tests.jsf.common.beans;

import java.io.Serializable;

import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;
import javax.faces.event.ActionEvent;

@ManagedBean(name="color")
@ApplicationScoped
public class ColorBean implements Serializable {
 
	private static final long serialVersionUID = 1L;
	private String color;
	
	public void editColor(ActionEvent event){	    
	    String buttonId = event.getComponent().getId();
	    
	if(buttonId.contains("Red")) {
		this.setColor("Red");
	    } else {
		this.setColor("Blue");
	    }
	}
	
	public String result(){
	    return color;
	}

	public String getColor() {
	    return color;
	}

	private void setColor(String color) {
	    this.color = color;
	}
	
	
	
}