Monkeybars: Swing Development for (J)Ruby
Author: ceefour | Filed under: GUI, JRuby, Ruby, ToolsMonkeybars is a library that enables you to make use of Swing from JRuby.
Monkeybars aims to allow you to continue using the GUI editing tools you are used to but makes it easy to write all your application logic in pure Ruby. In fact, with most editors you’ll never even have to look at Java code.
Monkeybars was created from a pretty specific need. Rising Tide Software company was working on a large Swing application and wanted to be able to easily write all the logic in Ruby via JRuby. The initial attempts laid the groundwork for what was to become Monkeybars. Monkeybars has an emphasis on using normal Swing development tools (using Netbeans 6) and especially the ability to sit down with a client and use a visual designer to create the Swing layouts.
To this end, Monkeybars is designed to reach in and integrate itself with a Java class without any special consideration on the Java side. This means Monkeybars should work with Java code emitted from any Swing form designer, we don’t parse the code directly so there is no issue with code formatting or code conventions used inside the class.
Want to set up mouse event listeners on all elements in your form?
add_listener :type => :mouseOr how about declaring that only the components okButton and cancelButton should get mouse events?
add_listener :type => :mouse, :components => ["okButton", "cancelButton"]
Testing
A second important consideration for us was testability. Our early attempts to create a Ruby interface to Swing left us with brittle, difficult to test code. Therefore in Monkeybars we implemented a stark separation between controller and view. All* communication between the two is accomplished via a model which is just a plain Ruby class. This keeps your controllers much more testable. The views also are typically smaller and much easier to test, only being concerned with their methods to convert data from and back into the model.
For further details visit: Monkeybars project page
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.