java - 带有状态栏的 Vaadin 14,6 AppLayout?

标签 java layout statusbar vaadin14

我很高兴使用标准 Vaadin AppLayout Component作为我的应用程序的布局起点。现在我收到了添加状态栏的要求。状态栏必须与导航栏具有相同的宽度,因此它不能成为“内容”的一部分。

使用默认的 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);

关于java - 带有状态栏的 Vaadin 14,6 AppLayout?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68248661/

相关文章:

html - 我可以用什么来替换 HTML 中的内容?

r - 在 R 中使用 layout() 划分图形的线

android - 状态栏通知自动启动 Activity

swift - iOS 13 设置状态栏背景色

java - 如何创建二维集合?

java - 从 StringBuffer 中删除某些行

qt - 在 Qt 中切换布局

android - 如果应用程序处于全屏模式,是否可以在通知栏上显示通知?

java - jcreator - 制作配对游戏

java - JUnit 测试(使用 Spring MVC 和 Hibernate): IllegalArgumentException: Unknown entity