README.markdown in glimmer-0.1.9.470 vs README.markdown in glimmer-0.1.10.470

- old
+ new

@@ -16,19 +16,38 @@ text "Hello World!" } }.open ``` +## Resources + +* [Eclipse Zone Tutorial](http://eclipse.dzone.com/articles/an-introduction-glimmer) +* [InfoQ Article](http://www.infoq.com/news/2008/02/glimmer-jruby-swt) +* [RubyConf 2008 Video](https://confreaks.tv/videos/rubyconf2008-desktop-development-with-glimmer) +* [Code Blog](http://andymaleh.blogspot.com/search/label/Glimmer) + +## Pre-requisites + +JRuby 9.2.9.0 (supporting Ruby 2.5.0 syntax) + +Easiest way to obtain is through [RVM](http://rvm.io) + +With RVM installed on your system, please run this command to install JRuby: + +```bash +rvm install jruby-9.2.9.0 +``` + ## Setup Please follow these instructions to make the `glimmer` command available on your system. ### Option 1: Bundler Add the following to `Gemfile`: ``` -gem 'glimmer', '~> 0.1.9.470' +gem 'glimmer', '~> 0.1.10.470' ``` And, then run: ``` bundle install @@ -36,31 +55,73 @@ ### Option 2: Direct RubyGem Run this command to get directly: ``` -gem install glimmer -v 0.1.9.470 +gem install glimmer -v 0.1.10.470 ``` ## Usage -Usage: `glimmer [--setup] [application_ruby_file_path.rb]` +Usage: +``` +glimmer [--setup] [application_ruby_file_path.rb] +``` -Example 1: `glimmer hello_combo.rb` -This runs the Glimmer application hello_combo.rb -If the SWT Jar is missing, it downloads it and sets it up first. +Example 1: +``` +glimmer hello_combo.rb +``` +This runs the Glimmer application `hello_combo.rb` (if the SWT Jar is missing, it downloads it and sets it up first.) -Example 2: `glimmer --setup hello_combo.rb` -This performs setup and then runs the Glimmer application hello_combo.rb -It downloads and sets up the SWT jar whether missing or not. +Example 2: +``` +glimmer --setup hello_combo.rb +``` +This performs setup and then runs the Glimmer application `hello_combo.rb` (downloads and sets up the SWT jar whether present or not) -Example 3: `glimmer --setup` -This downloads and sets up the SWT jar whether missing or not. +Example 3: +``` +glimmer --setup +``` +This just downloads and sets up the SWT jar even if already present. +## Syntax + +Check out the SWT library API for a list of available widgets: +https://help.eclipse.org/oxygen/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fswt%2Fwidgets%2Fpackage-summary.html + +In Glimmer DSL, SWT widgets are declared with lowercase underscored naming. + +Widget examples: +- `button` for `org.eclipse.swt.widgets.Button` +- `label` for `org.eclipse.swt.widgets.Label` +- `table_column` for `org.eclipse.swt.widgets.TableColumn` + +The `shell` widget is always the outermost widget containing all others in a desktop windowed application. + +Widget properties may be set with methods matching their names in lower snakecase. + +Widget property examples: +- `text` to set text value of a `label` +- `gridData` to set grid data of a `composite` + +Data-binding is done with `bind` command following widget property to bind and taking model and bindable attribute as arguments. + +Data-binding examples: +- `text bind(contact, :first_name)` +- `text bind(contact, :name, computed_by: [:first_name, :last_name])` + +The first example binds the text property of a widget like `label` to the first name of a contact model. + +The second example demonstrates computed value data binding whereby the value of `name` depends on changes to both `first_name` and `last_name` + +You may learn more about Glimmer's syntax by reading the Eclipse Zone Tutorial mentioned in resources and opening up the samples under the `samples` folder. + ## Girb (Glimmer irb) -You may run girb instead of standard irb to have SWT preloaded and the Glimmer required and included for quick Glimmer coding/testing. +With Glimmer installed, you may run want to run `girb` instead of standard `irb` to have SWT preloaded and the Glimmer library required and included for quick Glimmer coding/testing. ## Samples Check the "samples" folder for examples on how to write Glimmer applications. @@ -94,36 +155,39 @@ D, [2017-07-21T19:23:12.878798 #35707] DEBUG -- : widget styles are: [:multi] ``` ## Mac Support -In order to run Glimmer on the Mac, you need to pass an extra option to JRuby. For example: +Mac is well supported with the `glimmer` command. + +If there is a reason to use the raw jruby command on the Mac, you need to pass an extra option to JRuby. For example: `jruby -J-XstartOnFirstThread samples/hello_world.rb` +## Windows Support + +Windows is supported by JRuby and the Eclipse SWT library Glimmer runs on. However, the `glimmer` command has not been confirmed to be working on Windows yet. Please feel free to share experiences and provide help in ensuring support for Windows. + +## Linux Support + +Same as Windows + ## Contributing to Glimmer Please follow these instructions if you would like to help us develop Glimmer: 1. Download and extract the ["SWT binary and source"](http://download.eclipse.org/eclipse/downloads/drops4/R-4.7-201706120950/#SWT). 2. Add swt.jar to your Java CLASSPATH environment (e.g. `export CLASSPATH="$CLASSPATH:/path_to_swt_jar/swt.jar"`) -3. Download and setup jRuby 1.5.6 (`rvm install jruby-9.1.12.0`) +3. Download and setup jRuby 1.5.6 (`rvm install jruby-9.2.9.0`) 4. Install bundler (gem install bundler) 5. Install project required gems (bundle install) 6. Write a program that requires the file "lib/glimmer.rb" (or glimmer gem) and has the UI class (view) include the Glimmer module 7. Run your program with `bin/glimmer` or jruby (pass `-J-XstartOnFirstThread` option if on the Mac) -## Resources - -* [Eclipse Zone Tutorial](http://eclipse.dzone.com/articles/an-introduction-glimmer) -* [InfoQ Article](http://www.infoq.com/news/2008/02/glimmer-jruby-swt) -* [RubyConf 2008 Video](http://rubyconf2008.confreaks.com/desktop-development-with-glimmer.html) -* [Code Painter Blog](http://andymaleh.blogspot.com/search/label/Glimmer) - ## Contributors * Annas "Andy" Al Maleh (Founder) * Dennis Theisen ## License -Copyright (c) 2007-2017 Annas Al Maleh. +Copyright (c) 2007-2019 Annas "Andy" Al Maleh. See LICENSE.txt for further details.