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


	$m['DOM'] = $p['___import___']('pyjamas.DOM', 'pyjamas.ui', null, false);
	$m['Factory'] = $p['___import___']('pyjamas.Factory', 'pyjamas.ui', null, false);
	$m['Event'] = $p['___import___']('pyjamas.ui.Event', 'pyjamas.ui', null, false);
	$m['ButtonBase'] = $p['___import___']('ButtonBase.ButtonBase', 'pyjamas.ui', null, false);
	$m['Focus'] = $p['___import___']('pyjamas.ui.Focus', 'pyjamas.ui', null, false);
	$m['UIObject'] = $p['___import___']('UIObject.UIObject', 'pyjamas.ui', null, false);
	$m['Face'] = (function(){
		var $cls_definition = new Object();
		var $method;
		$cls_definition['__module__'] = 'pyjamas.ui.CustomButton';
		$cls_definition['STYLENAME_HTML_FACE'] = 'html-face';
		$method = $pyjs__bind_method2('__init__', function(button, delegateTo) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				button = arguments[1];
				delegateTo = arguments[2];
			}
			if (typeof delegateTo == 'undefined') delegateTo=arguments['callee']['__args__'][4][1];

			self['button'] = button;
			self['delegateTo'] = delegateTo;
			self['face'] = null;
			self['id'] = null;
			self['$$name'] = 'fazom';
			return null;
		}
	, 1, [null,null,['self'],['button'],['delegateTo', null]]);
		$cls_definition['__init__'] = $method;
		$method = $pyjs__bind_method2('getName', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

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

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

			self['$$name'] = name;
			return null;
		}
	, 1, [null,null,['self'],['name']]);
		$cls_definition['setName'] = $method;
		$method = $pyjs__bind_method2('setFaceID', function(face_id) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				face_id = arguments[1];
			}

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

			return $m['DOM']['getInnerHTML'](self['getFace']());
		}
	, 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'](self['getFace']());
		}
	, 1, [null,null,['self']]);
		$cls_definition['getText'] = $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['face'] = $m['DOM']['createDiv']();
			$m['UIObject']['setStyleName']($p['getattr'](self, 'button'), $p['getattr'](self, 'face'), $p['getattr'](self, 'STYLENAME_HTML_FACE'), true);
			$m['DOM']['setInnerHTML']($p['getattr'](self, 'face'), html);
			self['button']['updateButtonFace']();
			return null;
		}
	, 1, [null,null,['self'],['html']]);
		$cls_definition['setHTML'] = $method;
		$method = $pyjs__bind_method2('setImage', function(image) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				image = arguments[1];
			}

			self['face'] = image['getElement']();
			self['button']['updateButtonFace']();
			return null;
		}
	, 1, [null,null,['self'],['image']]);
		$cls_definition['setImage'] = $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['face'] = $m['DOM']['createDiv']();
			$m['UIObject']['setStyleName']($p['getattr'](self, 'button'), $p['getattr'](self, 'face'), $p['getattr'](self, 'STYLENAME_HTML_FACE'), true);
			$m['DOM']['setInnerText']($p['getattr'](self, 'face'), text);
			self['button']['updateButtonFace']();
			return null;
		}
	, 1, [null,null,['self'],['text']]);
		$cls_definition['setText'] = $method;
		$method = $pyjs__bind_method2('toString', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

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

			if ($p['bool'](($p['getattr'](self, 'face') !== null))) {
				return $p['getattr'](self, 'face');
			}
			if ($p['bool'](($p['getattr'](self, 'delegateTo') !== null))) {
				return self['delegateTo']['getFace']();
			}
			self['face'] = $m['DOM']['createDiv']();
			return $p['getattr'](self, 'face');
		}
	, 1, [null,null,['self']]);
		$cls_definition['getFace'] = $method;
		var $bases = new Array(pyjslib['object']);
		var $data = $p['dict']();
		for (var $item in $cls_definition) { $data['__setitem__']($item, $cls_definition[$item]); }
		return $p['_create_class']('Face', $p['tuple']($bases), $data);
	})();
	$m['CustomButton'] = (function(){
		var $cls_definition = new Object();
		var $method;
		$cls_definition['__module__'] = 'pyjamas.ui.CustomButton';
		$cls_definition['STYLENAME_DEFAULT'] = 'gwt-CustomButton';
		$cls_definition['DOWN_ATTRIBUTE'] = 1;
		$cls_definition['HOVERING_ATTRIBUTE'] = 2;
		$cls_definition['DISABLED_ATTRIBUTE'] = 4;
		$cls_definition['UP'] = 0;
		$cls_definition['DOWN'] = $cls_definition['DOWN_ATTRIBUTE'];
		$cls_definition['UP_HOVERING'] = $cls_definition['HOVERING_ATTRIBUTE'];
		$cls_definition['DOWN_HOVERING'] = ($cls_definition['DOWN_ATTRIBUTE'])|($cls_definition['HOVERING_ATTRIBUTE']);
		$cls_definition['UP_DISABLED'] = $cls_definition['DISABLED_ATTRIBUTE'];
		$cls_definition['DOWN_DISABLED'] = ($cls_definition['DOWN'])|($cls_definition['DISABLED_ATTRIBUTE']);
		$method = $pyjs__bind_method2('__init__', function(upImageText, downImageText, listener) {
			if (this['__is_instance__'] === true) {
				var self = this;
				var kwargs = arguments['length'] >= 4 ? 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];
				upImageText = arguments[1];
				downImageText = arguments[2];
				listener = arguments[3];
				var kwargs = arguments['length'] >= 5 ? 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 listener != 'undefined') {
					if (listener !== null && typeof listener['$pyjs_is_kwarg'] != 'undefined') {
						kwargs = listener;
						listener = arguments[4];
					}
				} else 				if (typeof downImageText != 'undefined') {
					if (downImageText !== null && typeof downImageText['$pyjs_is_kwarg'] != 'undefined') {
						kwargs = downImageText;
						downImageText = arguments[4];
					}
				} else 				if (typeof upImageText != 'undefined') {
					if (upImageText !== null && typeof upImageText['$pyjs_is_kwarg'] != 'undefined') {
						kwargs = upImageText;
						upImageText = arguments[4];
					}
				} else 				if (typeof self != 'undefined') {
					if (self !== null && typeof self['$pyjs_is_kwarg'] != 'undefined') {
						kwargs = self;
						self = arguments[4];
					}
				} else {
				}
			}
			if (typeof upImageText == 'undefined') upImageText=arguments['callee']['__args__'][3][1];
			if (typeof downImageText == 'undefined') downImageText=arguments['callee']['__args__'][4][1];
			if (typeof listener == 'undefined') listener=arguments['callee']['__args__'][5][1];
			var upImage,upText,$and1,$and3,$and4,$and5,$and6,element,downText,downImage,$and2;
			if ($p['bool'](!$p['bool'](kwargs['has_key']('StyleName')))) {
				kwargs['__setitem__']('StyleName', $p['getattr'](self, 'STYLENAME_DEFAULT'));
			}
			if ($p['bool'](kwargs['has_key']('Element'))) {
				element = kwargs['pop']('Element');
			}
			else {
				element = $m['Focus']['createFocusable']();
			}
			$pyjs_kwargs_call($m['ButtonBase'], '__init__', null, kwargs, [{}, self, element]);
			self['curFace'] = null;
			self['curFaceElement'] = null;
			self['up'] = null;
			self['down'] = null;
			self['downHovering'] = null;
			self['upHovering'] = null;
			self['upDisabled'] = null;
			self['downDisabled'] = null;
			self['isCapturing'] = false;
			self['isFocusing'] = false;
			self['allowClick'] = false;
			self['setUpFace'](self['createFace'](null, 'up', $p['getattr'](self, 'UP')));
			if ($p['bool'](($p['bool']($and1=(downImageText === null))?(listener === null):$and1))) {
				listener = upImageText;
				upImageText = null;
			}
			if ($p['bool'](($p['bool']($and3=upImageText)?$p['isinstance'](upImageText, $p['basestring']):$and3))) {
				upText = upImageText;
				upImage = null;
			}
			else {
				upImage = upImageText;
				upText = null;
			}
			if ($p['bool'](($p['bool']($and5=downImageText)?$p['isinstance'](downImageText, $p['basestring']):$and5))) {
				downText = downImageText;
				downImage = null;
			}
			else {
				downImage = downImageText;
				downText = null;
			}
			if ($p['bool']((upImage !== null))) {
				self['getUpFace']()['setImage'](upImage);
			}
			if ($p['bool']((upText !== null))) {
				self['getUpFace']()['setText'](upText);
			}
			if ($p['bool']((downImage !== null))) {
				self['getDownFace']()['setImage'](downImage);
			}
			if ($p['bool']((downText !== null))) {
				self['getDownFace']()['setText'](downText);
			}
			self['sinkEvents'](($p['getattr']($m['Event'], 'ONCLICK'))|($p['getattr']($m['Event'], 'MOUSEEVENTS'))|($p['getattr']($m['Event'], 'FOCUSEVENTS'))|($p['getattr']($m['Event'], 'KEYEVENTS')));
			if ($p['bool']((listener !== null))) {
				self['addClickListener'](listener);
			}
			return null;
		}
	, 1, [null,['kwargs'],['self'],['upImageText', null],['downImageText', null],['listener', null]]);
		$cls_definition['__init__'] = $method;
		$method = $pyjs__bind_method2('updateButtonFace', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}
			var $and8,$and7;
			if ($p['bool'](($p['bool']($and7=($p['getattr'](self, 'curFace') !== null))?$p['op_eq'](self['curFace']['getFace'](), self['getFace']()):$and7))) {
				self['setCurrentFaceElement']($p['getattr'](self, 'face'));
			}
			return null;
		}
	, 1, [null,null,['self']]);
		$cls_definition['updateButtonFace'] = $method;
		$method = $pyjs__bind_method2('getDownDisabledFace', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			if ($p['bool'](($p['getattr'](self, 'downDisabled') === null))) {
				self['setDownDisabledFace'](self['createFace'](self['getDownFace'](), 'down-disabled', $p['getattr'](self, 'DOWN_DISABLED')));
			}
			return $p['getattr'](self, 'downDisabled');
		}
	, 1, [null,null,['self']]);
		$cls_definition['getDownDisabledFace'] = $method;
		$method = $pyjs__bind_method2('getDownFace', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			if ($p['bool'](($p['getattr'](self, 'down') === null))) {
				self['setDownFace'](self['createFace'](self['getUpFace'](), 'down', $p['getattr'](self, 'DOWN')));
			}
			return $p['getattr'](self, 'down');
		}
	, 1, [null,null,['self']]);
		$cls_definition['getDownFace'] = $method;
		$method = $pyjs__bind_method2('getDownHoveringFace', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			if ($p['bool'](($p['getattr'](self, 'downHovering') === null))) {
				self['setDownHoveringFace'](self['createFace'](self['getDownFace'](), 'down-hovering', $p['getattr'](self, 'DOWN_HOVERING')));
			}
			return $p['getattr'](self, 'downHovering');
		}
	, 1, [null,null,['self']]);
		$cls_definition['getDownHoveringFace'] = $method;
		$method = $pyjs__bind_method2('getHTML', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

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

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

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

			if ($p['bool'](($p['getattr'](self, 'upDisabled') === null))) {
				self['setUpDisabledFace'](self['createFace'](self['getUpFace'](), 'up-disabled', $p['getattr'](self, 'UP_DISABLED')));
			}
			return $p['getattr'](self, 'upDisabled');
		}
	, 1, [null,null,['self']]);
		$cls_definition['getUpDisabledFace'] = $method;
		$method = $pyjs__bind_method2('getUpFace', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

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

			if ($p['bool'](($p['getattr'](self, 'upHovering') === null))) {
				self['setUpHoveringFace'](self['createFace'](self['getUpFace'](), 'up-hovering', $p['getattr'](self, 'UP_HOVERING')));
			}
			return $p['getattr'](self, 'upHovering');
		}
	, 1, [null,null,['self']]);
		$cls_definition['getUpHoveringFace'] = $method;
		$method = $pyjs__bind_method2('onBrowserEvent', function(event) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				event = arguments[1];
			}
			var $and9,$and13,$or1,event_type,$or3,$or2,keyCode,$and12,to,$and10,$and11,$and14,$or4;
			if ($p['bool'](!$p['bool'](self['isEnabled']()))) {
				return null;
			}
			event_type = $m['DOM']['eventGetType'](event);
			if ($p['bool']($p['op_eq'](event_type, 'click'))) {
				if ($p['bool'](!$p['bool']($p['getattr'](self, 'allowClick')))) {
					$m['DOM']['eventStopPropagation'](event);
					return null;
				}
			}
			else if ($p['bool']($p['op_eq'](event_type, 'mousedown'))) {
				if ($p['bool']($p['op_eq']($m['DOM']['eventGetButton'](event), $p['getattr']($m['Event'], 'BUTTON_LEFT')))) {
					self['setFocus'](true);
					self['onClickStart']();
					$m['DOM']['setCapture'](self['getElement']());
					self['isCapturing'] = true;
					$m['DOM']['eventPreventDefault'](event);
				}
			}
			else if ($p['bool']($p['op_eq'](event_type, 'mouseup'))) {
				if ($p['bool']($p['getattr'](self, 'isCapturing'))) {
					self['isCapturing'] = false;
					$m['DOM']['releaseCapture'](self['getElement']());
					if ($p['bool'](($p['bool']($and9=self['isHovering']())?$p['op_eq']($m['DOM']['eventGetButton'](event), $p['getattr']($m['Event'], 'BUTTON_LEFT')):$and9))) {
						self['onClick']();
					}
				}
			}
			else if ($p['bool']($p['op_eq'](event_type, 'mousemove'))) {
				if ($p['bool']($p['getattr'](self, 'isCapturing'))) {
					$m['DOM']['eventPreventDefault'](event);
				}
			}
			else if ($p['bool']($p['op_eq'](event_type, 'mouseout'))) {
				to = $m['DOM']['eventGetToElement'](event);
				if ($p['bool'](($p['bool']($and11=$m['DOM']['isOrHasChild'](self['getElement'](), $m['DOM']['eventGetTarget'](event)))?($p['bool']($or1=(to === null))?$or1:!$p['bool']($m['DOM']['isOrHasChild'](self['getElement'](), to))):$and11))) {
					if ($p['bool']($p['getattr'](self, 'isCapturing'))) {
						self['onClickCancel']();
					}
					self['setHovering'](false);
				}
			}
			else if ($p['bool']($p['op_eq'](event_type, 'mouseover'))) {
				if ($p['bool']($m['DOM']['isOrHasChild'](self['getElement'](), $m['DOM']['eventGetTarget'](event)))) {
					self['setHovering'](true);
					if ($p['bool']($p['getattr'](self, 'isCapturing'))) {
						self['onClickStart']();
					}
				}
			}
			else if ($p['bool']($p['op_eq'](event_type, 'blur'))) {
				if ($p['bool']($p['getattr'](self, 'isFocusing'))) {
					self['isFocusing'] = false;
					self['onClickCancel']();
				}
			}
			else if ($p['bool']($p['op_eq'](event_type, 'losecapture'))) {
				if ($p['bool']($p['getattr'](self, 'isCapturing'))) {
					self['isCapturing'] = false;
					self['onClickCancel']();
				}
			}
			$m['ButtonBase']['onBrowserEvent'](self, event);
			if ($p['bool']($p['op_eq'](($m['DOM']['eventGetTypeInt'](event))&($p['getattr']($m['Event'], 'KEYEVENTS')), 0))) {
				return null;
			}
			keyCode = $m['DOM']['eventGetKeyCode'](event);
			if ($p['bool']($p['op_eq'](event_type, 'keydown'))) {
				if ($p['bool']($p['op_eq'](keyCode, ' '))) {
					self['isFocusing'] = true;
					self['onClickStart']();
				}
			}
			else if ($p['bool']($p['op_eq'](event_type, 'keyup'))) {
				if ($p['bool'](($p['bool']($and13=$p['getattr'](self, 'isFocusing'))?$p['op_eq'](keyCode, ' '):$and13))) {
					self['isFocusing'] = false;
					self['onClick']();
				}
			}
			else if ($p['bool']($p['op_eq'](event_type, 'keypress'))) {
				if ($p['bool'](($p['bool']($or3=$p['op_eq'](keyCode, '\n'))?$or3:$p['op_eq'](keyCode, '\r')))) {
					self['onClickStart']();
					self['onClick']();
				}
			}
			return null;
		}
	, 1, [null,null,['self'],['event']]);
		$cls_definition['onBrowserEvent'] = $method;
		$method = $pyjs__bind_method2('setAccessKey', function(key) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				key = arguments[1];
			}

 			return null;
		}
	, 1, [null,null,['self'],['key']]);
		$cls_definition['setAccessKey'] = $method;
		$method = $pyjs__bind_method2('setEnabled', function(enabled) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				enabled = arguments[1];
			}

			if ($p['bool']($p['op_eq'](self['isEnabled'](), enabled))) {
				return null;
			}
			self['toggleDisabled']();
			$m['ButtonBase']['setEnabled'](self, enabled);
			if ($p['bool'](enabled)) {
				self['setAriaPressed'](self['getCurrentFace']());
			}
			else {
				self['cleanupCaptureState']();
			}
			return null;
		}
	, 1, [null,null,['self'],['enabled']]);
		$cls_definition['setEnabled'] = $method;
		$method = $pyjs__bind_method2('setFocus', function(focused) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				focused = arguments[1];
			}

			if ($p['bool'](focused)) {
				$m['Focus']['focus'](self['getElement']());
			}
			else {
				$m['Focus']['blur'](self['getElement']());
			}
			return null;
		}
	, 1, [null,null,['self'],['focused']]);
		$cls_definition['setFocus'] = $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['getCurrentFace']()['setHTML'](html);
			return null;
		}
	, 1, [null,null,['self'],['html']]);
		$cls_definition['setHTML'] = $method;
		$method = $pyjs__bind_method2('setTabIndex', function(index) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				index = arguments[1];
			}

			$m['Focus']['setTabIndex'](self['getElement'](), index);
			return null;
		}
	, 1, [null,null,['self'],['index']]);
		$cls_definition['setTabIndex'] = $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['getCurrentFace']()['setText'](text);
			return null;
		}
	, 1, [null,null,['self'],['text']]);
		$cls_definition['setText'] = $method;
		$method = $pyjs__bind_method2('isDown', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			return ($p['cmp'](($p['getattr'](self, 'DOWN_ATTRIBUTE'))&(self['getCurrentFace']()['getFaceID']()), 0) == 1);
		}
	, 1, [null,null,['self']]);
		$cls_definition['isDown'] = $method;
		$method = $pyjs__bind_method2('onAttach', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			self['finishSetup']();
			$m['ButtonBase']['onAttach'](self);
			return null;
		}
	, 1, [null,null,['self']]);
		$cls_definition['onAttach'] = $method;
		$method = $pyjs__bind_method2('onClick', function(sender) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				sender = arguments[1];
			}
			if (typeof sender == 'undefined') sender=arguments['callee']['__args__'][3][1];
			var evt;
			self['allowClick'] = true;
			evt = null;
			$m['DOM']['buttonClick'](self['getElement']());
			self['allowClick'] = false;
			return null;
		}
	, 1, [null,null,['self'],['sender', null]]);
		$cls_definition['onClick'] = $method;
		$method = $pyjs__bind_method2('onClickCancel', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

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

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

			$m['ButtonBase']['onDetach'](self);
			self['cleanupCaptureState']();
			return null;
		}
	, 1, [null,null,['self']]);
		$cls_definition['onDetach'] = $method;
		$method = $pyjs__bind_method2('setDown', function(down) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				down = arguments[1];
			}

			if ($p['bool'](!$p['op_eq'](down, self['isDown']()))) {
				self['toggleDown']();
			}
			return null;
		}
	, 1, [null,null,['self'],['down']]);
		$cls_definition['setDown'] = $method;
		$method = $pyjs__bind_method2('finishSetup', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			if ($p['bool'](($p['getattr'](self, 'curFace') === null))) {
				self['setCurrentFace'](self['getUpFace']());
			}
			return null;
		}
	, 1, [null,null,['self']]);
		$cls_definition['finishSetup'] = $method;
		$method = $pyjs__bind_method2('fireClickListeners', function(nativeEvent) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				nativeEvent = arguments[1];
			}

			self['fireEvent']((typeof ClickEvent == "undefined"?$m['ClickEvent']:ClickEvent)());
			return null;
		}
	, 1, [null,null,['self'],['nativeEvent']]);
		$cls_definition['fireClickListeners'] = $method;
		$method = $pyjs__bind_method2('fireEvent', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

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

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

			return ($p['cmp'](($p['getattr'](self, 'HOVERING_ATTRIBUTE'))&(self['getCurrentFace']()['getFaceID']()), 0) == 1);
		}
	, 1, [null,null,['self']]);
		$cls_definition['isHovering'] = $method;
		$method = $pyjs__bind_method2('setHovering', function(hovering) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				hovering = arguments[1];
			}

			if ($p['bool'](!$p['op_eq'](hovering, self['isHovering']()))) {
				self['toggleHover']();
			}
			return null;
		}
	, 1, [null,null,['self'],['hovering']]);
		$cls_definition['setHovering'] = $method;
		$method = $pyjs__bind_method2('toggleDown', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}
			var newFaceID;
			newFaceID = (self['getCurrentFace']()['getFaceID']())^($p['getattr'](self, 'DOWN_ATTRIBUTE'));
			self['setCurrentFaceFromID'](newFaceID);
			return null;
		}
	, 1, [null,null,['self']]);
		$cls_definition['toggleDown'] = $method;
		$method = $pyjs__bind_method2('cleanupCaptureState', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}
			var $and16,$and15;
			if ($p['bool'](($p['bool']($and15=!$p['bool']($p['getattr'](self, 'isCapturing')))?!$p['bool']($p['getattr'](self, 'isFocusing')):$and15))) {
				return null;
			}
			$m['DOM']['releaseCapture'](self['getElement']());
			self['isCapturing'] = false;
			self['isFocusing'] = false;
			self['onClickCancel']();
			return null;
		}
	, 1, [null,null,['self']]);
		$cls_definition['cleanupCaptureState'] = $method;
		$method = $pyjs__bind_method2('createFace', function(delegateTo, name, faceID) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				delegateTo = arguments[1];
				name = arguments[2];
				faceID = arguments[3];
			}
			var face;
			face = $m['Face'](self, delegateTo);
			face['setName'](name);
			face['setFaceID'](faceID);
			return face;
		}
	, 1, [null,null,['self'],['delegateTo'],['name'],['faceID']]);
		$cls_definition['createFace'] = $method;
		$method = $pyjs__bind_method2('getFaceFromID', function(face_id) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				face_id = arguments[1];
			}

			if ($p['bool']($p['op_eq'](face_id, $p['getattr'](self, 'DOWN')))) {
				return self['getDownFace']();
			}
			else if ($p['bool']($p['op_eq'](face_id, $p['getattr'](self, 'UP')))) {
				return self['getUpFace']();
			}
			else if ($p['bool']($p['op_eq'](face_id, $p['getattr'](self, 'DOWN_HOVERING')))) {
				return self['getDownHoveringFace']();
			}
			else if ($p['bool']($p['op_eq'](face_id, $p['getattr'](self, 'UP_HOVERING')))) {
				return self['getUpHoveringFace']();
			}
			else if ($p['bool']($p['op_eq'](face_id, $p['getattr'](self, 'UP_DISABLED')))) {
				return self['getUpDisabledFace']();
			}
			else if ($p['bool']($p['op_eq'](face_id, $p['getattr'](self, 'DOWN_DISABLED')))) {
				return self['getDownDisabledFace']();
			}
			else {
				throw ($p['Exception']($p['sprintf']('%s is not a known face id.', $p['str'](face_id))));
			}
			return null;
		}
	, 1, [null,null,['self'],['face_id']]);
		$cls_definition['getFaceFromID'] = $method;
		$method = $pyjs__bind_method2('setAriaPressed', function(newFace) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				newFace = arguments[1];
			}
			var pressed;
			pressed = $p['op_eq']((newFace['getFaceID']())&($p['getattr'](self, 'DOWN_ATTRIBUTE')), 1);
			return null;
		}
	, 1, [null,null,['self'],['newFace']]);
		$cls_definition['setAriaPressed'] = $method;
		$method = $pyjs__bind_method2('setCurrentFace', function(newFace) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				newFace = arguments[1];
			}

			if ($p['bool']($p['op_eq']($p['getattr'](self, 'curFace'), newFace))) {
				return null;
			}
			if ($p['bool'](($p['getattr'](self, 'curFace') !== null))) {
				self['removeStyleDependentName'](self['curFace']['getName']());
			}
			self['curFace'] = newFace;
			self['setCurrentFaceElement'](newFace['getFace']());
			self['addStyleDependentName'](self['curFace']['getName']());
			if ($p['bool']($p['getattr'](self, 'isEnabled'))) {
				self['setAriaPressed'](newFace);
			}
			self['style_name'] = self['getStyleName']();
			return null;
		}
	, 1, [null,null,['self'],['newFace']]);
		$cls_definition['setCurrentFace'] = $method;
		$method = $pyjs__bind_method2('setCurrentFaceFromID', function(faceID) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				faceID = arguments[1];
			}
			var newFace;
			newFace = self['getFaceFromID'](faceID);
			self['setCurrentFace'](newFace);
			return null;
		}
	, 1, [null,null,['self'],['faceID']]);
		$cls_definition['setCurrentFaceFromID'] = $method;
		$method = $pyjs__bind_method2('setCurrentFaceElement', function(newFaceElement) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				newFaceElement = arguments[1];
			}

			if ($p['bool']($p['op_eq']($p['getattr'](self, 'curFaceElement'), newFaceElement))) {
				return null;
			}
			if ($p['bool'](($p['getattr'](self, 'curFaceElement') !== null))) {
				$m['DOM']['removeChild'](self['getElement'](), $p['getattr'](self, 'curFaceElement'));
			}
			self['curFaceElement'] = newFaceElement;
			$m['DOM']['appendChild'](self['getElement'](), $p['getattr'](self, 'curFaceElement'));
			return null;
		}
	, 1, [null,null,['self'],['newFaceElement']]);
		$cls_definition['setCurrentFaceElement'] = $method;
		$method = $pyjs__bind_method2('setDownDisabledFace', function(downDisabled) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				downDisabled = arguments[1];
			}

			self['downDisabled'] = downDisabled;
			return null;
		}
	, 1, [null,null,['self'],['downDisabled']]);
		$cls_definition['setDownDisabledFace'] = $method;
		$method = $pyjs__bind_method2('setDownFace', function(down) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				down = arguments[1];
			}

			self['down'] = down;
			return null;
		}
	, 1, [null,null,['self'],['down']]);
		$cls_definition['setDownFace'] = $method;
		$method = $pyjs__bind_method2('setDownHoveringFace', function(downHovering) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				downHovering = arguments[1];
			}

			self['downHovering'] = downHovering;
			return null;
		}
	, 1, [null,null,['self'],['downHovering']]);
		$cls_definition['setDownHoveringFace'] = $method;
		$method = $pyjs__bind_method2('setUpDisabledFace', function(upDisabled) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				upDisabled = arguments[1];
			}

			self['upDisabled'] = upDisabled;
			return null;
		}
	, 1, [null,null,['self'],['upDisabled']]);
		$cls_definition['setUpDisabledFace'] = $method;
		$method = $pyjs__bind_method2('setUpFace', function(up) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				up = arguments[1];
			}

			self['up'] = up;
			return null;
		}
	, 1, [null,null,['self'],['up']]);
		$cls_definition['setUpFace'] = $method;
		$method = $pyjs__bind_method2('setUpHoveringFace', function(upHovering) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				upHovering = arguments[1];
			}

			self['upHovering'] = upHovering;
			return null;
		}
	, 1, [null,null,['self'],['upHovering']]);
		$cls_definition['setUpHoveringFace'] = $method;
		$method = $pyjs__bind_method2('toggleDisabled', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}
			var newFaceID;
			newFaceID = (self['getCurrentFace']()['getFaceID']())^($p['getattr'](self, 'DISABLED_ATTRIBUTE'));
			newFaceID &= ~($p['getattr'](self, 'HOVERING_ATTRIBUTE'));
			self['setCurrentFaceFromID'](newFaceID);
			return null;
		}
	, 1, [null,null,['self']]);
		$cls_definition['toggleDisabled'] = $method;
		$method = $pyjs__bind_method2('toggleHover', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}
			var newFaceID;
			newFaceID = (self['getCurrentFace']()['getFaceID']())^($p['getattr'](self, 'HOVERING_ATTRIBUTE'));
			newFaceID &= ~($p['getattr'](self, 'DISABLED_ATTRIBUTE'));
			self['setCurrentFaceFromID'](newFaceID);
			return null;
		}
	, 1, [null,null,['self']]);
		$cls_definition['toggleHover'] = $method;
		var $bases = new Array($m['ButtonBase']);
		var $data = $p['dict']();
		for (var $item in $cls_definition) { $data['__setitem__']($item, $cls_definition[$item]); }
		return $p['_create_class']('CustomButton', $p['tuple']($bases), $data);
	})();
	$m['Factory']['registerClass']('pyjamas.ui.CustomButton', 'CustomButton', $m['CustomButton']);
	return this;
}; /* end pyjamas.ui.CustomButton */


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


/*
PYJS_DEPS: ['pyjamas.DOM', 'pyjamas', 'pyjamas.Factory', 'pyjamas.ui.Event', 'pyjamas.ui', 'ButtonBase.ButtonBase', 'ButtonBase', 'pyjamas.ui.Focus', 'UIObject.UIObject', 'UIObject']
*/
