Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Simple loginView and navigation
Hi, I am a novice!
I implemented simple application according of example simple login view. Where we have login-view and main-view. When you loged in navigator navigate to main-view. But now, how I can implement on main-view MenuBar where every Items when clicked open different sub-views. I allready make something. In UI I registered navigator somethin like this:
n = new Navigator();
And my idea is to put MenuBar in main-view and when you click on Items of MenuBar to cheng sub-view below same MenuBar.
I made view1 , view2 and view3 like class who extend MainView class. And configure command of MenuBar to change views. But will bi nice if exist a way, in sib-views(view1, view2 and view3) to stay same MenuBar. For now, when I click on item on ManuBar I got only new view. My question is how to add new component on sub-view(in my case ) and how make to remaine ManuBar on sub-views. It is possible and in what way? Or I have the wrong approach? What could be right weay?
As mentioned in this thread, managing login view with Navigator is not recommended. Instead, you should manage the login view by yourself, switch to a main view with setContent(), and then use Navigator in the main view to control a SingleComponentContainer that holds the sub-views.
Unfortunately, the book and most examples still use the not-recommended way. At least the Dashboard demo uses the recommended way. See, for example, its UI class to see how it manages the login and main views. It has various extra stuff, so it's not really a simple example, but anyhow.
Oh I have to make one correction. I allready have MenuBar on sub-wies(I made small corrections). And my question is actually how add other additional component in sub-view. If we have in mind that sub-views(view1, view2 and view3) are extended class of main-view class? Sense of sub-view that I wish to add subcontent in them.
In the meantime, I came across this solution. But please, can you consider my solution. Can you advice to me, haow I add conntetn in mentioned sub-views. I would be grateful to you!
Ok I have bean consider your sugestion. But I have problem with navigator. Do you have more advice about navigator
I initiated a navigator in the UI class and now I have a problem to fit the default view and setcontet of Main page. I know it's not like in the example. Can we further consider the case of a navigator. I do not understand the best example in terms of navigation.