Tuesday, September 22, 2009

Webinar: Simplifying Desktop Development with Glimmer


Simplifying Desktop Development with Glimmer




Programming SWT/JFace user-interfaces in Java often involves a lot of repetitive boiler-plate code that is overly verbose and hard to map to the user-interface visually. This can significantly hinder maintainability and productivity for Eclipse RCP projects.

Enter Glimmer; a JRuby API for SWT that takes advantage of the expressive Ruby language to provide a simple user-interface DSL (domain-specific language). Developers can rely on Glimmer to build the presentation layer of desktop applications in Ruby while keeping the business logic in Java, or alternatively do complete desktop application development in Ruby. Glimmer comes with built-in data-binding support to greatly facilitate writing maintainable and testable desktop application code.

In this webinar, I will introduce Glimmer, demo the latest features by contrasting the code of an application written in both Glimmer and classic SWT, provide a quick update on the status of the project and finally, have a Q&A and feedback session.

Total running time will be approximately 1 hour

9:00 am PDT / 12:00 pm EDT / 4:00 pm GMT - Convert to other time zones


hadenp said...

Hey Andy,

Glimmer looks fantastic! As a first try I'm modifying Contact Manager, to load @contacts[] from a database(activerecord-jdbcsqlite3-adapter). When I run it (Jruby -w) I get...
"Processing method: text and args: ["Contact Manager"]
java.lang.ClassNotFoundException: org.eclipse.swt.Table"
Is this a name conflict with another Table and if so how can I resolve it?

Annas "Andy" Maleh said...

No, this is pretty much the SWT table used in the Contact Manager application. This error happens if you do not have SWT installed correctly. Refer to the README file for instructions on how to install SWT if you have not already.

Did you run the program successfully before modifying Contact Manager to load a database? Make sure it runs fine in its original form first.

If you encounter an error again, please post a stack trace (or the top 10 entries at least)?

hadenp said...

Thanks for responding. Yes, I ran Contact_Manager successfully before attempting to modify it.

Here's the modified Contact_Repository (excerpt) and below it the error I get(w/o -w flag). Hope I'm not bothering you with something obvious that I'm doing wrong...

require 'rubygems'
require 'active_record'
gem 'activerecord-jdbcsqlite3-adapter'
require 'yaml'

require File.dirname(__FILE__) + "/contact"

class ContactRepository

def initialize
@connections = YAML.load_file("database.yml")
stmt = "select first_name, last_name, email from contacts"
@val = ActiveRecord::Base.connection.select_all(stmt)
@contacts = []

@val.each do |c|
#puts "@val= #{c["first_name"]} #{c["last_name"]} #{c["email"]}"
@map = {:first_name => c["first_name"], :last_name => c["last_name"], :email => c["email"] }
#puts "@map= #{@map}"
@contacts << Contact.new( @map )
# @contacts = [
# Contact.new(:first_name => "Anne", :last_name => "Sweeney", :email => "anne@sweeny.com"),
# Contact.new(:first_name => "Beatrice", :last_name => "Jung", :email => "beatrice@jung.com"),
# Contact.new(:first_name => "Frank", :last_name => "Deelio", :email => "frank@deelio.com"),
# Contact.new(:first_name => "franky", :last_name => "miller", :email => "frank@miller.com"),
# ]
Here's the error...

C:\gui\samples\contactmanager>jruby contact_manager.rb
c:/jruby/lib/ruby/gems/1.8/gems/facets-2.8.1/lib/core/facets/kernel/here.rb:9 warning: `binding' should not be aliased

Loading command handlers for DSL: swt
@val= Fred Apple fredapple@ma.com
@map= first_nameFredlast_nameAppleemailfredapple@ma.com
@val= Joe Napolitano joeynap@yahoo.com
@map= first_nameJoelast_nameNapolitanoemailjoeynap@yahoo.com
@val= Alice Laring alice.laring@gmail.com
@map= first_nameAlicelast_nameLaringemailalice.laring@gmail.com

Processing method: shell and args: []

ShellCommandHandler will handle command: shell with arguments []

Processing method: text and args: ["Contact Manager"]
c:/jruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/string/output_safety.rb:25:in `add_with_
safety': can't convert nil into String (TypeError)
from ./../../src/command_handlers/models/r_widget.rb:55:in `respond_to?'
from ./../../src/command_handlers/widget_method_command_handler.rb:19:in `can_handle?'
from ./../../src/command_handler_chain_link.rb:20:in `handle'
from ./../../src/command_handler_chain_link.rb:24:in `handle'
from ./../../src/glimmer.rb:29:in `method_missing'
from ./../../src/glimmer.rb:41:in `method_missing'
from contact_manager.rb:29
from ./../../src/command_handlers/models/r_widget.rb:144:in `call'
from ./../../src/command_handlers/models/r_widget.rb:144:in `process_block'
from ./../../src/glimmer.rb:36:in `add_contents'
from ./../../src/glimmer.rb:30:in `method_missing'
from ./../../src/glimmer.rb:41:in `method_missing'
from contact_manager.rb:28

Annas "Andy" Maleh said...

Thanks for the extra information. Since this thread of discussion is growing and there is a lot of information involved, I posted it on the Glimmer Eclipse Newsgroup:

Let's continue the discussion over there as that makes it easier for others to find it in the future if they encounter similar issues.

hadenp said...

That makes sense.

I posted on the JRuby forum yesterday
and one response may be useful so I'll pass it on to you.