/* start module: pyjamas.ui.MenuBarPopupPanel */
pyjamas.ui.MenuBarPopupPanel = $pyjs.loaded_modules["pyjamas.ui.MenuBarPopupPanel"] = function (__mod_name__) {
if(pyjamas.ui.MenuBarPopupPanel.__was_initialized__) return pyjamas.ui.MenuBarPopupPanel;
pyjamas.ui.MenuBarPopupPanel.__was_initialized__ = true;
if (__mod_name__ == null) __mod_name__ = 'pyjamas.ui.MenuBarPopupPanel';
var __name__ = pyjamas.ui.MenuBarPopupPanel.__name__ = __mod_name__;
var MenuBarPopupPanel = pyjamas.ui.MenuBarPopupPanel;

 pyjslib.__import__(['pyjamas.ui.pyjamas.DOM', 'pyjamas.ui.pyjamas', 'pyjamas.DOM', 'pyjamas'], 'pyjamas.DOM', 'pyjamas.ui.MenuBarPopupPanel')
 pyjamas.ui.MenuBarPopupPanel.DOM = $pyjs.__modules__.pyjamas.DOM;
 pyjslib.__import__(['pyjamas.ui.pyjamas.ui.PopupPanel.PopupPanel', 'pyjamas.ui.pyjamas.ui.PopupPanel', 'pyjamas.ui.PopupPanel.PopupPanel', 'pyjamas.ui.PopupPanel'], 'pyjamas.ui.PopupPanel.PopupPanel', 'pyjamas.ui.MenuBarPopupPanel')
 pyjamas.ui.MenuBarPopupPanel.PopupPanel = $pyjs.__modules__.pyjamas.ui.PopupPanel.PopupPanel;
pyjamas.ui.MenuBarPopupPanel.MenuBarPopupPanel = (function(){
	var cls_instance = pyjs__class_instance('MenuBarPopupPanel');
	var cls_definition = new Object();
	cls_definition.__md5__ = '11b49d3b881c93ed714ab002b28308c4';
	cls_definition.__init__ = pyjs__bind_method(cls_instance, '__init__', function(item) {
		if (this.__is_instance__ === true) {
			var self = this;
			var kwargs = arguments.length >= 2 ? arguments[arguments.length-1] : arguments[arguments.length];
			if (typeof kwargs != 'object' || kwargs.__is_instance__ !== true || kwargs.__name__ != 'Dict') {
				kwargs = arguments[arguments.length+1];
			}
		} else {
			var self = arguments[0];
			item = arguments[1];
			var kwargs = arguments.length >= 3 ? arguments[arguments.length-1] : arguments[arguments.length];
			if (typeof kwargs != 'object' || kwargs.__is_instance__ !== true || kwargs.__name__ != 'Dict') {
				kwargs = arguments[arguments.length+1];
			}
		}
		if (typeof kwargs == 'undefined') {
			kwargs = pyjslib.Dict({});
			if (typeof item != 'undefined') {
				if (pyjslib.get_pyjs_classtype(item) == 'Dict') {
					kwargs = item;
					item = arguments[2];
				}
			} else 			if (typeof self != 'undefined') {
				if (pyjslib.get_pyjs_classtype(self) == 'Dict') {
					kwargs = self;
					self = arguments[2];
				}
			} else {
			}
		}

		self.item = item;
		kwargs.__setitem__(String('Widget'), item.getSubMenu());
		pyjs_kwargs_call(pyjamas.ui.MenuBarPopupPanel.PopupPanel, '__init__', null, kwargs, [{}, self, true]);
		item.getSubMenu().onShow();
		return null;
	}
	, 1, [null,'kwargs','self', 'item']);
	cls_definition.onEventPreview = pyjs__bind_method(cls_instance, 'onEventPreview', function(event) {
		if (this.__is_instance__ === true) {
			var self = this;
		} else {
			var self = arguments[0];
			event = arguments[1];
		}
		var parentMenuElement,type,target;
		type = pyjamas.ui.MenuBarPopupPanel.DOM.eventGetType(event);
		if (pyjslib.bool(pyjslib.eq(type, String('click')))) {
			target = pyjamas.ui.MenuBarPopupPanel.DOM.eventGetTarget(event);
			parentMenuElement = self.item.getParentMenu().getElement();
			if (pyjslib.bool(pyjamas.ui.MenuBarPopupPanel.DOM.isOrHasChild(parentMenuElement, target))) {
				return false;
			}
		}
		return pyjamas.ui.MenuBarPopupPanel.PopupPanel.onEventPreview(self, event);
	}
	, 1, [null,null,'self', 'event']);
	return pyjs__class_function(cls_instance, cls_definition, 
	                            new Array(pyjamas.ui.MenuBarPopupPanel.PopupPanel));
})();
return this;
}; /* end pyjamas.ui.MenuBarPopupPanel */
$pyjs.modules_hash['pyjamas.ui.MenuBarPopupPanel'] = $pyjs.loaded_modules['pyjamas.ui.MenuBarPopupPanel'];


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


/*
PYJS_DEPS: ['pyjamas.DOM', 'pyjamas', 'pyjamas.ui.PopupPanel.PopupPanel', 'pyjamas.ui', 'pyjamas.ui.PopupPanel']
*/
