/**
*树展示控件
*@access : public
*/
var treegrid;
(function($){
	/**
	*class treegrid
	*/
	var tg = treegrid = function(){
		this.contruct = function(id){
			this.id = id;
		};
		this.contruct.apply(this, arguments);
	};
//**************** begin public ********************
	tg.prototype.id = '';
	/**
	*数据源
	* @access : public
	* @parameters: 
			value:object  
	*/
	tg.prototype.__o_data__ = null;
	tg.prototype.data = function(value){		
		if(arguments.length>0){	//set
			if(typeof(value)=='object')
				this.__o_data__ = value;
			else
				throw new Error('The data is not a object.');
		}
		return this.__o_data__;
	};	//end function
	/**
	*plugin
	* @access : public
	* @parameters:
			value:plugin_instance
	*/
	tg.prototype.__plugin_inst__ = null;
	tg.prototype.plugin = function(value){
		if(arguments.length>0){
			this.__plugin_inst__ = value;
			if( this.__plugin_inst__ )
				this.__plugin_inst__.owner( this );
		}
		return this.__plugin_inst__;
	}	//end function
	/**
	*创建
	* @access : public
	*/
	tg.prototype.create = function() {		
		render.call(this);
	};	//end function
	/**
	*是否单一展开
	* @access : public
	*/
	tg.prototype.__is_multi_selected__ = false;
	tg.prototype.is_multi_selected = function(value){
		if(arguments.length>0){
			this.__is_multi_selected__ = value?true:false;
		}
		return this.__is_multi_selected__;
	};	//end function
	/**
	*已选项
	* @access : public
	*/
	tg.prototype.__selected_items__ = [];
	tg.prototype.selectedItems = function( /*string*/dom_id ){
		if(arguments.length>0 && dom_id!=''){
			if(this.is_multi_selected()){
				if(this.__selected_items__.indexOf(dom_id) < 0){
					this.__selected_items__.push(dom_id);
				}
			}
			else{
				this.__selected_items__ = [ dom_id ];
			}
		}
		return this.__selected_items__;
	};	//end function
//**************** end public ********************

//*********** begin private ***********
/**
	*渲染
	* @access : private
	*/	
	function render(){
		this.plugin().start();
	}	//end function
		
//*********** end private ************	
})(jQuery);
