tags:

views:

177

answers:

2

This is some very simple code that I'm using to try showing a VerticalSplitPanel, but the widgets I add don't show. The divider thing of VerticalSplitPanels does show however the widgets I add don't.

Code:

public class MyView extends Composite
{
    private VerticalSplitPanel mainPanel=new VerticalSplitPanel();

    public CountryFilterView()
    {    

     mainPanel.setSize("100%", "100%");
     mainPanel.setSplitPosition("50%");
     // Add some content
        String randomText = "This is some text to show how the contents on either "
            + "side of the splitter flow.   "
            + "This is some text to show how the contents on either "
            + "side of the splitter flow.   "
            + "This is some text to show how the contents on either "
            + "side of the splitter flow.   ";
        mainPanel.setTopWidget(new HTML(randomText));
        mainPanel.setBottomWidget(new HTML(randomText));
        initWidget(mainPanel);
    }
}

Am I doing something wrong, or is VerticalPanel just very annoyingly buggy?

A: 

Try run initWidget method before the component configuration. Check this link SplitPanel problems.

mykhaylo
No, its still the same even after putting initWidget before everything else.
Click Upvote
+1  A: 

I just tried your code (with a small tweak to fix compile error) and it is displaying both widgets. I have tried this in GWT 2.0.

Here is the code I used that is working. Notice the Constructor name difference.

public class MyView extends Composite
{
    private VerticalSplitPanel mainPanel=new VerticalSplitPanel();

    public MyView()
    {                           

     mainPanel.setSize("100%", "100%");
     mainPanel.setSplitPosition("50%");
     // Add some content
     String randomText = "This is some text to show how the contents on either "
      + "side of the splitter flow.   "
      + "This is some text to show how the contents on either "
      + "side of the splitter flow.   "
      + "This is some text to show how the contents on either "
      + "side of the splitter flow.   ";
     mainPanel.setTopWidget(new HTML(randomText));
     mainPanel.setBottomWidget(new HTML(randomText));
     initWidget(mainPanel);
    }
}

And here is how i invoked it.

public void onModuleLoad() {
    RootPanel.get().add(new MyView());
}
Carnell
they may have fixed it in the new version
Click Upvote