I'm creating a structure that looks like:
dockLayoutPanel
verticalPanel
scrollPanel
grid
But if I fill the grid with rows so it's larger than the screen, the
vertical panel size extends below the bottom of the dockLayoutPanel's
center region. Why?
If I skip the vertical panel, and have the scrollpanel added to the
docklayoutpanel directly, the scroll panel size is what I'd expect.
Flipping between addUsingVerticalPanel and
addWithoutUsingVerticalPanel should show the problem.
public class Playground implements EntryPoint {
public void onModuleLoad() {
RootLayoutPanel rlp = RootLayoutPanel.get();
DockLayoutPanel dockLayoutPanel = new DockLayoutPanel(Unit.PX);
dockLayoutPanel.setSize("100%", "100%");
ScrollPanel scrollPanel = new ScrollPanel();
scrollPanel.setAlwaysShowScrollBars(true);
Grid grid = createGrid();
addUsingVerticalPanel(dockLayoutPanel, scrollPanel, grid);
//addWithoutUsingVerticalPanel(dockLayoutPanel, scrollPanel,
grid);
rlp.add(dockLayoutPanel);
}
private Grid createGrid() {
Grid grid = new Grid();
int nRows = 50;
grid.resize(nRows, 20);
for (int i = 0; i < nRows; i++) {
Label l = new Label("The number is " + i);
grid.setWidget(i, 0, l);
}
return grid;
}
private void addUsingVerticalPanel(DockLayoutPanel dockLayoutPanel,
ScrollPanel scrollPanel, Grid grid) {
VerticalPanel verticalPanel = new VerticalPanel();
verticalPanel.add(scrollPanel);
scrollPanel.setWidget(grid);
grid.setSize("100%", "100%");
dockLayoutPanel.add(verticalPanel);
}
private void addWithoutUsingVerticalPanel(DockLayoutPanel
dockLayoutPanel,
ScrollPanel scrollPanel, Grid grid) {
scrollPanel.setWidget(grid);
grid.setSize("100%", "100%");
dockLayoutPanel.add(scrollPanel);
}
}
--
James Moore
[email protected]
http://jamesmoorecode.blogspot.com/
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.