我是新来Vaadin并试图了解它是否能满足一个webapp项目迁移我的需求。 其实我已经失去一个简单的目标,我的时间:有固定的页眉和页脚,并在中间的滚动内容的布局。 我做了我想要的一个非常基本的小提琴: jsfiddleVaadin基本布局:固定页眉和页脚+滚动内容
这里是我想出了主要Vaadin类:
public class MyVaadinUI extends UI {
// attributes
@WebServlet(value = "/*", asyncSupported = true)
@VaadinServletConfiguration(productionMode = false, ui = MyVaadinUI.class, widgetset = "testvaadin.aep.com.AppWidgetSet")
public static class Servlet extends VaadinServlet {
}
@Override
protected void init(VaadinRequest request) {
buildMainLayout();
}
private void buildMainLayout() {
final VerticalLayout mainLayout = new VerticalLayout();
mainLayout.setSizeFull();
//HEADER
final VerticalLayout headerLayout = new VerticalLayout();
final Resource res = new ThemeResource("img/logo.png");
final Image image = new Image(null, res);
headerLayout.addComponent(image);
//CONTENT
final VerticalLayout contentLayout = new VerticalLayout();
for(int i=0; i<80; i++){
contentLayout.addComponent(new Button("TEST " + i));
}
//FOOTER
final VerticalLayout footerLayout = new VerticalLayout();
footerLayout.addComponent(new Label("--------------------------- footer --------------------------"));
mainLayout.addComponent(headerLayout);
mainLayout.addComponent(contentLayout);
mainLayout.addComponent(footerLayout);
mainLayout.setExpandRatio(contentLayout, 1);
setContent(mainLayout);
}
}
显示的页面是在启动时确定,但当我向下滚动时,页脚也滚动(它不是固定的)。
在启动时:
当滚动:
我浏览了很多关于这个话题的页面,但我从来没有看到任何正确的答案。这在Vaadin中似乎相当复杂,尽管它在HTML中非常简单; Vaadin可能不适合我的需求。 无论如何,你知道我该如何实现这种行为? 谢谢!
,如果你喜欢用HTML摆弄,那么也许一个CustomLayout将有助于(见http://stackoverflow.com/questions/9563406/how-to -use-HTML模板与 - vaadin#9564654)。 – cfrick
嗨,谢谢你的回复,但实际上我不想为我的第一个要求去定制。 – toni07