Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Multiple modules and SelectItem problem

    Hello,

    Using the NetBeans's GWT plugin, I created two web applications and, in each one a GWT module that inherits SmartGwt (1.3).

    Separately, each web application works well : its GWT module added to a page displays a dynamic form containing a SelectItem with some values.

    The first web application has the web context named "Module1", and the GWT module org.yournamehere.Main1.

    The second web application has the web context named "Module2", and the GWT module org.yournamehere.Main2.

    Here the code that is pratically identical for the two modules and that comes from the class that implements the EntryPoint interface:

    Code:
    public class Main1EntryPoint implements EntryPoint {
        /** 
         * Creates a new instance of Main1EntryPoint
         */
        public Main1EntryPoint() {
        }
    
        /** 
         * The entry point method, called automatically by loading a module
         * that declares an implementing class as an entry-point
         */
        public void onModuleLoad() {
            RootPanel.get("1").add(buildView());
        }
    
        public Widget buildView() {
            VLayout layout = new VLayout(15);
            layout.setAutoHeight();
    
            final DynamicForm form = createForm();
    
            layout.addMember(form);
    
            return layout;
        }
    
        private DynamicForm createForm() {
            DynamicForm form = new DynamicForm();
            form.setWidth(300);
    
            SelectItem storeItem = new SelectItem("storeId", "Magasin");
    
            LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
            valueMap.put("US", "<b>United States</b>");
            valueMap.put("CH", "China");
            valueMap.put("JA", "<b>Japan</b>");
            valueMap.put("IN", "India");
            valueMap.put("GM", "Germany");
            valueMap.put("FR", "France");
            valueMap.put("IT", "Italy");
            valueMap.put("RS", "Russia");
            valueMap.put("BR", "<b>Brazil</b>");
            valueMap.put("CA", "Canada");
            valueMap.put("MX", "Mexico");
            valueMap.put("SP", "Spain");
            storeItem.setValueMap(valueMap);
    
            form.setFields(storeItem);
    
            return form;
        }
    
    }
    The only difference between the two modules is the value of the id in which the interface is injected.
    For the org.yournamehere.Main1 GWT module, the interface is injected in a div element that has an id with the value "1".
    For the org.yournamehere.Main2 GWT module, the interface is injected in a div element that has an id with the value "2".

    So, I deployed the two web applications ; for the second web application, I used this HTML page in order to use the two GWT module in the same page:

    Code:
    <html>
        <head>
            <title>Main2</title>
        </head>
        <body>
            <p>Module 1</p>
            <div id="1"></div>
            <p>Module 2</p>
            <div id="2"></div>
            <script language="javascript">
                var isomorphicDir = "/Module1/org.yournamehere.Main1/sc/";
            </script>
    
            <script language="javascript" src="/Module1/org.yournamehere.Main1/org.yournamehere.Main1.nocache.js"></script>
            <script language="javascript" src="/Module2/org.yournamehere.Main2/org.yournamehere.Main2.nocache.js"></script>
        </body>
    </html>
    The problem I get is that, when the page is displayed, combo boxes appear, but when you try to pull down elements on a combo box there is no element!

    What can be wrong? Is it really possible to use SmartGWT with multiple modules?

    Thank you a lot for any help!

    #2
    Have you checked your Developer Console for errors and warnings?

    Comment


      #3
      As I got some difficulties to start a web application in hosted mode, under NetBeans 6.7.1 with GWT4NB, I decided to give a try with Eclipse Galileo with its GWT plugin. With it, I was able to define two GWT modules in the same web application and to run it in hosted mode. I ran also the developer console.
      I used: GWT 1.7, Smart GWT 1.3.
      As in the previous test, each module defines a dynamic form (DynamicForm) containing a SelectItem with some values.

      I ge these symtoms, when the page in which the two modules are injected, is displayed:
      - forms are well displayed
      - each times I click on one of the comboxes, the GWT Browser displays a "Stack overflow at line 0" dialog box error; and in Elipse IDE I get this exception:

      java.lang.NullPointerException
      at com.google.gwt.dev.shell.ie.JsValueIE6.isString(JsValueIE6.java:355)
      at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:124)
      at com.google.gwt.dev.shell.ie.SwtOleGlue.convertVariantsToObjects(SwtOleGlue.java:57)
      at com.google.gwt.dev.shell.ie.IDispatchImpl.callMethod(IDispatchImpl.java:119)
      at com.google.gwt.dev.shell.ie.IDispatchProxy.invoke(IDispatchProxy.java:155)

      but values of the combox are well displayed!

      - the developer console doesn't display any warn or error
      - the GWT hosted mode windows doesn't display any warn or error


      Here an important remark: in one GWT module, if I comment the use of the SelectItem, I get no error on the other (as described) when clicking on it when the HTML page is displayed.
      It seems there is a side effect when using two GWT modules with SmartGWT, at least with SelectItem.

      If you want I can send you the Eclipse project.

      I Hope there is a solution.


      Bertrand.

      Comment


        #4
        These really seems to be in the guts of the GWT engine and not something we could be affecting with SmartGWT. Have you looked around for general tutorials on how to run two GWT modules on the same page? Have you tried Googling the error messages you're getting?

        Comment


          #5
          Finally, I saw in the Google GWT documentation, that it as strongly recommanded to use only one GWT module in an HTML page.

          Thank you again.

          Bertrand.

          Comment

          Working...
          X