Calling a MainWindow from another MainWindow

I’m at the initial stage of developing a large app but wondering what will be the best approach of managing menus. I have reviewed the options in documentations here :
https://doc.cuba-platform.com/manual-6.1/main_window_layout.html?_ga=1.34471009.1122889202.1457376426
For a large application having a few hundreds of menu/sub-menu items to navigate between, a good way of managing such menu items is impact-full to the end users. How can we achieve this in CUBA. Here is a thought and question:

Thoughts:
Use more than one mainWindow in the application where one is Global Main window calling other main windows. The global Main window will have no menu (single mode) but will have UI Components (Buttons/Icons). By clicking those buttons, each related App will be loaded in a separate window (New window button?) using mainWindow where there will be menu items only related to that mainWindow. For Example, MyERP is global mainWindow will have buttons myAR, mySales, myInventory, myFinance etc. which will call arMainWIndow, salesMainWIndow, financeMainWindiw, inventoryMainWindow, financeMainWindow.

Is this workable in CUBA? Any more specific thoughts will be appreciated.

There is no easy way of using menus defined in app components separately. They are either automatically merged in the target application, or you can ignore them and define the menu from scratch.

The resulting menu structure is contained in com.haulmont.cuba.gui.config.MenuConfig bean. The getRootItems() method returns root items, and you can unfold the whole structure using getChildren() methods of the MenuItem class.

So it is possible to create a custom main window which obtains the menu structure and represents it as desired: first level as tiles, lower levels as drop-down menus or a tree.

Does it mean that We can’ call a CUBA application from another CUBA application? For example calling appModule1 from main project testProject ? If yes, any hints for the project files that u have sent earlier will be appreciated.

Based on my note above, I have created 3 sample projects. testProjects represents the main project where there are some buttons to call different other projects like appModule1, appModule2 etc. as attached.

When I click a button in testProjects, how can i run the appModule1?

appModule1.7z (37.2K)

appModule2.7z (5.9K)

testProjects.7z (109.4K)

Do you want to have standard CUBA horizontal menus on the second level (myAR, mySales, etc.)?

That would be ok unless we cannot have extended menu.

What do you mean by extended menu?

Sorry, I mean extending the mainWIndow of modules so that I can customize my menu in those modules but that is optional and the first thing is, how can I call those modules of second level!

Konstantin
What I am trying to achieve, is that possible in current version or it is part of future release plan? This is very essential feature to develop a large application with different modules.

Hi Mortoza,

After implementing STUDIO-2598 in version 6.4, we are going to provide some templates for creating different main window layouts. They will be a good starting point for designing your menu functionality. If you don’t want to wait, create your own main window from scratch and use my recommendations above about MenuConfig bean to create a main menu.

Sounds very good. I would wait for the new version 6.4. I hope RC is to be around shortly!