Friday, March 13, 2009

Spice up your GWT components with GWT EXT - (read gwit extension)

GWText comes with some great components that spices up your otherwise plain GWT components.

Place the 'gwtext.jar' file and include in your project classpath ie. compiler and shell script


@java -Xmx256M -cp "%~dp0\src;%~dp0\bin;C:/gwt-windows-1.5.2/gwt-user.jar;C:/gwt-windows-1.5.2/gwt-dev-windows.jar;C:/gwt-windows-1.5.2/gwtext.jar" com.google.gwt.dev.GWTCompiler -out "%~dp0\www" %* com.rsheyeah.gwt.UITest


Make sure you have these lines in UITest.gwt.xml file

<inherits name='com.gwtext.GwtExt' />
<script src="js/ext/adapter/ext/ext-base.js" />
<script src="js/ext/ext-all.js" />
<stylesheet src="js/ext/resources/css/ext-all.css" />


Lastly, just have the appropriate resource files in their respective js folder

Otherwise, the compiler screams "No source code is available for type com.gwtext.client.widgets.form.*****; did you forget to inherit a required module?"

Creating JUnit test cases for your GWT project

The importance of JUnit testing and benchmarking cannot be undermined for java projects, let alone GWT projects.

Out-of-box JUnit test support is shipped with GWT for client and server side synchronous and asynchronous testing.Each GWT JUnit test extends GWTTestCase and implements getModuleName() method which defines the interest of GWT module.

Hence, if you like to create a project "MyUITest" in eclipse:
Go to your GWT_HOME (the place where your gwt related jars reside) directory and in the command prompt, promptly type in
projectCreator -eclipse MyUITest
and
applicationCreator -eclipse MyUITest -out MyUITest com.rsheyeah.gwt.client.UITest

and the result is as follows:
Created directory MyUITest\src
Created directory MyUITest\src\com\rsheyeah\gwt
Created directory MyUITest\src\com\rsheyeah\gwt\client
Created directory MyUITest\src\com\rsheyeah\gwt\public
Created file MyUITest\src\com\rsheyeah\gwt\UITest.gwt.xml
Created file MyUITest\src\com\rsheyeah\gwt\public\UITest.html
Created file MyUITest\src\com\rsheyeah\gwt\public\UITest.css
Created file MyUITest\src\com\rsheyeah\gwt\client\UITest.java
Created file MyUITest\UITest.launch
Created file MyUITest\UITest-shell.cmd
Created file MyUITest\UITest-compile.cmd

Now heres the line which generates the junit files:

junitCreator -junit "F:\eclipse-jee-ganymede-SR2-win32\plugins\org.junit_3.8.2.v20080602-1318\junit.jar" -module com.rsheyeah.gwt.UITest -eclipse MyUITest com.rsheyeah.gwt.client.UITester

and the result is as follows:
Created directory C:\gwt-windows-1.5.2\test
Created directory C:\gwt-windows-1.5.2\test\com\rsheyeah\gwt\client
Created file C:\gwt-windows-1.5.2\test\com\rsheyeah\gwt\client\UITester.java
Created file C:\gwt-windows-1.5.2\UITester-hosted.launch
Created file C:\gwt-windows-1.5.2\UITester-web.launch
Created file C:\gwt-windows-1.5.2\UITester-hosted.cmd
Created file C:\gwt-windows-1.5.2\UITester-web.cmd

Hence, it is recommended to use GWT JUnit for non-UI based tests, such as logic and functionality tests which may or may not require client and server asynchronous communication.

Tuesday, March 3, 2009

Feel like smoothening your GWT Development...

GWT Designer helps kick start your GWT development. GWT Designer™ is a GUI creator that supports GWT. Use GWT Designer's visual tools and wizards, and Java code will be generated for you. You don't need to write any lines of Java code, but you can fully edit the resulting Java if you wish.
Below are the list of features cited -
"GWT Designer™ from Instantiations is powerful, easy-to-use, and bi-directional. With its WYSIWYG tools, you can easily:
- add controls using drag-and-drop.
- add event handlers to your controls.
- change various properties of controls using a property editor.
- change and refactor its generated code and see it immediately in the visual designer.
- reverse engineer code created by hand.
"

So, don't wait to try it out here. It comes with a 15 day trial period, which I believe is enough time frame to get you hooked.

Yow will soon find out its worth the effort. Just download the 90 MB installer and point it to your favorite eclipse installation directory. And you are all set.

Wannabe iPhone App Developer...

Have fun exploring the following sites -

The KamiCrazy development blog
The official iPhone development site
Idevgames - a developers site
Iphonedevsdk - a community development forum
Mobile Orchard - information and useful blog posts 
148apps - an app review site

Sunday, March 1, 2009

What is with GWT, AWT and SWING ?

So you have experienced Panels, Widgets and Event Listeners in AWT and Swing. And found the concept is pretty much similar in GWT as well. The differrence comes with the intent - Think of GWT and think of Javascript and HTML as Assembly language and GWT as a sort of High level language which generates Javascript and HTML.

Moreover, AWT/Swing are used for desktop Java apps or applets and both require JVM to run as opposed to GWT that is targeted for building web apps that run on browsers and are look-alike of desktop apps