Announcement

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

    cannot get loadScreen to work - Canvas is always null

    I'm using
    Isomorphic SmartClient/SmartGWT Framework (v9.0p_2013-09-17/Pro Deployment 2013-09-17)

    I'm running this from within Eclipse and using Firefox 20.0 on a linux desktop.

    I'm trying to get the balsamiq UI import to work but before that happens I wanted to verify that I can get the ComponentXML to work... and I can't. I have read tons of info pages and I even copied code straight from the samples and they do not work for me. So here is what I have and have done...

    After trying my own and failing, I grabbed a ui.xml from the samples... I'm using addingHandler.ui.xml
    Code:
    <VLayout xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
         ID="componentsLayout" autoDraw="false">
         <members>
            <DynamicForm ID="saveForm" dataSource="supplyItem" autoDraw="false" width="300" titleWidth="100">
                <items>
                    <item name="headerItem" type="header" defaultValue="Enter new Stock Item" />
                    <item name="itemName" type="text" title="Item Name" />
                    <item name="unitCost" type="number" title="Price" />
                    <item name="inStock" type="boolean" title="In stock">
                        <defaultValue xsi:type="xsd:boolean">false</defaultValue>
                    </item>
                    <item name="nextShipment" type="date" useTextField="true" title="Stock Date" />
                </items>
            </DynamicForm>
            <Button ID="saveButton" title="Save" autoDraw="false" />
        </members>
    </VLayout>
    and I'm loading it with essentially the code that I found in the showcase sample in AddingHandlers.java. I started with the full code from that method and have now just narrowed it down to a null check. And it's always null.
    Code:
        public Canvas getViewPanel() {
            final Canvas layout = new Canvas();
            RPCManager.loadScreen("addingHandlers", new LoadScreenCallback() {
                @Override
                public void execute() {
                    Canvas theScreen = this.getScreen();
                    if (theScreen == null) {
                        //crud - it's null
                        Window.alert("the screen was null");
                    } else {
                        Window.alert("the screen was NOT null");                
                    }
                }
            });
            layout.addChild(new HTML("placeholder"));
            return layout;
        }
    I *am* getting the json representation of the ui.xml in the console, so I know something is working:
    Code:
    === 2013-09-25 15:45:55,868 [l0-5] DEBUG ScreenLoaderServlet - screenLoader - Generated response:{
        VLayout:{
            ID:"componentsLayout",
            autoDraw:"false",
            xsi:"http://www.w3.org/1999/XMLSchema-instance",
            members:{
                DynamicForm:{
                    ID:"saveForm",
                    autoDraw:"false",
                    dataSource:"supplyItem",
                    titleWidth:"100",
                    width:"300",
                    items:{
                        item:[
                            {
                                defaultValue:"Enter new Stock Item",
                                name:"headerItem",
                                type:"header"
                            },
                            {
                                name:"itemName",
                                title:"Item Name",
                                type:"text"
                            },
                            {
                                name:"unitCost",
                                title:"Price",
                                type:"number"
                            },
                            {
                                name:"inStock",
                                title:"In stock",
                                type:"boolean",
                                defaultValue:{
                                    type:"xsd:boolean",
                                    "#text":"false"
                                }
                            },
                            {
                                name:"nextShipment",
                                title:"Stock Date",
                                type:"date",
                                useTextField:"true"
                            }
                        ]
                    }
                },
                Button:{
                    ID:"saveButton",
                    autoDraw:"false",
                    title:"Save"
                }
            }
        }
    }
    Can anyone see what I'm doing wrong and why I can't load a screen properly?

    Thanks,
    Brian

    #2
    Looks like skipped installation steps. Files in [war]sc/system/schema aren't there or can't be located. Your <inherits> could be wrong, or you may not have run a GWT compile after changing them.

    Or, this could also happen if you've tweaked your project layout but not updated properties like isomorphicPathRootRelative in server.properties.

    Comment


      #3
      Originally posted by Isomorphic View Post
      Looks like skipped installation steps. Files in [war]sc/system/schema aren't there or can't be located. Your <inherits> could be wrong, or you may not have run a GWT compile after changing them.

      Or, this could also happen if you've tweaked your project layout but not updated properties like isomorphicPathRootRelative in server.properties.
      Thanks for the quick reply... you say
      "[war]sc/system/schema aren't there or can't be located"
      but in my project it's under
      "[war]/projectname/sc/system/schema"

      Maybe that is the problem? Where would I set/change this? server.properties? I don't remember setting that but maybe I did? Here is the contents of my project's .gwt.xml file (sensitive data replaced with HIDDEN)
      Code:
      <?xml version="1.0" encoding="UTF-8"?>
      <!--
       When updating your version of GWT, you should also update this DTD reference,
       so that your app can take advantage of the latest GWT module capabilities.
      -->
      <!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN"
        "http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd">
      <module rename-to='HIDDEN'>
       <!-- Inherit the core Web Toolkit stuff.                        -->
       <inherits name='com.google.gwt.user.User' />
       
       <inherits name='com.sensei.themes.blue.blue'/>  
      
       <!-- Other module inherits                                      -->
          
       <!-- for Pro Edition -->
       <inherits name="com.smartgwtpro.SmartGwtPro"/>
       <inherits name="com.smartgwtpro.tools.Tools"/>
       <inherits name="com.smartclient.theme.enterpriseblue.EnterpriseBlue"/>
       <inherits name="com.smartclient.theme.enterpriseblue.EnterpriseBlueResources"/> 
      
       <!-- Specify the app entry point class.                         -->
       <entry-point class='HIDDEN' />
      
       <!-- Specify the paths for translatable code                    -->
       <source path='client' />
       <source path='shared' />
      </module>

      Comment


        #4
        Sorry, you're correct, the path should include your GWT module name. This assumes that isomorphicPathRootRelative in server.properties agrees, and has the same gwtModuleName.

        If these agree, and you don't see some other reason why the files might be inaccessible (perhaps they are not allowed to be read because they were created with bad permissions) then please post the full server logs from startup to the loading of this screen.

        Unrelated issues:

        1. you are loading 2 skins (or maybe 3) - see the QuickStart Guide on how to correctly switch skins.

        2. you don't need to use "SmartGwtPro"-specific inherits anymore with version 4.0 and later. Just use SmartGwtEE, and this will allow you to more easily switch over to using the Eval edition if you want to try something new, and won't need changing if you upgrade to Power someday.

        Comment


          #5
          Originally posted by Isomorphic View Post
          Sorry, you're correct, the path should include your GWT module name. This assumes that isomorphicPathRootRelative in server.properties agrees, and has the same gwtModuleName.
          BINGO - that was it. We went from the free version to the pro version and I copied the server.properties file from another sample project. I missed changing the gwtModuleName in server.properties. Once I fixed that as you sugegsted, it worked (or at least my code now says "screen was not null").

          Originally posted by Isomorphic View Post
          Unrelated issues:

          1. you are loading 2 skins (or maybe 3) - see the QuickStart Guide on how to correctly switch skins.
          I thought I was loading one for our non-SmartGWT widgets (which we are in the process of converting) and then loading the EnterpriseBlue theme for SmartGWT.
          are you saying I don't need one of these?:
          <inherits name="com.smartclient.theme.enterpriseblue.EnterpriseBlue"/>
          <inherits name="com.smartclient.theme.enterpriseblue.EnterpriseBlueResources"/>

          I found some code somewhere that had both so that's why I put both. Which one should I use?

          Originally posted by Isomorphic View Post
          2. you don't need to use "SmartGwtPro"-specific inherits anymore with version 4.0 and later. Just use SmartGwtEE, and this will allow you to more easily switch over to using the Eval edition if you want to try something new, and won't need changing if you upgrade to Power someday.
          Not sure I follow... are you saying I can remove one or both of these?
          <inherits name="com.smartgwtpro.SmartGwtPro"/>
          <inherits name="com.smartgwtpro.tools.Tools"/>
          and if so, do I replace them with something?

          Thanks for all your help!
          Brian

          Comment


            #6
            I found some code somewhere that had both so that's why I put both. Which one should I use?
            Depends on what you are trying to do. Take a look at the QuickStart Guide instructions, and if those don't seem to address your intent, explain what you wanted to achieve.

            Not sure I follow... are you saying I can remove one or both of these?
            <inherits name="com.smartgwtpro.SmartGwtPro"/>
            <inherits name="com.smartgwtpro.tools.Tools"/>
            and if so, do I replace them with something?
            The <inherits> are now the same across all Pro+ editions. They just use "ee" everywhere instead of Edition-specific names.

            So you can replace "smartgwtpro" with "smartgwtee" and "SmartGwtPro" with "SmartGwtEE".

            Comment


              #7
              Originally posted by Isomorphic View Post
              Depends on what you are trying to do. Take a look at the QuickStart Guide instructions, and if those don't seem to address your intent, explain what you wanted to achieve.



              The <inherits> are now the same across all Pro+ editions. They just use "ee" everywhere instead of Edition-specific names.

              So you can replace "smartgwtpro" with "smartgwtee" and "SmartGwtPro" with "SmartGwtEE".
              Ok, I changed my inherits to:
              Code:
               <inherits name="com.smartgwtee.SmartGwtEE"/>
               <inherits name="com.smartgwtee.tools.Tools"/>
               <inherits name="com.smartclient.theme.enterpriseblue.EnterpriseBlue"/>
              and all seems to be working fine - thanks!

              Comment

              Working...
              X