I am have memory leak issues with LayoutPanels. I tested it with 2.5.0-
rc2. See my example below. Little description. I created a vertical
panel, added a button and Layout panel with 200 labels in this. Click
of the button clears the vertical panel(not layout panel), creates
the layout panel with 200 labels and adds it on the vertical panel.
Every click causes the leak of memory. Changing Layout panel with
VericalPanel resolved the leak. When changing LayoutPanel to
VerticalPanel make sure to comment lines with method call
setWidgetTopHeight.
package layout.client;
import java.util.*;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.*;
import com.google.gwt.user.client.ui.*;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class LayoutPaenlTest implements EntryPoint {
private VerticalPanel appWidget = new VerticalPanel();
private SimplePanel buttonWrapper = new SimplePanel();
Button reset;
public void onModuleLoad() {
reset = new Button("Replace Labels", new ClickHandler() {
public void onClick(ClickEvent event) {
reset.setEnabled(false);
appWidget.clear();
appWidget.add(buttonWrapper);
LayoutPanel layoutpanel = new LayoutPanel();
VerticalPanel labelContainer = new
VerticalPanel();
String time = new Date().toString();
for (int i = 0; i < 200; i++) {
Label currentLabel = new Label("Testing
" + i+ " "+time);
labelContainer.add(currentLabel);
}
layoutpanel.add(labelContainer);
layoutpanel.setWidgetLeftWidth(labelContainer,
0, Unit.PX, 300,
Unit.PX);
layoutpanel.setWidgetTopHeight(labelContainer,
45, Unit.PX, 4900,
Unit.PX);
layoutpanel.setWidth("300px");
layoutpanel.setHeight("5000px");
appWidget.add(layoutpanel);
reset.setEnabled(true);
}
});
buttonWrapper.add(reset);
appWidget.add(buttonWrapper);
LayoutPanel layoutpanel = new LayoutPanel();
VerticalPanel labelContainer = new VerticalPanel();
for (int i = 0; i < 200; i++) {
Label currentLabel = new Label("Testing " + i);
labelContainer.add(currentLabel);
}
layoutpanel.add(labelContainer);
layoutpanel.setWidgetLeftWidth(labelContainer, 0, Unit.PX, 300,
Unit.PX);
layoutpanel.setWidgetTopHeight(labelContainer, 45, Unit.PX,
4900,
Unit.PX);
layoutpanel.setWidth("300px");
layoutpanel.setHeight("5000px");
appWidget.add(layoutpanel);
appWidget.setWidth("320px");
appWidget.setHeight("5100px");
RootPanel.get("layouttest").add(appWidget);
}
}
--
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.