PDA

View Full Version : CenterLayout potencial issue



fother
22 Jan 2009, 2:41 AM
public void onModuleLoad() {

TabPanel panel = new TabPanel();
panel.setAutoWidth(true);
panel.setHeight(400);

com.google.gwt.user.client.ui.Image. img = new com.google.gwt.user.client.ui.Image("http://www.google.com.br/intl/pt-BR_br/images/logo.gif");

TabItem tabItem = new TabItem("Tab");
tabItem.setLayout(new CenterLayout());
tabItem.add(img);
panel.add(tabItem);

RootPanel.get().add(panel);

}


In hosted mode and in firefox 3.0.5, in the first time the image "google" stay equals the attachment "1.jpg". If you refresh the browser or maximize the browser the image "google" stay equals the attachment "2.jpg"

gslender
22 Jan 2009, 2:46 AM
that is because on layout the image hasn't fully loaded and has no dimensions - it is 0,0 when 1st rendered - on resize the image has loaded and so has correct dimensions and can be centered correctly.

solution is to load image before rendering the tab item.

fother
22 Jan 2009, 2:50 AM
or setting the width and height solve the problem... thanks for your reply