<?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>It's Just a Bunch of Stuff That Happens &#187; Java</title>
	<atom:link href="http://stuffthathappens.com/blog/category/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://stuffthathappens.com/blog</link>
	<description>Technology and Geek Stuff by Eric Burke</description>
	<lastBuildDate>Fri, 04 Jun 2010 14:44:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>IDE Feature Matrix</title>
		<link>http://stuffthathappens.com/blog/2009/10/15/ide-feature-matrix/</link>
		<comments>http://stuffthathappens.com/blog/2009/10/15/ide-feature-matrix/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 17:53:02 +0000</pubDate>
		<dc:creator>Eric Burke</dc:creator>
				<category><![CDATA[Fun]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://stuffthathappens.com/blog/?p=1502</guid>
		<description><![CDATA[This is how I feel about Java IDEs.

]]></description>
			<content:encoded><![CDATA[<p>This is how I feel about Java IDEs.</p>
<p><img src="http://stuffthathappens.com/blog/wp-content/uploads/2009/10/matrix.png" alt="IDE Feature Matrix" title="IDE Feature Matrix" width="571" height="230" class="alignnone size-full wp-image-1503" /></p>
]]></content:encoded>
			<wfw:commentRss>http://stuffthathappens.com/blog/2009/10/15/ide-feature-matrix/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>GWT Glass Pane</title>
		<link>http://stuffthathappens.com/blog/2009/10/03/gwt-glass-pane/</link>
		<comments>http://stuffthathappens.com/blog/2009/10/03/gwt-glass-pane/#comments</comments>
		<pubDate>Sat, 03 Oct 2009 14:25:45 +0000</pubDate>
		<dc:creator>Eric Burke</dc:creator>
				<category><![CDATA[GWT]]></category>
		<category><![CDATA[HTML and CSS]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://stuffthathappens.com/blog/?p=1466</guid>
		<description><![CDATA[This code darkens the entire screen, allowing you to create lightbox effects when showing dialogs. For example, here is the normal screen:

And here is how the screen looks with a glass pane and dialog:

There are GWT component libraries that do this sort of thing, for example GlassPanel, but I prefer to minimize external dependencies. Instead, [...]]]></description>
			<content:encoded><![CDATA[<p>This code darkens the entire screen, allowing you to create lightbox effects when showing dialogs. For example, here is the normal screen:</p>
<p><a href="http://stuffthathappens.com/blog/wp-content/uploads/2009/10/lightbox1.png"><img src="http://stuffthathappens.com/blog/wp-content/uploads/2009/10/lightbox1-300x225.png" alt="Lightbox 1" title="Lightbox 1" width="300" height="225" class="alignnone size-medium wp-image-1467" /></a></p>
<p>And here is how the screen looks with a glass pane and dialog:</p>
<p><a href="http://stuffthathappens.com/blog/wp-content/uploads/2009/10/lightbox2.png"><img src="http://stuffthathappens.com/blog/wp-content/uploads/2009/10/lightbox2-300x225.png" alt="Lightbox 2" title="Lightbox 2" width="300" height="225" class="alignnone size-medium wp-image-1468" /></a></p>
<p>There are GWT component libraries that do this sort of thing, for example <a href="http://code.google.com/p/google-web-toolkit-incubator/wiki/GlassPanel">GlassPanel</a>, but I prefer to minimize external dependencies. Instead, I decided to try <a href="http://groups.google.com/group/google-web-toolkit/msg/1bbc660dbb6a1a6d">this code example</a> by Evaldas Taroza.</p>
<h3>My Changes</h3>
<p>I made a few changes to the original code:</p>
<ul>
<li>Since I&#8217;m using GWT 1.7, I implement <code>ResizeHandler</code> instead of <code>WindowResizeListener</code>, which is deprecated.</li>
<li>I&#8217;m removing the <a href="https://developer.mozilla.org/en/CSS/opacity">-moz-opacity</a> since it is specific to older versions of Mozilla and no longer seems relevant.</li>
</ul>
<h3>The Final Code</h3>
<p>First, here is the CSS file:</p>
<pre class="prettyprint">.gcomp-GlassPanel {
    background-color: black;
    filter: alpha(opacity=50);
    opacity: .50;
}</pre>
<p>Next, here is the JavaDoc comment, listed separately because syntax highlighting wasn&#8217;t working here on my blog.</p>
<pre style="prettyprint">/**
 * This panel is positioned absolutely and covers the whole client
 * area of the browser. It can be used to disable everything
 * underneath it with appropriate z-index.
 * &lt;p/>
 * For instance a dialog can attach it to the root panel during
 * opening, and remove it during closing.
 * &lt;p/>
 * CSS:&lt;br>
 * .gcomp-GlassPanel
 * &lt;p/>
 * Example:&lt;br>
 * Add and remove this widget whenever you want, and style it as
 * follows:
 * &lt;pre>
 * .gcomp-GlassPanel{
 *   background-color: black;
 *   filter:alpha(opacity=50);
 *   opacity:.50;
 * }
 * &lt;/pre>
 */</pre>
<p>And here is the code&#8230;</p>
<pre class="prettyprint">public class GlassPanel extends Composite implements ResizeHandler {
    public static final String STYLE = "gcomp-GlassPanel";

    private SimplePanel panel = new SimplePanel();

    public GlassPanel() {
        initWidget(panel);

        panel.setStylePrimaryName(STYLE);
        Window.addResizeHandler(this);
        resize();
    }

    public void onResize(ResizeEvent event) {
        resize();
    }

    public void show() {
        // Override the styles explicitly, because it's needed
        // every time the widget is detached
        Element elem = panel.getElement();
        DOM.setStyleAttribute(elem, "left", "0");
        DOM.setStyleAttribute(elem, "top", "0");
        DOM.setStyleAttribute(elem, "position", "absolute");
        RootPanel.get().add(this);
    }

    public void hide() {
        RootPanel.get().remove(this);
    }

    private void resize() {
        panel.setSize(Window.getClientWidth() + "px",
                Window.getClientHeight() + "px");
    }
}</pre>
<p>I&#8217;ve only done minimal testing, on the latest Firefox and IE7.</p>
]]></content:encoded>
			<wfw:commentRss>http://stuffthathappens.com/blog/2009/10/03/gwt-glass-pane/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Generic DTOs</title>
		<link>http://stuffthathappens.com/blog/2009/09/27/generic-dtos/</link>
		<comments>http://stuffthathappens.com/blog/2009/09/27/generic-dtos/#comments</comments>
		<pubDate>Sun, 27 Sep 2009 13:21:40 +0000</pubDate>
		<dc:creator>Eric Burke</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://stuffthathappens.com/blog/?p=1435</guid>
		<description><![CDATA[Adam Bien presents the Generic DTO convention, where your DTOs wrap around Java Map instances.
If you are considering a generic DTO approach, you might want to investigate Protocol Buffers. Though you will have to create and maintain .proto files, you&#8217;ll gain language independence and (presumably) performance.
]]></description>
			<content:encoded><![CDATA[<p>Adam Bien presents the <a href="http://www.adam-bien.com/roller/abien/entry/no_duplication_no_decoupling_the">Generic DTO</a> convention, where your DTOs wrap around Java <code>Map</code> instances.</p>
<p>If you are considering a generic DTO approach, you might want to investigate <a href="http://code.google.com/p/protobuf/">Protocol Buffers</a>. Though you will have to create and maintain <a href="http://code.google.com/apis/protocolbuffers/docs/proto.html">.proto</a> files, you&#8217;ll gain language independence and (presumably) performance.</p>
]]></content:encoded>
			<wfw:commentRss>http://stuffthathappens.com/blog/2009/09/27/generic-dtos/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Guice with GWT</title>
		<link>http://stuffthathappens.com/blog/2009/09/14/guice-with-gwt/</link>
		<comments>http://stuffthathappens.com/blog/2009/09/14/guice-with-gwt/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 00:10:32 +0000</pubDate>
		<dc:creator>Eric Burke</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://stuffthathappens.com/blog/?p=1398</guid>
		<description><![CDATA[This article shows how to configure Guice with server side code in Google Web Toolkit (GWT) applications1. I use Guice 2.0 with GWT 1.7.0.
Steps include:

Obtain the Guice JAR files
Extend GWT&#8217;s RemoteServiceServlet
Extend Guice&#8217;s GuiceServletContextListener
Extend Guice&#8217;s ServletModule
Set all RemoteService relative paths to GWT.rpc
Configure GuiceFilter and your context listener in web.xml
(optional, but good) Your remote service implementation classes [...]]]></description>
			<content:encoded><![CDATA[<p>This article shows how to configure Guice with server side code in Google Web Toolkit (GWT) applications<sup>1</sup>. I use Guice 2.0 with GWT 1.7.0.</p>
<p>Steps include:</p>
<ul>
<li>Obtain the Guice JAR files</li>
<li>Extend GWT&#8217;s <code>RemoteServiceServlet</code></li>
<li>Extend Guice&#8217;s <code>GuiceServletContextListener</code></li>
<li>Extend Guice&#8217;s <code>ServletModule</code></li>
<li>Set all <code>RemoteService</code> relative paths to <em>GWT.rpc</em></li>
<li>Configure <code>GuiceFilter</code> and your context listener in <em>web.xml</em></li>
<li>(optional, but good) Your remote service implementation classes no longer have to extend <code>RemoteServiceServlet</code></li>
</ul>
<p>Phew! That seems like a long list, but I want to ensure I list every step. This approach is based on the excellent <a href="http://pavelgj.blogspot.com/2008/02/gwt-remoteserviceservlet-guice.html">GuiceRemoteServiceServlet</a> by <a href="http://pavelgj.blogspot.com/">Pavel Jbanov</a>. His initial work pointed me in the right direction, making this much easier.</p>
<h2>Get Guice</h2>
<p>Grab <a href="http://google-guice.googlecode.com/files/guice-2.0.zip">guice-2.0.zip</a> from the Guice <a href="http://code.google.com/p/google-guice/downloads/list">downloads page</a>. This ZIP contains all of the required JARs. You may also want <a href="http://google-guice.googlecode.com/files/guice-2.0-src.zip">guice-2.0-src.zip</a>.</p>
<p>To use Guice with GWT, you&#8217;ll need two JARs: <em>guice.jar</em> and <em>guice-servlet.jar</em>. Just drop these into your <em>war/WEB-INF/lib</em> directory.</p>
<h2>Extend GWT&#8217;s <code>RemoteServiceServlet</code></h2>
<p>This code comes almost verbatim from Pevel Jbanov&#8217;s blog, with the modifications mentioned in the first comment on that page. Here is the source:</p>
<pre class="prettyprint">
@Singleton
public class GuiceRemoteServiceServlet extends RemoteServiceServlet {
  @Inject
  private Injector injector;

  @Override
  public String processCall(String payload) throws SerializationException {
    try {
      RPCRequest req = RPC.decodeRequest(payload, null, this);

      RemoteService service = getServiceInstance(
            req.getMethod().getDeclaringClass());

      return RPC.invokeAndEncodeResponse(service, req.getMethod(),
        req.getParameters(), req.getSerializationPolicy());
    } catch (IncompatibleRemoteServiceException ex) {
      log("IncompatibleRemoteServiceException in the processCall(String) method.",
          ex);
      return RPC.encodeResponseForFailure(null, ex);
    }
  }

  @SuppressWarnings({"unchecked"})
  private RemoteService getServiceInstance(Class serviceClass) {
    return (RemoteService) injector.getInstance(serviceClass);
  }
}
</pre>
<p>All GWT RPC requests will go through this single servlet. Thus, your remote service implementation classes will not have to extend <code>RemoteServiceServlet</code>.</p>
<ul>
<li><code>GuiceFilter</code> will inject the <code>Injector</code></li>
<li>The @Singleton annotation is required for Guice-managed servlets</li>
</ul>
<h2>Extend Guice&#8217;s <code>GuiceServletContextListener</code></h2>
<p>This step creates a Guice-friendly servlet context listener.</p>
<pre class="prettyprint">
public class MyGuiceContextListener extends GuiceServletContextListener {
  @Override
  protected Injector getInjector() {
    return Guice.createInjector(
      new MyServletModule(),
      new AnotherOneOfMyModules(), etc...);
  }
}</pre>
<p>You can hook up as many Guice modules as you want. The first, <code>MyServletModule</code>, replaces much of what traditionally goes in <em>web.xml</em>.</p>
<h2>Extend Guice&#8217;s <code>ServletModule</code></h2>
<p>In order to use constructor injection with servlets, Guice must construct your servlet instances. Thus, you no longer list each servlet in <em>web.xml</em>. Here is a simple module:</p>
<pre class="prettyprint">
public class MyServletModule extends ServletModule {
    @Override
    protected void configureServlets() {
        serve("/MyApp/GWT.rpc").with(GuiceRemoteServiceServlet.class);

        // cannot use @ImplementedBy
        bind(MyService.class).to(MyServiceImpl.class);
    }
}</pre>
<p>Go check out the Guice <a href="http://code.google.com/p/google-guice/wiki/ServletModule">ServletModule</a> documentation for a full explanation.</p>
<p>You cannot use @ImplementedBy on the <code>MyService</code> interface. That&#8217;s because <code>MyService</code> is in GWT client code, and the <code>MyServiceImpl</code> is in GWT server code. Instead, the binding is configured in <code>MyServletModule</code> as shown.</p>
<p>Remember &#8212; this replaces most of what you typically place in <em>web.xml</em>.</p>
<h2>Set all <code>RemoteService</code> relative paths to <em>GWT.rpc</em></h2>
<p>All of your GWT remote services will dispatch to the <code>GuiceRemoteServiceServlet</code> shown earlier.</p>
<pre class="prettyprint">
@RemoteServiceRelativePath("GWT.rpc")
public interface MyService extends RemoteService {
    ...
}</pre>
<h2>Create the web.xml</h2>
<p>In old-style GWT, you list your remote service implementations in the GWT module XML file (MyApp.gwt.xml). If you have any servlets listed there, you can remove them. Your GWT module should look something like this:</p>
<pre class="prettyprint">&lt;module rename-to='MyApp'&gt;
  &lt;inherits name='com.google.gwt.user.User'/&gt;
  etc...

  &lt;entry-point class='com.abc.whatever.client.MyEntryPoint'/&gt;
&lt;/module&gt;
</pre>
<p>Your <em>web.xml</em> should list the Guice filter and your custom Guice context listener.</p>
<pre class="prettyprint">

&lt;web-app>
  &lt;filter>
    &lt;filter-name>guiceFilter&lt;/filter-name>
    &lt;filter-class>com.google.inject.servlet.GuiceFilter&lt;/filter-class>
  &lt;/filter>

  &lt;filter-mapping>
    &lt;filter-name>guiceFilter&lt;/filter-name>
    &lt;url-pattern>/*&lt;/url-pattern>
  &lt;/filter-mapping>

  &lt;listener>
    &lt;listener-class>com.yourcompany.server.MyGuiceContextListener&lt;/listener-class>
  &lt;/listener>

  &lt;!-- NOTE: List all Servlets in MyServletModule for Guice injection -->

  &lt;welcome-file-list>
    &lt;welcome-file>Css.html&lt;/welcome-file>
  &lt;/welcome-file-list>
&lt;/web-app>
</pre>
<h2>Clean up Remote Service Implementations</h2>
<p>Your GWT remote service implementations do not have to extend <code>RemoteServiceServlet</code> any more.</p>
<p>Old code:</p>
<pre class="prettyprint">public class MyServiceImpl
    extends RemoteServiceServlet implements MyService {
  ...
}</pre>
<p>New code:</p>
<pre class="prettyprint">public class MyServiceImpl implements MyService {

  private final AnInterface anInterface;

  // Guice injection here!
  @Inject
  public MyServiceImpl(AnInterface anInterface) {
    this.anInterface = anInterface;
  }
  ...
}</pre>
<h2>Summary</h2>
<p>Once all of the above pieces are in place, you can use normal Guice dependency injection in all of your GWT remote service implementation classes. This includes both constructor and setter injection. </p>
<p>Please let me know if you find any mistakes, and I&#8217;ll be sure to update this article.</p>
<p><sup>1</sup> To use Guice with GWT client code, check out the <a href="http://code.google.com/p/google-gin/">GIN</a> project. (I have not tried GIN)</p>
<h3>Updates</h3>
<h4>Sep 17, 2009</h4>
<p>Changed: RPCRequest req = RPC.decodeRequest(payload);<br />
To this: RPCRequest req = RPC.decodeRequest(payload, null, this);</p>
]]></content:encoded>
			<wfw:commentRss>http://stuffthathappens.com/blog/2009/09/14/guice-with-gwt/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>JConsole and Java VisualVM Problems on Windows</title>
		<link>http://stuffthathappens.com/blog/2009/09/09/hsperfdata/</link>
		<comments>http://stuffthathappens.com/blog/2009/09/09/hsperfdata/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 13:09:21 +0000</pubDate>
		<dc:creator>Eric Burke</dc:creator>
				<category><![CDATA[Bugs]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://stuffthathappens.com/blog/?p=1376</guid>
		<description><![CDATA[I ran in to this problem again today, only I forgot that I had blogged about it in the past, so I had to research and find the solution a second time.
In summary, if JConsole or Java VisualVM aren&#8217;t able to connect to local processes, your %TMP%\hsperfdata_[username] directory needs to match the capitalization of your [...]]]></description>
			<content:encoded><![CDATA[<p>I ran in to <a href="http://stuffthathappens.com/blog/2008/12/16/visualvm-on-vista/">this problem</a> again today, only I forgot that I had <a href="http://stuffthathappens.com/blog/2008/12/16/visualvm-on-vista/">blogged about it in the past</a>, so I had to research and find the solution a second time.</p>
<p>In summary, if JConsole or Java VisualVM aren&#8217;t able to connect to local processes, your %TMP%\hsperfdata_[username] directory needs to match the capitalization of your Windows username. In my case, I renamed hsperfdata_eburke to hsperfdata_EBurke, solving the problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://stuffthathappens.com/blog/2009/09/09/hsperfdata/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>IDEA 9 Android Support</title>
		<link>http://stuffthathappens.com/blog/2009/09/07/idea-9-android-support/</link>
		<comments>http://stuffthathappens.com/blog/2009/09/07/idea-9-android-support/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 03:41:10 +0000</pubDate>
		<dc:creator>Eric Burke</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://stuffthathappens.com/blog/?p=1360</guid>
		<description><![CDATA[IDEA 9 Android support is looking good.
]]></description>
			<content:encoded><![CDATA[<p>IDEA 9 <a href="http://blogs.jetbrains.com/idea/tag/android/">Android support</a> is looking good.</p>
]]></content:encoded>
			<wfw:commentRss>http://stuffthathappens.com/blog/2009/09/07/idea-9-android-support/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Not a JComboBox Bug</title>
		<link>http://stuffthathappens.com/blog/2009/09/07/not-a-jcombobox-bug/</link>
		<comments>http://stuffthathappens.com/blog/2009/09/07/not-a-jcombobox-bug/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 02:29:00 +0000</pubDate>
		<dc:creator>Eric Burke</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Usability]]></category>

		<guid isPermaLink="false">http://stuffthathappens.com/blog/?p=1352</guid>
		<description><![CDATA[Here is a little Java program that creates a JComboBox with three identical &#8220;Green&#8221; items:
public class ComboDemo extends JFrame {
    public static void main(String... args) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
  [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a little Java program that creates a JComboBox with three identical &#8220;Green&#8221; items:</p>
<pre class="prettyprint">public class ComboDemo extends JFrame {
    public static void main(String... args) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                new ComboDemo().setVisible(true);
            }
        });
    }

    public ComboDemo() {
        super("Duplicates are Dumb");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        JComboBox combo = new JComboBox(new String[] {
                "Red", "Green", "Blue", "Green", "Yellow", "Green"
        });
        add(new JLabel("Choose your favorite color:"), BorderLayout.NORTH);
        add(combo, BorderLayout.SOUTH);
        pack();
    }
}</pre>
<p>As you can see, the user really has no way to know which &#8220;Green&#8221; is the correct selection:</p>
<p><img src="http://stuffthathappens.com/blog/wp-content/uploads/2009/09/combo1.png" alt="Combo with Duplicate Items" title="Combo with Duplicate Items" width="396" height="204" class="alignnone size-full wp-image-1354" /></p>
<p>Some people want to display multiple identical items in combo boxes. I&#8217;ve had customers ask me for this feature &#8212; and I refused. If memory serves correctly, they were having keyboard navigation problems because focus would get stuck on the first of the duplicate items. Their database contained duplicate descriptions, and they wanted me to fix the alleged focus &#8220;bug&#8221; in the combo box rather than eliminate the duplicate descriptions in the database. (eventually, reason prevailed and we made the descriptions unique).</p>
<p>This has even been <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4133743">reported as a bug</a>, and the ensuing comments are interesting to read. For example:</p>
<blockquote><p>Good God sun!!! Just because you dont&#8217; see why people would use the same string more than once in a JComboBox, it doesn&#8217;t mean that it isn&#8217;t need people like us!! Fix it please!!!</p></blockquote>
<p>Yikes&#8230;imagine a GUI with these choices:</p>
<p>a) Yes<br />
b) Yes<br />
c) No</p>
<p>Um&#8230;</p>
<p>Apple&#8217;s Swing implementation has an interesting approach. When you click on one of the identical items, they are all selected:</p>
<p><img src="http://stuffthathappens.com/blog/wp-content/uploads/2009/09/combo2.png" alt="Leopard Combo Selection" title="Leopard Combo Selection" width="421" height="210" class="alignnone size-full wp-image-1355" /></p>
<p>This seems like a reasonable way for JComboBox to behave when given unreasonable data.</p>
]]></content:encoded>
			<wfw:commentRss>http://stuffthathappens.com/blog/2009/09/07/not-a-jcombobox-bug/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>GWT IDE Selection</title>
		<link>http://stuffthathappens.com/blog/2009/08/26/gwt-ide-selection/</link>
		<comments>http://stuffthathappens.com/blog/2009/08/26/gwt-ide-selection/#comments</comments>
		<pubDate>Thu, 27 Aug 2009 02:28:47 +0000</pubDate>
		<dc:creator>Eric Burke</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Reviews]]></category>

		<guid isPermaLink="false">http://stuffthathappens.com/blog/?p=1327</guid>
		<description><![CDATA[I&#8217;m starting a new GWT project at work, so I wanted to select the best IDE for the job. I installed the very latest versions of these IDEs along with their respective GWT plugins:

Eclipse 3.5 (Galileo)
NetBeans 6.7
IDEA 8.1

I&#8217;ll warn you right now that this is not an in-depth review or comparison. I looked just deep [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m starting a new GWT project at work, so I wanted to select the best IDE for the job. I installed the very latest versions of these IDEs along with their respective GWT plugins:</p>
<ul>
<li>Eclipse 3.5 (Galileo)</li>
<li>NetBeans 6.7</li>
<li>IDEA 8.1</li>
</ul>
<p>I&#8217;ll warn you right now that this is not an in-depth review or comparison. I looked just deep enough to satisfy my own curiosity and to choose a tool for my own coding.</p>
<h2>Eclipse</h2>
<p>Eclipse has an advantage in that Google supplies the <a href="http://code.google.com/appengine/docs/java/tools/eclipse.html">Google Plugin for Eclipse</a>, ensuring the plugin generates the exact same directory layout as the GWT command line tools. After installing Eclipse and the plugin, I generated a sample GWT project and it ran perfectly in hosted mode.</p>
<p>This is where things went badly, however. As you may know, GWT services consist of two interfaces and a class:</p>
<ul>
<li>MyService</li>
<li>MyServiceAsync</li>
<li>MyServiceImpl</li>
</ul>
<p>For my first (and only) trick, I performed a Rename refactoring on <em>MyService</em>. Eclipse renamed that interface, but not the other interface or implementation class. Instead, Eclipse immediately lit up with errors, forcing me to manually rename the Async interface and Impl class. Epic fail.</p>
<h2>NetBeans</h2>
<p>NetBeans also supports GWT through the <a href="https://gwt4nb.dev.java.net/">gwt4nb</a> plugin. I generated a project and noted it creates a slightly different directory layout, but nothing that would introduce problems.</p>
<p>Like Eclipse, NetBeans failed the Rename refactoring test. Unlike Eclipse, however, NetBeans did not immediately indicate errors in the mismatched class and interface names. Thus, errors would only manifest later at runtime. I gave up very quickly.</p>
<h2>IDEA</h2>
<p>Unlike the other two IDEs, IDEA&#8217;s plugin does not yet support the new directory layout introduced in GWT 1.6. I initially assumed this would be a big problem, since you also see deprecation warnings when you launch your app in hosted mode.</p>
<p>In reality, however, the directory layout differences only manifest themselves in the output directories. The source directories are the same, so a simple Ant buildfile can produce a more standard GWT 1.7 WAR-style layout.</p>
<p>Of the three IDEs, IDEA is the only one to properly implement the Rename refactoring. When you rename your Service interface, the other interface and class both rename in unison.</p>
<p>Also, IDEA does a kick-ass job of keeping  CSS styles in sync with styles referenced in GWT code. As I discovered today, when I define a style name in Java code, IDEA shows it in red and can automatically insert a new style class into my CSS file. I also refactored a &lt;div> identifier in my HTML file, and IDEA correctly refactored the String reference in the Java source code!</p>
<h2>Conclusion</h2>
<p>I&#8217;ve used IDEA for years, and was initially put off by the fact that IDEA 8.1 does not yet fully support the new GWT 1.6 and 1.7 directory layout. In practice, this is a non-issue, and IDEA 9 will support the latest GWT conventions. IDEA&#8217;s first rate refactoring, along with tight integration with CSS classes and HTML identifiers really set it apart from the other IDEs.</p>
]]></content:encoded>
			<wfw:commentRss>http://stuffthathappens.com/blog/2009/08/26/gwt-ide-selection/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Ominous New Direction for Java?</title>
		<link>http://stuffthathappens.com/blog/2009/05/29/ominous-new-direction-for-java/</link>
		<comments>http://stuffthathappens.com/blog/2009/05/29/ominous-new-direction-for-java/#comments</comments>
		<pubDate>Fri, 29 May 2009 14:22:54 +0000</pubDate>
		<dc:creator>Eric Burke</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://stuffthathappens.com/blog/?p=1215</guid>
		<description><![CDATA[Java SE 6 Update 14 (gotta love those names) is now available. According to the release notes, a new &#8220;Garbage First (G1) Garbage Collector&#8221; is enabled. To use it:
-XX:+UnlockExperimentalVMOptions -XX:+UseG1GC
Do so with caution, however. As @kimchy noted on Twitter, the release notes include this statement:
Although G1 is available for use in this release, note that [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://java.sun.com/javase/6/webnotes/6u14.html">Java SE 6 Update 14</a> (gotta love those names) is now available. According to the release notes, a new &#8220;Garbage First (G1) Garbage Collector&#8221; is enabled. To use it:</p>
<pre>-XX:+UnlockExperimentalVMOptions -XX:+UseG1GC</pre>
<p>Do so with caution, however. As <a href="http://twitter.com/kimchy/statuses/1957697906">@kimchy noted</a> on Twitter, the <a href="http://java.sun.com/javase/6/webnotes/6u14.html">release notes</a> include this statement:</p>
<blockquote><p>Although G1 is available for use in this release, note that production use of G1 is only permitted where a Java support contract has been purchased.</p></blockquote>
<p>What do you think?</p>
]]></content:encoded>
			<wfw:commentRss>http://stuffthathappens.com/blog/2009/05/29/ominous-new-direction-for-java/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Setting Java Version on Leopard</title>
		<link>http://stuffthathappens.com/blog/2009/05/23/setting-java-version-on-leopard/</link>
		<comments>http://stuffthathappens.com/blog/2009/05/23/setting-java-version-on-leopard/#comments</comments>
		<pubDate>Sat, 23 May 2009 16:40:36 +0000</pubDate>
		<dc:creator>Eric Burke</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://stuffthathappens.com/blog/?p=1194</guid>
		<description><![CDATA[Today I learned something new about Leopard. On the command line, my default JDK was 1.5. I was about to edit a symlink under /System/Library/Frameworks/JavaVM.framework/Versions to change to 1.6, but instead learned about the Java Preferences app.
In Spotlight, find &#8220;Java Preferences&#8221; and launch it. Or, find it directly under Applications/Utilities/Java. It looks like this:

Just drag [...]]]></description>
			<content:encoded><![CDATA[<p>Today I learned something new about Leopard. On the command line, my default JDK was 1.5. I was about to edit a symlink under /System/Library/Frameworks/JavaVM.framework/Versions to change to 1.6, but instead learned about the Java Preferences app.</p>
<p>In Spotlight, find &#8220;Java Preferences&#8221; and launch it. Or, find it directly under Applications/Utilities/Java. It looks like this:</p>
<p><img src="http://stuffthathappens.com/blog/wp-content/uploads/2009/05/java_prefs.png" alt="Java Preferences" title="Java Preferences" /></p>
<p>Just drag and drop to rearrange items in the lists. The JDK at the top of the list becomes your default.</p>
<h2>Ant</h2>
<p>While this worked, Ant still used the old Java 1.5. I fixed this by adding a line to ~/.bash_profile:</p>
<p><code>export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home</code></p>
]]></content:encoded>
			<wfw:commentRss>http://stuffthathappens.com/blog/2009/05/23/setting-java-version-on-leopard/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.380 seconds -->

