Announcement

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

    SmartGWT- Why does it not work?

    Hey!

    I started to try Smart GWT development, but I don't can run it. I am using eclipse 4.4 with GWT 2.6 and SmartGWT 4.0. I followed several tutorials, which should show how to setup a SmartGWT project.
    My problem is that my widgets, which I add in onModuleLoad are not displayed in the browser, just the default HTML-sheet.
    I tried a lot, but I don't get it.

    My code:

    onModuleLoad
    Code:
     
    	public void onModuleLoad() {
    		
    		
            final IButton button = new IButton("Hello");
            
            button.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
    			
    			@Override
    			public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
    				// TODO Auto-generated method stub
    				SC.say("Hello ");
    			}
    		});
            
            VLayout vl= new VLayout();
            vl.setSize("100%", "100%");
            vl.addMember(button);
            
            
            RootPanel.get().add(vl);
    GWT.XML
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.6.0//EN"
      "http://google-web-toolkit.googlecode.com/svn/tags/2.6.0/distro-source/core/src/gwt-module.dtd">
    <module rename-to='test'>
                            -->
    <inherits name='com.google.gwt.user.User'/>
    
    <inherits name="com.smartgwt.SmartGwt"/>
    
    <source path='client'/>
    <source path='shared'/>
    
    
    </module>
    My HTML-File

    Code:
    <!doctype html>
    
    
    <html>
      <head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    
        <link type="text/css" rel="stylesheet" href="Test.css">
    
        <title>Web Application Starter Project</title>
        
        
        <script>var isomorphicDir="test/sc/";</script>
    <script type="text/javascript" language="test/test.nocache.js"></script>
    </head>
    
        <script type="text/javascript" language="javascript" src="test/test.nocache.js"></script>
      </head>
    
      <body>
    
        <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>
        
        <noscript>
          <div style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif">
            Your web browser must have JavaScript enabled
            in order for this application to display correctly.
          </div>
        </noscript>
    
        <h1>Web Application Starter Project</h1>
    
        <table align="center">
          <tr>
            <td colspan="2" style="font-weight:bold;">Please enter your name:</td>        
          </tr>
          <tr>
            <td id="nameFieldContainer"></td>
            <td id="sendButtonContainer"></td>
          </tr>
          <tr>
            <td colspan="2" style="color:red;" id="errorLabelContainer"></td>
          </tr>
        </table>
      </body>
    </html>
    WEB-XML

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
                  http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
             version="2.5"
             xmlns="http://java.sun.com/xml/ns/javaee">
    
      <!-- Servlets -->
      <servlet>
        <servlet-name>greetServlet</servlet-name>
        <servlet-class>test.test.server.GreetingServiceImpl</servlet-class>
      </servlet>
      
      <servlet-mapping>
        <servlet-name>greetServlet</servlet-name>
        <url-pattern>/test/greet</url-pattern>
      </servlet-mapping>
      
      <!-- Default page to serve -->
      <welcome-file-list>
        <welcome-file>Test.html</welcome-file>
      </welcome-file-list>
    
    </web-app>
    Maybe one of you can find my problem, because I really don't know, what the problem is.
    Please, please help me!


    Peter

    #2
    I don't know whose tutorials you are following, but Isomorphic recommends to start with one of their sample projects, then tweak from there.

    It appears you're doing stuff they say not to do. Such as:
    - Looks like you're mixing GWT (RootPanel?), don't do that: They are different frameworks. SmartGWT != GWT.
    - You never actually do a canvas.draw?
    - Your GWT xml does not define the entry-point class.
    - etc.

    Easiest way to get started is:
    - Eclipse with Google Plugin for Eclipse.
    - Import sample project builtinds.
    - Set Eclipse preferences for:
    -- Google -> Web Toolkit
    -- Java -> Build Path -> Classpath Variables -> GWT_HOME & SGWTxx_HOME, where xx is "EE" or "POWER" or whatever your license is. The required variable name will be clearly indicated in the Eclipse "Problems" tab if you don't know.

    Then do a Project -> Run As -> Web Application (GWT...) Whether to use Classic vs SuperDev is out-of-scope and up to you. I still use classic, but it does require a browser plugin, and it is being phased out.

    Once you get this sample Built-In DS project going, start building on that. Create your own Entry-Point classes that use the HSQL database. Then explore the utility classes & methods, like SC.openDataSourceConsole(), to create connections to your own databases. You will need to import the JDBC jar file for each respective database you try to connect to.

    Then read the Quick Start Guide. Again. I have found benefit in repeated re-readings.

    Once you achieve basic functionality/connectivity, look at the online Showcase example code. It's a cut & paster's candy store :)

    Enjoy!

    Comment


      #3
      Hi guys, I'm to trying to start smartgwt developing, but it's no so easy.
      First of all - I'm using Intellij Idea, and I can't mograto to another IDE
      Second - I was trying to compile sample project as it said in tutorial (ant host), but when I wait for about an hour for project to compile, I closed it.
      If I'm putting smartgwt library as external library to my project it just do nothing.
      So please can any one help mr to start using it?
      It woukd be great if I could use it in such maner: Intellij Idea + Maven + SmartGWT

      Comment


        #4
        Take a look at this. It is for Eclipse, but since all IDEs are pretty similar, I think you can easily apply it to Intellij. And remember to read the Quick Start Guide and start by importing builtinds, which is a good example to start with.

        Comment

        Working...
        X