package testing;

import com.ulcjava.base.application.ULCButton;
import com.ulcjava.base.application.ULCProxy;
import com.ulcjava.base.application.event.ActionEvent;
import com.ulcjava.base.application.event.IActionListener;
import com.ulcjava.base.application.util.Color;
import com.ulcjava.base.shared.UlcEventCategories;

public class ULCButtonAdapter extends ULCProxy {

	
	private ULCButton button;
	
	public ULCButtonAdapter(ULCButton button){
		this.button = button;
		upload();
		addListener(UlcEventCategories.ACTION_EVENT_CATEGORY,new ActionHandler());
	}
		
	protected void uploadStateUI() {
		super.uploadStateUI();
		createStateUI(new Object[]{button});
	}

	protected String typeString() {
		return "testing.UIAdapter";
	}
	
	public void service(){
		System.out.println("ULCButtonAdapter.service()");
		button.setText("service");
	}
	
	class ActionHandler implements IActionListener{

		public void actionPerformed(ActionEvent arg0) {
			System.out.println("ActionHandler.actionPerformed()");
			button.setBackground(Color.red);
		}		
	}
}
