InfoQ

News

Glimmer - using JRuby and SWT for Eclipse RCP apps

Posted by Werner Schuster on Feb 19, 2008 01:00 PM

Community
Java,
Ruby
Topics
Domain Specific Languages ,
Rich Client / Desktop ,
JRuby ,
Scripting
Tags
SWT ,
Eclipse ,
GUI ,
JRuby
JRuby allows to use Java's GUI libraries, which has already led to a host of different approaches to JRuby GUI APIs. Glimmer is a new library that uses the SWT toolkit.

We caught up with Andy Maleh, the creator of Glimmer to see what the project is about and where it'll go. Andy explains the design principles behind Glimmer:
The initial goal behind Glimmer was to facilitate desktop application development with Ruby by relying on a robust platform-independent UI technology. Eclipse SWT happened to fill that role, so it was reused through the JRuby implementation of Ruby.
Glimmer's API was designed with the following principles in mind:
  • Concise and DRY
  • Asks for minimum info needed to accomplish task
  • Convention over configuration
  • As predictable as possible for existing SWT developers

Additionally, the API is being designed to take advantage of every language technique available in Ruby that will ease desktop application development. Builder-style syntax happens to be one of these techniques, so it was utilized to allow developers to author desktop user-interfaces in a similar fashion to how they would author web user-interfaces with HTML. That is by writing code that visually maps to how the user-interface will look like once rendered.
Nonetheless, Glimmer's goals do go beyond providing a Builder-style syntax. For example, Glimmer comes with built-in data-binding support and smart customizable defaults. [..]
Glimmer is not only minimalistic in its syntax, but also in its architecture. It was designed to be very easy to extend, without requiring developers to hard-code every keyword they would like to contribute to the syntax. This is in fact the reason why Glimmer supports 3rd party widgets out of the box.
JFace is a layer of useful components built on top of the basic SWT widgets, among others. Glimmer also supports these:
Glimmer does currently work with JFace widgets. In fact, it supports any custom SWT/JFace widget as long as it has a (parent, style) constructor.
Glimmer can also be utilized to build RCP UI components such as views and editors. [..] As I started developing data-binding support for Glimmer, I did consider reusing the JFace Data-Binding framework. However, the latest API requires calling statically typed methods, which do not fit well with Ruby's dynamic nature, so it seemed simpler to develop data-binding support in Ruby from scratch.
Learn more about Glimmer's data binding approach.

One important aspect of GUI libraries is the layout of components, which is also addressed by Glimmer:
Glimmer currently has smart defaults for laying out composite widgets, such as Shell, Composite, and Group. When declaring a Composite for example, the layout automatically defaults to the commonly used GridLayout. Still, consumers of the API can change the defaults when the need arises.
Asked for existing features and future plans for Glimmer, Andy explains:
Glimmer currently supports:
  • Rendering of SWT and JFace widgets with predefined smart defaults for commonly used widgets, such as Shell, Composite, Group, Text, Button, Spinner, and Label
  • Data-binding of Text, Spinner, Check-box Button, Radio Button, and Table
  • Ability to extend syntax by writing command handlers for newly contributed keywords
In the near future, Glimmer will provide data-binding support for other widgets, such as Tree, Combo, and List, and smart defaults for the rest of the widgets in SWT and JFace.
Future plans include:
  • Exploring ideas on how to ease RCP development
  • Augmenting Rails with Ajax component support when SWT starts supporting Ajax widgets.
Glimmer has been proposed as an Eclipse project. Andy explains the reasoning behind it:
There were several incentives behind creating an Eclipse project:
  • Improve Glimmer's robustness and reliance on Eclipse technologies through the help of the Eclipse community
  • Get exposure and feedback from veteran Eclipse developers
  • Gain broader publicity, recognition, and support
While the GUI DSL is a good first step in easing Eclipse development with Ruby, it might just be the tip of the iceberg. Future plans do include exploring ideas on how to simplify RCP development, and creating Eclipse plugins from JRuby scripts may actually be one of them.
I have not given much thought yet to current problem areas in plug-in development, but two areas that could potentially benefit from Ruby's expressive syntax are definition of extension points and configuration/integration of plug-ins.
What about Scala or Groovy? by Matthias Lübken Posted Feb 20, 2008 3:08 AM
Re: What about Scala or Groovy? by Guillaume Laforge Posted Feb 20, 2008 5:33 AM
Re: What about Scala or Groovy? by Andy Maleh Posted Feb 20, 2008 12:41 PM
  1. Back to top

    What about Scala or Groovy?

    Feb 20, 2008 3:08 AM by Matthias Lübken

    This was asked in the newsgroup already: Does Glimmer depend in JRuby? And what about other languages like Scala and Groovy?

  2. Back to top

    Re: What about Scala or Groovy?

    Feb 20, 2008 5:33 AM by Guillaume Laforge

    Actually, Groovy has had a dedicated SWT UI builder for quite a long while. This concept of builder was pioneered by the Groovy project back in 2003 and has evolved quite a lot, especially with the Swing builder, but a similar work was done around SWT with the aforementioned builder. This additional Groovy module hasn't been updated for a while, so perhaps it's not up-to-date with the latest Eclipse runtime (was built against 3.2.1), but if there's enough interest, it can definitely be updated.

  3. Back to top

    Re: What about Scala or Groovy?

    Feb 20, 2008 12:41 PM by Andy Maleh

    The Eclipse proposal has Ruby as the language for Glimmer. I have been wanting to try out something similar in Scala however. If I do, I will post something on my blog about it.

Educational Content

Bindings, Platforms, and Innovation

This presentation focuses on the Internet and separating myth from fact, history from the future, and the mundane from the imaginative. Bob Frankston presents a vision of what could and should be.

Orchestrating Long Running Activities with JBoss / JBPM

This article explores the use of JBoss and jBPM to implement design solutions that effectively address the issue of orchestrating long running activities.

Neo4j - The Benefits of Graph Databases

This presentation covers the use of graph databases as an optimal solution for data that is difficult to fit in static tables, rapidly evolving data or data that has a lot of optional attributes.

Realistic about Risk: Software development with Real Options

This session introduces Real Options and shows how it can help in running your project. Real Options is a decision-making process that can be used to manage risk.

Communication Flexibility Using Bindings

This article discusses the use of bindings on services and references (including the instance of non-configured bindings) as the means to implement SCA communications in a Web and SOA environment.

Writing DSLs in Groovy

After a short introduction to DSLs, Scott Davis plays with the keyboard showing how to approach the creation of a DSL by typing working snippets of Groovy code that get executed.

Scaling Agile with C/ALM (Collaborative Application Lifecycle Management)

IBM Rational and InfoQ present, Scaling Agile with C/ALM, an eBook showing organizations how to become “finely tuned software delivery machines” by enabling team integration and scaling.

Concurrent Programming with Microsoft F#

Amanda Laucher presents a real life enterprise application written in F#. She shows actual code snippets, explaining design decisions and suggesting how to use some of the F# constructs.