<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Rich Internet Applications (RIA) &#187; GWT</title>
	<atom:link href="http://canoo.com/blog/category/gwt/feed/" rel="self" type="application/rss+xml" />
	<link>http://canoo.com/blog</link>
	<description>Web 2.0 Technology Blog on Java RIA, AJAX and Flex</description>
	<lastBuildDate>Fri, 19 Mar 2010 08:05:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Jazoon &#8216;09: RIA and Security</title>
		<link>http://canoo.com/blog/2009/06/23/jazoon-09-ria-and-security/</link>
		<comments>http://canoo.com/blog/2009/06/23/jazoon-09-ria-and-security/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 13:54:50 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[GWT]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Java RIA]]></category>
		<category><![CDATA[Jazoon]]></category>
		<category><![CDATA[Rich Internet Applications]]></category>

		<guid isPermaLink="false">http://canoo.com/blog/?p=451</guid>
		<description><![CDATA[Session title: RIA Security: Broken by Design
From: Joonas Lehtinen, CEO IT Mill
IT Mill is the creator of Vaadin: A 100% Java tool for RIA.
Joonas outlines a spectrum of complexity from Basic site to 3D games examples:
Web Sites (Wikipedia), AJAX Sugar (Facebook), Full RIA
He divides „Full RIA“ divide into client side vs. Server driven. Gives a [...]]]></description>
			<content:encoded><![CDATA[<p>Session title: RIA Security: Broken by Design<br />
From: Joonas Lehtinen, CEO IT Mill</p>
<p>IT Mill is the creator of Vaadin: A 100% Java tool for RIA.</p>
<p>Joonas outlines a spectrum of complexity from Basic site to 3D games examples:<br />
Web Sites (Wikipedia), AJAX Sugar (Facebook), Full RIA</p>
<p>He divides „Full RIA“ divide into client side vs. Server driven. Gives a crash course in GWT.</p>
<p>Vaadin: Apparently 100% Java and server driven, which sounds an awful lot like ULC at this stage&#8230; But here’s a difference: It builds on GWT and relies on JavaScript on the client-side.</p>
<p>He goes on to present a bunch of development rules:</p>
<p>Rule #1: Don&#8217;t trust the browser<br />
Rule #2: Complexity is a hiding place for bugs<br />
Rule #3: Large surface give more opportunities for attack. This surface has increased with Web 2.0.</p>
<p> </p>
<p style="text-align: center;"><a href="http://canoo.com/blog/wp-content/uploads/2009/06/p1010092.jpg"><img class="alignnone size-medium wp-image-453" title="p1010092" src="http://canoo.com/blog/wp-content/uploads/2009/06/p1010092-300x200.jpg" alt="" width="300" height="200" /></a></p>
<p> </p>
<p>Difference between GWT and Vaadin architectures is that GWT relies on the client invoking a server-side Web Service API, whereas Vaadin renders the client&#8217;s view on the server.</p>
<p>Erm&#8230; he then offers the cures for the problems (Rules above)&#8230; which I miss because the explanation is compressed into around 5s.</p>
<p>I&#8217;m starting to dislike this presentation at this point. Because here comes another artificial security issue scenario&#8230; which <em>guess which product</em> solves. And I thought product placement in Hollywood movies was irritating.</p>
<p>The issues he raises are legitimate, but the lack of objectivity is obscuring the message. And as I write the presenter is debugging JavaScript which depends on analysing the DOM on the client side &#8211; I&#8217;m not sure if he&#8217;s now analysing the problem or trying to fix it!?</p>
<p>I am formally declaring myself lost at this stage. At least I hope the other attendees are getting something out of this presentation, which has lost focus IMO.</p>
<p>He continues with a discussion about attacking at the transport level, inserting new data on the fly. But come on: A secure transaction in this technical setting will operate under HTTPS, which in most instances will deal with this kind of attack. Unless, of course, that&#8217;s something else I missed.</p>
<p>I think I need a coffee!!!</p>
]]></content:encoded>
			<wfw:commentRss>http://canoo.com/blog/2009/06/23/jazoon-09-ria-and-security/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Computerworld.ch on GWT and UltraLightClient</title>
		<link>http://canoo.com/blog/2008/08/04/computerworldch-on-gwt-and-ultralightclient/</link>
		<comments>http://canoo.com/blog/2008/08/04/computerworldch-on-gwt-and-ultralightclient/#comments</comments>
		<pubDate>Mon, 04 Aug 2008 09:37:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[GWT]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[UltraLightClient]]></category>
		<category><![CDATA[comparing GWT and Canoo ULC]]></category>
		<category><![CDATA[computerworld.ch]]></category>
		<category><![CDATA[feature article]]></category>
		<category><![CDATA[Stefan Thomas]]></category>

		<guid isPermaLink="false">http://canoo.com/blog/?p=277</guid>
		<description><![CDATA[Here is a link to an older Computerworld.ch article comparing Google Web Toolkit and Canoo&#8217;s Java RIA library, UltraLightClient (in German only).

Google Web Toolkit und Ultra Light Client
Die Anbindung an das Internet und ein Browser gehören heute zur Standardausrüstung eines jeden Arbeitsplatzrechners oder Heim-PCs.
Stefan Thomas
Viele neue Anwendungen werden darum als HTML-basierte Web-Anwendungen implementiert, die leicht [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a link to an <a href="http://www.computerworld.ch/aktuell/developerworld/43649/index1.html">older Computerworld.ch article</a> comparing <a href="http://code.google.com/webtoolkit/overview.html">Google Web Toolkit</a> and Canoo&#8217;s Java RIA library, <a href="http://www.canoo.com/ulc/">UltraLightClient</a> (<em>in German only</em>).</p>
<p><a href="http://www.computerworld.ch/aktuell/developerworld/43649/index1.html"><img src="http://canoo.com/blog/wp-content/uploads/2008/08/computerworldch-300x44.jpg" alt="Computerworld online" title="computerworldch" width="200"  /></a></p>
<blockquote><p>Google Web Toolkit und Ultra Light Client</p>
<p>Die Anbindung an das Internet und ein Browser gehören heute zur Standardausrüstung eines jeden Arbeitsplatzrechners oder Heim-PCs.</p>
<p>Stefan Thomas</p>
<p>Viele neue Anwendungen werden darum als HTML-basierte Web-Anwendungen implementiert, die leicht verteilt und aktualisiert werden können und von überall, zu jeder Zeit genutzt werden können. Durch den Einsatz von AJAX-Technologien konnte die Benutzerfreundlichkeit der Oberflächen in den letzten Jahren deutlich gesteigert werden, allerdings bei gleichzeitig wachsender Komplexität in der Anwendungsentwicklung. Bibliotheken, Toolkits und Frameworks versprechen hier eine Erleichterung. Beispielsweise durch die Abstraktion der unterschiedlichen JavaScript-Implementierungen der Browser oder durch vorgefertigte, komplexere Bedienelemente wie Menübalken, Tabreiter oder Baumstrukturen.
</p></blockquote>
<p>The article was written by UltraLightClient customer <a href="http://idaplan.com/en/index.html">Dr. Stefan Thomas</a>. Dr. Thomas is an independent consultant, that has developed two large corporate web applications with <a href="http://www.canoo.com/ulc/ ">Canoo&#8217;s UltraLightClient</a> for a global retailer.</p>
<p><strong>GWT vs. ULC:</strong></p>
<p>Comparing the two is a bit like comparing apples and pears (<a href="http://www.computerworld.ch/aktuell/developerworld/43649/index1.html">the article</a> discusses this). On the other hand, the two widget libraries can be used for similar web applications. And both of them address Java developers. </p>
<p>See also the corresponding product websites:<br />
<a href="http://code.google.com/webtoolkit/">Google Web Toolkit</a><br />
<a href="http://www.canoo.com/ulc/">Canoo UltraLightClient</a></p>
]]></content:encoded>
			<wfw:commentRss>http://canoo.com/blog/2008/08/04/computerworldch-on-gwt-and-ultralightclient/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Jazoon 08 Day I</title>
		<link>http://canoo.com/blog/2008/06/25/jazoon-08-day-i/</link>
		<comments>http://canoo.com/blog/2008/06/25/jazoon-08-day-i/#comments</comments>
		<pubDate>Wed, 25 Jun 2008 10:04:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[GWT]]></category>
		<category><![CDATA[Google Android]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Jazoon]]></category>
		<category><![CDATA[brief overview]]></category>
		<category><![CDATA[day 1]]></category>
		<category><![CDATA[jazoon 08]]></category>
		<category><![CDATA[sihlcity]]></category>
		<category><![CDATA[zurich]]></category>

		<guid isPermaLink="false">http://canoo.com/blog/?p=269</guid>
		<description><![CDATA[
Here are some quick notes on the sessions I attended yesterday at Sihlcity. I believe Jazoon will be uploading videos and slides very soon:
First in my lineup was a talk on using Google Web Toolkit for a business application in a typical enterprise environment. This was kind of like a case study. Dmitry Buzdin talked [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/canoo/2609288583/" title="jazoon by canoo engineering, on Flickr"><img src="http://farm4.static.flickr.com/3078/2609288583_756f72145e_m.jpg" width="240" height="180" alt="jazoon" /></a></p>
<p>Here are some quick notes on the sessions I attended yesterday at Sihlcity. I believe Jazoon will be uploading videos and slides very soon:</p>
<p>First in my lineup was a talk on using Google Web Toolkit for a business application in a typical enterprise environment. This was kind of like a case study. Dmitry Buzdin talked about the experience his company gained and listed the various pros and cons.</p>
<p>Next, I listened in to Bruno Schäffer&#8217;s talk together with Christoph Henrici and Daniel Buffet of APG. The talk described the migration of an Oracle Forms application to Java forms for the advertising industry. Main requirement: development and application performance had to remain just as fast as with Oracle Forms. A requirement that the migrated application managed to over-fulfill. </p>
<p><a href="http://www.flickr.com/photos/canoo/2610175088/" title="IMG_5023 by canoo engineering, on Flickr"><img src="http://farm4.static.flickr.com/3208/2610175088_2fba5ea635_m.jpg" width="180" height="240" alt="IMG_5023" /></a></p>
<p>Canoo&#8217;s Andreas Hölzl and Christian Stettler presented their Google Android experience report. They showed an application they developed for the Android Developer Challenge called Mobile Zoo. Their baseline: &#8220;What&#8217;s here looks promising. Let&#8217;s see the devices!&#8221;</p>
<p>Brian Sletten&#8217;s presentation on data-driven applications was very interesting. I particularly liked the analogy between resampling music and data. </p>
]]></content:encoded>
			<wfw:commentRss>http://canoo.com/blog/2008/06/25/jazoon-08-day-i/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rich(Mobile) != Rich(Desktop)</title>
		<link>http://canoo.com/blog/2008/01/16/richmobile-richdesktop/</link>
		<comments>http://canoo.com/blog/2008/01/16/richmobile-richdesktop/#comments</comments>
		<pubDate>Wed, 16 Jan 2008 08:00:57 +0000</pubDate>
		<dc:creator>Christian</dc:creator>
				<category><![CDATA[GWT]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[RIA4Mobiles]]></category>
		<category><![CDATA[Rich Internet Applications]]></category>

		<guid isPermaLink="false">http://canoo.com/blog/2008/01/14/richmobile-richdesktop/</guid>
		<description><![CDATA[Shortly before the end of last year, we completed a mobile demo application, which we used to analyze and investigate the status of Rich Internet Applications (RIA) technologies for mobile devices (what we will refer to as &#8220;RIA4Mobiles&#8221; within this blog post) .
The showcase application we developed describes the following scenario: field engineers use a [...]]]></description>
			<content:encoded><![CDATA[<p>Shortly before the end of last year, we completed a mobile demo application, which we used to analyze and investigate the status of Rich Internet Applications (RIA) technologies for mobile devices (what we will refer to as &#8220;<strong>RIA4Mobiles</strong>&#8221; within this blog post) .</p>
<p>The showcase application we developed describes the following scenario: field engineers use a mobile device to receive their daily work tasks or orders (called &#8220;mission&#8221; in our application) which they need to complete for that day and to communicate certain states such as &#8220;starting to work on mission X&#8221; or &#8220;completed mission Y&#8221; to a back office team application.  The field engineer can use the mobile device to book the time spent and material used for a certain mission, so that the back office team can directly process the billing once a mission has been completed. In addition, the back office team can send &#8220;high prio&#8221; missions to a specific field engineer.</p>
<p>After having a look at different architectural approaches (ranging from device-specific fat clients to browser-based generic Web applications), we decided to go with an <em>in-between</em> approach: a <a href="http://code.google.com/webtoolkit/">GWT</a> application tailored for mobile devices that runs in a generic, JavaScript-enabled mobile browser and connects to a server-side service infrastructure to fetch data and post back state changes. </p>
<p>For the target devices, we used a brand-new <a href="http://www.apple.com/iphone/">iPhone</a> and an older <a href="http://welcome.hp.com/country/us/en/prodserv/handheld.html">iPAQ</a> (about two years old, running Windows Mobile 2003). </p>
<p>The back office application is written in server-side Java, using <a href="http://www.canoo.com/ulc/">UltraLightClient</a> as the RIA technology. </p>
<p>Here is a screenshot of the mobile client:</p>
<p><img id="image173" src="http://canoo.com/blog/wp-content/uploads/2008/01/MobileClient.png" alt="Showcase application: mobile screen" /></p>
<p>Here is a screenshot of the corresponding back office application (click on the image to view a larger screenshot):</p>
<p><a href="http://canoo.com/blog/wp-content/uploads/2008/01/backofficeclient_large.png"><img id="image175" src="http://canoo.com/blog/wp-content/uploads/2008/01/backofficeclient_small.png" alt="Showcase application: Back office screen" /></a></p>
<p>Instead of going into the gory technical details here (we will do that in a future posting), let me discuss some of the lessons learned:</p>
<p>First, the approach chosen (GWT application + &#8220;Web services&#8221;) works for mobile applications. We were able to deliver the mobile application to the mobile device. Nevertheless, there are some shortcomings:</p>
<ul>
<li>whereas the generic, browser-based approach supports any device that hosts an up-to-date browser (with JavaScript support enabled), it also  prevents a tight integration into the device itself: the look and feel is not completely &#8220;native&#8221;, its usability may be different from the concepts known from other device-native applications, and the application shows a &#8220;low fidelity&#8221;. In addition, the reuse of existing device-specific applications such as map tools, address book or telephony application is either impossible or only achievable in a device-specific way (e.g. the iPhone supports dialing numbers from a website that are encoded as a URL with link type &#8220;tel://&#8221;, other devices may support the &#8220;callto://&#8221; link type, others may not support this functionality at all). A browser-based mobile application is somehow isolated from the device, running in its own world. This is especially irritating as two of the most current developments in the mobile world, <a href="http://code.google.com/android/">Google’s Android</a> and <a href="http://java.sun.com/javafx/mobile/">Sun’s Java FX Mobile</a>, propagate an application model that is based on the reuse of existing applications available on the mobile device.</li>
<li>one evil thing we know from the desktop world also holds true for the mobile world: <strong>browser hell</strong>. There is no „write once, run anywhere“ (not even with GWT’s cross-browser abstraction layer). This is due to the fact that there are various different mobile browser products and versions available on the market. Some of them are state-of-the-art and support a wide set of JavaScript and CSS features, others provide no JavaScript support at all (or only a very small subset of the language). Some of the good browsers are not available for free (such as Opera Mobile). Tweaking CSS properties and pixels was part of the daily business while developing the showcase application.</li>
<li>in mobile scenarios, (bad, broken) connectivity is an important topic, and so is offline capability. Thanks to the client-side JavaScript-based approach of GWT, offline &#8220;reading&#8221; is possible to a certain extent, but modifying data offline and synchronizinig the changes back to the server has very narrow limits in a browser-based world. Typically, there is no on-device persistent storage (such as a local database) available for browser-based application, as the browser builds some kind of a sandbox for that application. Ideas and projects such as <a href="http://gears.google.com/">Google Gears</a> aim to ease those limitations, but currently require the installation of  additional software (i.e. a browser plugin) on the mobile device. </li>
<li>even in times with high-end mobile devices such as the iPhone, performance issues on mobile devices are ubiquitous. The rendering performance is often poor, resulting in disturbing lags when rendering large option lists or tables (on the iPAQ device, even DOM manipulations on small HTML-based tables lead to unwanted &#8220;update effects&#8221;).</li>
</ul>
<p>In addition to these shortcomings, rooted in the architectural approach chosen for the showcase, another thing became obvious to us: <strong>Rich(Mobile) != Rich(Desktop)</strong>:</p>
<ul>
<li>one important difference when it comes to &#8220;rich&#8221;, especially related to the usability aspect of richness, is the fact that on mobile devices, users do not have a mouse pointer. Mobile users use either a pen, their fingers, or a navigation button (for devices without touch screens). These facilities reduce pointing precision. There is no &#8220;mouse move&#8221; equivalent as there is no difference between moving the pointer and activating the pointer (as soon as you touch the screen, an event is triggered). This reduces the number of available gestures and thus, prevents applications from using some of this gestures for interaction (e.g. hovering effects or tooltips are normally not supported on touch screen devices due to the lack of &#8220;mouse move&#8221; events). A further effect of the reduced set of useful gestures for mobile devices and the corresponding pointing devices is  that gestures often get &#8220;overloaded&#8221; (on the iPhone, for example, dragging means &#8220;scroll the web page&#8221;, and not &#8220;perform a drag and drop operation&#8221;).</li>
<li>the set of useful UI widgets is reduced as a consequence of the low-precision pointing device and the small screen size. Widgets such as spinners that allow toggling a value up and down using small arrows is not very usable on a mobile device, the same applies to scrolling in large lists (guess why the iPhone provides enhanced support for selecting a value from a combobox shown on a Web page). </li>
<li>the general layout-policy for mobile devices differs from desktop-based RIAs: whereas on desktop RIAs, layouts such as the dock layout are often used to provide as much flexibility to the user as possible and let the user choose almost any desired application with as little clicks as possible, mobile applications use a stack-based layout that limits the information displayed and the actions available to the user at a given moment. A mobile application needs to reduce the application context to the most important information and actions at any given time. This layout resembles the page-based approach of old-school Web applications that the one of modern RIAs.
</li>
</ul>
<p><strong>The bottom line:</strong> RIA4Mobiles developers will need to focus a lot more on usablility, device limitations and richness compared to the development of desktop RIAs in order to deliver highly usable, responsive and appealing mobile RIAs.</p>
<p>All in all, RIA4Mobiles is an exciting new application area. Stay tuned to hear more about our showcase application!</p>
]]></content:encoded>
			<wfw:commentRss>http://canoo.com/blog/2008/01/16/richmobile-richdesktop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building a Regular Website with the Google Web Toolkit &#8211; Part II</title>
		<link>http://canoo.com/blog/2007/04/18/building-a-regular-website-with-the-google-web-toolkit-part-ii/</link>
		<comments>http://canoo.com/blog/2007/04/18/building-a-regular-website-with-the-google-web-toolkit-part-ii/#comments</comments>
		<pubDate>Wed, 18 Apr 2007 09:45:34 +0000</pubDate>
		<dc:creator>danip</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[GWT]]></category>

		<guid isPermaLink="false">http://canoo.com/blog/2007/04/16/building-a-regular-website-with-the-google-web-toolkit-part-ii/</guid>
		<description><![CDATA[Introduction
About a month ago I wrote about my experience when building a simple but configurable web site with help of the Google Web Toolkit (see Part I). I mentioned the hurdles that I encountered but also some motivating aspects when working with GWT.

An issue I haven&#8217;t reported on yet was my attempt to internationalize my [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>About a month ago I wrote about my experience when building a simple but configurable web site with help of the Google Web Toolkit (see <a href="http://canoo.com/blog/2007/03/13/building-a-regular-website-with-the-google-web-toolkit/">Part I</a>). I mentioned the hurdles that I encountered but also some motivating aspects when working with GWT.</p>
<p/>
An issue I haven&#8217;t reported on yet was my attempt to internationalize my GWT application. You might be surprised why this is even worth mentioning, since GWT includes I18N support. Well, let&#8217;s say it includes <strong><em>some</em></strong> I18N support &#8211; but it was not what I needed.</p>
<h2>Giving GWT&#8217;s I18N a Try</h2>
<p>The GWT developer guide explains the various I18N options of GWT (see <a href="http://code.google.com/webtoolkit/documentation/com.google.gwt.doc.DeveloperGuide.Internationalization.html">GWT I18N</a>) but all of them have one thing in common: The locale cannot be changed dynamically at runtime <strong>after</strong> a GWT application has been started. However, it is a common use case that you want to change an application&#8217;s locale at that point of time.</p>
<h2>Providing Truly Dynamic I18N</h2>
<p>Truly dynamic I18N means that use change the locale in the GUI at runtime. E.g., if the user changes a combo box entry, then all GUI labels magically obtain the newly localized values. To see what I mean, you may want to check out <a href="http://canoo.com/blog/wp-content/uploads/2007/03/org.canoo.gwt.sample.MySite/MySite.html">the result of my attempts</a>.</p>
<p/>
The way to solve this was to write my own (but simple) resource bundle API, which is similar<br />
to the one provided by the Java class java.util.ResourceBundle. Unfortunately, this requires quite some code including:</p>
<ul>
<li>a properties file reader,</li>
<li>a locale class,</li>
<li>a resource bundle loader.</li>
</ul>
<h2>The Resource Bundle Loader</h2>
<p>As it turned out, implementing the resource bundle loader was far from trivial. One of the resource bundle loader&#8217;s tasks is to load and cache a properties file from the server on the basis of a given locale. You can access a bundle entry with a key string in order to obtain the best possible localized result value. The means that the loader might have to access a chain of properties files according the chain of locales (from the most specific current locale to the default locale).</p>
<p/>
To implement the loading of properties files with GWT, one must use the class HTTPRequest, which offers an asynchronous request API for loading files from the server. Unfortunately, coordinating the chained download of properties files such as described above is rather difficult to implement with an asynchronous API. (See my last blog about <a href="http://canoo.com/blog/2007/03/13/building-a-regular-website-with-the-google-web-toolkit">infectious asynchronous APIs</a>.)</p>
<h2>Summary</h2>
<p>In the following I would like to give brief summary of my experiences with GWT:</p>
<p/>
<strong>Upsides:</strong></p>
<ul>
<li>I liked the general concept behind GWT and I think it is the (or &#8220;a&#8221;) way to go for proper software engineering in the AJAX space.</li>
<li>Getting in touch and getting familiar with GWT was easy enough and was great fun.</li>
<li>The compiler and the debugger seemed stable, work well and the compiler generates efficient code.</li>
</ul>
<p><strong>Downsides:</strong></p>
<ul>
<li>The widget library is far from complete and not engineered for extensions and reuse.</li>
<li>The asynchronous GWT APIs are often inconvenient &#8211; Google should ofter synchronous variants wherever possible.</li>
<li>Google&#8217;s I18N solution does not offer true dynamic locale changes. This is a serious drawback for many rich client applications.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://canoo.com/blog/2007/04/18/building-a-regular-website-with-the-google-web-toolkit-part-ii/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Building a Regular Website with the Google Web Toolkit</title>
		<link>http://canoo.com/blog/2007/03/13/building-a-regular-website-with-the-google-web-toolkit/</link>
		<comments>http://canoo.com/blog/2007/03/13/building-a-regular-website-with-the-google-web-toolkit/#comments</comments>
		<pubDate>Tue, 13 Mar 2007 10:02:18 +0000</pubDate>
		<dc:creator>danip</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[GWT]]></category>

		<guid isPermaLink="false">http://canoo.com/blog/?p=11</guid>
		<description><![CDATA[The Idea
Many nice and home-grown websites contain a navigation bar. But without a special design tool a navigation bar is not easy to build because it typically involves JavaScript programming. My idea was to build a simple and convenient tool such that a non-technical person with basic knowledge about static HTML can easily include a [...]]]></description>
			<content:encoded><![CDATA[<h2>The Idea</h2>
<p>Many nice and home-grown websites contain a navigation bar. But without a special design tool a navigation bar is not easy to build because it typically involves JavaScript programming. My idea was to build a simple and convenient tool such that a non-technical person with basic knowledge about static HTML can easily include a corresponding navigation bar in its pages.</p>
<p>The person configures the navigation bar by composing or adjusting a rather simple XML file. The HTML writer should not have to deal with server-side page scripting or anything a like. For the website to work, it should be sufficient to deploy the XML and a bunch of static HTML files along with some ready-made magic. Trying out the site should be as easy as double-clicking the main HTML file in the local file system.</p>
<p>I like Java and I did not want get my hands dirty with JavaScript and browser compatiblity issues. So how could I get the job done? Since I also like experimenting, I decided to give the GWT (the Google Web Toolkit) a go for the project.</p>
<p>When reading the GWT&#8217;s documentation, its seemed like the perfect choice for me: I program my navigation bar entirely in Java and in the end, it is all converted to a highly optimized and pure client-side JavaScript / HTML mash. Wow!</p>
<p>In the following, you can read about my related experience with the GWT and the many unexpected hurdles a had to take in order to reach my goal.</p>
<p>Here is a brief summary about the problems I encountered and my general impression, after playing with the GWT:</p>
<ul>
<li>The GWT misses (at least) some basic widgets, you may expect in an Ajax (library).</li>
<li>(At least some) of the existing widgets are difficult to extend.</li>
<li>The asynchronous programming model of the GWT (and Ajax in general) leads to problems,<br />
when creating higher level API. (You are forced to give it an asynchronous design, too.)</li>
<li>The GWT does not well support dynamic locale changes (details will follow in an upcoming blog entry).</li>
</ul>
<p>Although I was really enthusiastic about the GWT when I started, I have to admit that I got disappointed here and there.<br />
An upside is the GWT&#8217;s basic infrastructure (i.e. the compiler and the debugger), which seems very mature and stable.<br />
It&#8217;s really just the library that should be improved&#8230;</p>
<h2>Getting in Touch with the GWT</h2>
<p>If you are a reasonably experienced Java programmer, then getting started with the GWT is easy, and the quick results are motivating. So, after trying out some basic stuff, I wanted to make shure that the GWT API indeed allows me to realize my little project.</p>
<h2>The Navigation Bar Hassle</h2>
<p>The GWT library contains a widget, which is close to the kind of navigation bar I had in mind: the class <em><a href="http://code.google.com/webtoolkit/documentation/com.google.gwt.user.client.ui.TabPanel.html">com.google.gwt.user.client.ui.TabPanel</a></em>. Unfortunately, it allows for creating horzitontal navigation bars <strong>only</strong>.</p>
<p>When looking at the <a href="http://code.google.com/webtoolkit/documentation/examples/kitchensink/demo.html">GWT kitchen sink example</a>, it seems like there is a vertical navigation bar included &#8211; but that impression is misleading. The vertical navigation bar in the kitchen sink does not use a ready-made GWT widget. Instead, it is a custom built thing made out of a bunch of hyperlink objects (of type <em>com.google.gwt.user.client.ui.Hyperlink</em>)</p>
<p>I wondered why Google did not add a built-in vertical tab panel and so I began to read the source code of the<br />
<em>TabPanel</em> and the affiliated <em>TabBar</em> class. I could not find any good reason why this widget should not be vertical and so, I tried to subclass <em>TabPanel</em> in order to get a vertical version of it. Sadly, my attempt quickly came to a halt, because the <em>TabPanel</em> had not at all been created with extensibilty in mind. The first few lines of code of GWT&#8217;s <em>TabPanel</em> reads as follows:</p>
<p><code>public class TabPanel &#46;.. {<br />
&#46;..<br />
private DeckPanel deck = new DeckPanel();<br />
private TabBar tabBar = new TabBar();<br />
private TabListenerCollection tabListeners;<br />
&nbsp;<br />
/**<br />
* Creates an empty tab panel.<br />
*/<br />
public TabPanel() {<br />
VerticalPanel panel = new VerticalPanel();<br />
panel.add(tabBar);<br />
panel.add(deck);<br />
&#46;..</code><br />
The <em>TabPanel</em> is a composite widget, which consists of simpler widgets, namely a <a href="http://code.google.com/webtoolkit/documentation/com.google.gwt.user.client.ui.VerticalPanel.html">vertical panel</a>, a <a href="http://code.google.com/webtoolkit/documentation/com.google.gwt.user.client.ui.TabBar.html">tab bar</a> and a <a href="http://code.google.com/webtoolkit/documentation/com.google.gwt.user.client.ui.DeckPanel.html">deck panel</a>. However, given the code from above, none of these contained widgets can be exchanged by subclassing, and therefore, it is practically impossible to get a vertical tab panel by by subclassing <em>TabPanel</em>.</p>
<p>I felt disappointed: If the set of built-in widgets is small, then at least I expect a good degree of extensibilty of the corresponding framework.</p>
<p>So how did I get my vertical tab pane then? By <strong>copy and patch</strong>! I copied the entire <em>TabPanel</em> code and turned it into my so-called <em>FlexibleTabPanel</em> class.</p>
<p>Its first lines read as follows:</p>
<p><code>public class FlexibleTabPanel extends Composite implements TabListener,<br />
SourcesTabEvents, HasWidgets, IndexedPanel {<br />
&nbsp;<br />
private final WidgetCollection children = new WidgetCollection(this);<br />
private final DeckPanel deck = new DeckPanel();<br />
private final FlexibleTabBar tabBar;<br />
private TabListenerCollection tabListeners;<br />
&nbsp;<br />
/**<br />
* Creates an empty tab panel.<br />
*/<br />
public FlexibleTabPanel(boolean horizontal) {<br />
Panel panel = createOuterPanel(horizontal);<br />
tabBar = createTabBar(horizontal);<br />
&nbsp;<br />
panel.add(tabBar);<br />
panel.add(deck);<br />
&#46;..</code><br />
The constructor of <em>FlexibleTabPanel</em> obtains a <em>boolean</em>, which decides, if the resulting tab pane is vertical or horizontal. The methods <em>createOuterPanel()</em> and <em>createTabBar()</em> may be overriden. Depending on the <em>boolean</em> flag, they create widgets for either the horizontal or the vertical case.</p>
<p>As you might guess, I also had to copy and patch the class <em><a href="http://code.google.com/webtoolkit/documentation/com.google.gwt.user.client.ui.TabBar.html">com.google.gwt.user.client.ui.TabBar</a></em>. I even had to subclass (the standard GWT classes) <em>HorizontalPanel</em> and <em>VerticalPanel</em>: Both classes have certain methods in common but the GWT does not factor them out in a common superclass or super interface. However, the original <em>TabPanel</em> class counts on these methods with respect to <em>HorizontalPanel</em>. Since I wanted to use the corresponding code in <em>FlexibleTabPanel</em> for both the <em>HorizontalPanel</em> and <em>VerticalPanel</em>, I was forced to do the following:</p>
<ol>
<li>I created an interface, which contains the missing super class methods and it looks<br />
as follows:<br />
<code>public interface FlexibleIndexedPanel extends IndexedPanel {<br />
public void add(Widget w);<br />
public void insert(Widget w, int beforeIndex);<br />
public boolean remove(Widget index);<br />
}</code><br />
(<em><a href="http://code.google.com/webtoolkit/documentation/com.google.gwt.user.client.ui.IndexedPanel.html">IndexedPanel</a></em> is an existing interface of the GWT, which just lacks the methods from above.)</li>
<li>I subclassed <em>HorizontalPanel</em> and <em>VerticalPanel</em> in the following ways:<br />
<code>public class FlexibleHorizontalPanel extends HorizontalPanel<br />
implements FlexibleIndexedPanel {<br />
}<br />
&nbsp;<br />
public class FlexibleVerticalPanel extends VerticalPanel<br />
implements FlexibleIndexedPanel {<br />
}</code>
</li>
</ol>
<p>The new classes <em>FlexibleHorizontalPanel</em> and <em>FlexibleVerticalPanel</em> offer the functionality needed in <em>FlexibleTabPanel</em>. So far I could not find any good reason, why the GWT does not share this functionality in a common super class of the vertical and horizontal panel already.</p>
<h2>Building the Builder</h2>
<h3>XML and Properties Files for Configuration</h3>
<p>As I mentioned in the beginning, I wanted the navigation bar to be configurable via an XML file. Essentially the XML file should determine the structure of the bar and its contents. I wrote a little interpreter, which parses a related XML file and and turns it into a widget object hierarchy. This is a similar approach as in frameworks such as <a href="http://www.swixml.org/">SwiXML</a> and <a href="http://ulc-community.canoo.com/snipsnap/space/ULC+XML">ULCXML</a>, but for my purpose, the navigation builder, as I called it, acts on a much smaller scale.</p>
<p>Here is a sample XML file that the navigation builder is able to digest:</p>
<p><tt><br />
&lt;?xml version="1.0" encoding="ISO-8859-1" ?&gt;<br />
&lt;navigation&gt;<br />
&lt;file id="home" xhref="home.html" mce_href="home.html"    html="true"/&gt;<br />
&lt;file id="cv" xhref="cv.html" mce_href="cv.html"    html="true"/&gt;<br />
&lt;file id="concerts" xhref="concerts.html" mce_href="concerts.html"    html="true"/&gt;<br />
&lt;navigation id="gallery" orientation="vertical" default="true"&gt;<br />
&lt;file id="image1" xhref="image1.html" mce_href="image1.html"    html="true" default="true"/&gt;<br />
&lt;content id="image2"&gt;This image is not yet available.&lt;/content&gt;<br />
&lt;/navigation&gt;<br />
&lt;file id="contact" xhref="contact.html" mce_href="contact.html"    html="true"/&gt;<br />
&lt;/navigation&gt;<br />
</tt></p>
<p>Based on this file, the interpreter creates an outer navigation bar with five tabs. The first tab has the id <em>home</em>, and when selected, it displays the HTML file <em>home.html</em>. The next two entry work similarly. The fourth entry defines an inner navigation bar, which is vertical and contains two tabs itself: The first inner tab relates to the HTML file <em>image1.html</em> and the second one adds the text <em>This image is not yet available.</em> in place.</p>
<p>As you can see, it&#8217;s usually HTML files, which determine, what&#8217;s displayed upon tab selection. But where do the display names of the tabs actually come from? For reasons I will explain later, I moved all of these names to Java properties files. E.g. the properties file <em>navigation.properties</em> for the XML file from above may look as follows:</p>
<p><code>home=Home<br />
cv=CV<br />
concerts=Concerts<br />
gallery=Gallery<br />
contact=Contact<br />
image1=Image 1<br />
image2=Image 2</code></p>
<p>Every id defined in the XML file is referenced in the properties file and is associated with an English display text.</p>
<h3>Being Asynchronous is Contagious</h3>
<p>After that, it was time to build the navigation builder class itself. The GWT comes with a convenient<br />
DOM-based XML parser API and so, it was easy to write the interpreter code.<br />
Interestingly, the way to read a corresponding XML file with the GWT has a serious impact on the entire program structure.</p>
<p>Reading files inside a Web page is real Ajax functionality, and the related GWT API must be used as follows:</p>
<p><code>HTTPRequest.asyncGet(&quot;myfileName&quot;, new ResponseTextHandler() {<br />
public void onCompletion(String responseText) {<br />
&#46;..<br />
}<br />
}</code></p>
<p>The code loads the file <em>myfileName</em> via a relative URL and upon success, the contents of the file is passed in as a string to the <em>onCompletion()</em> method.<br />
Since the method <em>asyncGet()</em> returns its result via a callback, it is called <em>asynchronous</em>. The navigation builder uses <em>asyncGet()</em> and therefore its API became asynchronous too:</p>
<p><code>NavigationBuilder builder = new NavigationBuilder(&#46;..);<br />
builder.buildNavigation(<br />
new NavigationBuildHandler() {<br />
public void onBuilt(Widget widget) {<br />
&#46;..<br />
}<br />
&nbsp;<br />
public void onFailure() {<br />
&#46;..<br />
}<br />
});</code><br />
Asynchronous APIs considerably change the structure of depending programs and in the example above, an asynchronous low level API &#8220;infected&#8221; a higher level API.<br />
In the context of the GWT this effect is hard to prevent, because the native<br />
execution environment (Java Script) has no thread concept and no thread synchronization mechanisms.</p>
<h3>Results</h3>
<p>After putting it all together, I finally got a first version of the navigation bar. <a href="http://canoo.com/blog/wp-content/uploads/2007/03/org.canoo.gwt.sample.MySite/MySite.html">Follow this link</a> to try out a corresponding example, which uses the XML file and the properties file from above.</p>
<p>The file <a href="http://canoo.com/blog/wp-content/uploads/2007/03/gwtsample1.zip">GWTSample1.zip</a> contains all the related source code.</p>
<p>Next week, I will talk about my adventures, when I tried to bring internationalization into the system. (Note that the code in the zip file contains the code for related feature already.)</p>
]]></content:encoded>
			<wfw:commentRss>http://canoo.com/blog/2007/03/13/building-a-regular-website-with-the-google-web-toolkit/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
