Child height in SplitLayoutPanel
I've got a SplitLayoutPanel. In the North cell, I've got a ScrollPanel with a tree on it. I want this ScrollPanel height to be the same of the north cell, so when the tree expand, a scroll appears. The size of this ScrollPanel must changed when the north cell is resized. I've tried with RequireResizes but parent does not send size information... An ideal approach should be that ProvidesSize widgets call onResize method with available size for the RequiresSize widget children
I'm very confused. 开发者_如何学CHow to configure SplitLayoutPanel to have cell children resized ?
Thanks
Create a class that extends Composite and implement RequiresResize; like so:
public class MyScrollPanel extends Composite implements RequiresResize {
private ScrollPanel scrollPanel;
public MyScrollPanel() {
scrollPanel = new ScrollPanel();
initWidget(scrollPanel);
}
public void onResize() {
// do something to your scrollpanel
}
}
Then add MyScrollPanel to the north cell in your SplitLayoutPanel.
EDIT
However. It turns out ScrollPanel already has the desired behavior by default. A ScrollPanel added to a SplitLayoutPanel cell will automatically fill the size of the cell, even on resize. And any ScrollPanel child widget larger than available space will cause a scrollbar to appear.
But make sure you're adding the SplitLayoutPanel to the RootLayoutPanel by doing
RootLayoutPanel.get().add(splitLayoutPanel);
精彩评论