Java 使用gxt3的BorderLayoutContainer时排列布局不正确
我面临着不同的问题,每当我试图调整窗口内容的大小时,它都不会被调整大小。我还尝试了调整大小处理程序的方法 正如我们可以看到的,SnapshotChooserView和RunLogGrid有两个组件,我已经使它可折叠。 因此,当我使SnapshotChooserView折叠时,所有空间都应该被RunLogGrid占用,当我折叠RunLogGrid时,所有其他空间都应该被SnapshotChooserView占用 谁能帮我弄清楚这件事Java 使用gxt3的BorderLayoutContainer时排列布局不正确,java,gwt,layout,gxt,Java,Gwt,Layout,Gxt,我面临着不同的问题,每当我试图调整窗口内容的大小时,它都不会被调整大小。我还尝试了调整大小处理程序的方法 正如我们可以看到的,SnapshotChooserView和RunLogGrid有两个组件,我已经使它可折叠。 因此,当我使SnapshotChooserView折叠时,所有空间都应该被RunLogGrid占用,当我折叠RunLogGrid时,所有其他空间都应该被SnapshotChooserView占用 谁能帮我弄清楚这件事 public class RunView implements
public class RunView implements IsWidget {
// Client factory
private ClientFactory iClientFactory;
// Main Container
private BorderLayoutContainer borderLayoutContainer;
// Components
private SnapshotChooserView snapshotChooserView;
// Components
private RunLogGrid runLogGrid;
ContentPanel north;
ContentPanel south;
ResizeHandler handler1;
ResizeHandler handler2;
// ---- CONSTRUCTORS ----
public RunView() {
}
public RunView(ClientFactory aClientFactory) {
iClientFactory = aClientFactory;
borderLayoutContainer = new BorderLayoutContainer();
borderLayoutContainer.setBorders(true);
snapshotChooserView = iClientFactory.getSnapshotChooserView();
runLogGrid = new RunLogGrid(iClientFactory);
final double SnapshotChooserHeight = 500;
final int RunLogGridHeight = 350;
handler1 = new ResizeHandler(){
@Override
public void onResize(ResizeEvent event) {
north.setWidth(event.getWidth());
north.setHeight(event.getHeight());
}
};
handler2 = new ResizeHandler(){
@Override
public void onResize(ResizeEvent event) {
south.setWidth(event.getWidth());
south.setHeight(event.getHeight());
}
};
north = new ContentPanel();
north.setHeadingText("Run Details");
north.add(snapshotChooserView.asWidget());
north.setCollapsible(true);
north.setResize(true);
north.addResizeHandler(handler1);
// north.forceLayout();
south = new ContentPanel();
south.setHeadingText("Run Log Info");
south.add(runLogGrid.asWidget());
south.setCollapsible(true);
south.setResize(true);
south.addResizeHandler(handler2);
// south.forceLayout();
BorderLayoutData northData = new BorderLayoutData(SnapshotChooserHeight);
northData.setMargins(new Margins(2, 2, 2, 2));
//northData.setCollapsible(true);
//northData.setSplit(true);
//northData.setCollapsed(true);
//northData.setCollapseMini(true);
BorderLayoutData southData = new BorderLayoutData(RunLogGridHeight);
southData.setMargins(new Margins(2, 2, 2, 2));
//southData.setCollapsible(true);
//southData.setMinSize(RunLogGridHeight);
//southData.setMaxSize(850);
//southData.setSplit(true);
//southData.setCollapseMini(true);
//borderLayoutContainer.addResizeHandler(handler1);
//borderLayoutContainer.addResizeHandler(handler2)
}只有从a开始,然后使用GXT容器作为BorderLayoutContainers的父级/祖先级,GXT中的大小调整才会起作用。是这样做的吗?要么是视口,要么直接指定大小。此外,GXT布局容器或GWT布局面板都可以用作父级,只要它们被配置为为为其子级提供一个大小。GWT的RootLayoutPanel不够,因为它并不表示初始大小已经准备好。
borderLayoutContainer.setNorthWidget(north, northData);
borderLayoutContainer.setSouthWidget(south, southData);
}
/*
* @see RunLogGrid::TriggerGridReload
*/
public void triggerRunGridRefresh() {
runLogGrid.triggerGridReload();
}
/*
* (non-Javadoc)
*
* @see com.google.gwt.user.client.ui.IsWidget#asWidget()
*/
@Override
public Widget asWidget() {
return borderLayoutContainer;
}