vaadin VerticalSplitPanel,出现水平滚动条,但我看不到右边的结束行

时间:2015-10-23 15:59:22

标签: java user-interface vaadin vaadin7

我使用VerticalSplitPanel作为HorizontalSplitPanel的第二个组成部分。 当我添加一个面板作为VerticalSplitPanel的第二个组件时,我可以看到垂直滚动条和水平滚动条(cf screenshoot)。 我的问题是我无法滚动直到右边的行尾。 这是我的源代码:

        hsplit = new HorizontalSplitPanel();
        hsplit.setSplitPosition(13, Unit.PERCENTAGE);

        // Set the 1 pixel wide small style
        hsplit.addStyleName(Reindeer.SPLITPANEL_SMALL);

        vsplit.setSecondComponent(hsplit);
        Panel treePanel = new Panel();
        treePanel.setHeight(100, Unit.PERCENTAGE);
        treePanel.setContent(treeDataSourceManager.getView());
        treePanel.setStyleName("tree-panel");
        hsplit.setFirstComponent(treePanel);

        navbar = new VerticalLayout();

        GridLayout secondaryNavBar = new GridLayout(3, 1);
        secondaryNavBar.setWidth("100%");
        secondaryNavBar.addComponent(userPreferencesBar, 0, 0);
        secondaryNavBar.addComponent(paginationView, 2, 0);

        navbar.addComponent(alphaNavigationView);
        navbar.addComponent(secondaryNavBar);

        thirdPartLayout = new VerticalSplitPanel();
        thirdPartLayout.setStyleName("thirdPart");
        thirdPartLayout.setFirstComponent(navbar);
        thirdPartLayout.setSplitPosition(60, Unit.PIXELS);

        thirdPartLayout.setSecondComponent(mwiListResultView);
        hsplit.setSecondComponent(thirdPartLayout);

  public class MwiListResultView extends CustomComponent {



public MwiListResultView() {

    setSizeUndefined();
    setCompositionRoot(getResultLayout());

}

 private Panel getResultLayout() {


    Panel panel = new Panel();
    VerticalLayout resultLayout = new VerticalLayout();
    panel.setContent(resultLayout);
    panel.setWidth("1380px");
    resultLayout.setStyleName("mwiWorksResultLayout");
    resultLayout.setSizeUndefined();
   for (int i = 0; i < 200; i++) {
        Label l = new Label("test horizontal scrollbar right side not 
       shown totaly 
 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaattttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttXXXXXXXXXXXX");
        resultLayout.addComponent(l);
    }

  return panel;

 }
}

输出enter image description here

的屏幕截图

1 个答案:

答案 0 :(得分:0)

底部有第二个滚动条,但没有出现。 我在根布局上将margin设置为true,然后删除Panel。 问题已解决。

private VerticalLayout  getResultLayout() {


VerticalLayout resultLayout = new VerticalLayout();
VerticalLayout .setWidth("1380px");
resultLayout.setStyleName("mwiWorksResultLayout");
resultLayout.setSizeUndefined();
for (int i = 0; i < 200; i++) {
    Label l = new Label("test horizontal scrollbar right side not 
   shown totaly     
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

     aaaaaaaaaaaaaaaaaaaaaaaaaattttttttttttttttttttttttttttttttttttttttttttttttttt

tttttttttttttttttttttttttXXXXXXXXXXXX");
    resultLayout.addComponent(l);
                                 }

return resultLayout;

 }

这是一个vaadin错误,因为在根布局上没有将margin设置为true,底部滚动条不会出现。 我会创建一张票。