How to create a vertical menu bar in the left side and content is displayed in the right side in vaadin 10
With Vaadin 10 is there a way to achieve this? Or else vaadin-10 is only supporting top menus? I am very curious about this topic.
When I am having a parent layout in a tree like this MainView -> MenuBar -> MenuItemPage(for example main view -> menubar -> homepage(route="home"))
It always displays the content below the menu. Not at the side of the menu. My MainView is a horizontal layout. What I want to do is when someone is loading wwww.mydomain.com/home it should load the home page next to the menu bar. Not below the menu bar.
Is there a way to do that or am I am trying something impossible?
vaadin vaadin10
add a comment |
With Vaadin 10 is there a way to achieve this? Or else vaadin-10 is only supporting top menus? I am very curious about this topic.
When I am having a parent layout in a tree like this MainView -> MenuBar -> MenuItemPage(for example main view -> menubar -> homepage(route="home"))
It always displays the content below the menu. Not at the side of the menu. My MainView is a horizontal layout. What I want to do is when someone is loading wwww.mydomain.com/home it should load the home page next to the menu bar. Not below the menu bar.
Is there a way to do that or am I am trying something impossible?
vaadin vaadin10
Please add the code, that does not work as expected to your question.
– cfrick
Aug 15 at 8:31
add a comment |
With Vaadin 10 is there a way to achieve this? Or else vaadin-10 is only supporting top menus? I am very curious about this topic.
When I am having a parent layout in a tree like this MainView -> MenuBar -> MenuItemPage(for example main view -> menubar -> homepage(route="home"))
It always displays the content below the menu. Not at the side of the menu. My MainView is a horizontal layout. What I want to do is when someone is loading wwww.mydomain.com/home it should load the home page next to the menu bar. Not below the menu bar.
Is there a way to do that or am I am trying something impossible?
vaadin vaadin10
With Vaadin 10 is there a way to achieve this? Or else vaadin-10 is only supporting top menus? I am very curious about this topic.
When I am having a parent layout in a tree like this MainView -> MenuBar -> MenuItemPage(for example main view -> menubar -> homepage(route="home"))
It always displays the content below the menu. Not at the side of the menu. My MainView is a horizontal layout. What I want to do is when someone is loading wwww.mydomain.com/home it should load the home page next to the menu bar. Not below the menu bar.
Is there a way to do that or am I am trying something impossible?
vaadin vaadin10
vaadin vaadin10
asked Aug 15 at 7:42
user2810472
406
406
Please add the code, that does not work as expected to your question.
– cfrick
Aug 15 at 8:31
add a comment |
Please add the code, that does not work as expected to your question.
– cfrick
Aug 15 at 8:31
Please add the code, that does not work as expected to your question.
– cfrick
Aug 15 at 8:31
Please add the code, that does not work as expected to your question.
– cfrick
Aug 15 at 8:31
add a comment |
2 Answers
2
active
oldest
votes
There is no limitation how to compose menu templates, there is no such template built in Vaadin 10 or 11 platform yet, but there is one add on already that does it.
https://vaadin.com/directory/component/app-layout-addon
Or more elaborate:
https://vaadin.com/directory/component/hybridmenu
Thanks @cfrick.
– Tatu Lund
Aug 15 at 9:41
add a comment |
I found this one nicer:
https://vaadin.com/directory/component/app-layout-add-on
It is compatible with Vaadin 11 (also V10 and V8) and more important, it is based compatible with Vaddin Routing API.
<dependency>
<groupId>com.github.appreciated</groupId>
<artifactId>app-layout-addon</artifactId>
<version>2.0.0</version>
</dependency>
Here is the code example for Vaadin 11 (and 10):
https://github.com/appreciated/vaadin-app-layout/tree/master/app-layout-examples/app-layout-plain-example
Start with extending AppLayoutRouterLayout on your main layout (I also removed the default routing from my main layout but up to you) and continue with the plain example above.
The following is a sample code based on the above example;
import com.github.appreciated.app.layout.behaviour.Behaviour;
import com.github.appreciated.app.layout.builder.AppLayoutBuilder;
import com.github.appreciated.app.layout.component.appbar.AppBarBuilder;
import com.github.appreciated.app.layout.component.appmenu.MenuHeaderComponent;
import com.github.appreciated.app.layout.component.appmenu.left.LeftClickableComponent;
import com.github.appreciated.app.layout.component.appmenu.left.LeftNavigationComponent;
import com.github.appreciated.app.layout.component.appmenu.left.builder.LeftAppMenuBuilder;
import com.github.appreciated.app.layout.design.AppLayoutDesign;
import com.github.appreciated.app.layout.notification.DefaultNotificationHolder;
import com.github.appreciated.app.layout.notification.component.AppBarNotificationButton;
import com.github.appreciated.app.layout.router.AppLayoutRouterLayout;
import com.vaadin.flow.component.icon.VaadinIcon;
import static com.github.appreciated.app.layout.entity.Section.HEADER;
public class MainLayout
extends AppLayoutRouterLayout {//https://vaadin.com/directory/component/app-layout-add-on
private static DefaultNotificationHolder notifications = new DefaultNotificationHolder(newStatus -> {
});
@Override
public com.github.appreciated.app.layout.behaviour.AppLayout getAppLayout() {
return AppLayoutBuilder
.get(Behaviour.LEFT_HYBRID_SMALL)// There some other behaviours too
.withTitle("Header")
.withAppBar(AppBarBuilder
.get()
.add(new AppBarNotificationButton(VaadinIcon.BELL, notifications))
.build())
.withDesign(AppLayoutDesign.MATERIAL)
.withAppMenu(LeftAppMenuBuilder
.get()
.addToSection(new MenuHeaderComponent("Menu-Header",
"Version 2.0.1",
null
), HEADER)
.addToSection(new LeftClickableComponent("Set Behaviour HEADER",
VaadinIcon.COG.create(),
clickEvent -> openModeSelector()
), HEADER)
.add(new LeftNavigationComponent("Home", VaadinIcon.HOME.create(), View1.class))
.build())
.build();
}
private void openModeSelector() {
// the code to open a dialog
}
}
in which the View1 class is just a simple layout;
@Route(value = "", layout = MainLayout.class)
public class View1 extends VerticalLayout {
public View1() {
Paragraph label = new Paragraph("Hi!");
label.setWidth("100%");
add(label);
}
}
Also, make sure to have a view as the default (@Route(value = "",...)
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51854749%2fhow-to-create-a-vertical-menu-bar-in-the-left-side-and-content-is-displayed-in-t%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
There is no limitation how to compose menu templates, there is no such template built in Vaadin 10 or 11 platform yet, but there is one add on already that does it.
https://vaadin.com/directory/component/app-layout-addon
Or more elaborate:
https://vaadin.com/directory/component/hybridmenu
Thanks @cfrick.
– Tatu Lund
Aug 15 at 9:41
add a comment |
There is no limitation how to compose menu templates, there is no such template built in Vaadin 10 or 11 platform yet, but there is one add on already that does it.
https://vaadin.com/directory/component/app-layout-addon
Or more elaborate:
https://vaadin.com/directory/component/hybridmenu
Thanks @cfrick.
– Tatu Lund
Aug 15 at 9:41
add a comment |
There is no limitation how to compose menu templates, there is no such template built in Vaadin 10 or 11 platform yet, but there is one add on already that does it.
https://vaadin.com/directory/component/app-layout-addon
Or more elaborate:
https://vaadin.com/directory/component/hybridmenu
There is no limitation how to compose menu templates, there is no such template built in Vaadin 10 or 11 platform yet, but there is one add on already that does it.
https://vaadin.com/directory/component/app-layout-addon
Or more elaborate:
https://vaadin.com/directory/component/hybridmenu
edited Aug 15 at 9:26
cfrick
18.1k13452
18.1k13452
answered Aug 15 at 9:01
Tatu Lund
2,271139
2,271139
Thanks @cfrick.
– Tatu Lund
Aug 15 at 9:41
add a comment |
Thanks @cfrick.
– Tatu Lund
Aug 15 at 9:41
Thanks @cfrick.
– Tatu Lund
Aug 15 at 9:41
Thanks @cfrick.
– Tatu Lund
Aug 15 at 9:41
add a comment |
I found this one nicer:
https://vaadin.com/directory/component/app-layout-add-on
It is compatible with Vaadin 11 (also V10 and V8) and more important, it is based compatible with Vaddin Routing API.
<dependency>
<groupId>com.github.appreciated</groupId>
<artifactId>app-layout-addon</artifactId>
<version>2.0.0</version>
</dependency>
Here is the code example for Vaadin 11 (and 10):
https://github.com/appreciated/vaadin-app-layout/tree/master/app-layout-examples/app-layout-plain-example
Start with extending AppLayoutRouterLayout on your main layout (I also removed the default routing from my main layout but up to you) and continue with the plain example above.
The following is a sample code based on the above example;
import com.github.appreciated.app.layout.behaviour.Behaviour;
import com.github.appreciated.app.layout.builder.AppLayoutBuilder;
import com.github.appreciated.app.layout.component.appbar.AppBarBuilder;
import com.github.appreciated.app.layout.component.appmenu.MenuHeaderComponent;
import com.github.appreciated.app.layout.component.appmenu.left.LeftClickableComponent;
import com.github.appreciated.app.layout.component.appmenu.left.LeftNavigationComponent;
import com.github.appreciated.app.layout.component.appmenu.left.builder.LeftAppMenuBuilder;
import com.github.appreciated.app.layout.design.AppLayoutDesign;
import com.github.appreciated.app.layout.notification.DefaultNotificationHolder;
import com.github.appreciated.app.layout.notification.component.AppBarNotificationButton;
import com.github.appreciated.app.layout.router.AppLayoutRouterLayout;
import com.vaadin.flow.component.icon.VaadinIcon;
import static com.github.appreciated.app.layout.entity.Section.HEADER;
public class MainLayout
extends AppLayoutRouterLayout {//https://vaadin.com/directory/component/app-layout-add-on
private static DefaultNotificationHolder notifications = new DefaultNotificationHolder(newStatus -> {
});
@Override
public com.github.appreciated.app.layout.behaviour.AppLayout getAppLayout() {
return AppLayoutBuilder
.get(Behaviour.LEFT_HYBRID_SMALL)// There some other behaviours too
.withTitle("Header")
.withAppBar(AppBarBuilder
.get()
.add(new AppBarNotificationButton(VaadinIcon.BELL, notifications))
.build())
.withDesign(AppLayoutDesign.MATERIAL)
.withAppMenu(LeftAppMenuBuilder
.get()
.addToSection(new MenuHeaderComponent("Menu-Header",
"Version 2.0.1",
null
), HEADER)
.addToSection(new LeftClickableComponent("Set Behaviour HEADER",
VaadinIcon.COG.create(),
clickEvent -> openModeSelector()
), HEADER)
.add(new LeftNavigationComponent("Home", VaadinIcon.HOME.create(), View1.class))
.build())
.build();
}
private void openModeSelector() {
// the code to open a dialog
}
}
in which the View1 class is just a simple layout;
@Route(value = "", layout = MainLayout.class)
public class View1 extends VerticalLayout {
public View1() {
Paragraph label = new Paragraph("Hi!");
label.setWidth("100%");
add(label);
}
}
Also, make sure to have a view as the default (@Route(value = "",...)
add a comment |
I found this one nicer:
https://vaadin.com/directory/component/app-layout-add-on
It is compatible with Vaadin 11 (also V10 and V8) and more important, it is based compatible with Vaddin Routing API.
<dependency>
<groupId>com.github.appreciated</groupId>
<artifactId>app-layout-addon</artifactId>
<version>2.0.0</version>
</dependency>
Here is the code example for Vaadin 11 (and 10):
https://github.com/appreciated/vaadin-app-layout/tree/master/app-layout-examples/app-layout-plain-example
Start with extending AppLayoutRouterLayout on your main layout (I also removed the default routing from my main layout but up to you) and continue with the plain example above.
The following is a sample code based on the above example;
import com.github.appreciated.app.layout.behaviour.Behaviour;
import com.github.appreciated.app.layout.builder.AppLayoutBuilder;
import com.github.appreciated.app.layout.component.appbar.AppBarBuilder;
import com.github.appreciated.app.layout.component.appmenu.MenuHeaderComponent;
import com.github.appreciated.app.layout.component.appmenu.left.LeftClickableComponent;
import com.github.appreciated.app.layout.component.appmenu.left.LeftNavigationComponent;
import com.github.appreciated.app.layout.component.appmenu.left.builder.LeftAppMenuBuilder;
import com.github.appreciated.app.layout.design.AppLayoutDesign;
import com.github.appreciated.app.layout.notification.DefaultNotificationHolder;
import com.github.appreciated.app.layout.notification.component.AppBarNotificationButton;
import com.github.appreciated.app.layout.router.AppLayoutRouterLayout;
import com.vaadin.flow.component.icon.VaadinIcon;
import static com.github.appreciated.app.layout.entity.Section.HEADER;
public class MainLayout
extends AppLayoutRouterLayout {//https://vaadin.com/directory/component/app-layout-add-on
private static DefaultNotificationHolder notifications = new DefaultNotificationHolder(newStatus -> {
});
@Override
public com.github.appreciated.app.layout.behaviour.AppLayout getAppLayout() {
return AppLayoutBuilder
.get(Behaviour.LEFT_HYBRID_SMALL)// There some other behaviours too
.withTitle("Header")
.withAppBar(AppBarBuilder
.get()
.add(new AppBarNotificationButton(VaadinIcon.BELL, notifications))
.build())
.withDesign(AppLayoutDesign.MATERIAL)
.withAppMenu(LeftAppMenuBuilder
.get()
.addToSection(new MenuHeaderComponent("Menu-Header",
"Version 2.0.1",
null
), HEADER)
.addToSection(new LeftClickableComponent("Set Behaviour HEADER",
VaadinIcon.COG.create(),
clickEvent -> openModeSelector()
), HEADER)
.add(new LeftNavigationComponent("Home", VaadinIcon.HOME.create(), View1.class))
.build())
.build();
}
private void openModeSelector() {
// the code to open a dialog
}
}
in which the View1 class is just a simple layout;
@Route(value = "", layout = MainLayout.class)
public class View1 extends VerticalLayout {
public View1() {
Paragraph label = new Paragraph("Hi!");
label.setWidth("100%");
add(label);
}
}
Also, make sure to have a view as the default (@Route(value = "",...)
add a comment |
I found this one nicer:
https://vaadin.com/directory/component/app-layout-add-on
It is compatible with Vaadin 11 (also V10 and V8) and more important, it is based compatible with Vaddin Routing API.
<dependency>
<groupId>com.github.appreciated</groupId>
<artifactId>app-layout-addon</artifactId>
<version>2.0.0</version>
</dependency>
Here is the code example for Vaadin 11 (and 10):
https://github.com/appreciated/vaadin-app-layout/tree/master/app-layout-examples/app-layout-plain-example
Start with extending AppLayoutRouterLayout on your main layout (I also removed the default routing from my main layout but up to you) and continue with the plain example above.
The following is a sample code based on the above example;
import com.github.appreciated.app.layout.behaviour.Behaviour;
import com.github.appreciated.app.layout.builder.AppLayoutBuilder;
import com.github.appreciated.app.layout.component.appbar.AppBarBuilder;
import com.github.appreciated.app.layout.component.appmenu.MenuHeaderComponent;
import com.github.appreciated.app.layout.component.appmenu.left.LeftClickableComponent;
import com.github.appreciated.app.layout.component.appmenu.left.LeftNavigationComponent;
import com.github.appreciated.app.layout.component.appmenu.left.builder.LeftAppMenuBuilder;
import com.github.appreciated.app.layout.design.AppLayoutDesign;
import com.github.appreciated.app.layout.notification.DefaultNotificationHolder;
import com.github.appreciated.app.layout.notification.component.AppBarNotificationButton;
import com.github.appreciated.app.layout.router.AppLayoutRouterLayout;
import com.vaadin.flow.component.icon.VaadinIcon;
import static com.github.appreciated.app.layout.entity.Section.HEADER;
public class MainLayout
extends AppLayoutRouterLayout {//https://vaadin.com/directory/component/app-layout-add-on
private static DefaultNotificationHolder notifications = new DefaultNotificationHolder(newStatus -> {
});
@Override
public com.github.appreciated.app.layout.behaviour.AppLayout getAppLayout() {
return AppLayoutBuilder
.get(Behaviour.LEFT_HYBRID_SMALL)// There some other behaviours too
.withTitle("Header")
.withAppBar(AppBarBuilder
.get()
.add(new AppBarNotificationButton(VaadinIcon.BELL, notifications))
.build())
.withDesign(AppLayoutDesign.MATERIAL)
.withAppMenu(LeftAppMenuBuilder
.get()
.addToSection(new MenuHeaderComponent("Menu-Header",
"Version 2.0.1",
null
), HEADER)
.addToSection(new LeftClickableComponent("Set Behaviour HEADER",
VaadinIcon.COG.create(),
clickEvent -> openModeSelector()
), HEADER)
.add(new LeftNavigationComponent("Home", VaadinIcon.HOME.create(), View1.class))
.build())
.build();
}
private void openModeSelector() {
// the code to open a dialog
}
}
in which the View1 class is just a simple layout;
@Route(value = "", layout = MainLayout.class)
public class View1 extends VerticalLayout {
public View1() {
Paragraph label = new Paragraph("Hi!");
label.setWidth("100%");
add(label);
}
}
Also, make sure to have a view as the default (@Route(value = "",...)
I found this one nicer:
https://vaadin.com/directory/component/app-layout-add-on
It is compatible with Vaadin 11 (also V10 and V8) and more important, it is based compatible with Vaddin Routing API.
<dependency>
<groupId>com.github.appreciated</groupId>
<artifactId>app-layout-addon</artifactId>
<version>2.0.0</version>
</dependency>
Here is the code example for Vaadin 11 (and 10):
https://github.com/appreciated/vaadin-app-layout/tree/master/app-layout-examples/app-layout-plain-example
Start with extending AppLayoutRouterLayout on your main layout (I also removed the default routing from my main layout but up to you) and continue with the plain example above.
The following is a sample code based on the above example;
import com.github.appreciated.app.layout.behaviour.Behaviour;
import com.github.appreciated.app.layout.builder.AppLayoutBuilder;
import com.github.appreciated.app.layout.component.appbar.AppBarBuilder;
import com.github.appreciated.app.layout.component.appmenu.MenuHeaderComponent;
import com.github.appreciated.app.layout.component.appmenu.left.LeftClickableComponent;
import com.github.appreciated.app.layout.component.appmenu.left.LeftNavigationComponent;
import com.github.appreciated.app.layout.component.appmenu.left.builder.LeftAppMenuBuilder;
import com.github.appreciated.app.layout.design.AppLayoutDesign;
import com.github.appreciated.app.layout.notification.DefaultNotificationHolder;
import com.github.appreciated.app.layout.notification.component.AppBarNotificationButton;
import com.github.appreciated.app.layout.router.AppLayoutRouterLayout;
import com.vaadin.flow.component.icon.VaadinIcon;
import static com.github.appreciated.app.layout.entity.Section.HEADER;
public class MainLayout
extends AppLayoutRouterLayout {//https://vaadin.com/directory/component/app-layout-add-on
private static DefaultNotificationHolder notifications = new DefaultNotificationHolder(newStatus -> {
});
@Override
public com.github.appreciated.app.layout.behaviour.AppLayout getAppLayout() {
return AppLayoutBuilder
.get(Behaviour.LEFT_HYBRID_SMALL)// There some other behaviours too
.withTitle("Header")
.withAppBar(AppBarBuilder
.get()
.add(new AppBarNotificationButton(VaadinIcon.BELL, notifications))
.build())
.withDesign(AppLayoutDesign.MATERIAL)
.withAppMenu(LeftAppMenuBuilder
.get()
.addToSection(new MenuHeaderComponent("Menu-Header",
"Version 2.0.1",
null
), HEADER)
.addToSection(new LeftClickableComponent("Set Behaviour HEADER",
VaadinIcon.COG.create(),
clickEvent -> openModeSelector()
), HEADER)
.add(new LeftNavigationComponent("Home", VaadinIcon.HOME.create(), View1.class))
.build())
.build();
}
private void openModeSelector() {
// the code to open a dialog
}
}
in which the View1 class is just a simple layout;
@Route(value = "", layout = MainLayout.class)
public class View1 extends VerticalLayout {
public View1() {
Paragraph label = new Paragraph("Hi!");
label.setWidth("100%");
add(label);
}
}
Also, make sure to have a view as the default (@Route(value = "",...)
edited Nov 23 at 3:57
answered Nov 21 at 4:45
Youness
669916
669916
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51854749%2fhow-to-create-a-vertical-menu-bar-in-the-left-side-and-content-is-displayed-in-t%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Please add the code, that does not work as expected to your question.
– cfrick
Aug 15 at 8:31