java - 带有状态栏的 Vaadin 14,6 AppLayout?
问题描述
我很高兴使用标准Vaadin AppLayout 组件作为我的应用程序的布局起点。现在我收到了添加状态栏的要求。状态栏的宽度必须与导航栏的宽度相同,因此它不能成为“内容”的一部分。
使用默认的 AppLayout 是否有可能?
解决方案
最初 AppLayout 旨在接管整个空间,因此它并不真正适用于这个用例。但是,我可以通过这些设置对其进行调整以使其适合页脚栏。
public class MainLayout extends VerticalLayout implements RouterLayout {
private AppLayout appLayout = new AppLayout();
private FlexLayout childWrapper = new FlexLayout();
public MainLayout() {
... setup appLayout ...
childWrapper.setSizeFull();
appLayout.setContent(childWrapper);
HorizontalLayout statusBar = new HorizontalLayout();
statusBar.setHeight("50px");
statusBar.setWidth("100%");
statusBar.add(new Span("Status Bar"));
statusBar.getElement().getStyle().set("background",
"var(--lumo-tint-30pct)");
appLayout.getElement().getStyle().set("width", "100%");
appLayout.getElement().getStyle().set("height", "500px");
add(appLayout, statusBar);
this.expand(appLayout);
}
@Override
public void showRouterLayoutContent(HasElement content) {
childWrapper.getElement().appendChild(content.getElement());
}
}
如果您对状态栏感兴趣,请切换add(appLayout, statusBar);
到add(statusBar, appLayout);
推荐阅读
- android - 为什么 gradle 没有签署我的工件
- python - 帆布,一条尾巴较细的线条
- javascript - 异步处理程序在 unhandledRejection 上开玩笑(反应)失败
- java - 自定义对象从嵌入式 FX (JFXPanel) 拖放到 Swing
- android - 由于绝对定位的底部导航栏,Android 会动态设置布局高度
- python-3.x - Python3 pkgutil get_data 用法
- javascript - 在div之外浮动文本?
- sql - Oracle SQL Count 或 Sum 以防万一查询?
- java - Java 8组对象列表,里面有列表
- html - AngularJS - 使用 ng-include 将 html 添加到页面的 ng-click 不起作用