Target Audience: CAST Administrators
Summary: This document provides a guide based on CAST’s field experience on how to configure GWT based applications using CAST AIP. These configurations are used all versions of CAST AIP 8.2.x and above for GWT offering (see Reference Materials below for links) to overcome limitations such as missing links. The applicability of this guide should have assessed for newer versions of CAST AIP and Extension.
Introduction to GWT
This section gives a brief overview of the framework.
GWT is a development toolkit for building and optimizing complex browser-based applications. Its goal is to enable productive development of high-performance web applications without the developer having to be an expert in browser quirks, XMLHttpRequest, and JavaScript. GWT is used by many products at Google, including AdWords, AdSense, Flights, Hotel Finder, Offers, Wallet, Blogger. It's open source, completely free, and used by thousands of developers around the world.
In a nutshell,
- Google Web Toolkit (GWT) is a development toolkit to create RICH Internet Application(RIA).
- GWT provides developers option to write client side application in JAVA.
- GWT compiles the code written in JAVA to JavaScript code.
- Application written in GWT is cross-browser compliant. GWT automatically generates javascript code suitable for each browser.
A GWT application consists of following four important parts out of which last part is optional but first three parts are mandatory:
- Module descriptors
- Public resources
- Client-side code
- Server-side code
Versions of GWT Supported by CAST
NA
File Types expected for CAST Analysis
This section highlights all the file types that can be expected to be delivered if the application has implemented this framework.
- Java
GWT
How to identify the implementation of GWT:
This section details the approach for identifying the presence of GWT in the code delivered.
A module descriptor is the configuration file in the form of XML which is used to configure a GWT application. A module descriptor file extension is *.gwt.xml, where * is the name of the application and this file should reside in the project's root. Following will be the module descriptor Helloworld.gwt.xml for a Helloworld application. This xml contains the Entry Point class and the source-path.
The most important public resource is host page which is used to invoke actual GWT application. A typical HTML host page for an application might not include any visible HTML body content at all but it is always expected to include GWT application via a <script.../> tag as follows:
Client Side code is the actual Java code written implementing the business logic of the application and that the GWT compiler translates into JavaScript, which will eventually run inside the browser. The location of these resources can be configured using <source path="path" /> element in module configuration file.
For example Entry Point code will be used as client side code and its location will be specified using <source path="path" />. A module entry-point is any class that is assignable to EntryPoint and that can be constructed without parameters. When a module is loaded, every entry point class is instantiated and its EntryPoint.onModuleLoad() method gets called. A sample HelloWorld Entry Point class will be as follows:
The server side part of your application and its very much optional. If you are not doing any backend processing with-in your application then you do not need this part, but if there is some processing required at backend and your client-side application interact with the server then you will have to develop these components.
Every user interface considers the following three main aspects which is added to the client side part code and these classes can be set as Entry Point classes in CAST:
- UI elements : Thes are the core visual elements the user eventually sees and interacts with. GWT provides a huge list of widely used and common elements varying from basic to complex which we will cover in this tutorial.
- Layouts: They define how UI elements should be organized on the screen and provide a final look and feel to the GUI (Graphical User Interface). This part will be covered in Layout chapter.
- Behavior: These are events which occur when the user interacts with UI elements. This part will be covered in Event Handling chapter.
GWT Description:
This section gives a brief overview of GWT.
GWT UI Elements:
The GWT library provides classes in a well-defined class hierarchy to create complex web-based user interfaces. All classes in this component hierarchy has been derived from the UIObject base class as shown below:
How to configure GWT in CAST AIP:
This section describes all the CAST configuration steps to be followed in order to configure GWT based application.
Reference for other patterns of GWT
Pattern 1 – GWT
1. Architecture Diagram:
1.1. Code Snippet:
1.2.. Representative Code Flow
JSP -> GWT Client Module -> GWT Place -> GWT Activity/View -> GWT RequestFactory Proxy -> GWT RequestFactory Service -> Hibernate -> Database(extends ContentView, start from step 5)
1.PlacePrefix.java(....\com\....\tfx\client\mvp\PlacePrefix.java)
2. CertificationPlace.java (....\com\....\tfx\client\mvp\CertificationPlace.java)
3.AppActivityMapper.java(....\com\....\tfx\client\mvp\AppActivityMapper.java)
4.ClientFactoryImpl.java(....\com\....\tfx\client\ClientFactoryImpl.java)
5.ClientFactoryImpl.java(....\com\....\tfx\client\ClientFactoryImpl.java)
6.CertificationView.java(....\com\....\tfx\client\ui\CertificationView.java)
7.CertificationView.java(....\com\....\tfx\client\ui\CertificationView.java)
8. ....\com\....\tfx\shared\AppRequestFactoryImpl.java
9. ....\com\....\tfx\shared\service\ajax\CertificationServiceRequest.java)
10.CertificationServiceImpl.java(....\com\....\tfx\server\service\ajax\CertificationServiceImpl.java)
Pattern 2 – GWT
Architecture Diagram:
Server manager Configuration:
N/A
Pre Analysis Configuration:
N/A
Enlighten
This section gives an overview of the Enlighten diagram.
CMS Configuration:
This section describes the CMS Configuration which is required to set for GWT.
Universal Importer | Class_To_onStart |
2 | Universal Importer | Class_To_findCertificationBySlipType |
TCC Configuration:
This section describes the TCC configuration which needs to be set.
- Standard Configuration
a. Classes which extends Widget
- Custom Configuration
a. GWT View classes which extends ContentView
b. Classes which extends WidgetDisplay
c. Classes which extends Composite
d. Classes which extends EntryPoint
e. Classes which extends BasePresenter
Limitations
- Cast does not support GWT out-of-box.