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]

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]

Benefits of using GWT

I have been exploring GWT for 4 years now. I have seen it enhancing and improving year over year. I have also used it in few of my projects. After using it for long I see following benefits of using GWT. I have added these point based on my experience after using GWT. So I might be wrong on some points please feel free to add your comments about the same. [Read More]

GWT use I18 Message resource in uiBinder

To use I18 Message resource in uiBinder you need to follow the same mechanism as that of ClientBundle In your corresponding java class add @uiFactory method which will return the object of required Message interface e.g. package com.test.module.client; public interface Messages extends com.google.gwt.i18n.client.Messages { @DefaultMessage("Home") @Key("home") @DefaultMessage("Home") String home(); } public class MyUiBinder extends Composite{ ..... ..... @UiFactory public static Messages getResources() { return GWT.create(Messages.class); } } And you can use the same inside corresponding MyUiBinder. [Read More]