Adding Ext GWT

Ext GWT is a Java UI component library developed by Ext JS, Inc. for building rich web applications with the Google Web Toolkit.

Its important features include the following:

  • High performance, customizable UI components, panels, windows, menus, and so on
  • Standard CSS support
  • Well-documented source code
  • Native GWT solution without any external JavaScript or third-party libraries
  • Full remote procedure support using GWT RPC, JSON, and XML
  • Support for Java 1.5 features, including generics, enums, and varargs
  • Commercial and open source licenses available

Getting ready

Download Ext GWT SDK from http://www.sencha.com/products/gwt/download.php.

The file gxt-2.1.1-gwt2.zip is the EXT GWT 2.1.1 PUBLIC RELEASE for GWT 2.

How to do it...

  1. Extract gxt-2.1.1-gwt2.zip to C:\Program Files\ or any other desired location.
  2. The next step is to add the Ext GWT library in the Sales Processing System project. To do this:
    • Right-click on Libraries under the Project tab, and click on Add Jar/Folder
    • Open the gxt.jar file from C:\Program Files\gxt-2.1.1-gwt2\gxt-2.1.1(or from the location to which the file was extracted), as shown in the following three screenshots:
    How to do it...
    How to do it...
    How to do it...
  3. The next step is to place the Ext GWT resources folder containing the CSS, images, and others into the web folder of the Sales Processing System project.
    • Copy the folder resources from C:\Program Files\gxt-2.1.1-gwt2\gxt-2.1.1(or from the location to which the file was extracted)
    How to do it...
  4. Paste it in the web folder by going to the Files tab, as shown in the following screenshot:
    How to do it...
  5. Now, we need to modify the GWT module:
    • Open Main.gwt.xml from Source Packages | com.packtpub
    • Expand the General node:
      How to do it...
    • Click on Add and write the module name com.extjs.gxt.ui.GXT:
      How to do it...
    • Save and close Main.gwt.xml
    • Modify welcomeGWT.html to add a link to the CSS in the /web/resources/css folder
    • Open welcomeGWT.html
    • Add the following line just above the</head> tag:
      <link rel="stylesheet" type="text/css" href="resources/css/gxt-all.css" />
      

Now, we are ready to start developing the GWT application

How it works...

Let's explain how these steps allow us to complete the task or solve the problem.

Adding the GXT JAR file allows us to use the widget library to create the user interfaces. Some important widgets used in this book from this library are Grids, Panels, Tabs, Layouts, Forms, Toolbar, Menu bar, Fields, Buttons, and so on.

The resources folder in the GXT contains the required CSS used in the widget library, images, and so on. By placing this folder in our application, we are being able to create nice user interfaces even without using any new CSS or images, though we can do so if required.

See also