protected MenueBase(XComponentContext xContext, XMultiComponentFactory xMcf, XTopWindow xWindow, XMenuListener xMListener, XMenuBar xMenuBar = null) { _xContext = xContext; _xMCF = xMcf; _xWindow = xWindow; _xMenuListener = xMListener; _xMenuBar = xMenuBar != null ? xMenuBar : AddMenuBar(); }
protected XMenuBar AddMenuBar() { // create a menubar at the global MultiComponentFactory... Object oMenuBar = _xMCF.createInstanceWithContext(OO.Services.VCLX_MENU_BAR, _xContext); // add the menu items... XMenuBar xMenuBar = oMenuBar as XMenuBar; if (xMenuBar != null) { xMenuBar.addMenuListener(_xMenuListener); _xWindow.setMenuBar(xMenuBar); return(xMenuBar); } else { //TODO: handle if the cast fails throw new NullPointerException("Cast to XMenuBar fails:", oMenuBar); } }