0

look at this DockPanel http://gwt.googleusercontent.com/samples/Showcase/Showcase.html#!CwDockPanel & it's code:

  dock.add(new HTML(constants.cwDockPanelNorth1()), DockPanel.NORTH);
  dock.add(new HTML(constants.cwDockPanelSouth1()), DockPanel.SOUTH);
  dock.add(new HTML(constants.cwDockPanelEast()), DockPanel.EAST);
  dock.add(new HTML(constants.cwDockPanelWest()), DockPanel.WEST);
  dock.add(new HTML(constants.cwDockPanelNorth2()), DockPanel.NORTH);
  dock.add(new HTML(constants.cwDockPanelSouth2()), DockPanel.SOUTH);

Is it similar to the BorderLayout in Java? or it is different?

How to set layout using DockLayoutPanel in UiBinder for the below picture: enter image description here Why don't they add the Center? I am confused, also how to set docklayout for the above picture in UiBinder?

Kiti
  • 543
  • 7
  • 18

1 Answers1

3

Diffrences between DockPanel and DockLayouPanel

DockLayoutPanel

A panel that lays its child widgets out "docked" at its outer edges, and allows its last widget to take up the remaining space in its center. This widget will only work in standards mode, which requires that the HTML page in which it is run have an explicit declaration.

DockPanel

A panel that lays its child widgets out "docked" at its outer edges, and allows its last widget to take up the remaining space in its center. This widget has limitations in standards mode that did not exist in quirks mode. The child Widgets contained within a DockPanel cannot be sized using percentages. Setting a child widget's height to 100% will NOT cause the child to fill the available height.

If you need to work around these limitations, use DockLayoutPanel instead, but understand that it is not a drop in replacement for this class. It requires standards mode, and is most easily used under a RootLayoutPanel (as opposed to a RootPanel).

DockLayoutPanel is similar to BorderLayout.

To add something in center use add with no params:

dockLayoutPanel.add(widget);

This will take all remaining space.

The center widget should be added last. Otherwise you get an exception.

The Layout you want to create can't be done with just one DockLayoutPanel.

Spiff
  • 3,873
  • 4
  • 25
  • 50