Spring Rich Client Browser Launcher

Ryan Sonnek bio photo By Ryan Sonnek

I’ve been debating the best avenue for client apps to present help information to users. The client applications I’ve written for shard are built on Spring Rich Client, which has built in support for JHelp resources. Now, maybe I’m missing something, but working with JHelp has been anything but helpful. That’s why I’ve decided to take a new direction to leverage the shard project wiki for user help documentation. This feels like a perfect use of a wiki, and users never have to worry about “out of date” documentation.

I’ve rolled my own browser launcher for previous projects, but this time, I’m using the opensource BareBonesBrowserLauncher. It’s a lightweight version (~50 LOC) of the more robust BrowserLauncher2 library and it’s worth a shot until my requirements get more complex.

Here’s a snapshot of the code, and the complete source can be found as part of the shard project.

public class BrowserLauncherCommand extends ApplicationWindowAwareCommand {
  private String url;

  protected void doExecuteCommand() {
    new BareBonesBrowserLauncher().openURL(url);
  }

  public String getUrl() {
    return url;
  }

  public void setUrl(String url) {
    this.url = url;
  }
}

The Spring configuration is just a drop in replacement for the default HelpContentsCommand

<bean id="helpContentsCommand"
class="com.codecrate.shard.ui.command.BrowserLauncherCommand">
<property name="url">
<value>http://wiki.codecrate.com/display/SHA/User+Guide</value>
</property>
</bean>

This is another component could be useful to other spring-rich applications. Anyone interested in integrating this into the core? There are no external dependencies, so there shouldn’t be too much fuss over allowing it in.