Showing posts with label GWT. Show all posts
Showing posts with label GWT. Show all posts

Running the GWT application

    Running the GWT application
•Two ways of running the application
  1. create a war file and deploy in any app server or
  2. Run ant hosted in the command prompt. And click on the ‘Launch Default Browser’









1) If the ‘Launch Default Browser’ is used then you may see below screen
2) Development mode requires a gwt developer plugin. The plugin provides additional debugging cababilities on the client side.
3) If plugin is not installed, remove ?gwt.codesvr=127.0.0.1:9997 from the url to see the application.


nn,j

Browser targeted Compilation in GWT

    Browser targeted Compilation in GWT
To reduce the compilation time, choose favorite browser and add the user.agent property in the module configuration file.
Other values: ie6,ie8,gecko1_8,safari,opera

Compile the GWT application

    Compile the GWT application :
    Run ant build in the root folder of the application
    By default gwt compiler creates optimized JS files for some browsers.
    Disadvantage is it takes a lot of time to compile each change because of the permutations

gg

Creating a GWT application

    Creating a GWT application :
    Create a folder for the application (e.g. uicontrols)
    Run webAppCreator in the newly created folder
    webAppCreator takes a module name (here 'uicontrols' is the module name with a package prefix)


GWT Introduction

GWT Introduction :
  1. To simply put ‘Write JavaScript using JAVA’
  2. And in a little more detail
  3. Compiles JAVA code into JavaScript code
  4. Takes care of cross browser compatibility by generating a browser specific code
  5. Not client side alone. Has a deployable server side components (which is not compiled into JavaScript)
  6. Client communicates to server via GWT-RPC call (if services are written using GWT),
  7. Supports http calls using JSON and XML format
  8. Supports AJAX calls
  9. With JSNI (Javascript native interface) can mix javascript code with java code
  10. java can call javascript method
  11. javascript can call java method

Google Web Toolkit (GWT) Overview

 The Google Web Toolkit (GWT) is a toolkit to develop Ajax web application with Java. The programmer writes Java code and this code is translated into HTML and Javascript via the GWT compiler.
The compiler creates browser specific HTML and JavaScript to support all the major browsers correctly. GWT supports a standard set of UI widgets, has build in support for the browser back button and a JUnit based test framework.
GWT provides two modes
  • Development Mode: allows to debug the Java code of your application directly via the standard Java debugger.
  • Web mode: the application is translated into HTML and Javascript code and can be deployed to a webserver.

 Modules, Entry Points and HTML pages

GWT applications are described as modules. A module "modulename" is described by a configuration file "modulename.gwt.xml". Each module can define one or more Entry point classes. An entry point is the starting point for a GWT application, similar to the main method in a standard Java program. A Java class which is an entry point must implement the interface "com.google.gwt.core.client.EntryPoint" which defines the method onModuleLoad().
The module is connected to a HTML page, which is called "host page". The code for a GWT web application executes within this HTML document.
The HTML page can define "div" containers to which the GWT application can assign UI components or the GWT UI components are simply assigned to the body tag of the HTML page.

Using CSS

The look and feel of a GWT application can be customized via CSS files. Each widget in GWT can be given a HTML "div" container and can therefore be individually styled by CSS. You use the Java method setStyle(String s) for this.                                     


Enter your email address to get our daily JOBS & INTERVIEW FAQ's Straight to your Inbox.

Make sure to activate your subscription by clicking on the activation link sent to your email