2

I am trying to create a DockLayoutPanel using GWT. It should occupy the complete screen.

DockLayoutPanel dockPanel = new DockLayoutPanel(Unit.EM);
dockPanel.addSouth(new HTML("South"), 2);
dockPanel.addNorth(new HTML("North"), 2);
dockPanel.addEast(new HTML("Easat"), 2);
dockPanel.addWest(new HTML("West"), 2);
dockPanel.add(new HTML("Center"));
RootLayoutPanel.get().add(dockPanel);
  1. I believe that the second parameter to the add methods is the width of the respective panels. How does the layout decide the height of the panel?
  2. How can I style the layout, like add border to the panels, spacing between the panels, add panel headings in-line with the border?
  3. Should the panel background colors be set using CSS, or is there a way to do so from java?
  4. Can I make these panels as drag and drop panels?
Mithun
  • 7,747
  • 6
  • 52
  • 68

2 Answers2

2

1) The second parameter is really the size of the panel. It will be the width or the height, depending of the layout position. Use Unit.PX or Unit.PC for a clearer result, the EM unit maybe confusing at the beginning.

2) Use CSS styles.

3) Again, use CSS

4) It's not possible using GWT alone. Take a look to the GWT-Mosaic project. Specially to the "Drag & Drop Column/Row Layout": http://mosaic.analytical-labs.com/#CwDNDColumnRowLayout

Carlos Tasada
  • 4,438
  • 1
  • 23
  • 26
0

1) The height and such are determined using normal HTML layout rules. The height and width of the panel is just the height and width of the containing div.

2) Style it using CSS just as you would any other div. UiBinder makes this pretty easy.

3) Yes, use CSS. You can call getElement() and getStyle() if you want to manipulate it directly or addStyleName() to add a CSS class. Regardless, UiBinder is probably the better bet than doing it in Java.

4) AFAIK, there's no way to do this out of the box. You'll have to write some code to handle that. SplitLayoutPanel will let you change the sizes of the panels, but not the positions.

gk5885
  • 3,742
  • 21
  • 16