<?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>H72 - Innovation through improvisation</title>
	<atom:link href="http://h72.nl/feed" rel="self" type="application/rss+xml" />
	<link>http://h72.nl</link>
	<description>GWT software development</description>
	<lastBuildDate>Mon, 28 Feb 2011 11:15:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>How to implement an EntityProxy interface without frustration</title>
		<link>http://h72.nl/277</link>
		<comments>http://h72.nl/277#comments</comments>
		<pubDate>Mon, 24 Jan 2011 15:58:07 +0000</pubDate>
		<dc:creator>Hilbrand</dc:creator>
				<category><![CDATA[gwt]]></category>
		<category><![CDATA[EntityProxy]]></category>
		<category><![CDATA[RequestFactory]]></category>

		<guid isPermaLink="false">http://h72.nl/?p=277</guid>
		<description><![CDATA[One of new GWT 2.1 features is RequestFactory; &#8220;an alternative to GWT-RPC for creating data-oriented services.&#8221;. The main drive behind many of the new features is Spring Roo with GWT support. RequestFactory offers some great advantages over GWT-RPC, but the &#8230; <a href="http://h72.nl/277">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>One of new GWT 2.1 features is RequestFactory; <em>&#8220;an alternative to GWT-RPC for creating data-oriented services.&#8221;</em>. The main drive behind many of the new features is <a href="http://www.springsource.org/roo">Spring Roo</a> with GWT support. RequestFactory offers some great advantages over GWT-RPC, but the bad news is, it&#8217;s very lightly <a href="http://code.google.com/webtoolkit/doc/latest/DevGuideRequestFactory.html">documented</a>. Also as RequestFactory adds an extra layer of abstraction with advanced functionality, like keeping objects synchronized, it makes it difficult to use and understand in practice without good documentation.</p>
<p>Part of the difficulty of using RequestFactory and more specific EntityProxy is the implied usage conventions. With EntityProxy client/server code part of the implementation depends on implicit naming conventions. This is similar to GWT-RPC where the <code>service</code> and <code>serviceAsync</code> interfaces are bound by naming conventions, not code. As a consequence it&#8217;s easy to forget or create invalid code, which you unfortunately will find out at runtime. Leading to longer development cycles and frustration.</p>
<h2>Implementing an EntityProxy</h2>
<p>In this article the focus is on implementing an EntityProxy interface without getting run time error because you missed some implicit convention. I tried to create a comprehensive list as possible, but don&#8217;t sue me if I missed something&#8230; I&#8217;m assuming from here you have a basic understanding of how to use an EntityProxy.</p>
<p>EntityProxy is the core of an alternative method to transfer data between client and server. With GWT-RPC you need to create Data Transfer Objects(DTO). A  DTO contains simple getters and setters that mirror your server side data object. A DTO is necessary because your server side objects can not be used on the client side, due to dependencies on libraries that can&#8217;t be compiled with GWT. A big disadvantage of a DTO is that you need to copy data from the DTO into and from the server object. Code you need to write manually. With EntityProxy instead of creating a DTO you create an interface, and specify on that interface the getter and setter methods. GWT will generate a class for you from that interface. A small disadvantage of this approach is that is more difficult to debug. You have to include the generated path in your source path to access the code if you need and your data in the generated class is somewhat buried. But together with RequestFactory it gives you a simpler approach to keep data synchronized on the client. A very simple Employee EntityProxy example with a getter and setter method that relates to a field <code>name</code> in you server side class <code>Employee</code> would look as follows:</p>
<pre class="brush: java; title: ; notranslate">
    @ProxyFor(Employee.class)
    public interface EmployeeProxy extends EntityProxy {

       String getName();

       void setName(String name);

       @Override
       EntityProxyId&lt;EmployeeProxy&gt; stableId();
    }
</pre>
<p>With this interface, anytime you need an Employee object on the client you use the <code>EmployeeProxy</code> and on the server side you program with the <code>Employee</code> class. Meaning you may never use one of them on the other side! This approach with the DTO interface looks like the same overhead as a DTO class. But it frees you from having to write the copy code from the data class into the DTO class and back. With the RequestBuilder you create instances of the EntityProxy objects, but I won&#8217;t go the details on how to do that in this article.</p>
<h2>Rules to obey</h2>
<p>When implementing an EntityProxy interface there are a number of conventions you need to know and follow. The main cause of problems simple problems when using  EntityProxy are because there is no relation between the EntityProxy interface and the server side data object. As a consequence you have no compile time support to check if you missed something, like if the methods you put on the interface actual exist on the data class on the server. Incorrectly implementations result in run time errors and are sometimes buried in the stack trace or hard to find in production if the stack trace was not logged. Al you get in the client is an empty error message. GWT documentation already names a number of the items shown below, but here is an more comprehensive list:</p>
<p>For you EntityProxy interfaces:</p>
<ul>
<li>Each method in your interface must have an matching method in the server side class.</li>
<li>Only get or set methods are allowed in your interface.</li>
<li>You don&#8217;t have to add getters/setters for all member fields of server side data class in the EntityProxy interface, only those you want to use on the client side</li>
<li>If you add a setter method to your EntityProxy you must add a getter or else the setter will have no effect.</li>
<li><strike>The naming of the getter and setter method must match a field member in your server side class. If you have a <code>getLocation()</code> getter you must have a field named <code>location</code> in the server data class.</strike> This restriction has been removed in GWT 2.1.1. But when using an Editor with an EntityProxy you must name the Editor field (in Class) or method (in Interface) exactly as the getter/setter.</li>
<li>While you need matching getter/setter/fields the getters and setter don&#8217;t have to operate on the same type as the field, but it must match the type of the getter/setter method. So it correct to have an field of type Integer, while you getter/setter methods in the server side object and EntityProxy operate on String.</li>
<li>GWT 2.1 doesn&#8217;t support native types (like int) as return type for methods in the proxy interface and only <code>List</code> and <code>Set</code> data grouping types are valid. For the latter it means you can for example return an <code>ArrayList</code>, but the return type of the method must be <code>List</code></li>
<li>In the example above the <code>stableId()</code> is override from the interface EntityProxy. You <strike>must always override the <code>stableId()</code> method</strike> can override the  <code>stableId()</code> method so it will be easier to use with the RequestFactory <code>find</code> method, but it&#8217;s not a requirement.</li>
</ul>
<p>While your server side data object have no knowledge of the client side, and are not dependent on GWT they must meet some requirements to make things work. Here is the list for your server side data objects:</p>
<ul>
<li>A no-arg constructor. This may be the implicit default constructor. This is required unless you use a Locator, which takes the control of object instantiation.</li>
<li>The data class must have a method getId() that returns <string>a String or Long</string> any type (Since GWT 2.1.1) that represents the persisted ID.</li>
<li>A <code>getVersion()</code> method, which returns a non null value. This value should be incremented or changed each time that specific instance of the object is persisted. GWT uses this version number to check whether the object was changed. Some ORM frameworks have support for Versioning and thus can be implemented with ease. Since GWT 2.1.1 the return type is no longer limited to Integer and with a Locator you can use a different name for the method instead of <code>getVersion()</code>.
</li>
<li>A <code>getVersion()</code> method my not return null. GWT will not set version if you create a new object on the client. When a new object is persisted GWT will call <code>getVersion()</code> and you must make sure it doesn&#8217;t return null, even while it was never set to any value.
</li>
<li>A method: <code>public static entity_type find&lt;entity_type&gt;(id_type id)</code>. This method is used by RequestFactory <code>find</code> method to lookup individual instances. It seems possible since GWT 2.1.1 to do have a non static method by using a <code>Locator</code>. But I haven&#8217;t tried it.</li>
</ul>
<p>To summarize. As you&#8217;ve seen you need to keep an eye on a number of rules to correctly implement and use EntityProxy interfaces. It might be possible in the future better tool will be released or some limitations will be lifted. For now keep the list at hand when implementing EntityProxy interfaces or you will become frustrated each time you hit a run time error&#8230; </p>
<p>This article only covered EntityProxy but to correctly and efficient use the RequestFactory there is enough material to write about. Thomas Broyer wrote two articles on GWT 2.1.1 RequestFactory <a href="http://tbroyer.posterous.com/gwt-211-requestfactory">Part I</a> and <a href="http://tbroyer.posterous.com/gwt-211-requestfactory-part-ii">Part II</a> that are a good starting point. Finally if you find other rules I&#8217;ve missed let me know.</p>
<p><strong>UPDATE January, 26 2011:</strong> Thanks to Thomas Broyer for commenting and pointing out some incorrect claims. Based on his feedback I&#8217;ve updated the text.</p>
]]></content:encoded>
			<wfw:commentRss>http://h72.nl/277/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Introducing my new business site: h72.nl</title>
		<link>http://h72.nl/272</link>
		<comments>http://h72.nl/272#comments</comments>
		<pubDate>Tue, 30 Nov 2010 11:50:27 +0000</pubDate>
		<dc:creator>Hilbrand</dc:creator>
				<category><![CDATA[Uncategorized @en]]></category>

		<guid isPermaLink="false">http://h72.nl/?p=272</guid>
		<description><![CDATA[In July this year I started as a freelancer. After many years working mostly for small startup product companies I decided to become a freelancer specialized in GWT (Google Web Toolkit). In 2006 Google released GWT. From its inception I&#8217;ve been following &#8230; <a href="http://h72.nl/272">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In July this year I started as a freelancer. After many years working mostly for small startup product companies I decided to become a freelancer specialized in GWT (Google Web Toolkit).</p>
<p>In 2006 Google released GWT. From its inception I&#8217;ve been following and working with GWT and became a specialist in GWT. As more and more companies start to embrace GWT it leads to business opportunities for developers and freelancers, but also the need to train people.</p>
<p>To better position myself I&#8217;ve moved my old blog at bouwkamp.com to this site. If you&#8217;ve been following my old blog for GWT related topics please update your feed to the new site. Here is the link for the rss2 feed: <a href="http://h72.nl/?feed=rss2">h72.nl/?feed=rss2</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://h72.nl/272/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Solution to perform GWT RPC calls from within a Wave Gadget</title>
		<link>http://h72.nl/169</link>
		<comments>http://h72.nl/169#comments</comments>
		<pubDate>Fri, 25 Jun 2010 13:00:38 +0000</pubDate>
		<dc:creator>Hilbrand</dc:creator>
				<category><![CDATA[gadget]]></category>
		<category><![CDATA[gwt]]></category>
		<category><![CDATA[wave]]></category>

		<guid isPermaLink="false">http://www.bouwkamp.com/?p=110</guid>
		<description><![CDATA[The Problem When you&#8217;re building a Google Wave Gadgets with GWT you might want to communicate with the server via RPC, because that&#8217;s any easy way to communicate. Until now it was not really possible to do. The reason, the &#8230; <a href="http://h72.nl/169">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h2>The Problem</h2>
<p>When you&#8217;re building a Google Wave Gadgets with GWT you might want to communicate with the server via RPC, because that&#8217;s any easy way to communicate. Until now it was not really possible to do. The reason, the standard RPC implementation works only when the client application is loaded from the same server to which the RPC calls are made. This is due to the cross-site restriction browsers enforce to avoid harmfull actions performed by malicious sites. The problem is that Wave caches the gadget and runs it from it&#8217;s own server, instead of the originating server, and thus when the Gadget is loaded and runs, the original server is now on another domain, and therefor it&#8217;s not possible to perform the standard RPC calls.</p>
<h2>The Solution</h2>
<p>The solution lies in the iGoogle Gadget api. Wave Gadgets are build upon the iGoogle Gadget api and the Gadget api contains a proxy method to perform RPC calls to another server. Calls are routed through the iGoogle Gadget proxy server and for the client, the gadget code, it seems as if it performs a direct call to the external server. This is nothing new. However, there was not yet a GWT wrapper for access to these Google Gadgets api calls, and thus you would have to write that yourself.</p>
<p>But that&#8217;s about to change. When I was informed by the GWT team they where working on a new release of the GWT Gadget api I noticed the wrapper for the iGoogle proxy methods were added and wrote additional code to make it easy to do actual RPC calls from Wave. Now this code has been added to get GWT Gadget api library and will be present in the comming release. The trunk already contains these method, so if you want to start today, build your own version of the GWT Gadget api from <a title="trunk" href="http://code.google.com/p/gwt-google-apis/source/checkout">trunk</a>.</p>
<h2>How To</h2>
<p>Making RPC work within a Wave GWT Gadget is now easy. With these 2 steps any GWT Gadget can be made to work to use RPC.</p>
<p>1) For each service you want to use you need to redirect it to the Gadget api proxy to perform RPC call. This is done with the static method <code>redirectThroughProxy</code>. As shown in the following example:</p>
<pre class="brush: java; title: ; notranslate">
  YourServiceAsync yourService = GWT.create(YourService.class);
  GadgetsGwtRpc.redirectThroughProxy((ServiceDefTarget) yourService);
</pre>
<p>2) On the server side you need to override the method <code>readContent</code> in your servlet implementing the service, the one extending <code>RemoteServiceServlet</code>:</p>
<pre class="brush: java; title: ; notranslate">
  @Override
  protected String readContent(HttpServletRequest request)
      throws ServletException, IOException {
    return RPCServletUtils.readContentAsUtf8(request, false);
  }
</pre>
<p>This is needed because the current implementation of the iGoogle Gadget and thus Wave proxy rewrites the content type header and the GWT RPC implementation checks for this type to be <code>text/x-gwt-rpc</code>.</p>
<h2>One Final Remark</h2>
<p>Wave Gadgets can store state in the Wave itself. When storing state it&#8217;s also available in the Wave&#8217;s history. When you decide to store state on your own server, via RPC, you need to take care of showing historic versions yourself. This means depending on the case it&#8217;s better to store state in the Wave instead of obtaining the data from your own server.</p>
<p>Thanks to the GWT team for adding the code and make it easy to perform RPC calls from within Wave Gadgets.</p>
<p>To easily write Wave Gadgets with GWT use the <a href="http://code.google.com/p/cobogwave/">cobogwave</a> library that wraps all Wave specific methods.</p>
<p><strong>Update June, 28:</strong> The new iGoogle GWT Gadget api is available for download. Version 1.2: <a href="http://code.google.com/p/gwt-google-apis/downloads/detail?name=gwt-gadgets-1.2.0.zip">http://code.google.com/p/gwt-google-apis/downloads/detail?name=gwt-gadgets-1.2.0.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://h72.nl/169/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Update for cobogwave, the GWT wrapper for the Wave Gadget api: support for Private State and new Wave styled UI widgets</title>
		<link>http://h72.nl/157</link>
		<comments>http://h72.nl/157#comments</comments>
		<pubDate>Mon, 17 May 2010 13:02:25 +0000</pubDate>
		<dc:creator>Hilbrand</dc:creator>
				<category><![CDATA[gadget]]></category>
		<category><![CDATA[gwt]]></category>
		<category><![CDATA[wave]]></category>

		<guid isPermaLink="false">http://www.bouwkamp.com/?p=107</guid>
		<description><![CDATA[Just in time for GoogleIO 2010. Here is the updated version of the cobogwave library, the GWT wrapper for the Wave Gadget api. Recently, the Wave gadget api got some new features, and now the GWT wrapper library supports this &#8230; <a href="http://h72.nl/157">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Just in time for GoogleIO 2010. Here is the updated version of the cobogwave library, the GWT wrapper for the Wave Gadget api. Recently, the Wave gadget api got some new features, and now the GWT wrapper library supports this new functionality.</p>
<h2>Private State</h2>
<p>State values stored in a gadget are global for every viewer of the wave containing the widget. Changes made by one of the viewer are seen by all other viewers. With the new api changes, it&#8217;s now possible to store private state. This means those state values are only accessible by the viewer who made the changes. Private state can be used to store data for a viewer, that should not be accessible or seen by other viewers.</p>
<h2>Wave styled widgets</h2>
<p>In the wave gadget api there are 3 methods added to create ui widgets with a Wave style. While it doesn&#8217;t seem to be supported officially, the cobogwave GWT wrapper now provides access to those methods such that they can be used as standard GWT widgets. The 3 widgets made accessible are: Button, DialogBox and DecoratedSimplePanel.</p>
<p><b>Button</b> An anchor styled as button.</p>
<p><img src="http://cobogwave.googlecode.com/svn/trunk/src/main/resources/org/cobogw/gwt/waveapi/gadget/client/ui/doc-files/button.png" alt="Wave button" /></p>
<p><b>DialogBox</b> A DialogBox styled as a Wave dialog box.</p>
<p><img src="http://cobogwave.googlecode.com/svn/trunk/src/main/resources/org/cobogw/gwt/waveapi/gadget/client/ui/doc-files/dialogbox.png" alt="Wave DialogBox" /></p>
<p><b>DecoratedSimplePanel</b> A GWT SimplePanel with Wave style.</p>
<p><img src="http://cobogwave.googlecode.com/svn/trunk/src/main/resources/org/cobogw/gwt/waveapi/gadget/client/ui/doc-files/decoratedsimplepanel.png" alt="Wave DecoratedSimplePanel" /></p>
<p>Download the cobogwave library at  <a href="http://code.google.com/p/cobogwave/">http://code.google.com/p/cobogwave/</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://h72.nl/157/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;Recreating the button&#8221; in GWT</title>
		<link>http://h72.nl/147</link>
		<comments>http://h72.nl/147#comments</comments>
		<pubDate>Sun, 08 Mar 2009 21:26:30 +0000</pubDate>
		<dc:creator>Hilbrand</dc:creator>
				<category><![CDATA[gwt]]></category>
		<category><![CDATA[widget]]></category>
		<category><![CDATA[Button]]></category>

		<guid isPermaLink="false">http://www.bouwkamp.com/?p=50</guid>
		<description><![CDATA[On 3 Februari 2009 Google launched their new &#8220;custom buttons&#8221; in Gmail. The idea and creation process behind these buttons were described in the blog post Recreating the button at stopdesign.com, who were part of the process to develop these &#8230; <a href="http://h72.nl/147">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>On 3 Februari 2009 Google launched their new &#8220;custom buttons&#8221; in Gmail. The idea and creation process behind these buttons were described in the blog post <a href="http://stopdesign.com/archive/2009/02/04/recreating-the-button.html">Recreating the button</a> at stopdesign.com, who were part of the process to develop these buttons. The buttons were designed for the following reason:</p>
<blockquote><p>The buttons are designed to look very similar to basic HTML input buttons. But they can handle multiple interactions with one basic design. The buttons we’re using are imageless, and they’re created entirely using HTML and CSS, plus some JavaScript to manage the behavior. They’re also easily skinnable with a few lines of CSS, which was a key factor now that Gmail has themes.</p></blockquote>
<p>Unfortunately, as with many UI widgets created by Google, these are not made publicly available via their GWT framework. Therefor I decided to recreate the button in GWT. I&#8217;ll describe some of the JavaScript and CSS issue I faced and how these were solved. If you want to go straight to the button and demo here are the relevant links: <a href="http://code.google.com/p/cobogw/">download</a>, <a href="http://cobogw.googlecode.com/svn/trunk/widgets/samples/WidgetsDemo/www/org.cobogw.gwt.demo.widgets.WidgetsDemo/WidgetsDemo.html#Button">demo</a>. Javadoc: <a href="http://cobogw.googlecode.com/svn/trunk/widgets/doc/javadoc/org/cobogw/gwt/user/client/ui/Button.html">Button</a> and <a href="http://cobogw.googlecode.com/svn/trunk/widgets/doc/javadoc/org/cobogw/gwt/user/client/ui/ButtonBar.html">ButtonBar</a></p>
<a href="http://cobogw.googlecode.com/svn/trunk/widgets/samples/WidgetsDemo/www/org.cobogw.gwt.demo.widgets.WidgetsDemo/WidgetsDemo.html#Button"><img class="size-full wp-image-59" title="Example of using the button in GWT" src="http://h72.nl/wp-content/uploads/2009/03/button.png" alt="Example of using the button in GWT" /></a>
<h3>Design</h3>
<p>The Button widget has been designed to look as close as possible to the look and feel of the Google button (read: pixel perfect). To make the usage of button easy it has same class interface as the PushButton widget from the GWT library, this makes it easy to replace existing buttons with the new Button widget. Additional there are several methods to easily change the color, size or text/button ratio. For the color I added a method that based on a hue and saturation value calculates all colors needed. This makes it easy to change the color of the button.</p>
<p>The button is constructed with nested <code>&lt;div&gt;</code> element&#8217;s. You can easily see this when you view the button with your favorite browser code inspector tool. Eventually I ended up with one <code>&lt;div&gt;</code> element less than in the Google button, which didn&#8217;t effect the layout as far as I my tests concluded.</p>
<h3>JavaScript and CSS issues and fixes</h3>
<p>After the basic reverse engineering I fixed the specific browser support issues, mainly related to the <code>inline-block</code> support. In the process the free browser testing service <a href="http://browsershots.org/">browsershots.org</a> was of great help. But service only helps you with layout issues, not if the effects and actions work correctly.  The <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=21eabb90-958f-4b64-b5f1-73d0a413c8ef&amp;DisplayLang=en">Internet Explorer Application Compatibility VPC Image</a> make it possible to test different versions of Internet Explorer. In the end I only didn&#8217;t fix IE 6 issues yet. Here are some details regarding the major issues:</p>
<h4>DOCTYPE</h4>
<p>It turned out that to display the button correctly in Internet Explorer 7 you need to set a DOCTYPE. It doesn&#8217;t matter which one, you just need one. So don&#8217;t forget to set one!</p>
<h4>display:inline-block</h4>
<p>What is interesting about the google button, is the use of the <code>display</code> property value <code>inline-block</code>. This property can be used to position block elements horizontally without having to <code>float</code> them. Because browser support has been <a href="http://www.quirksmode.org/css/display.html">very poor</a> and using it <span style="text-decoration: line-through;">is</span> was not recommended. But newer browsers do support it and it won&#8217;t be long before you can safely use this property value.</p>
<p>Of the major browsers, support in Internet Explorer 7 can be achieved via the <a href="http://www.brunildo.org/test/InlineBlockLayout.html">hasLayout</a> trick, used in the button widget by setting <code>display:inline</code> and <code>zoom:1</code> instead of <code>display:inline-block</code>. In the cobogw library there is a method <a href="http://cobogw.googlecode.com/svn/trunk/widgets/doc/javadoc/org/cobogw/gwt/user/client/CSS.html#setInlineBlock(com.google.gwt.dom.client.Element)">CSS#setInlineBlock</a> that will take care of different browser implementations.</p>
<h4>Unselectable button text</h4>
<p>If you check the Google button you will see that&#8217;s it&#8217;s not possible to select the text. Making text unselectable is normally not considered good practice, but in this case a normal button is also not selectable. But making something unselectable differs almost is all browsers. In the cobogw library there is a method <a href="http://cobogw.googlecode.com/svn/trunk/widgets/doc/javadoc/org/cobogw/gwt/user/client/CSS.html#setSelectable(com.google.gwt.dom.client.Element,%20boolean)">CSS#setSelectable</a> to take care of different browsers.</p>
<p>A small related issue is with Opera. In Opera when a user selects an element with a tab index it gets a different background color. For Opera 9.5 and later this can be removed via the CSS3 pseudo element <a href="http://reference.sitepoint.com/css/pseudoelement-selection">::selection</a>. However, I didn&#8217;t find any way to set this via JavaScript, which means you need to set this in your own CSS file. This is documented in the <a href="http://cobogw.googlecode.com/svn/trunk/widgets/doc/javadoc/org/cobogw/gwt/user/client/ui/Button.html">Button</a> JavaDoc.</p>
<h4>Fire click event</h4>
<p>A <code>&lt;button&gt;</code> element triggers a click event in case the user hits the space bar or the return key. However, a <code>&lt;div&gt;</code> element doesn&#8217;t have this behavior so programmatically a <em>click</em> event must triggered when the user hits one of those keys. It turns out this is also browser specific. IE does support the JavaScript method <code>click()</code> on the <code>&lt;div&gt;</code>. In the other browsers you need to do somewhat more. In short, you need to create a <em>MouseEvents</em> and call the <code>dispatchEvent</code> method on the <code>&lt;div&gt;</code> element with the a <em>click</em> event object.</p>
<p>For most other use cases it should not be needed to fire events that are normally only triggered by user interaction. If you find yourself doing such and are not creating &#8216;low&#8217; level widgets like buttons you probably should reconsider your code. A method <a href="http://cobogw.googlecode.com/svn/trunk/widgets/doc/javadoc/org/cobogw/gwt/event/client/Event2.html#fireClickEvent(com.google.gwt.dom.client.Element)">fireClickEvent</a> that takes care of different browser implementations is available in the cobowg library to fire a mouse click event.</p>
]]></content:encoded>
			<wfw:commentRss>http://h72.nl/147/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>New name: cobogw.org, new widgets and GWT 1.5 support</title>
		<link>http://h72.nl/117</link>
		<comments>http://h72.nl/117#comments</comments>
		<pubDate>Wed, 13 Aug 2008 15:37:54 +0000</pubDate>
		<dc:creator>Hilbrand</dc:creator>
				<category><![CDATA[gwt]]></category>
		<category><![CDATA[widget]]></category>

		<guid isPermaLink="false">http://www.bouwkamp.com/?p=41</guid>
		<description><![CDATA[Today I moved the gwt.bouwkamp.com project to a new name: cobogw.org. I guess, it&#8217;s completely unpronounceable , but I like abbreviations, the domain was free and the name isn&#8217;t used. That can be an issue nowadays. The new name is &#8230; <a href="http://h72.nl/117">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Today I moved the gwt.bouwkamp.com project to a new name: cobogw.org. I guess, it&#8217;s completely unpronounceable <img src='http://h72.nl/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> , but I like abbreviations, the domain was free and the name isn&#8217;t used. That can be an issue nowadays. The new name is to better reflect the open source nature of the project (moving from a .com extension to a .org). The new project is hosted on google code, just as the old project was, <a title="http://code.google.com/p/cobogw/" href="http://code.google.com/p/cobogw/">http://code.google.com/p/cobogw/</a> (Or you can reach the project site via <a title="www.cobogw.org" href="http:/www.cobogw.org">www.cobogw.org</a>).</p>
<h3>New release, GWT 1.5 support</h3>
<p>I&#8217;ve released a packaged version of the cobogw project, which contains an easy to use jar file containing all widgets, source code and javadoc. With this release some new widgets are added and the jar file is also available as as GWT 1.5 compatible only version. You can find the zipped files at the <a title="http://code.google.com/p/cobogw/downloads" href="http://code.google.com/p/cobogw/downloads">download</a> site. The new widgets/classes are:</p>
<ul>
<li>Rating &#8211; A widget that allows users to set ratings (<a rel="nofollow" href="http://cobogw.googlecode.com/svn/trunk/widgets/samples/WidgetsDemo/www/org.cobogw.gwt.demo.widgets.WidgetsDemo/WidgetsDemo.html#RatingWidget">demo</a>).</li>
<li>Span/TextNode &#8211; Widgets to add span an textnode tags to other widgets without overhead of additional div tags (<a rel="nofollow" href="http://cobogw.googlecode.com/svn/trunk/widgets/samples/WidgetsDemo/www/org.cobogw.gwt.demo.widgets.WidgetsDemo/WidgetsDemo.html#Tags">demo</a>).</li>
<li>CSS &#8211; A helper class to help with CSS properties.</li>
</ul>
<p>On the project site you can also find examples and <a rel="nofollow" href="http://cobogw.googlecode.com/svn/trunk/widgets/doc/javadoc/index.html">javadoc</a> documentation for existing and new widgets.</p>
<p>Let me know what you think of the new name and new widgets.</p>
]]></content:encoded>
			<wfw:commentRss>http://h72.nl/117/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fixing java.sql.Date/Time/Timestamp support for GWT</title>
		<link>http://h72.nl/116</link>
		<comments>http://h72.nl/116#comments</comments>
		<pubDate>Tue, 11 Dec 2007 23:39:45 +0000</pubDate>
		<dc:creator>Hilbrand</dc:creator>
				<category><![CDATA[gwt core]]></category>

		<guid isPermaLink="false">http://www.bouwkamp.com/?p=38</guid>
		<description><![CDATA[Probably anyone who uses the sql Date/Time or Timestamp classes and wants to use these in GWT needs wrap a custom implementation around these classes on the server side, because the java.sql classes are not supported by the current version &#8230; <a href="http://h72.nl/116">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Probably anyone who uses the sql Date/Time or Timestamp classes and wants to use these in GWT needs wrap a custom implementation around these classes on the server side, because the java.sql classes are not supported by the current version of GWT (1.4.61). This is because for existing classes, like java.lang.String, GWT provides an emulated version. These are implemented for a large number of the java.lang objects among others, but not for these java.sql classes.</p>
<p>I had the same problem. I use Spring/Ibatis and maintained 2 data objects one on the server side used by Spring/Ibatis and on the client side which instead of the java.sql.Date used java.util.Date. The latter was used to communicate the data between the client and server.</p>
<p>When looking for a solution I found the problem was reported some time ago under <a title="GWT issue 87: Add java.sql.Date to the GWT JRE emulation library" href="http://code.google.com/p/google-web-toolkit/issues/detail?id=87">issue 87</a> in the GWT issue tracker. But it&#8217;s marked with Priority-low. Furthermore, <a title="hibernate4gwt" href="http://hibernate4gwt.sourceforge.net/index.html">hibernate4gwt</a> offers a solution, but I looked at the implementation of the emulated classes and  missed some functionality. Therefore I wrote my own implementation to support java.sql.Date, java.sql.Time and java.sql.Timestamp to be fully compliant with the JRE classes (as far as is possible).</p>
<p>I prefer simplicity and packed the classes in a jar file, which you can simply place in your classpath to add support for the java.sql.Date, java.sql.Time and java.sql.Timestamp classes (presumingly you have already added User.gwt.xml to you module).</p>
<p>Download of the jar file, packed in a zip: <a title="cobogw.java.sql.zip" href="http://cobogw.googlecode.com/files/cobogw.java.sql-1.0.zip">cobogw.java.sql-1.0.zip</a></p>
<p>Because quality is important I created JUnit test cases to check the implementation. You can find the <a title="JUnit test results" href="http://cobogw.googlecode.com/svn/trunk/reports/cobogw.java.sql/">reports</a> and <a title="JUnit test cases." href="http://cobogw.googlecode.com/svn/trunk/test">test</a> classes in my cobogw project repository.</p>
]]></content:encoded>
			<wfw:commentRss>http://h72.nl/116/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Lessons learned</title>
		<link>http://h72.nl/114</link>
		<comments>http://h72.nl/114#comments</comments>
		<pubDate>Sun, 07 Oct 2007 20:17:40 +0000</pubDate>
		<dc:creator>Hilbrand</dc:creator>
				<category><![CDATA[gwt]]></category>

		<guid isPermaLink="false">http://www.bouwkamp.com/?p=27</guid>
		<description><![CDATA[I&#8217;ve been working with GWT for more than a year and still think it changed the playing field. Joel Spolsky wrote an article about how GMail can be compared to what happened to Lotus 1-2-3 and that Google should watch &#8230; <a href="http://h72.nl/114">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working with GWT for more than a year and still think it changed the playing field. Joel Spolsky wrote an <a title="Joel on Software, Strategy Letter VI" href="http://www.joelonsoftware.com/items/2007/09/18.html">article</a> about how GMail can be compared to what happened to Lotus 1-2-3 and that Google should watch out for some SDK that will change the landscape. I think that SDK can be GWT. Here are some lessons I&#8217;ve learned:</p>
<ul>
<li>The GWT library takes away a lot of the burden of browser incompatibility related to JavaScript and therefor I don&#8217;t have to worry about browser JavaScript incompatibility. For new applications there are very few reasons to write your own JavaScript, unless you want to use a specific JavaScript or DOM element not accessible via GWT or want to integrate a some existing JavaScript code. Although when rewritten in GWT (i.e. Java) you can better debug the code.</li>
<li>What GWT does for JavaScript it doesn&#8217;t do for CSS or HTML. Which means that you still have to work around any CSS or HTML specific browser incompatibilities. CSS and HTML knowledge is very much required. I wrote a CSS helper class that contains all possible items and works around the &#8216;float&#8217; issue. I&#8217;ve not released it officially but you can find it <a title="CSS helper class" href="http://cobogw.googlecode.com/svn/trunk/src/org/cobogw/gwt/user/">here</a> (make sure you have all files and inherit the CSS.gwt.xml (or Users.gwt.xml)).</li>
<li>Programming GWT applications can be compared to writing classical GUI applications, like Java SWING applications.</li>
<li>Websites are created by web designers, who understand HTML and CSS, but probably are less familiar with programming. In GWT the whole design must be rewritten in GWT widgets, and none of the HTML created in the design can be reused. This makes the design/develop process more complicated.</li>
<li>In GWT there are two ways to set the style on HTML tags: programmatically and via CSS. The advantage of putting something in CSS is that it is easy to test your layout. I use the web developer extension in Firefox to dynamically alter the CSS style of an HTML page. When I&#8217;m satisfied with the style I hard code those properties that should not be changed, because when set differently they would break the layout. This makes reuse of the code more easy.</li>
<li>GWT does add a different dimension to HTML design. Because you develop in widgets and less in terms of HTML tags the notion of what is considered bad and good use of HTML blurs. For example, tables are considered bad it is better to use divs, the same for innerHTML. But all is hidden behind widgets. It becomes something you don&#8217;t care about. Although you have to because of the style differences between browsers on divs and tables. Some widgets are based on tables and could be rewritten in divs, but I found this very hard. I did a rewrite of the TabPanel widget with only divs, but to the implementations only worked if I didn&#8217;t use &#8216;quicks mode&#8217;.</li>
<li>With GWT you write in Java and debug your application in Java which makes it very easy to debug your code. Debugging is at Java language level, you are not debugging JavaScript. If you have custom JavaScript and you need to debug the JavaScript, you need to debug it using an external JavaScript debugger, which means you need to debug the generated code. I have not needed this, since I didn&#8217;t need any custom JavaScript, except for a few lines to set a very specific attribute not accessible via GWT.</li>
<li>GWT does lock you in. This means once you&#8217;ve writing your application in GWT &#8216;Java&#8217; you can&#8217;t easily move it to some other library. The lock in is comparable with when you write your application in a specific programming language. For example if you would write you application in C# it&#8217;s not easy to move to some other language or library. The lock in is not necessary a bad thing because GWT is based on open source software and is open source itself, which is a good thing.</li>
<li>What is important to remember is that although you code Java for the client side it isn&#8217;t Java you&#8217;re writing. You are writing an application using Java syntax which is compiled to JavaScript. This is important to understand because it basically means you are writing in an unspecified language. This is partly true because in hosted mode your application runs as a Java program which means it really is Java. But eventually when you deploy your code it will be compiled to JavaScript. It also means that you can only use a very small set of the standard Java library, which is supplied with the GWT library.</li>
<li>The GWT compiler is currently limited to Java 1.4 syntax (Java 1.5 syntax is planned for GWT version 1.5). However, this doesn&#8217;t limit you to use JAVA 1.5 or 6, you simply can&#8217;t use specific Java 1.5 syntax in the client code. For the server side you can use whatever Java (syntax/library) you want.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://h72.nl/114/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Updated RoundedPanel</title>
		<link>http://h72.nl/112</link>
		<comments>http://h72.nl/112#comments</comments>
		<pubDate>Mon, 30 Apr 2007 19:52:05 +0000</pubDate>
		<dc:creator>Hilbrand</dc:creator>
				<category><![CDATA[widget]]></category>

		<guid isPermaLink="false">http://www.bouwkamp.com/?p=23</guid>
		<description><![CDATA[Last year I created a small widget to create rounded corners similar to those in Google mail and calendar. While working with the widget I updated the RoundedPanel Widget with several improvements and changes: The height of the corners can &#8230; <a href="http://h72.nl/112">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Last year I created a small widget to create rounded corners similar to those in Google mail and calendar. While working with the widget I updated the RoundedPanel Widget with several improvements and changes:</p>
<ol>
<li>The height of the corners can be set. In the previous version this was set to 2. In the new version you can set an index between 1 and 9. I call this an index, not the height, because the real height is somewhat out of sync simply to get better looking rounded corners. For example using 9 will get an real height of 12px.</li>
<li>The color of the corner can be set via a method, setCornerColor. This method sets the background of the corner div&#8217;s. This method is helpful to programmatically change the colors.</li>
</ol>
<p>I created a project on the Google code site where the the latest sources will be maintained as well as issues found and where I will release new widgets, like the VerticalTabPanel: <a target="_blank" title="code.google.com/p/com-bouwkamp-gwt/" href="http://code.google.com/p/com-bouwkamp-gwt/">http://code.google.com/p/com-bouwkamp-gwt/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://h72.nl/112/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Vertical TabPanel</title>
		<link>http://h72.nl/109</link>
		<comments>http://h72.nl/109#comments</comments>
		<pubDate>Thu, 12 Apr 2007 21:05:04 +0000</pubDate>
		<dc:creator>Hilbrand</dc:creator>
				<category><![CDATA[widget]]></category>

		<guid isPermaLink="false">http://www.bouwkamp.com/?p=21</guid>
		<description><![CDATA[The default TabPanel in GWT supports only a Horizontal TabBar. If you want to create a TabPanel which has a Vertical TabBar on the left side of the TabPanel you need to create a complete new implementation, because it is &#8230; <a href="http://h72.nl/109">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The default TabPanel in GWT supports only a Horizontal TabBar. If you want to create a TabPanel which has a Vertical TabBar on the left side of the TabPanel you need to create a complete new implementation, because it is not possible to subclass the TabPanel class and modify the layout. Take the <a title="KitchenSink example" href="http://code.google.com/webtoolkit/documentation/examples/kitchensink/demo.html">KitchenSink</a> example. This is a Vertical TabPanel, but not implemented as one. With a VerticalTabPanel you can get the same layout.<br />
The following 2 classes are modified versions of the TabPanel and the TabBar to display as a VerticalTabPanel:</p>
<blockquote><p><a title="VerticalTabPanel.java" href="http://com-bouwkamp-gwt.googlecode.com/svn/trunk/src/com/bouwkamp/gwt/user/client/ui/VerticalTabPanel.java">VerticalTabPanel.java</a></p></blockquote>
<blockquote><p><a title="VerticalTabBar.java" href="http://com-bouwkamp-gwt.googlecode.com/svn/trunk/src/com/bouwkamp/gwt/user/client/ui/VerticalTabBar.java">VerticalTabBar.java</a></p></blockquote>
<p>Notes:</p>
<p>The TabPanel and TabBar are based on the not yet released GWT 1.4 TabBar, which include the feature to add widgets to the tabBar.</p>
<p>Furthermore, I added the method <strong>getSelectedTabWidget</strong> which returns, just as it implies, the widget of the selected tab. This can be useful if you want to dynamically change the style on a selected tab, for example set a different background color.</p>
]]></content:encoded>
			<wfw:commentRss>http://h72.nl/109/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

