/* start module: pyjamas.ui.TreeItem */
$pyjs['loaded_modules']['pyjamas.ui.TreeItem'] = function (__mod_name__) {
	if($pyjs['loaded_modules']['pyjamas.ui.TreeItem']['__was_initialized__']) return $pyjs['loaded_modules']['pyjamas.ui.TreeItem'];
	if(typeof $pyjs['loaded_modules']['pyjamas.ui'] == 'undefined' || !$pyjs['loaded_modules']['pyjamas.ui']['__was_initialized__']) $p['___import___']('pyjamas.ui', null);
	var $m = $pyjs['loaded_modules']['pyjamas.ui.TreeItem'];
	$m['__repr__'] = function() { return '<module: pyjamas.ui.TreeItem>'; };
	$m['__was_initialized__'] = true;
	if ((__mod_name__ === null) || (typeof __mod_name__ == 'undefined')) __mod_name__ = 'pyjamas.ui.TreeItem';
	$m['__name__'] = __mod_name__;
	$pyjs['loaded_modules']['pyjamas.ui']['TreeItem'] = $pyjs['loaded_modules']['pyjamas.ui.TreeItem'];


	$m['DOM'] = $p['___import___']('pyjamas.DOM', 'pyjamas.ui', null, false);
	$m['Factory'] = $p['___import___']('pyjamas.Factory', 'pyjamas.ui', null, false);
	$m['GWTCanvas'] = $p['___import___']('pyjamas.Canvas.GWTCanvas.GWTCanvas', 'pyjamas.ui', null, false);
	$m['Color'] = $p['___import___']('pyjamas.Canvas.Color', 'pyjamas.ui', null, false);
	$m['UIObject'] = $p['___import___']('pyjamas.ui.UIObject.UIObject', 'pyjamas.ui', null, false);
	$m['TreeContentPanel'] = $p['___import___']('pyjamas.ui.TreeContentPanel.TreeContentPanel', 'pyjamas.ui', null, false);
	$m['tree_closed'] = 'data:image/gif;base64,R0lGODlhEAAQAJECAMzMzAAAAP///wAAACH5BAEAAAIALAAAAAAQABAAAAIjlI+py+1vgJxzAYtNOFd1sUVYQJLCh3zhmYFcm1oUBdU2VAAAOw==';
	$m['tree_open'] = 'data:image/gif;base64,R0lGODlhEAAQAJECAAAAAMDAwAAAAP///yH5BAEAAAIALAAAAAAQABAAAAIflI+py+1vgpxzBYvV1TldAILC5nUIeZoHulIUBMdQAQA7';
	$m['tree_white'] = 'data:image/gif;base64,R0lGODlhEAAQAJEAAP///wAAAP///wAAACH5BAEAAAIALAAAAAAQABAAAAIOlI+py+0Po5y02ouzPgUAOw==';
	$m['TreeItem'] = (function(){
		var $cls_definition = new Object();
		var $method;
		$cls_definition['__module__'] = 'pyjamas.ui.TreeItem';
		$method = $pyjs__bind_method2('__init__', function(html) {
			if (this['__is_instance__'] === true) {
				var self = this;
				var ka = arguments['length'] >= 2 ? arguments[arguments['length']-1] : arguments[arguments['length']];
				if (ka === null || typeof ka != 'object' || ka['__name__'] != 'dict' || typeof ka['$pyjs_is_kwarg'] == 'undefined') {
					var ka = arguments[arguments['length']+1];
				} else {
					delete ka['$pyjs_is_kwarg'];
				}
			} else {
				var self = arguments[0];
				html = arguments[1];
				var ka = arguments['length'] >= 3 ? arguments[arguments['length']-1] : arguments[arguments['length']];
				if (ka === null || typeof ka != 'object' || ka['__name__'] != 'dict' || typeof ka['$pyjs_is_kwarg'] == 'undefined') {
					ka = arguments[arguments['length']+1];
				} else {
					delete ka['$pyjs_is_kwarg'];
				}
			}
			if (typeof ka == 'undefined') {
				ka = $p['__empty_dict']();
				if (typeof html != 'undefined') {
					if (html !== null && typeof html['$pyjs_is_kwarg'] != 'undefined') {
						ka = html;
						html = arguments[2];
					}
				} else 				if (typeof self != 'undefined') {
					if (self !== null && typeof self['$pyjs_is_kwarg'] != 'undefined') {
						ka = self;
						self = arguments[2];
					}
				} else {
				}
			}
			if (typeof html == 'undefined') html=arguments['callee']['__args__'][3][1];
			var $or1,tdContent,$or2,tdImg,tr,tbody,element,$pyjs_try_err;
			self['children'] = $p['list']([]);
			self['attached'] = false;
			self['contentPanel'] = null;
			self['itemTable'] = null;
			self['contentElem'] = null;
			self['imgElem'] = null;
			self['childSpanElem'] = null;
			self['open'] = false;
			self['parent'] = null;
			self['selected'] = false;
			self['tree'] = null;
			self['userObject'] = null;
			element = ($p['bool']($or1=ka['pop']('Element', null))?$or1:$m['DOM']['createDiv']());
			self['setElement'](element);
			self['itemTable'] = $m['DOM']['createTable']();
			self['contentElem'] = $m['DOM']['createSpan']();
			self['childSpanElem'] = $m['DOM']['createSpan']();
			self['imgElem'] = self['createImage']();
			tbody = $m['DOM']['createTBody']();
			tr = $m['DOM']['createTR']();
			tdImg = $m['DOM']['createTD']();
			tdContent = $m['DOM']['createTD']();
			$m['DOM']['appendChild']($p['getattr'](self, 'itemTable'), tbody);
			$m['DOM']['appendChild'](tbody, tr);
			$m['DOM']['appendChild'](tr, tdImg);
			$m['DOM']['appendChild'](tr, tdContent);
			$m['DOM']['setStyleAttribute'](tdImg, 'verticalAlign', 'middle');
			$m['DOM']['setStyleAttribute'](tdContent, 'verticalAlign', 'middle');
			$m['DOM']['setStyleAttribute'](self['getElement'](), 'cursor', 'pointer');
			$m['DOM']['appendChild'](self['getElement'](), $p['getattr'](self, 'itemTable'));
			$m['DOM']['appendChild'](self['getElement'](), $p['getattr'](self, 'childSpanElem'));
			$m['DOM']['appendChild'](tdImg, $p['getattr'](self, 'imgElem'));
			$m['DOM']['appendChild'](tdContent, $p['getattr'](self, 'contentElem'));
			self['setStyleName'](tdImg, 'gwt-TreeItemTdImg', true);
			self['setStyleName'](tdContent, 'gwt-TreeItemTdContent', true);
			try {
				$m['DOM']['setAttribute'](self['getElement'](), 'position', 'relative');
			} catch($pyjs_try_err) {
				var $pyjs_try_err_name = (typeof $pyjs_try_err['__name__'] == 'undefined' ? $pyjs_try_err['name'] : $pyjs_try_err['__name__'] );
				$pyjs['__last_exception__'] = {'error': $pyjs_try_err, 'module': $m};
				if (true) {
				}
			}
			$m['DOM']['setStyleAttribute']($p['getattr'](self, 'contentElem'), 'display', 'inline');
			$m['DOM']['setStyleAttribute'](self['getElement'](), 'whiteSpace', 'nowrap');
			try {
				$m['DOM']['setAttribute']($p['getattr'](self, 'itemTable'), 'whiteSpace', 'nowrap');
			} catch($pyjs_try_err) {
				var $pyjs_try_err_name = (typeof $pyjs_try_err['__name__'] == 'undefined' ? $pyjs_try_err['name'] : $pyjs_try_err['__name__'] );
				$pyjs['__last_exception__'] = {'error': $pyjs_try_err, 'module': $m};
				if (true) {
				}
			}
			$m['DOM']['setStyleAttribute']($p['getattr'](self, 'childSpanElem'), 'whiteSpace', 'nowrap');
			self['setStyleName']($p['getattr'](self, 'contentElem'), 'gwt-TreeItem', true);
			if ($p['bool']((html !== null))) {
				try {
					if ($p['bool']($p['isinstance'](html, (typeof unicode == "undefined"?$m['unicode']:unicode)))) {
						ka['__setitem__']('HTML', html);
					}
					else if ($p['bool']($p['isinstance'](html, $p['basestring']))) {
						ka['__setitem__']('HTML', html);
					}
					else {
						ka['__setitem__']('Widget', html);
					}
				} catch($pyjs_try_err) {
					var $pyjs_try_err_name = (typeof $pyjs_try_err['__name__'] == 'undefined' ? $pyjs_try_err['name'] : $pyjs_try_err['__name__'] );
					$pyjs['__last_exception__'] = {'error': $pyjs_try_err, 'module': $m};
					if (true) {
						if ($p['bool']($p['isinstance'](html, $p['basestring']))) {
							ka['__setitem__']('HTML', html);
						}
						else {
							ka['__setitem__']('Widget', html);
						}
					}
				}
			}
			$pyjs_kwargs_call($m['UIObject'], '__init__', null, ka, [{}, self]);
			return null;
		}
	, 1, [null,['ka'],['self'],['html', null]]);
		$cls_definition['__init__'] = $method;
		$method = $pyjs__bind_method2('__iter__', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			return self['children']['__iter__']();
		}
	, 1, [null,null,['self']]);
		$cls_definition['__iter__'] = $method;
		$method = $pyjs__bind_method2('createImage', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			return $m['DOM']['createImg']();
		}
	, 1, [null,null,['self']]);
		$cls_definition['createImage'] = $method;
		$method = $pyjs__bind_method2('addItem', function(item) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				item = arguments[1];
			}

			return self['insertItem'](item);
		}
	, 1, [null,null,['self'],['item']]);
		$cls_definition['addItem'] = $method;
		$method = $pyjs__bind_method2('insertItem', function(item, index) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				item = arguments[1];
				index = arguments[2];
			}
			if (typeof index == 'undefined') index=arguments['callee']['__args__'][4][1];
			var $or4,$or3;
			if ($p['bool'](!$p['bool']($p['hasattr'](item, 'getTree')))) {
				item = $m['TreeItem'](item);
			}
			if ($p['bool'](($p['bool']($or3=(item['getParentItem']() !== null))?$or3:(item['getTree']() !== null)))) {
				item['remove']();
			}
			item['setTree']($p['getattr'](self, 'tree'));
			item['setParentItem'](self);
			if ($p['bool']((index === null))) {
				self['children']['append'](item);
			}
			else {
				self['children']['insert'](index, item);
			}
			$m['DOM']['setStyleAttribute'](item['getElement'](), 'marginLeft', '16px');
			if ($p['bool']((index === null))) {
				$m['DOM']['appendChild']($p['getattr'](self, 'childSpanElem'), item['getElement']());
			}
			else {
				$m['DOM']['insertChild']($p['getattr'](self, 'childSpanElem'), item['getElement'](), index);
			}
			if ($p['bool']($p['op_eq']($p['len']($p['getattr'](self, 'children')), 1))) {
				self['updateState']();
			}
			return item;
		}
	, 1, [null,null,['self'],['item'],['index', null]]);
		$cls_definition['insertItem'] = $method;
		$method = $pyjs__bind_method2('onAttach', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}
			var $iter1_nextval,$iter1_type,$iter1_iter,item,$iter1_array,w,$iter1_idx;
			if ($p['bool']($p['getattr'](self, 'attached'))) {
				return null;
			}
			self['attached'] = true;
			$iter1_iter = $p['getattr'](self, 'children');
			$iter1_nextval=$p['__iter_prepare']($iter1_iter,false);
			while (typeof($p['__wrapped_next']($iter1_nextval)['$nextval']) != 'undefined') {
				item = $iter1_nextval['$nextval'];
				item['onAttach']();
			}
			w = self['getWidget']();
			if ($p['bool'](w)) {
				w['onAttach']();
			}
			return null;
		}
	, 1, [null,null,['self']]);
		$cls_definition['onAttach'] = $method;
		$method = $pyjs__bind_method2('onDetach', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}
			var $iter2_nextval,$iter2_type,$iter2_iter,item,$iter2_idx,w,$iter2_array;
			self['attached'] = false;
			$iter2_iter = $p['getattr'](self, 'children');
			$iter2_nextval=$p['__iter_prepare']($iter2_iter,false);
			while (typeof($p['__wrapped_next']($iter2_nextval)['$nextval']) != 'undefined') {
				item = $iter2_nextval['$nextval'];
				item['onDetach']();
			}
			w = self['getWidget']();
			if ($p['bool'](w)) {
				w['onDetach']();
			}
			return null;
		}
	, 1, [null,null,['self']]);
		$cls_definition['onDetach'] = $method;
		$method = $pyjs__bind_method2('getChild', function(index) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				index = arguments[1];
			}
			var $or5,$or6;
			if ($p['bool'](($p['bool']($or5=($p['cmp'](index, 0) == -1))?$or5:((($p['cmp'](index, $p['len']($p['getattr'](self, 'children'))))|1) == 1)))) {
				return null;
			}
			return $p['getattr'](self, 'children')['__getitem__'](index);
		}
	, 1, [null,null,['self'],['index']]);
		$cls_definition['getChild'] = $method;
		$method = $pyjs__bind_method2('getChildCount', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			return $p['len']($p['getattr'](self, 'children'));
		}
	, 1, [null,null,['self']]);
		$cls_definition['getChildCount'] = $method;
		$method = $pyjs__bind_method2('getChildIndex', function(child) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				child = arguments[1];
			}

			return self['children']['index'](child);
		}
	, 1, [null,null,['self'],['child']]);
		$cls_definition['getChildIndex'] = $method;
		$method = $pyjs__bind_method2('getHTML', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			return $m['DOM']['getInnerHTML']($p['getattr'](self, 'contentElem'));
		}
	, 1, [null,null,['self']]);
		$cls_definition['getHTML'] = $method;
		$method = $pyjs__bind_method2('getText', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			return $m['DOM']['getInnerText']($p['getattr'](self, 'contentElem'));
		}
	, 1, [null,null,['self']]);
		$cls_definition['getText'] = $method;
		$method = $pyjs__bind_method2('getParentItem', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			return $p['getattr'](self, 'parent');
		}
	, 1, [null,null,['self']]);
		$cls_definition['getParentItem'] = $method;
		$method = $pyjs__bind_method2('getState', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			return $p['getattr'](self, 'open');
		}
	, 1, [null,null,['self']]);
		$cls_definition['getState'] = $method;
		$method = $pyjs__bind_method2('getTree', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			return $p['getattr'](self, 'tree');
		}
	, 1, [null,null,['self']]);
		$cls_definition['getTree'] = $method;
		$method = $pyjs__bind_method2('getUserObject', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			return $p['getattr'](self, 'userObject');
		}
	, 1, [null,null,['self']]);
		$cls_definition['getUserObject'] = $method;
		$method = $pyjs__bind_method2('getWidget', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			if ($p['bool'](($p['getattr'](self, 'contentPanel') === null))) {
				return null;
			}
			return self['contentPanel']['getWidget']();
		}
	, 1, [null,null,['self']]);
		$cls_definition['getWidget'] = $method;
		$method = $pyjs__bind_method2('isSelected', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			return $p['getattr'](self, 'selected');
		}
	, 1, [null,null,['self']]);
		$cls_definition['isSelected'] = $method;
		$method = $pyjs__bind_method2('remove', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			if ($p['bool'](($p['getattr'](self, 'parent') !== null))) {
				self['parent']['removeItem'](self);
			}
			else if ($p['bool'](($p['getattr'](self, 'tree') !== null))) {
				self['tree']['removeItem'](self);
			}
			return null;
		}
	, 1, [null,null,['self']]);
		$cls_definition['remove'] = $method;
		$method = $pyjs__bind_method2('removeItem', function(item) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				item = arguments[1];
			}

			if ($p['bool'](!$p['getattr'](self, 'children')['__contains__'](item))) {
				return null;
			}
			item['setTree'](null);
			item['setParentItem'](null);
			self['children']['remove'](item);
			$m['DOM']['removeChild']($p['getattr'](self, 'childSpanElem'), item['getElement']());
			if ($p['bool']($p['op_eq']($p['len']($p['getattr'](self, 'children')), 0))) {
				self['updateState']();
			}
			return null;
		}
	, 1, [null,null,['self'],['item']]);
		$cls_definition['removeItem'] = $method;
		$method = $pyjs__bind_method2('removeItems', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			while ($p['bool'](($p['cmp'](self['getChildCount'](), 0) == 1))) {
				self['removeItem'](self['getChild'](0));
			}
			return null;
		}
	, 1, [null,null,['self']]);
		$cls_definition['removeItems'] = $method;
		$method = $pyjs__bind_method2('setHTML', function(html) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				html = arguments[1];
			}

			self['clearContentPanel']();
			$m['DOM']['setInnerHTML']($p['getattr'](self, 'contentElem'), html);
			return null;
		}
	, 1, [null,null,['self'],['html']]);
		$cls_definition['setHTML'] = $method;
		$method = $pyjs__bind_method2('setText', function(text) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				text = arguments[1];
			}

			self['clearContentPanel']();
			$m['DOM']['setInnerText']($p['getattr'](self, 'contentElem'), text);
			return null;
		}
	, 1, [null,null,['self'],['text']]);
		$cls_definition['setText'] = $method;
		$method = $pyjs__bind_method2('setSelected', function(selected) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				selected = arguments[1];
			}

			if ($p['bool']($p['op_eq']($p['getattr'](self, 'selected'), selected))) {
				return null;
			}
			self['selected'] = selected;
			self['setStyleName']($p['getattr'](self, 'contentElem'), 'gwt-TreeItem-selected', selected);
			return null;
		}
	, 1, [null,null,['self'],['selected']]);
		$cls_definition['setSelected'] = $method;
		$method = $pyjs__bind_method2('setState', function(open, fireEvents) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				open = arguments[1];
				fireEvents = arguments[2];
			}
			if (typeof fireEvents == 'undefined') fireEvents=arguments['callee']['__args__'][4][1];
			var $or7,$or8;
			if ($p['bool'](($p['bool']($or7=!$p['bool'](open))?$or7:!$p['op_eq']($p['len']($p['getattr'](self, 'children')), 0)))) {
				self['open'] = open;
				self['updateState']();
			}
			if ($p['bool'](fireEvents)) {
				self['tree']['fireStateChanged'](self);
			}
			return null;
		}
	, 1, [null,null,['self'],['open'],['fireEvents', true]]);
		$cls_definition['setState'] = $method;
		$method = $pyjs__bind_method2('setUserObject', function(userObj) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				userObj = arguments[1];
			}

			self['userObject'] = userObj;
			return null;
		}
	, 1, [null,null,['self'],['userObj']]);
		$cls_definition['setUserObject'] = $method;
		$method = $pyjs__bind_method2('setWidget', function(widget) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				widget = arguments[1];
			}

			self['ensureContentPanel']();
			self['contentPanel']['setWidget'](widget);
			return null;
		}
	, 1, [null,null,['self'],['widget']]);
		$cls_definition['setWidget'] = $method;
		$method = $pyjs__bind_method2('clearContentPanel', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}
			var child;
			if ($p['bool'](($p['getattr'](self, 'contentPanel') !== null))) {
				child = self['contentPanel']['getWidget']();
				if ($p['bool']((child !== null))) {
					self['contentPanel']['remove'](child);
				}
				if ($p['bool'](($p['getattr'](self, 'tree') !== null))) {
					self['tree']['disown']($p['getattr'](self, 'contentPanel'));
					self['contentPanel'] = null;
				}
			}
			return null;
		}
	, 1, [null,null,['self']]);
		$cls_definition['clearContentPanel'] = $method;
		$method = $pyjs__bind_method2('ensureContentPanel', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			if ($p['bool'](($p['getattr'](self, 'contentPanel') === null))) {
				$m['DOM']['setInnerHTML']($p['getattr'](self, 'contentElem'), '');
				self['contentPanel'] = $m['TreeContentPanel']($p['getattr'](self, 'contentElem'));
				self['contentPanel']['setTreeItem'](self);
				if ($p['bool']((self['getTree']() !== null))) {
					self['tree']['adopt']($p['getattr'](self, 'contentPanel'));
				}
			}
			return null;
		}
	, 1, [null,null,['self']]);
		$cls_definition['ensureContentPanel'] = $method;
		$method = $pyjs__bind_method2('addTreeItems', function(accum) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				accum = arguments[1];
			}
			var $iter3_idx,$iter3_type,item,$iter3_iter,$iter3_array,$iter3_nextval;
			$iter3_iter = $p['getattr'](self, 'children');
			$iter3_nextval=$p['__iter_prepare']($iter3_iter,false);
			while (typeof($p['__wrapped_next']($iter3_nextval)['$nextval']) != 'undefined') {
				item = $iter3_nextval['$nextval'];
				accum['append'](item);
				item['addTreeItems'](accum);
			}
			return null;
		}
	, 1, [null,null,['self'],['accum']]);
		$cls_definition['addTreeItems'] = $method;
		$method = $pyjs__bind_method2('getChildren', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			return $p['getattr'](self, 'children');
		}
	, 1, [null,null,['self']]);
		$cls_definition['getChildren'] = $method;
		$method = $pyjs__bind_method2('getContentElem', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			return $p['getattr'](self, 'contentElem');
		}
	, 1, [null,null,['self']]);
		$cls_definition['getContentElem'] = $method;
		$method = $pyjs__bind_method2('getContentHeight', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			return $m['DOM']['getIntAttribute']($p['getattr'](self, 'itemTable'), 'offsetHeight');
		}
	, 1, [null,null,['self']]);
		$cls_definition['getContentHeight'] = $method;
		$method = $pyjs__bind_method2('getImageElement', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			return $p['getattr'](self, 'imgElem');
		}
	, 1, [null,null,['self']]);
		$cls_definition['getImageElement'] = $method;
		$method = $pyjs__bind_method2('getTreeTop', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}
			var $add2,item,$add1,ret;
			item = self;
			ret = 0;
			while ($p['bool']((item !== null))) {
				ret = $p['__op_add']($add1=ret,$add2=$m['DOM']['getIntAttribute'](item['getElement'](), 'offsetTop'));
				item = item['getParentItem']();
			}
			return ret;
		}
	, 1, [null,null,['self']]);
		$cls_definition['getTreeTop'] = $method;
		$method = $pyjs__bind_method2('getFocusableWidget', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}
			var widget;
			widget = self['getWidget']();
			if ($p['bool']($p['hasattr'](widget, 'setFocus'))) {
				return widget;
			}
			return null;
		}
	, 1, [null,null,['self']]);
		$cls_definition['getFocusableWidget'] = $method;
		$method = $pyjs__bind_method2('imgSrc', function(img) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				img = arguments[1];
			}
			var $add3,$add4,src;
			if ($p['bool'](($p['getattr'](self, 'tree') === null))) {
				return img;
			}
			src = $p['__op_add']($add3=self['tree']['getImageBase'](),$add4=img);
			return src;
		}
	, 1, [null,null,['self'],['img']]);
		$cls_definition['imgSrc'] = $method;
		$method = $pyjs__bind_method2('setParentItem', function(parent) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				parent = arguments[1];
			}

			self['parent'] = parent;
			return null;
		}
	, 1, [null,null,['self'],['parent']]);
		$cls_definition['setParentItem'] = $method;
		$method = $pyjs__bind_method2('setTree', function(tree) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				tree = arguments[1];
			}
			var $iter4_nextval,$and1,$iter4_idx,$iter4_type,child,$iter4_array,$iter4_iter,$and2;
			if ($p['bool']($p['op_eq']($p['getattr'](self, 'tree'), tree))) {
				return null;
			}
			if ($p['bool'](($p['getattr'](self, 'tree') !== null))) {
				if ($p['bool']($p['op_eq'](self['tree']['getSelectedItem'](), self))) {
					self['tree']['setSelectedItem'](null);
				}
				if ($p['bool'](($p['getattr'](self, 'contentPanel') !== null))) {
					self['tree']['disown']($p['getattr'](self, 'contentPanel'));
				}
			}
			self['tree'] = tree;
			$iter4_iter = $p['getattr'](self, 'children');
			$iter4_nextval=$p['__iter_prepare']($iter4_iter,false);
			while (typeof($p['__wrapped_next']($iter4_nextval)['$nextval']) != 'undefined') {
				child = $iter4_nextval['$nextval'];
				child['setTree'](tree);
			}
			self['updateState']();
			if ($p['bool'](($p['bool']($and1=(tree !== null))?($p['getattr'](self, 'contentPanel') !== null):$and1))) {
				tree['adopt']($p['getattr'](self, 'contentPanel'));
			}
			return null;
		}
	, 1, [null,null,['self'],['tree']]);
		$cls_definition['setTree'] = $method;
		$method = $pyjs__bind_method2('updateState', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			if ($p['bool']($p['op_eq']($p['len']($p['getattr'](self, 'children')), 0))) {
				self['setVisible']($p['getattr'](self, 'childSpanElem'), false);
				self['drawImage']('white');
				return null;
			}
			if ($p['bool']($p['getattr'](self, 'open'))) {
				self['setVisible']($p['getattr'](self, 'childSpanElem'), true);
				self['drawImage']('open');
			}
			else {
				self['setVisible']($p['getattr'](self, 'childSpanElem'), false);
				self['drawImage']('closed');
			}
			return null;
		}
	, 1, [null,null,['self']]);
		$cls_definition['updateState'] = $method;
		$method = $pyjs__bind_method2('updateStateRecursive', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}
			var $iter5_nextval,i,$iter5_idx,child,$iter5_iter,$iter5_array,$iter5_type;
			self['updateState']();
			$iter5_iter = $p['range']($p['len']($p['getattr'](self, 'children')));
			$iter5_nextval=$p['__iter_prepare']($iter5_iter,false);
			while (typeof($p['__wrapped_next']($iter5_nextval)['$nextval']) != 'undefined') {
				i = $iter5_nextval['$nextval'];
				child = $p['getattr'](self, 'children')['__getitem__'](i);
				child['updateStateRecursive']();
			}
			return null;
		}
	, 1, [null,null,['self']]);
		$cls_definition['updateStateRecursive'] = $method;
		$method = $pyjs__bind_method2('drawImage', function(mode) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				mode = arguments[1];
			}
			var src;
			if ($p['bool']($p['op_eq'](mode, 'white'))) {
				src = $m['tree_white'];
			}
			else if ($p['bool']($p['op_eq'](mode, 'open'))) {
				src = $m['tree_open'];
			}
			else if ($p['bool']($p['op_eq'](mode, 'closed'))) {
				src = $m['tree_closed'];
			}
			$m['DOM']['setAttribute']($p['getattr'](self, 'imgElem'), 'src', src);
			return null;
		}
	, 1, [null,null,['self'],['mode']]);
		$cls_definition['drawImage'] = $method;
		var $bases = new Array($m['UIObject']);
		var $data = $p['dict']();
		for (var $item in $cls_definition) { $data['__setitem__']($item, $cls_definition[$item]); }
		return $p['_create_class']('TreeItem', $p['tuple']($bases), $data);
	})();
	$m['RootTreeItem'] = (function(){
		var $cls_definition = new Object();
		var $method;
		$cls_definition['__module__'] = 'pyjamas.ui.TreeItem';
		$method = $pyjs__bind_method2('addItem', function(item) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				item = arguments[1];
			}

			self['insertItem'](item);
			return null;
		}
	, 1, [null,null,['self'],['item']]);
		$cls_definition['addItem'] = $method;
		$method = $pyjs__bind_method2('insertItem', function(item, index) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				item = arguments[1];
				index = arguments[2];
			}
			if (typeof index == 'undefined') index=arguments['callee']['__args__'][4][1];
			var $or9,$or10;
			if ($p['bool'](($p['bool']($or9=(item['getParentItem']() !== null))?$or9:(item['getTree']() !== null)))) {
				item['remove']();
			}
			item['setTree'](self['getTree']());
			item['setParentItem'](null);
			if ($p['bool']((index === null))) {
				self['children']['append'](item);
			}
			else {
				self['children']['insert'](index, item);
			}
			$m['DOM']['setIntStyleAttribute'](item['getElement'](), 'marginLeft', 0);
			return null;
		}
	, 1, [null,null,['self'],['item'],['index', null]]);
		$cls_definition['insertItem'] = $method;
		$method = $pyjs__bind_method2('removeItem', function(item) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				item = arguments[1];
			}

			if ($p['bool'](!$p['getattr'](self, 'children')['__contains__'](item))) {
				return null;
			}
			item['setTree'](null);
			item['setParentItem'](null);
			self['children']['remove'](item);
			return null;
		}
	, 1, [null,null,['self'],['item']]);
		$cls_definition['removeItem'] = $method;
		var $bases = new Array($m['TreeItem']);
		var $data = $p['dict']();
		for (var $item in $cls_definition) { $data['__setitem__']($item, $cls_definition[$item]); }
		return $p['_create_class']('RootTreeItem', $p['tuple']($bases), $data);
	})();
	$m['Factory']['registerClass']('pyjamas.ui.TreeItem', 'TreeItem', $m['TreeItem']);
	return this;
}; /* end pyjamas.ui.TreeItem */


/* end module: pyjamas.ui.TreeItem */


/*
PYJS_DEPS: ['pyjamas.DOM', 'pyjamas', 'pyjamas.Factory', 'pyjamas.Canvas.GWTCanvas.GWTCanvas', 'pyjamas.Canvas', 'pyjamas.Canvas.GWTCanvas', 'pyjamas.Canvas.Color', 'pyjamas.ui.UIObject.UIObject', 'pyjamas.ui', 'pyjamas.ui.UIObject', 'pyjamas.ui.TreeContentPanel.TreeContentPanel', 'pyjamas.ui.TreeContentPanel']
*/
