/* Copyright 2009 Palm, Inc.  All rights reserved. */

var DebugAssistant = Class.create({
    initialize: function(params){
        this.appController = Mojo.Controller.getAppController();
        this.Messaging = this.appController.Messaging;
		
		this.handleDebugDataChange = function(data) {
			this.debugListModel.items = data;
			this.controller.modelChanged(this.debugListModel);
		}.bind(this);
		
    },
    
    setup: function(){
 		var debugData = this.Messaging.Debug.getDebugData();
		this.debugListAttr = {
			itemTemplate: 'debug/debugList-row'
		}
		this.debugListModel = {
			items: debugData
		};
		this.controller.setupWidget('debuglist', this.debugListAttr, this.debugListModel);
		this.debugListWidget = this.controller.get('debuglist');	  
    },
    
    ready: function(){
		this.Messaging.Debug.observe(this.handleDebugDataChange);
    },

    cleanup: function(){
		this.Messaging.Debug.stopObserving(this.handleDebugDataChange);
    },
    
    activate: function(){

    },
    
    deactivate: function(){

    }
});
