junaidp
junaidp

Reputation: 11221

GWT resizable dockpanel

I have a dock panel in my GWT application. Everything's fine

Now I want to add the option for a user to resize the west panel of the dockpanel So a user can any time increase the width of westpanel

Any guidance please

Code:

    public MainPanel (){
    DockPanel dockPanel = new DockPanel();
    dockPanel.add(new NorthPanel(),
            DockPanel.NORTH);
    dockPanel.add(new SouthPanel(),
            DockPanel.SOUTH);
    dockPanel.add(new EastPanel(),
            DockPanel.EAST);
    dockPanel.add(new WestPanel(),
            DockPanel.WEST);
    RootPanel.get("loadingMessage").setVisible(false);
    initWidget(dockPanel);
}

Upvotes: 0

Views: 220

Answers (2)

Abhijith Nagaraja
Abhijith Nagaraja

Reputation: 3380

You have to use SplitPanel as mentioned by @Chris Hinshaw. But be careful with layout and basic panels. If you are using basic panels then use SplitPanel else if you are using Layout Panels use SplitLayoutPanel.

If you have any doubts,see the following links

SplitPanel:http://www.giantflyingsaucer.com/blog/?p=2324

Basic Panels: http://www.gwtproject.org/doc/latest/DevGuideUiPanels.html#BasicPanels

Layout Panels: http://www.gwtproject.org/doc/latest/DevGuideUiPanels.html#LayoutPanels

For other info on panels : http://www.slideshare.net/martyhall/gwt-tutorial-laying-out-windows-with-panels-part-ii-composite-panels

Upvotes: 0

Chris Hinshaw
Chris Hinshaw

Reputation: 7285

My recomendation is to use a SplitLayoutPanel which will allow the user to resize the East and West Panel. You could so something like this.

SplitLayoutPanel splitPanel = new SplitLayoutPanel();
splitPanel.addEast(new EastPanel());
splitPanel.addWest(new WestPanel();
dockPanel.add(new NorthPanel());

dockPanel.add(splitPanel);

You can also configure a graphic for the slider in between the split panels east and west panels.

http://www.gwtproject.org/javadoc/latest/com/google/gwt/user/client/ui/SplitLayoutPanel.html

Upvotes: 1

Related Questions