GWT browser specific css

Yea it is possible to write browser specific css with GWT application which uses CSS through CssResource. @if user.agent gecko1_8 { .startup p { color: #000000; text-shadow: 0 0 3px #000000; } } @else { .startup p { color: #000000; } } Note: You can use this logical if else and many more other expression inside css which are used inside GWT code. Only through CssResource interface. If you are directly using the respective css inside html main source file then this will not work. [Read More]
GWT 

GWT Jquery integration

It is very easy to have GWT Jquery integration using gwtquery. Follow below steps Add maven dependency for gwtquery, at the time of writing this article it was 1.4.2 and tested it with GWT 2.5.0 version. <dependency> <groupId>com.googlecode.gwtquery</groupId> <artifactId>gwtquery</artifactId> <version>1.4.2</version> <scope>provided</scope> </dependency> Then inherit your module from required gwtquery module. <inherits name='com.google.gwt.query.Query'/> User jquery api wrappers as follows. import static com.google.gwt.query.client.GQuery.$; .. ... public class GwtJquery implements EntryPoint { @Override public void onModuleLoad() { $("#startup"). [Read More]

Install Eclipse Maven plugin and import maven project

With new versions of Eclipse old m2e plugins have become absolute now you need to install eclipse plugins from eclipse market place. Follow below steps to install m2e plugins along with required GWT plugins. I have tried below steps with Eclipse (Kepler) Install GWT eclipse plugin Help -> Eclipse Marketplace. Search with string GWT install Google Plugin for eclipse 4.3. Install maven plugin open Eclipse Marketplace and search for m2e-wtp look for Maven Integration for Eclipse WTP Juno (1. [Read More]

GWT youtube player

Created GWT wrapper over YouTube Iframe player api refer Usage Inherit GWT module <inherits name="open.pandurang.gwt.youtube.YouTube" /> Before you start using YouTube iframe library one need to load them first, so as to load the library first you need make call to YouTubePlayer.loadYouTubeIframeApi();. This will ensure library is loaded, you can register to recieve event when library is loaded completely by using ApiReadyEventHandler for more details on the same refer YouTube documentation geting started section. [Read More]

Call GWT Java Code from JavaScript

It is very easy to call Aavascript from GWT java code by making use of JSNI. But calling GWT java code from external Javascript of JSNI is little tricky and it becomes more complicate when you have to call instance method of a GWT java class. For more detail refer GWT official document (refer) Call static class method from JavaScript GWTCode.java package open.pandurang.client.view; /** * @author Pandurang Patil 18-Mar-2014 * */ public class GWTCode { public static String hello(String name) { return "Hello " + name + "! [Read More]

GWT access style defined inside .ui.xml within corresponding .java file

Some times you may want to access styles defined inside your Sample.ui.xml file which you want to access/use from within Sample.java widget class. You can do that by defining an interface which extends from com.google.gwt.resources.client.CssResource and declaring method with name matching exactly that of required style class name that you have declared inside ui.xml. Refer below code. Sample.ui.xml contents <src path>/com/pandurang/client/ui/Sample.ui.xml <ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' xmlns:g='urn:import:com.google.gwt.user.client.ui'> . . . <ui:style type="com.pandurang.client.ui.Sample.MyStyle"> .domain { margin: 0 auto; width: 730px; } . [Read More]

Java java.lang.OutOfMemoryError: PermGen space

java.lang.OutOfMemoryError: PermGen space You get this error that means your JVM is running out of allocated memory for storing class metadata information (class properties, methods annotations etc). This space is not cleaned by Garbage collector. It could happen because of multiple reasons. One you are dynamically generating classes and those are getting loaded in JVM. Second your application is so big and it has more number of dependencies on other third party libraries. [Read More]

Set default submit button on a page with GWT

I found few ways to set default submit button on page with GWT. Add key press handler for all form fields check for Enter button press and take action. You can add common key press handler for all form fields. This way you are not adding multiple handler for each form field. (I am assuming you understand what is ui handler and how it works.) @UiHandler({ "txtCompanyName", "txtcontactName", "txtEmail" }) public void onKeyPress(KeyPressEvent event) { if (event. [Read More]

Intercept GWT Request Factory on client side

How to intercept GWT Request Factory on client before call is being made and after response is received? One can extend DefaultRequestTransport and intercept send call, at the same time writing a wrapper over TrasnportReceiver one can intercept response’s. Following is the example. public class LoaderRequestTransport extends DefaultRequestTransport { private Loader loader; public LoaderRequestTransport(Loader loader) { this.loader = loader; } public LoaderRequestTransport() { this(new Loader(LoaderResources.INSTANCE.communicating())); } @Override public void send(final String payload, final TransportReceiver receiver) { final TransportReceiver proxy = new TransportReceiver() { @Override public void onTransportFailure(final ServerFailure failure) { loader. [Read More]

Intercept GWT RPC Request and Response

Some times you want to do some generic things like setting some header or adding some log or may be even showing a progress bar while rpc call is in progress and hide it once you receive the response. I came across one of such requirement for showing progress bar while service call is in progress. Following is complete end to end solution I found after searching for some solutions. I got some help at following threads and another one [Read More]