PDA

View Full Version : [CLOSED] Region cannot be resized in a BorderLayout'd container



sdc
3 Jul 2008, 10:37 PM
GXT version : SVN revision 547
Mode : Hosted mode and web mode (Firefox 3, IE6)
OS : Windows XP

If I add a west component in a BorderLayouted container, but not the center, the split bar is here but I cannot resize the region.


public void onModuleLoad() {
Viewport viewport = new Viewport();
viewport.setLayout(new BorderLayout());

BorderLayoutData westData = new BorderLayoutData(LayoutRegion.WEST,200f,100,300);
viewport.add(new ContentPanel(), westData);

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

darrellmeyer
9 Jul 2008, 6:37 PM
A component in the center region is required. I am adding that information to the JavaDocs and throwing an exception when there is no center component.

sdc
9 Jul 2008, 10:05 PM
Right. Thanks again for the nice job, Darell.

yawana1
7 Aug 2008, 6:42 AM
Hello darrellmeyer (http://extjs.com/forum/member.php?u=4759),
I'm very new to gwt and gwt-ext, so please bare with me. How do I add a component to the center region? I am getting a similar problem described above but with the window widget.

thanks in advance.

gslender
7 Aug 2008, 12:57 PM
raise a new post under the help forum and include some code to ensure we know what you are doing...

btw - adding a region to the center is a simple...

panel.add(widget, new BorderLayoutData(Style.LayoutRegion.CENTER));

cmregister
18 Aug 2008, 12:06 PM
Hi,

I got the following exception everytime I resize the browser: "A component in the CENTER region is required" (although the application works fine wihout resizing). In my code, I use BorderedLayout, every time users select an item on the left panel (West region), I dynamically create a new LayoutContainer in the Center region as the following in my AppView:

case AppEvents.MyEvent:

MyService.Util.getInstance().getMyStuff(tn.getId(),
new AsyncCallback<MyStuff>() {

public void onFailure(Throwable caught) {..}

public void onSuccess(MyStuff result) {
centerPanel.removeAll();
MyLayoutContainer myLayoutContainer = new MyLayoutContainer(result);
centerPanel.add(myLayoutContainer );
centerPanel.layout();
}
});

Any idea? Thanks in advance.

darrellmeyer
18 Aug 2008, 12:48 PM
BorderLayout requires a component in the center region.

cmregister
18 Aug 2008, 12:57 PM
Thanks. But LayoutContainer is a component, otherwise the same code will fail all the time, instead it only gives the exception when I resize the browser. Do I need to do anything special for resizing?

darrellmeyer
18 Aug 2008, 7:29 PM
You do not need to do anything special for resizing. When you resize the layout executes again. So if you get the exception only on resizing something must be chaning with the child components in the LayoutContainer with the BorderLayout. Hard to say without seeing the code.

cmregister
19 Aug 2008, 5:12 AM
I'm using GXT1.1 now, but I couldn't found anywhere in the source code where the exception is thrown, can you shed some light? Below is the stack trace I got (nowhere GXT code is referenced in the stack trace)
-------------------------------------------
09:08:34,451 FATAL [gwt-log] [FATAL] Uncaught Exception:
java.lang.RuntimeException: A component in the CENTER region is required.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.instantiate(ServerSerializationStreamReader.java:638)
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.deserialize(ServerSerializationStreamReader.java:462)
at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamReader.readObject(AbstractSerializationStreamReader.java:61)
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader$ValueReader$8.readValue(ServerSerializationStreamReader.java:123)
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.deserializeValue(ServerSerializationStreamReader.java:361)
at com.google.gwt.user.server.rpc.RPC.decodeRequest(RPC.java:287)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:162)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:85)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
at java.lang.Thread.run(Thread.java:595)

Alex.Leshkin
19 Aug 2008, 6:15 AM
Seems you are trying to pass a component as an argument in the server call

cmregister
19 Aug 2008, 6:26 AM
Actually, on the West region, we have a tree structure, so when a user selects a item on the tree, we do a server call to retrieve the related info for that item, upon returning successfully(AsyncCallback), we create a new component to display all the item's info, and put the new component into the Central panel. Everything works fine, except when resizing the browser, we got this exception.