Search code examples
javauser-interfacevaadinvaadin7

vaadin VerticalSplitPanel, horizontal scrollbar appears but i can't see the end line on the right


I use a VerticalSplitPanel as a second component of HorizontalSplitPanel. I can see a vertical scrollbar and horizontal scrollbar when I add a panel as a second component of the VerticalSplitPanel (cf screenshoot). My problem is that I can't scroll until the end of the line on the right. This is my source code:

        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;

 }
}

Screenshot of the outputenter image description here


Solution

  • A second scrollbar was there on the bottom but doesn't appear. I set margin to true on the root layout and i remove the Panel. The issue is fixed.

    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;
    
     }
    

    It was a vaadin bug because without setting margin to true on the root layout, the bottom scrollbar doesn't appear. I will create a ticket.