/* start module: pyjamas.ui.SplitPanel */
$pyjs['loaded_modules']['pyjamas.ui.SplitPanel'] = function (__mod_name__) {
	if($pyjs['loaded_modules']['pyjamas.ui.SplitPanel']['__was_initialized__']) return $pyjs['loaded_modules']['pyjamas.ui.SplitPanel'];
	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.SplitPanel'];
	$m['__repr__'] = function() { return '<module: pyjamas.ui.SplitPanel>'; };
	$m['__was_initialized__'] = true;
	if ((__mod_name__ === null) || (typeof __mod_name__ == 'undefined')) __mod_name__ = 'pyjamas.ui.SplitPanel';
	$m['__name__'] = __mod_name__;
	$pyjs['loaded_modules']['pyjamas.ui']['SplitPanel'] = $pyjs['loaded_modules']['pyjamas.ui.SplitPanel'];


	$m['DOM'] = $p['___import___']('pyjamas.DOM', 'pyjamas.ui', null, false);
	$m['Window'] = $p['___import___']('pyjamas.Window', 'pyjamas.ui', null, false);
	$m['DeferredCommand'] = $p['___import___']('pyjamas.DeferredCommand', 'pyjamas.ui', null, false);
	$m['EventGenerator'] = $p['___import___']('pyjamas.EventController.EventGenerator', 'pyjamas.ui', null, false);
	$m['GlassWidget'] = $p['___import___']('pyjamas.ui.GlassWidget', 'pyjamas.ui', null, false);
	$m['SimplePanel'] = $p['___import___']('pyjamas.ui.SimplePanel.SimplePanel', 'pyjamas.ui', null, false);
	$m['AbsolutePanel'] = $p['___import___']('pyjamas.ui.AbsolutePanel.AbsolutePanel', 'pyjamas.ui', null, false);
	$m['ScrollPanel'] = $p['___import___']('pyjamas.ui.ScrollPanel.ScrollPanel', 'pyjamas.ui', null, false);
	$m['MouseHandler'] = $p['___import___']('pyjamas.ui.MouseListener.MouseHandler', 'pyjamas.ui', null, false);
	$m['fireMouseEvent'] = $p['___import___']('pyjamas.ui.MouseListener.fireMouseEvent', 'pyjamas.ui', null, false);
	$m['Event'] = $p['___import___']('pyjamas.ui.Event', 'pyjamas.ui', null, false);
	$m['SplitPanelSplitter'] = (function(){
		var $cls_definition = new Object();
		var $method;
		$cls_definition['__module__'] = 'pyjamas.ui.SplitPanel';
		$method = $pyjs__bind_method2('__init__', function(splitPanel) {
			if (this['__is_instance__'] === true) {
				var self = this;
				var kwargs = arguments['length'] >= 2 ? arguments[arguments['length']-1] : arguments[arguments['length']];
				if (kwargs === null || typeof kwargs != 'object' || kwargs['__name__'] != 'dict' || typeof kwargs['$pyjs_is_kwarg'] == 'undefined') {
					var kwargs = arguments[arguments['length']+1];
				} else {
					delete kwargs['$pyjs_is_kwarg'];
				}
			} else {
				var self = arguments[0];
				splitPanel = arguments[1];
				var kwargs = arguments['length'] >= 3 ? arguments[arguments['length']-1] : arguments[arguments['length']];
				if (kwargs === null || typeof kwargs != 'object' || kwargs['__name__'] != 'dict' || typeof kwargs['$pyjs_is_kwarg'] == 'undefined') {
					kwargs = arguments[arguments['length']+1];
				} else {
					delete kwargs['$pyjs_is_kwarg'];
				}
			}
			if (typeof kwargs == 'undefined') {
				kwargs = $p['__empty_dict']();
				if (typeof splitPanel != 'undefined') {
					if (splitPanel !== null && typeof splitPanel['$pyjs_is_kwarg'] != 'undefined') {
						kwargs = splitPanel;
						splitPanel = arguments[2];
					}
				} else 				if (typeof self != 'undefined') {
					if (self !== null && typeof self['$pyjs_is_kwarg'] != 'undefined') {
						kwargs = self;
						self = arguments[2];
					}
				} else {
				}
			}
			var elem;
			self['_splitpanel'] = splitPanel;
			$pyjs_kwargs_call($m['SimplePanel'], '__init__', null, kwargs, [{}, self]);
			$m['MouseHandler']['__init__'](self);
			self['addMouseListener'](self);
			elem = self['getElement']();
			$m['DOM']['setStyleAttribute'](elem, 'overflow', 'hidden');
			return null;
		}
	, 1, [null,['kwargs'],['self'],['splitPanel']]);
		$cls_definition['__init__'] = $method;
		$method = $pyjs__bind_method2('onMouseDown', function(sender, x, y) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				sender = arguments[1];
				x = arguments[2];
				y = arguments[3];
			}
			var ev;
			ev = $m['DOM']['eventGetCurrentEvent']();
			if ($p['bool'](!$p['op_eq']($m['DOM']['eventGetButton'](ev), $p['getattr']($m['Event'], 'BUTTON_LEFT')))) {
				return null;
			}
			$m['DOM']['eventPreventDefault']($m['DOM']['eventGetCurrentEvent']());
			self['_splitpanel']['startSplitterDrag'](x, y);
			return null;
		}
	, 1, [null,null,['self'],['sender'],['x'],['y']]);
		$cls_definition['onMouseDown'] = $method;
		var $bases = new Array($m['SimplePanel'],$m['MouseHandler']);
		var $data = $p['dict']();
		for (var $item in $cls_definition) { $data['__setitem__']($item, $cls_definition[$item]); }
		return $p['_create_class']('SplitPanelSplitter', $p['tuple']($bases), $data);
	})();
	$m['SplitPanel'] = (function(){
		var $cls_definition = new Object();
		var $method;
		$cls_definition['__module__'] = 'pyjamas.ui.SplitPanel';
		$method = $pyjs__bind_method2('__init__', function(vertical) {
			if (this['__is_instance__'] === true) {
				var self = this;
				var kwargs = arguments['length'] >= 2 ? arguments[arguments['length']-1] : arguments[arguments['length']];
				if (kwargs === null || typeof kwargs != 'object' || kwargs['__name__'] != 'dict' || typeof kwargs['$pyjs_is_kwarg'] == 'undefined') {
					var kwargs = arguments[arguments['length']+1];
				} else {
					delete kwargs['$pyjs_is_kwarg'];
				}
			} else {
				var self = arguments[0];
				vertical = arguments[1];
				var kwargs = arguments['length'] >= 3 ? arguments[arguments['length']-1] : arguments[arguments['length']];
				if (kwargs === null || typeof kwargs != 'object' || kwargs['__name__'] != 'dict' || typeof kwargs['$pyjs_is_kwarg'] == 'undefined') {
					kwargs = arguments[arguments['length']+1];
				} else {
					delete kwargs['$pyjs_is_kwarg'];
				}
			}
			if (typeof kwargs == 'undefined') {
				kwargs = $p['__empty_dict']();
				if (typeof vertical != 'undefined') {
					if (vertical !== null && typeof vertical['$pyjs_is_kwarg'] != 'undefined') {
						kwargs = vertical;
						vertical = arguments[2];
					}
				} else 				if (typeof self != 'undefined') {
					if (self !== null && typeof self['$pyjs_is_kwarg'] != 'undefined') {
						kwargs = self;
						self = arguments[2];
					}
				} else {
				}
			}
			if (typeof vertical == 'undefined') vertical=arguments['callee']['__args__'][3][1];

			if ($p['bool'](!$p['bool'](kwargs['__contains__']('StyleName')))) {
				if ($p['bool'](vertical)) {
					kwargs['__setitem__']('StyleName', 'gwt-VerticalSplitPanel');
				}
				else {
					kwargs['__setitem__']('StyleName', 'gwt-HorizontalSplitPanel');
				}
			}
			self['_drag_start'] = null;
			self['_pos'] = '50%';
			self['_vertical'] = vertical;
			$pyjs_kwargs_call($m['AbsolutePanel'], '__init__', null, kwargs, [{}, self]);
			$m['MouseHandler']['__init__'](self);
			self['addListenedEvent']('Resize');
			self['_container1'] = $m['ScrollPanel']();
			self['_container2'] = $m['ScrollPanel']();
			self['_splitter'] = $m['SplitPanelSplitter'](self);
			self['_splitter']['addMouseListener'](self);
			self['addMouseListener'](self);
			$m['AbsolutePanel']['add'](self, $p['getattr'](self, '_container1'), 0, 0);
			$m['AbsolutePanel']['add'](self, $p['getattr'](self, '_splitter'), 0, 0);
			$m['AbsolutePanel']['add'](self, $p['getattr'](self, '_container2'), 0, 0);
			if ($p['bool'](vertical)) {
				self['_splitter']['setStyleName']('vsplitter');
				self['_splitter']['setWidth']('100%');
				self['_container1']['setWidth']('100%');
				self['_container2']['setWidth']('100%');
				$m['DOM']['setStyleAttribute'](self['_splitter']['getElement'](), 'cursor', 'n-resize');
			}
			else {
				self['_splitter']['setStyleName']('hsplitter');
				self['_splitter']['setHeight']('100%');
				self['_container1']['setHeight']('100%');
				self['_container2']['setHeight']('100%');
				$m['DOM']['setStyleAttribute'](self['_splitter']['getElement'](), 'cursor', 'e-resize');
			}
			return null;
		}
	, 1, [null,['kwargs'],['self'],['vertical', false]]);
		$cls_definition['__init__'] = $method;
		$method = $pyjs__bind_method2('onAttach', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			$m['AbsolutePanel']['onAttach'](self);
			self['setSplitPosition']();
			return null;
		}
	, 1, [null,null,['self']]);
		$cls_definition['onAttach'] = $method;
		$method = $pyjs__bind_method2('_finalizePositions', function(pos) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				pos = arguments[1];
			}
			if (typeof pos == 'undefined') pos=arguments['callee']['__args__'][3][1];
			var finalized,space,$sub9,$sub8,$sub12,$sub3,$sub2,$sub1,$sub7,$sub6,$sub5,$sub4,$sub10,$and1,$and2,$and3,$and4,$and5,$and6,sz,$add2,$add3,$add1,$add6,$add7,$add4,$add5,$sub11,$add8;
			finalized = false;
			if ($p['bool']($p['getattr'](self, '_vertical'))) {
				if ($p['bool']((pos === null))) {
					pos = self['_container1']['getOffsetHeight']();
				}
				space = self['getOffsetHeight']();
				sz = self['_splitter']['getOffsetHeight']();
				if ($p['bool'](($p['bool']($and1=($p['cmp'](space, 0) == 1))?($p['bool']($and2=($p['cmp'](sz, 0) == 1))?($p['cmp'](pos, 0) == 1):$and2):$and1))) {
					if ($p['bool'](($p['cmp'](pos, $p['__op_sub']($sub1=space,$sub2=sz)) == 1))) {
						pos = $p['__op_sub']($sub3=space,$sub4=sz);
						self['_container1']['setHeight'](pos);
					}
					self['setWidgetPosition']($p['getattr'](self, '_splitter'), 0, pos);
					self['setWidgetPosition']($p['getattr'](self, '_container2'), 0, $p['__op_add']($add1=pos,$add2=sz));
					self['_container2']['setHeight']($p['__op_sub']($sub5=space,$sub6=$p['__op_add']($add3=pos,$add4=sz)));
					finalized = true;
				}
			}
			else {
				if ($p['bool']((pos === null))) {
					pos = self['_container1']['getOffsetWidth']();
				}
				space = self['getOffsetWidth']();
				sz = self['_splitter']['getOffsetWidth']();
				if ($p['bool'](($p['bool']($and4=($p['cmp'](space, 0) == 1))?($p['bool']($and5=($p['cmp'](sz, 0) == 1))?($p['cmp'](pos, 0) == 1):$and5):$and4))) {
					if ($p['bool'](($p['cmp'](pos, $p['__op_sub']($sub7=space,$sub8=sz)) == 1))) {
						pos = $p['__op_sub']($sub9=space,$sub10=sz);
						self['_container1']['setWidth'](pos);
					}
					self['setWidgetPosition']($p['getattr'](self, '_splitter'), pos, 0);
					self['setWidgetPosition']($p['getattr'](self, '_container2'), $p['__op_add']($add5=pos,$add6=sz), 0);
					self['_container2']['setWidth']($p['__op_sub']($sub11=space,$sub12=$p['__op_add']($add7=pos,$add8=sz)));
					finalized = true;
				}
			}
			if ($p['bool'](finalized)) {
				self['dispatchResizeEvent'](self, pos);
			}
			return finalized;
		}
	, 1, [null,null,['self'],['pos', null]]);
		$cls_definition['_finalizePositions'] = $method;
		$method = $pyjs__bind_method2('_stopDragging', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			if ($p['bool'](($p['getattr'](self, '_drag_start') !== null))) {
				self['_drag_start'] = null;
				$m['GlassWidget']['hide']();
				$m['DOM']['eventCancelBubble']($m['DOM']['eventGetCurrentEvent'](), true);
			}
			return null;
		}
	, 1, [null,null,['self']]);
		$cls_definition['_stopDragging'] = $method;
		$method = $pyjs__bind_method2('_isDragging', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			return ($p['getattr'](self, '_drag_start') !== null);
		}
	, 1, [null,null,['self']]);
		$cls_definition['_isDragging'] = $method;
		$method = $pyjs__bind_method2('startSplitterDrag', function(x, y) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				x = arguments[1];
				y = arguments[2];
			}

			if ($p['bool'](($p['getattr'](self, '_drag_start') === null))) {
				if ($p['bool']($p['getattr'](self, '_vertical'))) {
					self['_drag_start'] = y;
				}
				else {
					self['_drag_start'] = x;
				}
				$m['GlassWidget']['show'](self);
			}
			return null;
		}
	, 1, [null,null,['self'],['x'],['y']]);
		$cls_definition['startSplitterDrag'] = $method;
		$method = $pyjs__bind_method2('onMouseMove', function(sender, x, y) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				sender = arguments[1];
				x = arguments[2];
				y = arguments[3];
			}
			var $sub13,$sub16,$sub15,$sub14;
			if ($p['bool'](!$p['bool'](self['_isDragging']()))) {
				return null;
			}
			if ($p['bool']($p['getattr'](self, '_vertical'))) {
				self['_pos'] = $p['__op_sub']($sub13=y,$sub14=$p['getattr'](self, '_drag_start'));
			}
			else {
				self['_pos'] = $p['__op_sub']($sub15=x,$sub16=$p['getattr'](self, '_drag_start'));
			}
			if ($p['bool'](($p['cmp']($p['getattr'](self, '_pos'), 1) == -1))) {
				self['_pos'] = 1;
			}
			self['setSplitPosition']();
			return null;
		}
	, 1, [null,null,['self'],['sender'],['x'],['y']]);
		$cls_definition['onMouseMove'] = $method;
		$method = $pyjs__bind_method2('onMouseUp', function(sender, x, y) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				sender = arguments[1];
				x = arguments[2];
				y = arguments[3];
			}
			var ev;
			ev = $m['DOM']['eventGetCurrentEvent']();
			if ($p['bool'](!$p['op_eq']($m['DOM']['eventGetButton'](ev), $p['getattr']($m['Event'], 'BUTTON_LEFT')))) {
				return null;
			}
			$m['DOM']['eventPreventDefault'](ev);
			if ($p['bool'](self['_isDragging']())) {
				self['_stopDragging']();
			}
			return null;
		}
	, 1, [null,null,['self'],['sender'],['x'],['y']]);
		$cls_definition['onMouseUp'] = $method;
		$method = $pyjs__bind_method2('onMouseGlassEnter', function(sender) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				sender = arguments[1];
			}

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

			self['_stopDragging']();
			return null;
		}
	, 1, [null,null,['self'],['sender']]);
		$cls_definition['onMouseGlassLeave'] = $method;
		$method = $pyjs__bind_method2('setSplitPosition', function(pos) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				pos = arguments[1];
			}
			if (typeof pos == 'undefined') pos=arguments['callee']['__args__'][3][1];
			var finalized;
			if ($p['bool']((pos !== null))) {
				self['_pos'] = pos;
			}
			else {
				pos = $p['getattr'](self, '_pos');
			}
			if ($p['bool'](($p['cmp'](pos, 1) == -1))) {
				pos = 1;
				self['_pos'] = pos;
			}
			if ($p['bool']($p['getattr'](self, '_vertical'))) {
				self['_container1']['setHeight'](pos);
			}
			else {
				self['_container1']['setWidth'](pos);
			}
			finalized = false;
			if ($p['bool']($p['isinstance'](pos, $p['float_int']))) {
				finalized = self['_finalizePositions'](pos);
			}
			if ($p['bool'](!$p['bool'](finalized))) {
				$m['DeferredCommand']['add']($p['getattr'](self, '_finalizePositions'));
			}
			return null;
		}
	, 1, [null,null,['self'],['pos', null]]);
		$cls_definition['setSplitPosition'] = $method;
		$method = $pyjs__bind_method2('getWidget', function(index) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				index = arguments[1];
			}

			if ($p['bool']($p['op_eq'](index, 0))) {
				return self['_container1']['getWidget']();
			}
			return self['_container2']['getWidget']();
		}
	, 1, [null,null,['self'],['index']]);
		$cls_definition['getWidget'] = $method;
		$method = $pyjs__bind_method2('setWidget', function(index, widget) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				index = arguments[1];
				widget = arguments[2];
			}

			if ($p['bool']($p['op_eq'](index, 0))) {
				return self['_container1']['setWidget'](widget);
			}
			return self['_container2']['setWidget'](widget);
		}
	, 1, [null,null,['self'],['index'],['widget']]);
		$cls_definition['setWidget'] = $method;
		$method = $pyjs__bind_method2('add', function(widget) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				widget = arguments[1];
			}

			if ($p['bool']($p['op_eq'](self['getWidget'](0), null))) {
				self['setWidget'](0, widget);
			}
			else if ($p['bool']($p['op_eq'](self['getWidget'](1), null))) {
				self['setWidget'](1, widget);
			}
			else {
				console['error']('SimplePanel can only contain one child widget');
			}
			return null;
		}
	, 1, [null,null,['self'],['widget']]);
		$cls_definition['add'] = $method;
		$method = $pyjs__bind_method2('remove', function(widget) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				widget = arguments[1];
			}

			if ($p['bool']($p['op_eq'](self['getWidget'](0), widget))) {
				self['_container1']['remove'](widget);
			}
			else if ($p['bool']($p['op_eq'](self['getWidget'](1), widget))) {
				self['_container2']['remove'](widget);
			}
			else {
				$m['AbsolutePanel']['remove'](self, widget);
			}
			return null;
		}
	, 1, [null,null,['self'],['widget']]);
		$cls_definition['remove'] = $method;
		$method = $pyjs__bind_method2('getElement', function(index) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				index = arguments[1];
			}
			if (typeof index == 'undefined') index=arguments['callee']['__args__'][3][1];

			if ($p['bool']((index === null))) {
				return $m['AbsolutePanel']['getElement'](self);
			}
			return self['getWidget'](index)['getElement']();
		}
	, 1, [null,null,['self'],['index', null]]);
		$cls_definition['getElement'] = $method;
		$method = $pyjs__bind_method2('getEndOfLineWidget', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

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

			return self['_splitter']['getElement']();
		}
	, 1, [null,null,['self']]);
		$cls_definition['getSplitElement'] = $method;
		$method = $pyjs__bind_method2('getStartOfLineWidget', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

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

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

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

			self['setWidget'](0, widget);
			return null;
		}
	, 1, [null,null,['self'],['widget']]);
		$cls_definition['setStartOfLineWidget'] = $method;
		var $bases = new Array($m['AbsolutePanel'],$m['MouseHandler'],$m['EventGenerator']);
		var $data = $p['dict']();
		for (var $item in $cls_definition) { $data['__setitem__']($item, $cls_definition[$item]); }
		return $p['_create_class']('SplitPanel', $p['tuple']($bases), $data);
	})();
	return this;
}; /* end pyjamas.ui.SplitPanel */


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


/*
PYJS_DEPS: ['pyjamas.DOM', 'pyjamas', 'pyjamas.Window', 'pyjamas.DeferredCommand', 'pyjamas.EventController.EventGenerator', 'pyjamas.EventController', 'pyjamas.ui.GlassWidget', 'pyjamas.ui', 'pyjamas.ui.SimplePanel.SimplePanel', 'pyjamas.ui.SimplePanel', 'pyjamas.ui.AbsolutePanel.AbsolutePanel', 'pyjamas.ui.AbsolutePanel', 'pyjamas.ui.ScrollPanel.ScrollPanel', 'pyjamas.ui.ScrollPanel', 'pyjamas.ui.MouseListener.MouseHandler', 'pyjamas.ui.MouseListener', 'pyjamas.ui.MouseListener.fireMouseEvent', 'pyjamas.ui.Event']
*/
