Hi community,
I have a question,
when I start my application of cuba,
I get one tab with the name: Application and in this tab, I can find my “entity” Customer
but what I want are different kind of tab with different entity, means
“application” “customer” “orders”
As tabs…
how to make it from source code?
Thanks
tsarev
(Daniil Tsaryov)
August 16, 2018, 2:21pm
#3
Hello @spamhater.alex
Could you share a screenshot that describes what are you talking about?
Regards,
Daniil.
@tsarev
Hello,
yes, of course
Here you can see the “UseCase” tab with Project and Usecase-Status
I want to add such a tab like “UseCase” for Example Orders, where I have Customer and Products for example
So the question is, how to add such “tab” like Usecase with his entity and I want to know, how to make it from “scratch” means, only from source code
Thanks a lot
PS: I like cuba-platform
tsarev
(Daniil Tsaryov)
August 16, 2018, 2:34pm
#5
Okay, thank you. Now it is clear - you are talking about main menu and its items.
So to imperatively add new item to application menu you have to extend main window - it is the only way to get access to main menu.
Then you can use the com.haulmont.cuba.gui.components.mainwindow.AppMenu
API to manage items.
1 Like
but how?
I have to be honest no idea…
tsarev
(Daniil Tsaryov)
August 23, 2018, 5:57am
#8
Could you clarify what do you mean by “but how”? I can’t help until you describe a problem.
Sorry,
I mean about how to “implementing” this,
that I can add a tab programmatically,
like, how to start or where I need exactly to make modifications, or do I need to create a class for this? Or where to create a class?
Thanks
tsarev
(Daniil Tsaryov)
August 23, 2018, 6:11am
#10
As I said above first of all you have to extend main window (documentation ). It can be done with CUBA Studio:
… click New on the GENERIC UI tab of the navigation panel and choose the template for the new main screen in the Generic UI templates visual designer.
And there is a field mainMenu
that represents the menu - use it to add new items like this:
AppMenu.MenuItem newItem = mainMenu.createMenuItem(
"menuItemId",
"menuItemCaption",
"menuItemIcon (nullable)",
menuItem ->
openWindow("screenId", WindowManager.OpenType.NEW_TAB));
mainMenu.addMenuItem(newItem);
Regards,
Daniil.
1 Like