PDA

View Full Version : [1.2.4] Center layout bug



cvs_fif
25 Jun 2009, 1:53 AM
When an element inside any scrollable panel/viewport is too big and the layout is the Center one, the scroll size is not calculated correctly and the inserted element is cut on the top and on the bottom. Here is the code demonstrating it:


package com.crofthawk.bugreports.r2_124.client;

import com.extjs.gxt.ui.client.Style.Scroll;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.HtmlContainer;
import com.extjs.gxt.ui.client.widget.Viewport;
import com.extjs.gxt.ui.client.widget.layout.CenterLayout;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;

public class BugReport implements EntryPoint {

public void onModuleLoad() {
final Viewport viewport = new Viewport();
viewport.setLayout(new CenterLayout());
viewport.setScrollMode(Scroll.AUTO);

final ContentPanel highContent = new ContentPanel();
highContent.setWidth(300);
final StringBuilder sb = new StringBuilder();
for (int i = 0; i < 500; i++) {
sb.append("L" + i + "<br />");
}
final HtmlContainer html = new HtmlContainer(sb.toString());
highContent.add(html);
viewport.add(highContent);

RootPanel.get().add(viewport);
}

}