Setting up SmartGWT and GWT with Eclipse

Smart GWT is a GWT based framework, It provides an environment to develop RIA applications. The framework supports rich UI component library and it also has widgets to supports data management on server-side.
Here we , exploring about basic Smart GWT application development.
Step 1:Set eclipse environment to develop GWT application.
Step 2: Download Smart GWT 3.x .
Step 3:
Setup SmartGWT:
1.     In your  hello project, create a new folder lib.
2.    Unzip smartgwt-3.0.zip and place both the smartgwt.jar and smartgwt-skins.jar in the lib folder you just created.
3.    Right-click on the hello project and go to Properties > Java Build Path > Libraries tab and add both the smartgwt.jar and smartgwt-skins.jar to the build path.
4.    Open com.becbe.smartgwt.hello.client.Home class and replace the entire onModuleLoad() with the following:
public void onModuleLoad() {
         IButton button = new IButton("Click Me");
         button.addClickHandler(new ClickHandler() {
        @Override
         public void onClick(ClickEvent event) {
                                    SC.say("Hello guys!!!.Welcome to Smart GWT application Development.");
                                   
                        }
            });
         button.draw();
    }
Source Code: Hello.java
package com.becbe.smartgwt.hello.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootLayoutPanel;
import com.google.gwt.user.client.ui.RootPanel;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;

/**
 * Entry point classes define onModuleLoad().
 */
public class Hello implements EntryPoint {
 
 /**
  * This is the entry point method.
  */
    public void onModuleLoad() {
         IButton button = new IButton("Click Me");
         button.addClickHandler(new ClickHandler() {
  
         @Override
         public void onClick(ClickEvent event) {
   SC.say("Hello guys!!!.Welcome to Smart GWT application Development.");
   
  }
 });
         button.draw();
    
    //RootLayoutPanel.get().add(button); 
    }
}

5.    Open the com.becbe.smartgwt.Hello.gwt.xml  file and delete or comment-out the following:

       

5.1.            In the same XML file, add the following inherits elements:
        
    

  6.      Open the war/Hello.html file and add the following between the <head> section and before thehello.nocache.js script:

  
Source Code: Hello.html
        
    
1. Open the war/Hello.html file and add the following between the section and before thehello.nocache.js script:
  
Source Code: Hello.html



 
 
 
 
 
 
 
 
 
 
 
 Web Application Starter Project
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
     
      
     
     
  

Step 4: Compile and Deploy:
  1. Right-click on the hello project and select Google > GWT Compile.
  2. Press Compile in the dialog.
  3. Pay attention to the console to make sure there are no compile errors.
  4. Now deploy the app by right-clicking on the hello project and select Run As > Web Application
  5. After the embedded web server starts, point your browser to the the URL: http://127.0.0.1:8888/Hello.html?gwt.codesvr=127.0.0.1:9997
You should see the following page:

 

SHARE

    Blogger Comment
    Facebook Comment

0 comments :

Post a Comment