PDA

View Full Version : [FIXED] [GWT 2.0m1] Attaching CheckBox to Container throws runtime exception



jlr
20 Apr 2009, 9:49 AM
Looks like simply attaching a CheckBox to a Container throws a RuntimeException.

- GXT version: 2.0m1
- GWT version: 1.6.4
- Hosted mode
- Red Hat Fedora 8

Sample code


public class Test implements EntryPoint {

/**
* This is the entry point method.
*/
public void onModuleLoad() {

ContentPanel panel = new ContentPanel();
CheckBox checkBox = new CheckBox();
panel.add(checkBox);

RootPanel.get().add(panel);
}
}
Stack trace:


[ERROR] Uncaught exception escaped
java.lang.RuntimeException: Failed to invoke native method: @com.extjs.gxt.ui.client.core.El::getAlignToXY(Lcom/google/gwt/user/client/Element;Ljava/lang/String;[I) with 3 arguments.
at com.google.gwt.dev.shell.moz.LowLevelMoz.invoke(LowLevelMoz.java:134)
at com.google.gwt.dev.shell.moz.ModuleSpaceMoz.doInvoke(ModuleSpaceMoz.java:99)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:453)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:231)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.extjs.gxt.ui.client.core.El.getAlignToXY(El.java)
at com.extjs.gxt.ui.client.core.El.alignTo(El.java:254)
at com.extjs.gxt.ui.client.widget.form.CheckBox.alignElements(CheckBox.java:211)
at com.extjs.gxt.ui.client.widget.form.CheckBox.onAttach(CheckBox.java:221)
at com.extjs.gxt.ui.client.widget.ComponentHelper.doAttach(ComponentHelper.java:23)
at com.extjs.gxt.ui.client.widget.Container.doLayout(Container.java:377)
at com.extjs.gxt.ui.client.widget.Container.layout(Container.java:294)
at com.extjs.gxt.ui.client.widget.LayoutContainer.layout(LayoutContainer.java:238)
at com.extjs.gxt.ui.client.widget.Container$1.execute(Container.java:448)
at com.google.gwt.user.client.CommandExecutor.doExecuteCommands(CommandExecutor.java:310)
at com.google.gwt.user.client.CommandExecutor$2.run(CommandExecutor.java:205)
at com.google.gwt.user.client.Timer.fireImpl(Timer.java:160)
at com.google.gwt.user.client.Timer.fireAndCatch(Timer.java:146)
at com.google.gwt.user.client.Timer.fire(Timer.java:138)
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:585)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.moz.MethodDispatch.invoke(MethodDispatch.java:80)
at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method)
at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:1428)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2840)
at com.google.gwt.dev.SwtHostedModeBase.processEvents(SwtHostedModeBase.java:235)
at com.google.gwt.dev.HostedModeBase.pumpEventLoop(HostedModeBase.java:558)
at com.google.gwt.dev.HostedModeBase.run(HostedModeBase.java:405)
at com.google.gwt.dev.HostedMode.main(HostedMode.java:232)

sven
21 Apr 2009, 4:12 AM
This is a known issue in the first milestone release and will be fixed soon.

misqu
2 May 2009, 7:36 AM
In my application the same happens with combo box within formpanel.

When the next milestone will be released ?

Martin

sven
3 May 2009, 4:03 AM
This is already fixed in SVN.

If it is urgent for you to get bugfixes as fast as possible you can consider to get a support subscription.

http://www.extjs.com/store/gxt/#support-table

findepi
7 May 2009, 10:41 AM
you can download the official gxt.jat 2.0m1 http://extjs.com/products/gxt/download2.php?dl=extgwt2m1, unzip it, apply the below patch and copy the whole resultin 'com' directory to your project's src/.


diff -urN gxt-old/com/extjs/gxt/ui/client/core/El.java gxt-new/com/extjs/gxt/ui/client/core/El.java
--- gxt-old/com/extjs/gxt/ui/client/core/El.java 2009-04-15 08:47:10.000000000 +0200
+++ gxt-new/com/extjs/gxt/ui/client/core/El.java 2009-05-06 23:42:41.000000000 +0200
@@ -679,11 +679,19 @@
* @return the point
*/
public native Point getAlignToXY(Element align, String pos, int[] offsets) /*-{
- var ox = offsets[0] || 0;
- var oy = offsets[1] || 0;
+ var ox = @com.extjs.gxt.ui.client.core.El::__get([III)(offsets, 0, 0);
+ var oy = @com.extjs.gxt.ui.client.core.El::__get([III)(offsets, 1, 0);
var xy = $wnd.GXT.Ext.Element.fly(this.@com.extjs.gxt.ui.client.core.El::dom).getAlignToXY(align, pos, ox, oy);
return @com.extjs.gxt.ui.client.util.Point::newInstance(DD)(xy[0],xy[1]);
}-*/;
+
+ @SuppressWarnings("unused")
+ private static int __get(int[] array, int index, int def) {
+ if (index < array.length) {
+ return array[index];
+ } else
+ return def;
+ }

/**
* Returns the x,y coordinates specified by the anchor position on the


If it's legal to redistribute the resulting code under GPLv3, then you can download a jar file with the above modifications already made from http://students.mimuw.edu.pl/~findepi/gxt/gxt-2.0-m1-pf.jar.

Beware that it makes code work but not display correctly.