pkt1583 / gwt-ext

Automatically exported from code.google.com/p/gwt-ext
0 stars 0 forks source link

can not convert JavaScriptObject from number for TabPanelListener #412

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The problem is when the Entry point is loaded in host mode, I got this error 
com.google.gwt.core.client.JavaScriptException: (RangeError):
java.lang.IllegalArgumentException: Error converting argument 1: Calling
method 'getComponent': Cannot convert to type
com.google.gwt.core.client.JavaScriptObject from number
   at
com.google.gwt.dev.shell.ie.SwtOleGlue.convertVariantsToObjects(SwtOleGlue.java:
61)
   at
com.google.gwt.dev.shell.ie.IDispatchImpl.callMethod(IDispatchImpl.java:119)
   at
com.google.gwt.dev.shell.ie.IDispatchProxy.invoke(IDispatchProxy.java:155)
   at com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke(IDispatchImpl.java:294)
   at com.google.gwt.dev.shell.ie.IDispatchImpl.method6(IDispatchImpl.java:194)
   at
org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:117)
   at org.eclipse.swt.internal.ole.win32.COM.VtblCall(Native Method)
   at org.eclipse.swt.internal.ole.win32.IDispatch.Invoke(IDispatch.java:64)
   at org.eclipse.swt.ole.win32.OleAutomation.invoke(OleAutomation.java:493)
   at org.eclipse.swt.ole.win32.OleAutomation.invoke(OleAutomation.java:417)
   at
com.google.gwt.dev.shell.ie.ModuleSpaceIE6.doInvokeOnWindow(ModuleSpaceIE6.java:
67)
   at
com.google.gwt.dev.shell.ie.ModuleSpaceIE6.doInvoke(ModuleSpaceIE6.java:152)
   at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:447)
   at
com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:248)
   at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107
)
   at com.gwtext.client.widgets.Container.doLayout(Container.java)

Here is a small code that can reproduce the error
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.gwtext.client.core.Position;
import com.gwtext.client.widgets.Button;
import com.gwtext.client.widgets.Panel;
import com.gwtext.client.widgets.TabPanel;
import com.gwtext.client.widgets.Viewport;
import com.gwtext.client.widgets.event.TabPanelListenerAdapter;
import com.gwtext.client.widgets.form.FormPanel;
import com.gwtext.client.widgets.form.Label;
import com.gwtext.client.widgets.form.TextArea;
import com.gwtext.client.widgets.form.TextField;
import com.gwtext.client.widgets.layout.HorizontalLayout;

public class HelloWorld implements EntryPoint
{

   public void onModuleLoad()
   {

      Panel mainPanel = new Panel();
      mainPanel.setTitle("main Panel");

      final FormPanel formPanel = new FormPanel();
      formPanel.setFrame(true);
      formPanel.setWidth(700);
      formPanel.setLabelWidth(200);
      formPanel.setFileUpload(true);
      formPanel.setUrl(GWT.getModuleBaseURL() + "test");

      FileInput fi=new FileInput("file", "file", 200);
      formPanel.add(fi);

      mainPanel.add(formPanel);
      Viewport viewport = new Viewport(mainPanel);
   }

}

class FileInput extends Panel
{
   TextField fileUploader;
   TextArea textArea;
   TextField serverFile;
   Button sButton;
   TabPanel contentPanel;
   Label label;

   public final static String LOCAL_TEXT = "Local Text";
   public final static String LOCAL_FILE = "Local File";
   public final static String SERVER_FILE = "Server File";

   public FileInput(String heading, String name, int labelWidth)
   {
      setStyleName("x-form-item");
      setBorder(false);
      setLayout(new HorizontalLayout(2));
      this.setPaddings(3, 0, 0, 0);
      this.setButtonAlign(Position.RIGHT);

      label = new Label();
      label.setHtml(heading + ":");
      label.setCls("x-form-item-label");
      label.setWidth(labelWidth);
      add(label);

      contentPanel = new TabPanel();
      contentPanel.setMinTabWidth(115);
      contentPanel.setTabWidth(135);
      contentPanel.setWidth(400);
      contentPanel.setEnableTabScroll(true);
      contentPanel.setActiveTab(0);
//     comment this out, program runs ok
      contentPanel.addListener(new TabPanelListenerAdapter()
      {
         @Override
         public boolean doBeforeTabChange(TabPanel source, Panel newPanel,
Panel oldPanel)
         {

            return true;
         }
      });

      Panel textPanel = new Panel();
      textPanel.setTitle("Local Text");
      textArea = new TextArea("Local Text", name + "_data");
      textArea.setHideLabel(true);
      textArea.setHeight(100);
      textArea.setWidth(400);
      textPanel.add(textArea);
      contentPanel.add(textPanel);

      Panel lfPanel = new Panel();
      lfPanel.setTitle("Local File");
      fileUploader = new TextField("Local File", name);
      fileUploader.setHideLabel(true);
      fileUploader.setInputType("file");
      lfPanel.add(fileUploader);
      contentPanel.add(lfPanel);

      Panel sPanel = new Panel();
      sPanel.setLayout(new HorizontalLayout(1));
      sPanel.setTitle("Server File");
      serverFile = new TextField("Server File", name + "_server");
      serverFile.setHideLabel(true);
      serverFile.disable();
      sPanel.add(serverFile);

      sButton = new Button("Browse Server");
      sPanel.add(sButton);
      contentPanel.add(sPanel);
      contentPanel.setActiveItem(0);
      add(contentPanel);
   }

}

If I remove the TabPanelListener in my code, I do not get the error.

My system: 
Window Xp, Eclipse+Cypal, Host mode error only, GWT
1.5.3(http://gwt-ext.com/forum/viewtopic.php?f=5&t=2657), GWT-EXT 2.0.4

-jason

Original issue reported on code.google.com by jasonzha...@gmail.com on 13 Sep 2008 at 12:27

GoogleCodeExporter commented 8 years ago

Original comment by sanjiv.j...@gmail.com on 9 Oct 2008 at 9:24

GoogleCodeExporter commented 8 years ago
Any updates on the issue?

Original comment by riteshga...@gmail.com on 28 Feb 2013 at 9:04