content: import _ from 'lodash';
  import React from 'react';
  import BaseView from './baseView';
  
  class TreeView extends BaseView {
  	constructor(props) {
  		super(props);
  	}
  
  	_onBind() {
  		this._onDraw = this._onDraw.bind(this);
  		this._onViewChanged = this._onViewChanged.bind(this);
  	}
  
  	_onSetup() {
  		return {
  			store: this.props.store,
  			tree: this.props.tree
  		};
  	}
  	
  	_onViewChanged(node) {
  		this.setState({});
  	}
  
  	_onDraw(tree, View, onTreeChanged) {
  		if (_.isArray(tree)) {
  			return <ul>{ _.map(tree, node => this._onDraw(node, View, onTreeChanged))}</ul>;
  		}
  		if (_.isObject(tree)) {
  			return tree.children
  				?
  				<li key={ tree.index }>
  					<View nodeInfo={ tree } treeInfo={ this.tree } onTreeChanged={ onTreeChanged } />
  					{ this._onDraw(tree.children, View, onTreeChanged) }
  				</li>
  				:
  				<li key={ tree.index }>
  					<View nodeInfo={ tree } treeInfo={ this.tree } onTreeChanged={ onTreeChanged } />
  				</li>;
  		}
  	}
  
  	render() {
  		const { tree, nodeView } = this.props;
  		return <div>{this._onDraw(tree, nodeView, this._onViewChanged)}</div>;
  	}
  }
  
  export default TreeView;
  