Trifork Blog

AngularJS training

Category ‘GWT’

Supporting IE10 on a Rich Internet Application with Vaadin - the Vaadin 7 migration

November 12th, 2013 by
(http://blog.trifork.com/2013/11/12/supporting-ie10-on-a-rich-internet-application-with-vaadin-the-vaadin-7-migration/)

Amidst the popularity of JavaScript-CSS frameworks like Bootstrap and Angular.js, Java developers like myself are still most comfortable with what we know - Java code. Vaadin provides a framework for Java developers to write rich internet applications that are highly interactive while usually not having to write a line of Javascript code. It builds on top of GWT, taking care of synchronizing server state with client state, which means that most of the time all you have to deal with is Java code -- not Java code that's compiled to JavaScript; real, server-side Java code.

At Trifork we especially like Vaadin because it integrates very nicely into the Liferay portal. This means you can write highly interactive portlets using Vaadin and deploy them to Liferay. My colleague David described this in detail last year in a different blog post.

Read the rest of this entry »

Getting GWT to work with Servlet 3 Async Requests

February 25th, 2011 by
(http://blog.trifork.com/2011/02/25/getting-gwt-to-work-with-servlet-3-async-requests/)

For one of our projects, we use a GWT client that needs to be updated in near-real time (< 1 second delay) when something relevant happens on the server. There are multiple ways of doing it, but I tried to get it working with the new Servlet 3 feature: Asynchronous Http Request handling.

Read on to find out how I got it done.

Read the rest of this entry »

Test driven development for GWT UI code with asynchronous RPC

April 22nd, 2008 by
(http://blog.trifork.com/2008/04/22/test-driven-development-for-gwt-ui-code-with-asynchronous-rpc/)

In my previous blog post I we saw a test-driven approach to GWT UI code. This was based on moving logic to a Supervising Controller.
In this follow-up post we'll turn our attention to interacting with RPC, and see how this can be tested using EasyMock. This involves some tricks and non-trivial boilerplate code, but fortunately most of this can be hidden by introducing convenience methods, and we end up with tests that are expressive and easy to read.
This article continuous on the sample code in my previous blog post, but if you're just interested in the RPC part you can probably skip that and start from here. Familiarity with EasyMock basics is assumed.

Read the rest of this entry »

Test driven development for GWT UI code

March 9th, 2008 by
(http://blog.trifork.com/2008/03/09/test-driven-development-for-gwt-ui-code/)

Is a test driven development (TDD) approach possible when creating a GUI using GWT? This post is about how to apply MVC (Model-View-Controller) to organize GWT UI code, with these objectives:

  1. a clear separation of the controller logic from presentation and model
  2. full testability of the controller logic independent of the (browser or hosted mode) GWT environment.

We will see how this can be realized by adding a few simple classes to the standard set of GWT widgets, and applying an MVC flavor described by Martin Fowler as Supervising Controller.
The sample code shows how tests can provide a programmatic alternative for tests you would otherwise have to perform manually by interacting with the UI of the deployed application.

Read the rest of this entry »

Optimizing startup time for GWT hosted mode

November 30th, 2007 by
(http://blog.trifork.com/2007/11/30/optimizing-startup-time-for-gwt-hosted-mode/)

When developing GWT (Google Web Toolkit) applications, the GWT hosted mode is an invaluable tool, as it allows for short development cycles. Whenever you change something in the GWT client code and hit the "Refresh" button it will compile the change, reload the application and show the result of my change almost immediately. In theory, that is...
As soon as the GWT client code grows in size, it takes longer and longer to refresh, to the point that it becomes unacceptable.
In this blog I'll explore this issue, discuss its causes and what you can do about it.

Read the rest of this entry »

Integrating Spring and GWT

June 4th, 2006 by
(http://blog.trifork.com/2006/06/04/integrating-spring-and-gwt/)

I just completed my first shot at integrating Spring with GWT. You can check it out here

Here's what you do to expose a simple service.

1) Write the remote service, note that the service no longer extends RemoteServiceServlet however HelloService should still implement RemoteService


public class HelloServiceImpl implements HelloService {
public String sayHello(String name) {
return "hello " + name;
}
}

2) Define this service in your application context

<bean id="helloService" class="nl.jteam.hello.server.HelloServiceImpl"/>

3) expose the bean as a gwt service

<bean id="defaultHandlerMapping" class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"/>

<bean name="/helloService" class="nl.jteam.gwt.exporter.GwtInvokerServiceExporter">
<property name="service" ref="helloService"/>
<property name="serviceInterface" value="nl.jteam.hello.client.HelloService"/>
</bean>

4) Change the clientcode to point to your Spring service. be sure to use an absolute url while running in hosted mode or it will complain


helloService = (HelloServiceAsync) GWT.create(HelloService.class);
ServiceDefTarget endpoint = (ServiceDefTarget) helloService;
endpoint.setServiceEntryPoint("http://localhost:8080/helloservice");

Feedback is appreciated