PDA

View Full Version : [FNR] Bug in BorderLayoutContainer.setXXXWidget(Widget w)?



jvahabzadeh
3 Nov 2011, 9:29 AM
I *think* I have encountered a bug. Or I'm doing something terribly wrong. This is with BorderLayoutContainer in GXT 3.0

When I have a BorderLayoutContainer, I can't necessarily set the widgets in the directional locations to any type of Widget.

This is the shortest bit of code I have that duplicates it:



public class Bug implements EntryPoint {

@Override
public void onModuleLoad() {
BorderLayoutContainer container = new BorderLayoutContainer();
container.setNorthWidget(new TextButton("Button"));
RootPanel.get().clear();
RootPanel.get().add(container);
}
}


The second line in the method throws a NullPointerException. (it is referred to as "Bug.java:17" in the exception trace provided below)

I have only tried to do a setNorthWidget (or South, East, West) with Label, VerticalPanel, TextButton, and VerticalLayoutContainer.

With Label and VerticalPanel, it works fine. With TextButton and VerticalLayoutContainer, the exception is thrown.

Is it that it will only work with standard GWT Widget subclasses, and not GXT Widget subclasses?

The exception I get from the above code is as follows:


13:21:36.580 [ERROR] [bug] Unable to load module entry point class com.test.bug.client.Bug (see associated exception for details)

java.lang.NullPointerException: null
at com.sencha.gxt.widget.core.client.container.BorderLayoutContainer.onInsert(BorderLayoutContainer.java:693)
at com.sencha.gxt.widget.core.client.container.Container.insert(Container.java:380)
at com.sencha.gxt.widget.core.client.container.BorderLayoutContainer.setNorthWidget(BorderLayoutContainer.java:332)
at com.test.bug.client.Bug.onModuleLoad(Bug.java:17)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396)
at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:525)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
at java.lang.Thread.run(Thread.java:662)


So, is it a bug, or am I using BorderLayoutContainer in some inappropriate way?

(line 17 in Bug.java corresponds to the se

(PS: I used the PHP tags to show my Java code - is there some sort of java-specific tag that will allow better color coding of code snippets?)

sven
3 Nov 2011, 10:00 AM
This is fixed in SVN now.

You are not specifying any layoutData. Simple use a BorderLayoutData as a workaround for now.