8,961 ViewsFor those who have never heard about GWT …let me tell you briefly about it …its stands for Google Web Toolkit ………its framework for lazy java dev who can program in comforts of their favourite java IDE like eclipse and favourite language which is java and producing amazing ajax based web apps ……….i dont want to waste your time about telling GWT you are better off learning about more about from the source http://code.google.com/webtoolkit/…………………Only thing which I found missing GWT was number of widgets ………..SmartGwt (based on smartclient javascript library) has more more 100 widgets !! Read about it here …. http://code.google.com/p/smartgwt/
Now you know about what smartgwt and Gwt is all about ………lets configure smartgwt/gwt on eclipse and make a sample app
- Download SmartGwt ->http://code.google.com/p/smartgwt/downloads/list
- Download latest Gwt -> http://code.google.com/webtoolkit/download.html
- Download Cypal studio -> http://code.google.com/p/cypal-studio/downloads/list
- Extract all above
- Install Cypal studio in eclipse -> Unzip Cypal.X.zip in eclipse folder
- Configure Cypal studio -> Eclipse -> Window Preferences -> Cypal Studio -> GWT Option -> Put that path to dowloaded gwt
- Create a Gwt project :- Create a new Dynamic Webproject in eclipse and choose configuration as cypal studio
- Add SmartGwt.jar to to project class path others as seen in the screen shot below in the order otherwise you will get errors
- Create GWt Module -> Right Click on Project ->New -> Other -> Cypal Studio ->Gwt Module
- Edit Module Xml Configuration -> Cypal Studio automatically creates module xml file which is of same name as Class Name -> locate it (in this example its TestSmartGwt.gwt.xml) and add following line to add smartgwt support to module -> <inherits name=”com.smartgwt.SmartGwt”/>
- Edit Entry point and Add code -> Cypal studio will create EntryPoint class with same name and location as mentioned in step 9
package com.pagux.gwt.tutorial.client;
import java.util.LinkedHashMap;
import com.google.gwt.core.client.EntryPoint;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.*;
import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
import com.smartgwt.client.util.SC;public class TestSmartGwt implements EntryPoint {
public void onModuleLoad() {
DynamicForm form = new DynamicForm();TextItem textItem = new TextItem();
textItem.setTitle(”Hello World “);
textItem.setHint(”<nobr>A plain text field</nobr>”);LinkItem linkItem = new LinkItem(”link”);
linkItem.setTitle(”LinkItem”);
linkItem.setLinkTitle(”Click Me”);
linkItem.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
SC.say(”Hello World”);
}
});
TextAreaItem textAreaItem = new TextAreaItem();
textAreaItem.setTitle(”TextArea”);
ColorPickerItem colorPicker = new ColorPickerItem();
colorPicker.setTitle(”Color Picker”);
colorPicker.setWidth(85);
DateItem dateItem = new DateItem();
dateItem.setTitle(”Date”);
dateItem.setHint(”<nobr>Picklist based date input</nobr>”);form.setFields(textItem, linkItem, colorPicker, textAreaItem, dateItem );
form.draw();}
}
12. Run Project -> Right Click on Project -> Run AS -> Gwt AppliocationI hope this will help you get started with smartgwt ……………please let me know if have anything to add-on
Unfortunately SmartGwt is quite bloated , application above produced application that involved 2 mb of download , upon optimization (manually including js files / GZIP compression) it came down 800 kb which is still not acceptable if got high traffic website or sensitive about application size …main reason for this is bloated CORE SmartClient Js Lib which is around 500kb and 230 kb uncompressed and is included in all applications …….so if your application is for corporate lan use smartgwt otherwise use GWT widgets…though GWT widgets have less due amazing amount of optimization done by GWT compiler..its even less than hand wirtten code most of the times ………I tried to raise this point in smartgwt forum but I dont think they are going to do anything about it -> http://forums.smartclient.com/showthread.php?t=4690&highlight=bloated
Mar 14






Recent Comments