glimmer 0.7.7 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +288 -141
  4. data/VERSION +1 -1
  5. data/lib/glimmer.rb +0 -20
  6. data/lib/glimmer/config.rb +0 -13
  7. data/lib/glimmer/dsl/engine.rb +25 -18
  8. data/lib/glimmer/dsl/expression.rb +0 -7
  9. data/lib/glimmer/dsl/static_expression.rb +2 -2
  10. metadata +48 -171
  11. data/RUBY_VERSION +0 -1
  12. data/bin/girb +0 -10
  13. data/bin/girb_runner.rb +0 -13
  14. data/bin/glimmer +0 -5
  15. data/icons/scaffold_app.icns +0 -0
  16. data/lib/glimmer/css/rule.rb +0 -25
  17. data/lib/glimmer/css/style_sheet.rb +0 -19
  18. data/lib/glimmer/data_binding/list_selection_binding.rb +0 -52
  19. data/lib/glimmer/data_binding/model_binding.rb +0 -248
  20. data/lib/glimmer/data_binding/observable.rb +0 -21
  21. data/lib/glimmer/data_binding/observable_array.rb +0 -107
  22. data/lib/glimmer/data_binding/observable_model.rb +0 -108
  23. data/lib/glimmer/data_binding/observable_widget.rb +0 -17
  24. data/lib/glimmer/data_binding/observer.rb +0 -124
  25. data/lib/glimmer/data_binding/shine.rb +0 -23
  26. data/lib/glimmer/data_binding/table_items_binding.rb +0 -47
  27. data/lib/glimmer/data_binding/tree_items_binding.rb +0 -71
  28. data/lib/glimmer/data_binding/widget_binding.rb +0 -33
  29. data/lib/glimmer/dsl/css/css_expression.rb +0 -21
  30. data/lib/glimmer/dsl/css/dsl.rb +0 -10
  31. data/lib/glimmer/dsl/css/dynamic_property_expression.rb +0 -12
  32. data/lib/glimmer/dsl/css/property_expression.rb +0 -22
  33. data/lib/glimmer/dsl/css/pv_expression.rb +0 -17
  34. data/lib/glimmer/dsl/css/rule_expression.rb +0 -25
  35. data/lib/glimmer/dsl/css/s_expression.rb +0 -26
  36. data/lib/glimmer/dsl/swt/async_exec_expression.rb +0 -14
  37. data/lib/glimmer/dsl/swt/bind_expression.rb +0 -37
  38. data/lib/glimmer/dsl/swt/color_expression.rb +0 -19
  39. data/lib/glimmer/dsl/swt/column_properties_expression.rb +0 -24
  40. data/lib/glimmer/dsl/swt/combo_selection_data_binding_expression.rb +0 -42
  41. data/lib/glimmer/dsl/swt/custom_widget_expression.rb +0 -36
  42. data/lib/glimmer/dsl/swt/data_binding_expression.rb +0 -34
  43. data/lib/glimmer/dsl/swt/display_expression.rb +0 -19
  44. data/lib/glimmer/dsl/swt/dsl.rb +0 -28
  45. data/lib/glimmer/dsl/swt/exec_expression.rb +0 -28
  46. data/lib/glimmer/dsl/swt/layout_data_expression.rb +0 -25
  47. data/lib/glimmer/dsl/swt/layout_expression.rb +0 -27
  48. data/lib/glimmer/dsl/swt/list_selection_data_binding_expression.rb +0 -44
  49. data/lib/glimmer/dsl/swt/menu_bar_expression.rb +0 -33
  50. data/lib/glimmer/dsl/swt/menu_expression.rb +0 -32
  51. data/lib/glimmer/dsl/swt/observe_expression.rb +0 -32
  52. data/lib/glimmer/dsl/swt/property_expression.rb +0 -22
  53. data/lib/glimmer/dsl/swt/rgb_expression.rb +0 -12
  54. data/lib/glimmer/dsl/swt/rgba_expression.rb +0 -12
  55. data/lib/glimmer/dsl/swt/shell_expression.rb +0 -25
  56. data/lib/glimmer/dsl/swt/swt_expression.rb +0 -25
  57. data/lib/glimmer/dsl/swt/sync_exec_expression.rb +0 -15
  58. data/lib/glimmer/dsl/swt/tab_item_expression.rb +0 -33
  59. data/lib/glimmer/dsl/swt/table_items_data_binding_expression.rb +0 -31
  60. data/lib/glimmer/dsl/swt/tree_items_data_binding_expression.rb +0 -31
  61. data/lib/glimmer/dsl/swt/tree_properties_expression.rb +0 -26
  62. data/lib/glimmer/dsl/swt/widget_expression.rb +0 -34
  63. data/lib/glimmer/dsl/swt/widget_listener_expression.rb +0 -32
  64. data/lib/glimmer/dsl/xml/dsl.rb +0 -11
  65. data/lib/glimmer/dsl/xml/html_expression.rb +0 -25
  66. data/lib/glimmer/dsl/xml/meta_expression.rb +0 -23
  67. data/lib/glimmer/dsl/xml/name_space_expression.rb +0 -37
  68. data/lib/glimmer/dsl/xml/node_parent_expression.rb +0 -33
  69. data/lib/glimmer/dsl/xml/tag_expression.rb +0 -29
  70. data/lib/glimmer/dsl/xml/text_expression.rb +0 -22
  71. data/lib/glimmer/dsl/xml/xml_expression.rb +0 -21
  72. data/lib/glimmer/launcher.rb +0 -196
  73. data/lib/glimmer/package.rb +0 -7
  74. data/lib/glimmer/rake_task.rb +0 -89
  75. data/lib/glimmer/scaffold.rb +0 -478
  76. data/lib/glimmer/swt/color_proxy.rb +0 -53
  77. data/lib/glimmer/swt/display_proxy.rb +0 -74
  78. data/lib/glimmer/swt/font_proxy.rb +0 -72
  79. data/lib/glimmer/swt/layout_data_proxy.rb +0 -84
  80. data/lib/glimmer/swt/layout_proxy.rb +0 -82
  81. data/lib/glimmer/swt/menu_proxy.rb +0 -84
  82. data/lib/glimmer/swt/packages.rb +0 -13
  83. data/lib/glimmer/swt/shell_proxy.rb +0 -170
  84. data/lib/glimmer/swt/swt_proxy.rb +0 -106
  85. data/lib/glimmer/swt/tab_item_proxy.rb +0 -65
  86. data/lib/glimmer/swt/tree_proxy.rb +0 -120
  87. data/lib/glimmer/swt/widget_listener_proxy.rb +0 -34
  88. data/lib/glimmer/swt/widget_proxy.rb +0 -489
  89. data/lib/glimmer/ui/custom_shell.rb +0 -45
  90. data/lib/glimmer/ui/custom_widget.rb +0 -241
  91. data/lib/glimmer/util/proc_tracker.rb +0 -16
  92. data/lib/glimmer/xml/depth_first_search_iterator.rb +0 -22
  93. data/lib/glimmer/xml/name_space_visitor.rb +0 -21
  94. data/lib/glimmer/xml/node.rb +0 -75
  95. data/lib/glimmer/xml/node_visitor.rb +0 -13
  96. data/lib/glimmer/xml/xml_visitor.rb +0 -65
  97. data/vendor/swt/linux/swt.jar +0 -0
  98. data/vendor/swt/mac/swt.jar +0 -0
  99. data/vendor/swt/windows/swt.jar +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 76d86f5e3e322edba85aee815e28a0bb19b6ed56694ff44b1311a759b249b189
4
- data.tar.gz: ad84ddf98c7a9da150f1dd4897e7a7df0e7d8cf06d317a1a748929c1446895ce
3
+ metadata.gz: c109cca015308e3a388d79b30ece439200ebf53d300cb2305be5c7a3845790eb
4
+ data.tar.gz: ad27543079db9eabface83fdf67342dabe37b1b01ba64e03c545bb1bea08158b
5
5
  SHA512:
6
- metadata.gz: dbbd46186a07700fed156566a5a0de4fb5ad90720ae2e24eb0662bc1ef3a64850f29d4f91fa577f388136511e3ec20689a97e1686e25f34112fabf35c05c2981
7
- data.tar.gz: f484803847e17525090f815ea117d429f10abc87f12a5c38343c9d6e2f56ff6bf055b153f5fa3f250ae60adde2b5ff4cba7b209b0b1693bc98d0f619cc1d15db
6
+ metadata.gz: ccdd49212a55e8ee6a91ae603314e926dfc8944c2b972e2fbf3e387b01020c6b9cdd5eeb28155f5b305f5f517e488414c01fc1f5cdec46372a34c41e467dff15
7
+ data.tar.gz: c19d423a2cf484f6749072e38e1f0608395420e2a44960672a5c9620867431ebae6d12e2015f8bf398bc6d565e0a8e661f86225880d42a7fd699146c9c65c342
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011 Andy Maleh
1
+ Copyright (c) 2011-2020 Andy Maleh
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
- # Glimmer 0.7.7 Beta (Desktop Development Library for Ruby)
1
+ # Glimmer - Ruby Desktop Development GUI Library
2
2
  [![Gem Version](https://badge.fury.io/rb/glimmer.svg)](http://badge.fury.io/rb/glimmer)
3
3
  [![Travis CI](https://travis-ci.com/AndyObtiva/glimmer.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer)
4
- [![Test Coverage](https://api.codeclimate.com/v1/badges/38fbc278022862794414/test_coverage)](https://codeclimate.com/github/AndyObtiva/glimmer/test_coverage)
5
- [![Maintainability](https://api.codeclimate.com/v1/badges/38fbc278022862794414/maintainability)](https://codeclimate.com/github/AndyObtiva/glimmer/maintainability)
6
4
 
7
5
  Glimmer is a native-GUI cross-platform desktop development library written in Ruby. Glimmer's main innovation is a JRuby DSL that enables productive and efficient authoring of desktop application user-interfaces while relying on the robust Eclipse SWT library. Glimmer additionally innovates by having built-in data-binding support to greatly facilitate synchronizing the GUI with domain models. As a result, that achieves true decoupling of object oriented components, enabling developers to solve business problems without worrying about GUI concerns, or alternatively drive development GUI-first, and then write clean business models test-first afterwards.
8
6
 
@@ -71,11 +69,13 @@ Glimmer app:
71
69
 
72
70
  ![Tic Tac Toe](images/glimmer-tic-tac-toe.png)
73
71
 
74
- NOTE: Glimmer is in beta mode. Please help make better by adopting for small or low risk projects and providing feedback.
72
+ NOTE: Glimmer is in beta mode. Please help make better by [contributing](#contributing), adopting for small or low risk projects, and providing feedback.
75
73
 
76
- ## Table of Contents
74
+ Ruby is a dynamically-typed object-oriented language, which provides great productivity gains due to its powerful expressive syntax and dynamic nature. While it is proven by the Ruby on Rails framework for web development, it currently lacks a robust platform-independent framework for building desktop applications. Given that Java libraries can now be utilized in Ruby code through JRuby, Eclipse technologies, such as SWT, JFace, and RCP can help fill the gap of desktop application development with Ruby.
75
+
76
+ ## Table of contents
77
77
 
78
- - [Glimmer 0.7.7 Beta (Desktop Development Library for Ruby)](#glimmer-075-beta-desktop-development-library-for-ruby)
78
+ - [Glimmer - Ruby Desktop Development GUI Library](#glimmer-ruby-desktop-development-gui-library)
79
79
  - [Examples](#examples)
80
80
  - [Hello, World!](#hello-world)
81
81
  - [Tic Tac Toe](#tic-tac-toe)
@@ -89,22 +89,55 @@ NOTE: Glimmer is in beta mode. Please help make better by adopting for small or
89
89
  - [Basic Usage](#basic-usage)
90
90
  - [Advanced Usage](#advanced-usage)
91
91
  - [Scaffolding](#scaffolding)
92
+ - [App](#app)
93
+ - [Custom Shell](#custom-shell)
94
+ - [Custom Widget](#custom-widget)
95
+ - [Custom Shell Gem](#custom-shell-gem)
96
+ - [Custom Widget Gem](#custom-widget-gem)
92
97
  - [Girb (Glimmer irb) Command](#girb-glimmer-irb-command)
93
98
  - [Glimmer DSL Syntax](#glimmer-dsl-syntax)
94
99
  - [Widgets](#widgets)
100
+ - [Display](#display)
101
+ - [SWT Proxies](#swt-proxies)
102
+ - [Dialog](#dialog)
103
+ - [Menus](#menus)
95
104
  - [Widget Styles](#widget-styles)
105
+ - [Explicit SWT Style Bit](#explicit-swt-style-bit)
106
+ - [Negative SWT Style Bits](#negative-swt-style-bits)
107
+ - [Extra SWT Styles](#extra-swt-styles)
96
108
  - [Widget Properties](#widget-properties)
109
+ - [Colors](#colors)
110
+ - [Fonts](#fonts)
97
111
  - [Layouts](#layouts)
98
112
  - [Layout Data](#layout-data)
99
113
  - [Data-Binding](#data-binding)
114
+ - [General Examples](#general-examples)
115
+ - [Combo](#combo)
116
+ - [List](#list)
117
+ - [Table](#table)
118
+ - [Tree](#tree)
100
119
  - [Observer](#observer)
120
+ - [Observing Widgets](#observing-widgets)
121
+ - [Observing Models](#observing-models)
101
122
  - [Custom Widgets](#custom-widgets)
123
+ - [Simple Example](#simple-example)
124
+ - [Hook Example](#hook-example)
125
+ - [Content/Options Example](#contentoptions-example)
126
+ - [Gotcha](#gotcha)
102
127
  - [Custom Shells](#custom-shells)
103
128
  - [Miscellaneous](#miscellaneous)
129
+ - [Multi-DSL Support](#multi-dsl-support)
130
+ - [Application Menu Items (About/Preferences)](#application-menu-items-aboutpreferences)
131
+ - [App Name and Version](#app-name-and-version)
132
+ - [Video Widget](#video-widget)
133
+ - [Browser Widget](#browser-widget)
104
134
  - [Glimmer Style Guide](#glimmer-style-guide)
105
135
  - [Samples](#samples)
106
136
  - [Hello Samples](#hello-samples)
107
137
  - [Elaborate Samples](#elaborate-samples)
138
+ - [External Samples](#external-samples)
139
+ - [Glimmer Calculator](#glimmer-calculator)
140
+ - [Gladiator](#gladiator)
108
141
  - [In Production](#in-production)
109
142
  - [SWT Reference](#swt-reference)
110
143
  - [SWT Packages](#swt-packages)
@@ -112,7 +145,8 @@ NOTE: Glimmer is in beta mode. Please help make better by adopting for small or
112
145
  - [Raw JRuby Command](#raw-jruby-command)
113
146
  - [Mac Support](#mac-support)
114
147
  - [Packaging & Distribution](#packaging--distribution)
115
- - [Defaults](#defaults)
148
+ - [Packaging Defaults](#packaging-defaults)
149
+ - [Packaging Configuration](#packaging-configuration)
116
150
  - [javapackager Extra Arguments](#javapackager-extra-arguments)
117
151
  - [Mac Application Distribution](#mac-application-distribution)
118
152
  - [Self Signed Certificate](#self-signed-certificate)
@@ -148,12 +182,12 @@ More info about the SWT GUI on various platforms can be found on the Eclipse WIK
148
182
  https://wiki.eclipse.org/SWT/Devel/Gtk/Dev_guide#Win32.2FCocoa.2FGTK
149
183
  https://www.eclipse.org/swt/faq.php
150
184
 
151
-
152
185
  ## Pre-requisites
153
186
 
154
187
  - SWT 4.15 (comes included in Glimmer gem)
155
- - JRuby 9.2.11.1 (supporting Ruby 2.5.x syntax) (find at https://www.jruby.org/download)
156
- - Java SE Runtime Environment 7 or higher (find at https://www.oracle.com/java/technologies/javase-downloads.html)
188
+ - JRuby 9.2.11.1 (supporting Ruby 2.5.x syntax) (find at [https://www.jruby.org/download](https://www.jruby.org/download))
189
+ - JDK 8 - 10 (find at [https://www.oracle.com/java/technologies/javase-downloads.html](https://www.oracle.com/java/technologies/javase-downloads.html))
190
+ - (Optional) RVM is needed for [Scaffolding](#scaffolding) only (find at [https://rvm.io/](https://rvm.io/))
157
191
 
158
192
  On **Mac** and **Linux**, an easy way to obtain JRuby is through [RVM](http://rvm.io) by running:
159
193
 
@@ -171,7 +205,7 @@ Please follow these instructions to make the `glimmer` command available on your
171
205
 
172
206
  Run this command to install directly:
173
207
  ```
174
- jgem install glimmer -v 0.7.7
208
+ jgem install glimmer-dsl-swt -v 0.1.0
175
209
  ```
176
210
 
177
211
  `jgem` is JRuby's version of `gem` command.
@@ -182,7 +216,7 @@ Otherwise, you may also run `jruby -S gem install ...`
182
216
 
183
217
  Add the following to `Gemfile`:
184
218
  ```
185
- gem 'glimmer', '~> 0.7.7'
219
+ gem 'glimmer-dsl-swt', '~> 0.1.0'
186
220
  ```
187
221
 
188
222
  And, then run:
@@ -190,6 +224,8 @@ And, then run:
190
224
  jruby -S bundle install
191
225
  ```
192
226
 
227
+ You may learn more about other Glimmer related gems at [Multi-DSL Support](#multi-dsl-support)
228
+
193
229
  ## Glimmer Command
194
230
 
195
231
  ### Basic Usage
@@ -219,7 +255,7 @@ bin/glimmer samples/hello/hello_world.rb
219
255
  Below are the full usage instructions that come up when running `glimmer` without args.
220
256
 
221
257
  ```
222
- Usage: glimmer [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
258
+ Usage: glimmer [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
223
259
 
224
260
  Runs Glimmer applications/tasks.
225
261
 
@@ -234,7 +270,7 @@ glimmer package:jar # Generate JAR
234
270
  glimmer package:native # Generate Native files (DMG/PKG/APP on the Mac)
235
271
  glimmer scaffold[app_name] # Scaffold a Glimmer application directory structure to begin building a new app
236
272
  glimmer scaffold:custom_shell[custom_shell_name,namespace] # Scaffold a Glimmer::UI::CustomShell subclass (represents a full window view) under app/views (namespace is optional)
237
- glimmer scaffold:custom_shell_gem[custom_widget_name,namespace] # Scaffold a Glimmer::UI::CustomShell subclass (represents a full window view) under its own Ruby gem project (namespace is required)
273
+ glimmer scaffold:custom_shell_gem[custom_shell_name,namespace] # Scaffold a Glimmer::UI::CustomShell subclass (represents a full window view) under its own Ruby gem + app project (namespace is required)
238
274
  glimmer scaffold:custom_widget[custom_widget_name,namespace] # Scaffold a Glimmer::UI::CustomWidget subclass (represents a part of a view) under app/views (namespace is optional)
239
275
  glimmer scaffold:custom_widget_gem[custom_widget_name,namespace] # Scaffold a Glimmer::UI::CustomWidget subclass (represents a part of a view) under its own Ruby gem project (namespace is required)
240
276
 
@@ -244,8 +280,9 @@ automatically preloading the glimmer Ruby gem and SWT jar dependency.
244
280
  Optionally, extra Glimmer options, JRuby options and environment variables may be passed in.
245
281
 
246
282
  Glimmer options:
247
- - "--debug" : Displays extra debugging information and passes "--debug" to JRuby
248
- - "--log-level=VALUE" : Sets Glimmer's Ruby logger level ("ERROR" / "WARN" / "INFO" / "DEBUG"; default is "WARN")
283
+ - "--quiet" : Does not announce file path of Glimmer application being launched
284
+ - "--debug" : Displays extra debugging information, passes "--debug" to JRuby, and enables debug logging
285
+ - "--log-level=VALUE" : Sets Glimmer's Ruby logger level ("ERROR" / "WARN" / "INFO" / "DEBUG"; default is none)
249
286
 
250
287
  Example: glimmer samples/hello_world.rb
251
288
 
@@ -277,7 +314,7 @@ getting you to a running and delivered state of an advanced "Hello, World!" Glim
277
314
  This should greatly facilitate building a new Glimmer app by helping you be productive and focus on app details while
278
315
  letting Glimmer scaffolding take care of initial app file structure concerns, such as adding:
279
316
  - Main application class that includes Glimmer
280
- - Main application view that houses main window content
317
+ - Main application view that houses main window content, about dialog, and preferences dialog
281
318
  - View and Model directories
282
319
  - Rakefile including Glimmer tasks
283
320
  - Version
@@ -285,7 +322,7 @@ letting Glimmer scaffolding take care of initial app file structure concerns, su
285
322
  - Icon
286
323
  - Bin file for starting application
287
324
 
288
- NOTE: Scaffolding currently supports Mac packaging only at the moment.
325
+ NOTE: Scaffolding requires RVM and currently supports Mac packaging only at the moment.
289
326
 
290
327
  #### App
291
328
 
@@ -344,8 +381,10 @@ glimmer scaffold:custom_widget[custom_widget_name]
344
381
  #### Custom Shell Gem
345
382
 
346
383
  Custom shell gems are self-contained Glimmer apps as well as reusable custom shells.
347
- As such, they are packaged as both a native executable (e.g. Mac DMG/PKG/APP) and a Ruby gem.
348
- Of course, you can build a Ruby gem and disregard its native executable packaging if you do not need it.
384
+ They have everything scaffolded Glimmer apps come with in addition to gem content like a Jeweler Rakefile that can build gemspec and release gems.
385
+ Unlike scaffolded Glimmer apps, custom shell gem content lives under the `lib` directory (not `app`).
386
+ They can be packaged as both a native executable (e.g. Mac DMG/PKG/APP) and a Ruby gem.
387
+ Of course, you can just build a Ruby gem and disregard native executable packaging if you do not need it.
349
388
 
350
389
  To scaffold a Glimmer custom shell gem (full window view distributed as a Ruby gem), run the following command:
351
390
 
@@ -359,7 +398,10 @@ The Ruby gem name will follow the convention "glimmer-cs-customwidgetname-namesp
359
398
 
360
399
  Only official Glimmer gems created by the Glimmer project committers will have no namespace (e.g. [glimmer-cs-gladiator](https://rubygems.org/gems/glimmer-cs-gladiator) Ruby gem)
361
400
 
362
- Example: [https://github.com/AndyObtiva/glimmer-cs-gladiator](https://github.com/AndyObtiva/glimmer-cs-gladiator)
401
+ Examples:
402
+
403
+ - [glimmer-cs-gladiator](https://github.com/AndyObtiva/glimmer-cs-gladiator): Gladiator (Glimmer Editor)
404
+ - [glimmer-cs-calculator](https://github.com/AndyObtiva/glimmer-cs-calculator): Glimmer Calculator
363
405
 
364
406
  #### Custom Widget Gem
365
407
 
@@ -385,7 +427,7 @@ With Glimmer installed, you may want to run `girb` instead of standard `irb` to
385
427
  girb
386
428
  ```
387
429
 
388
- If you cloned this project locally, you may run `bin/girb` instead.
430
+ If you cloned [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) project locally, you may run `bin/girb` instead.
389
431
 
390
432
  ```
391
433
  bin/girb
@@ -393,6 +435,8 @@ bin/girb
393
435
 
394
436
  Watch out for hands-on examples in this README indicated by "you may copy/paste in [`girb`](#girb-glimmer-irb-command)"
395
437
 
438
+ Keep in mind that all samples live under [https://github.com/AndyObtiva/glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt)
439
+
396
440
  ## Glimmer DSL Syntax
397
441
 
398
442
  Glimmer DSL syntax consists of static keywords and dynamic keywords to build and bind user-interface objects.
@@ -619,6 +663,12 @@ Shell widget proxy has extra methods specific to SWT Shell:
619
663
  - `#pack`: Packs contained widgets using SWT's `Shell#pack` method
620
664
  - `#pack_same_size`: Packs contained widgets without changing shell's size when widget sizes change
621
665
 
666
+ #### Dialog
667
+
668
+ Dialog is a variation on Shell. It is basically a shell that is modal (blocks what's behind it) and belongs to another shell. It only has a close button.
669
+
670
+ Glimmer facilitates building dialogs by using the `dialog` keyword, which automatically adds the SWT.DIALOG_TRIM and SWT.APPLICATION_MODAL [widget styles](#widget-styles) needed for a dialog.
671
+
622
672
  #### Menus
623
673
 
624
674
  Glimmer DSL provides support for SWT Menu and MenuItem widgets.
@@ -1085,7 +1135,7 @@ https://help.eclipse.org/2019-12/nftopic/org.eclipse.platform.doc.isv/reference/
1085
1135
 
1086
1136
  Data-binding is done with `bind` command following widget property to bind and taking model and bindable attribute as arguments.
1087
1137
 
1088
- #### General data-binding examples:
1138
+ #### General Examples
1089
1139
 
1090
1140
  `text bind(contact, :first_name)`
1091
1141
 
@@ -1256,7 +1306,62 @@ The Glimmer code is not much different from above except for passing the `:multi
1256
1306
 
1257
1307
  Note that in all the data-binding examples above, there was also an observer attached to the `button` widget to trigger an action on the model, which in turn triggers a data-binding update on the `list` or `combo`. Observers will be discussed in more details in the [next section](#observer).
1258
1308
 
1259
- You may learn more about Glimmer's data-binding syntax by reading the [Eclipse Zone Tutorial](http://eclipse.dzone.com/articles/an-introduction-glimmer) mentioned in resources and opening up the samples under the [samples](samples) directory.
1309
+ You may learn more about Glimmer's data-binding syntax by reading the code under the [samples](samples) directory.
1310
+
1311
+ #### Table
1312
+
1313
+ The SWT Tree widget renders a multi-column data table, such as a contact listing or a sales report.
1314
+
1315
+ To data-bind a Table, you need the main model, the collection property, and the text display attribute for each table column.
1316
+
1317
+ This involves using the `bind` keyword mentioned above in addition to a special `column_properties` keyword that takes the table column text attribute methods.
1318
+
1319
+ It assumes you have defined the table columns via `table_column` widget.
1320
+
1321
+ Example:
1322
+
1323
+ ```ruby
1324
+ shell {
1325
+ @table = table {
1326
+ table_column {
1327
+ text "Name"
1328
+ width 120
1329
+ }
1330
+ table_column {
1331
+ text "Age"
1332
+ width 120
1333
+ }
1334
+ table_column {
1335
+ text "Adult"
1336
+ width 120
1337
+ }
1338
+ items bind(group, :people), column_properties(:name, :age, :adult)
1339
+ selection bind(group, :selected_person)
1340
+ }
1341
+ }
1342
+ ```
1343
+
1344
+ The code above includes two data-bindings:
1345
+ - Table `items`, which first bind to the model collection property (group.people), and then maps each column property (name, age, adult) for displaying each table item column.
1346
+ - Table `selection`, which binds the single table item selected by the user to the attribute denoted by the `bind` keyword (or binds multiple table items selected for a table with `:multi` SWT style)
1347
+
1348
+ Additionally, Table `items` data-binding automatically stores each node model unto the SWT TableItem object via `setData` method. This enables things like searchability.
1349
+
1350
+ The table widget in Glimmer is represented by a subclass of `WidgetProxy` called `TableProxy`.
1351
+ TableProxy includes a `search` method that takes a block to look for a table item.
1352
+
1353
+ Example:
1354
+
1355
+ ```ruby
1356
+ found_array = @table.search { |table_item| table_item.getData == company.owner }
1357
+ ```
1358
+
1359
+ This finds a person. The array is a Java array. This enables easy passing of it to SWT `Table#setSelection` method, which expects a Java array of `TableItem` objects.
1360
+
1361
+ To edit a table, you must invoke `TableProxy#edit_selected_table_item(column_index, before_write: nil, after_write: nil, after_cancel: nil)` or `TableProxy#edit_table_item(table_item, column_index, before_write: nil, after_write: nil, after_cancel: nil)`.
1362
+ This automatically leverages the SWT TableEditor custom class behind the scenes, displaying a text widget to the user to change the selected or
1363
+ passed table item text into something else.
1364
+ It automatically persists the change to `items` data-bound model on ENTER/FOCUS-OUT or cancels on ESC/NO-CHANGE.
1260
1365
 
1261
1366
  #### Tree
1262
1367
 
@@ -1309,7 +1414,7 @@ Glimmer supports observing widgets with two main types of events:
1309
1414
 
1310
1415
  Additionally, there are two more types of events:
1311
1416
  - SWT `display` supports global listeners called filters that run on any widget. They are hooked via `on_event_{swt-event-constant}`
1312
- - the `shell` widget supports Mac application menu item observers (`on_about` and `on_preferences`), which you can read about under [Miscellaneous](#miscellaneous).
1417
+ - SWT `display` supports Mac application menu item observers (`on_about` and `on_preferences`), which you can read about under [Miscellaneous](#miscellaneous).
1313
1418
 
1314
1419
  Number 1 is more commonly used in SWT applications, so make it your starting point. Number 2 covers events not found in number 1, so look into it if you don't find an SWT listener you need in number 1.
1315
1420
 
@@ -1472,7 +1577,9 @@ Glimmer supports creating custom widgets with minimal code, which automatically
1472
1577
 
1473
1578
  Simply create a new class that includes `Glimmer::UI::CustomWidget` and put Glimmer DSL code in its `#body` block (its return value is stored in `#body_root` attribute). Glimmer will then automatically recognize this class by convention when it encounters a keyword matching the class name converted to underscored lowercase (and namespace double-colons `::` replaced with double-underscores `__`)
1474
1579
 
1475
- #### Example (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
1580
+ #### Simple Example
1581
+
1582
+ (you may copy/paste in [`girb`](#girb-glimmer-irb-command))
1476
1583
 
1477
1584
  Definition:
1478
1585
  ```ruby
@@ -1498,7 +1605,9 @@ shell {
1498
1605
 
1499
1606
  As you can see, `RedLabel` became Glimmer DSL keyword: `red_label`
1500
1607
 
1501
- #### Another Example (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
1608
+ #### Hook Example
1609
+
1610
+ (you may copy/paste in [`girb`](#girb-glimmer-irb-command))
1502
1611
 
1503
1612
  Definition:
1504
1613
  ```ruby
@@ -1535,19 +1644,21 @@ Notice how `Red::Composite` became `red__composite` with double-underscore, whic
1535
1644
 
1536
1645
  Keep in mind that namespaces are not needed to be specified if the Custom Widget class has a unique name, not clashing with a basic SWT widget or another custom widget name.
1537
1646
 
1538
- Custom Widgets have the following attributes (attribute readers) available to call from inside the `#body` method:
1647
+ Custom Widgets have the following attributes available to call from inside the `#body` method:
1539
1648
  - `#parent`: Glimmer object parenting custom widget
1540
1649
  - `#swt_style`: SWT style integer. Can be useful if you want to allow consumers to customize a widget inside the custom widget body
1541
- - `#options`: a hash of options passed in parentheses when declaring a custom widget (useful for passing in model data) (e.g. `calendar(events: events)`). Custom widget class can declare option names (array) with `.options` method as shown below, which generates attribute readers for every option (not to be confused with `#options` instance method for retrieving options hash containing names & values)
1650
+ - `#options`: a hash of options passed in parentheses when declaring a custom widget (useful for passing in model data) (e.g. `calendar(events: events)`). Custom widget class can declare option names (array) with `::options` class method as shown below, which generates attribute accessors for every option (not to be confused with `#options` instance method for retrieving options hash containing names & values)
1542
1651
  - `#content`: nested block underneath custom widget. It will be automatically called at the end of processing the custom widget body. Alternatively, the custom widget body may call `content.call` at the place where the content is needed to show up as shown in the following example.
1543
1652
  - `#body_root`: top-most (root) widget returned from `#body` method.
1544
1653
  - `#swt_widget`: actual SWT widget for `body_root`
1545
1654
 
1546
1655
  Additionally, custom widgets can call the following class methods:
1547
- - `.options`: declares a list of options by taking an option name array (symbols/strings). This generates option attribute readers (e.g. `options :orientation, :bg_color` generates `#orientation` and `#bg_color` attribute readers)
1548
- - `.option`: declares a single option taking option name and default value as arguments (also generates an attribute reader just like `.options`)
1656
+ - `::options(*option_names)`: declares a list of options by taking an option name array (symbols/strings). This generates option attribute accessors (e.g. `options :orientation, :bg_color` generates `#orientation`, `#orientation=(v)`, `#bg_color`, and `#bg_color=(v)` attribute accessors)
1657
+ - `::option(option_name, default: nil)`: declares a single option taking option name and default value as arguments (also generates attribute accessors just like `::options`)
1658
+
1659
+ #### Content/Options Example
1549
1660
 
1550
- #### Content/Options Example (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
1661
+ (you may copy/paste in [`girb`](#girb-glimmer-irb-command))
1551
1662
 
1552
1663
  Definition:
1553
1664
  ```ruby
@@ -1555,7 +1666,7 @@ class Sandwich
1555
1666
  include Glimmer::UI::CustomWidget
1556
1667
 
1557
1668
  options :orientation, :bg_color
1558
- option :fg_color, :black
1669
+ option :fg_color, default: :black
1559
1670
 
1560
1671
  body {
1561
1672
  composite(swt_style) { # gets custom widget style
@@ -1688,83 +1799,19 @@ shell { |app_shell|
1688
1799
 
1689
1800
  ### Miscellaneous
1690
1801
 
1691
- #### Application Menu Items (About/Preferences)
1692
-
1693
- Mac applications always have About and Preferences menu items. Glimmer provides widget observer hooks for them on the `shell` widget:
1694
- - `on_about`: executes code when user selects App Name -> About
1695
- - `on_preferences`: executes code when user selects App Name -> Preferences or hits 'CMD+,' on the Mac
1696
-
1697
- Example (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
1698
-
1699
- ```ruby
1700
- shell { |shell_proxy|
1701
- text 'Application Menu Items'
1702
- fill_layout {
1703
- margin_width 15
1704
- margin_height 15
1705
- }
1706
- label {
1707
- text 'Application Menu Items'
1708
- font height: 30
1709
- }
1710
- on_about {
1711
- message_box = MessageBox.new(shell_proxy.swt_widget)
1712
- message_box.setText("About")
1713
- message_box.setMessage("About Application")
1714
- message_box.open
1715
- }
1716
- on_preferences {
1717
- preferences_dialog = shell(:dialog_trim, :application_modal) {
1718
- text 'Preferences'
1719
- row_layout {
1720
- type :vertical
1721
- margin_left 15
1722
- margin_top 15
1723
- margin_right 15
1724
- margin_bottom 15
1725
- }
1726
- label {
1727
- text 'Check one of these options:'
1728
- }
1729
- button(:radio) {
1730
- text 'Option 1'
1731
- }
1732
- button(:radio) {
1733
- text 'Option 2'
1734
- }
1735
- }
1736
- preferences_dialog.open
1737
- }
1738
- }.open
1739
- ```
1740
-
1741
- #### App Name and Version
1742
-
1743
- Application name (shows up on the Mac in top menu bar) and version may be specified upon [packaging](#packaging--distribution) by specifying "-Bmac.CFBundleName" and "-Bmac.CFBundleVersion" options.
1744
-
1745
- Still, if you would like proper application name to show up on the Mac top menu bar during development, you may do so by invoking the SWT Display.setAppName method before any Display object has been instantiated (i.e. before any Glimmer widget like shell has been declared).
1746
-
1747
- Example (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
1748
-
1749
- ```ruby
1750
- Display.setAppName('Glimmer Demo')
1751
-
1752
- shell(:no_resize) {
1753
- text "Glimmer"
1754
- label {
1755
- text "Hello, World!"
1756
- }
1757
- }.open
1758
- ```
1802
+ #### Multi-DSL Support
1759
1803
 
1760
- Also, you may invoke `Display.setAppVersion('1.0.0')` if needed for OS app version identification reasons during development, replacing `'1.0.0'` with your application version.
1804
+ Glimmer is a DSL engine that supports multiple DSLs (Domain Specific Languages):
1805
+ - [SWT](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (Desktop GUI)
1806
+ - [Opal](https://github.com/AndyObtiva/glimmer-dsl-opal): Glimmer DSL for Opal (Web GUI Adapter for Desktop Apps)
1807
+ - [XML](https://github.com/AndyObtiva/glimmer-dsl-xml): Glimmer DSL for XML (& HTML) - Useful with [SWT Browser Widget](#browser-widget)
1808
+ - [CSS](https://github.com/AndyObtiva/glimmer-dsl-css): Glimmer DSL for CSS (Cascading Style Sheets) - Useful with [SWT Browser Widget](#browser-widget)
1761
1809
 
1762
- #### Multi-DSL Support
1810
+ Glimmer automatically recognizes top-level keywords in each DSL and activates DSL accordingly. Glimmer allows mixing DSLs, which comes in handy when doing things like using the SWT Browser widget with XML and CSS. Once done processing a nested DSL top-level keyword, Glimmer switches back to the prior DSL automatically.
1763
1811
 
1764
- Glimmer supports two other DSLs in addition to the SWT DSL; that is Glimmer XML DSL and Glimmer CSS DSL. It also allows mixing DSLs, which comes in handy when doing things like using the `browser` widget. Glimmer automatically recognizes top-level keywords in each DSL
1765
- and switches DSLs accordingly. Once done processing a top-level keyword, it switches back to the prior DSL automatically.
1812
+ ##### SWT
1766
1813
 
1767
- For example, the SWT DSL has the following top-level keywords:
1814
+ The SWT DSL was already covered in detail. However, for the sake of mixing DSLs, you need to know that the SWT DSL has the following top-level keywords:
1768
1815
  - `shell`
1769
1816
  - `display`
1770
1817
  - `color`
@@ -1772,7 +1819,13 @@ For example, the SWT DSL has the following top-level keywords:
1772
1819
  - `async_exec`
1773
1820
  - `sync_exec`
1774
1821
 
1775
- ##### XML DSL
1822
+ ##### Opal
1823
+
1824
+ Full instructions are found in the [Opal](https://github.com/AndyObtiva/glimmer-dsl-opal) DSL page.
1825
+
1826
+ The [Opal](https://github.com/AndyObtiva/glimmer-dsl-opal) DSL is simply a web GUI adapter for desktop apps written in Glimmer. As such, it supports all the DSL keywords of the SWT DSL and shares the same top-level keywords.
1827
+
1828
+ ##### XML
1776
1829
 
1777
1830
  Simply start with `html` keyword and add HTML inside its block using Glimmer DSL syntax.
1778
1831
  Once done, you may call `to_s`, `to_xml`, or `to_html` to get the formatted HTML output.
@@ -1850,8 +1903,7 @@ Output:
1850
1903
  <DOCUMENT><document:body document:id="main"></document:body></DOCUMENT>
1851
1904
  ```
1852
1905
 
1853
-
1854
- ##### CSS DSL
1906
+ ##### CSS
1855
1907
 
1856
1908
  Simply start with `css` keyword and add stylesheet rule sets inside its block using Glimmer DSL syntax.
1857
1909
  Once done, you may call `to_s` or `to_css` to get the formatted CSS output.
@@ -1887,6 +1939,86 @@ Glimmer provides a number of methods on Glimmer::DSL::Engine to configure DSL su
1887
1939
  - `Glimmer::DSL::Engine.enable_dsl(dsl_name)`: Re-enables disabled DSL
1888
1940
  - `Glimmer::DSL::Engine.enabled_dsls=(dsl_names)`: Disables all DSLs except the ones specified.
1889
1941
 
1942
+ #### Application Menu Items (About/Preferences)
1943
+
1944
+ Mac applications always have About and Preferences menu items. Glimmer provides widget observer hooks for them on the `display`:
1945
+ - `on_about`: executes code when user selects App Name -> About
1946
+ - `on_preferences`: executes code when user selects App Name -> Preferences or hits 'CMD+,' on the Mac
1947
+
1948
+ Example (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
1949
+
1950
+ ```ruby
1951
+ class Example
1952
+ def initialize
1953
+ display {
1954
+ on_about {
1955
+ message_box = MessageBox.new(@shell_proxy.swt_widget)
1956
+ message_box.setText("About")
1957
+ message_box.setMessage("About Application")
1958
+ message_box.open
1959
+ }
1960
+ on_preferences {
1961
+ preferences_dialog = dialog {
1962
+ text 'Preferences'
1963
+ row_layout {
1964
+ type :vertical
1965
+ margin_left 15
1966
+ margin_top 15
1967
+ margin_right 15
1968
+ margin_bottom 15
1969
+ }
1970
+ label {
1971
+ text 'Check one of these options:'
1972
+ }
1973
+ button(:radio) {
1974
+ text 'Option 1'
1975
+ }
1976
+ button(:radio) {
1977
+ text 'Option 2'
1978
+ }
1979
+ }
1980
+ preferences_dialog.open
1981
+ }
1982
+ }
1983
+ @shell_proxy = shell {
1984
+ text 'Application Menu Items'
1985
+ fill_layout {
1986
+ margin_width 15
1987
+ margin_height 15
1988
+ }
1989
+ label {
1990
+ text 'Application Menu Items'
1991
+ font height: 30
1992
+ }
1993
+ }
1994
+ @shell_proxy.open
1995
+ end
1996
+ end
1997
+
1998
+ Example.new
1999
+ ```
2000
+
2001
+ #### App Name and Version
2002
+
2003
+ Application name (shows up on the Mac in top menu bar) and version may be specified upon [packaging](#packaging--distribution) by specifying "-Bmac.CFBundleName" and "-Bmac.CFBundleVersion" options.
2004
+
2005
+ Still, if you would like proper application name to show up on the Mac top menu bar during development, you may do so by invoking the SWT Display.setAppName method before any Display object has been instantiated (i.e. before any Glimmer widget like shell has been declared).
2006
+
2007
+ Example (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
2008
+
2009
+ ```ruby
2010
+ Display.setAppName('Glimmer Demo')
2011
+
2012
+ shell(:no_resize) {
2013
+ text "Glimmer"
2014
+ label {
2015
+ text "Hello, World!"
2016
+ }
2017
+ }.open
2018
+ ```
2019
+
2020
+ Also, you may invoke `Display.setAppVersion('1.0.0')` if needed for OS app version identification reasons during development, replacing `'1.0.0'` with your application version.
2021
+
1890
2022
  #### Video Widget
1891
2023
 
1892
2024
  ![Video Widget](images/glimmer-video-widget.png)
@@ -1910,7 +2042,7 @@ shell {
1910
2042
  }.open
1911
2043
  ```
1912
2044
 
1913
- Example rendering HTML with JavaScript on document ready (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
2045
+ Example rendering HTML with JavaScript on document ready (you may copy/paste in [`girb`](#girb-glimmer-irb-command) provided you install and require [glimmer-dsl-xml gem](https://github.com/AndyObtiva/glimmer-dsl-xml)):
1914
2046
 
1915
2047
  ```ruby
1916
2048
  shell {
@@ -1931,7 +2063,7 @@ shell {
1931
2063
  }.open
1932
2064
  ```
1933
2065
 
1934
- This relies on Glimmer's [Multi-DSL Support](https://github.com/AndyObtiva/glimmer/tree/development#multi-dsl-support) for building the HTML text using Glimmer XML DSL.
2066
+ This relies on Glimmer's [Multi-DSL Support](#multi-dsl-support) for building the HTML text using [Glimmer XML DSL](https://github.com/AndyObtiva/glimmer-dsl-xml).
1935
2067
 
1936
2068
  ## Glimmer Style Guide
1937
2069
 
@@ -1977,12 +2109,22 @@ glimmer samples/hello/hello_computed.rb # demonstrates computed data-binding
1977
2109
  For more elaborate samples, check the following:
1978
2110
 
1979
2111
  ```
1980
- glimmer samples/elaborate/login.rb # demonstrates general data-binding
2112
+ glimmer samples/elaborate/login.rb # demonstrates basic data-binding
1981
2113
  glimmer samples/elaborate/contact_manager.rb # demonstrates table data-binding
1982
2114
  glimmer samples/elaborate/tic_tac_toe.rb # demonstrates a full MVC application
1983
2115
  ```
1984
2116
 
1985
- ![Gladiator](https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-gladiator/v0.1.5/images/glimmer-gladiator.png)
2117
+ ### External Samples
2118
+
2119
+ #### Glimmer Calculator
2120
+
2121
+ [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-calculator/v1.0.0/glimmer-cs-calculator-screenshot.png" />](https://github.com/AndyObtiva/glimmer-cs-calculator)
2122
+
2123
+ [Glimmer Calculator](https://github.com/AndyObtiva/glimmer-cs-calculator) is a basic calculator sample project demonstrating data-binding and TDD (test-driven-development) with Glimmer following the MVP pattern (Model-View-Presenter).
2124
+
2125
+ #### Gladiator
2126
+
2127
+ [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-gladiator/v0.1.5/images/glimmer-gladiator.png" />](https://github.com/AndyObtiva/glimmer-cs-gladiator)
1986
2128
 
1987
2129
  [Gladiator](https://github.com/AndyObtiva/glimmer-cs-gladiator) (short for Glimmer Editor) is a Glimmer sample project under on-going development.
1988
2130
  You may check it out to learn how to build a Glimmer Custom Shell gem.
@@ -2111,33 +2253,20 @@ Glimmer apps may be packaged and distributed on the Mac, Windows, and Linux via
2111
2253
  - Warbler (https://github.com/jruby/warbler): Enables bundling a Glimmer app into a JAR file
2112
2254
  - javapackager (https://docs.oracle.com/javase/8/docs/technotes/tools/unix/javapackager.html): Enables packaging a JAR file as a DMG file on Mac, EXE on Windows, and multiple Linux supported formats on Linux.
2113
2255
 
2114
- Glimmer simplifies the process for Mac packaging by providing a rake task.
2256
+ Glimmer simplifies the process of Mac packaging via the `glimmer package` command. It works out of the box for any application generated by [Glimmer Scaffolding](https://github.com/AndyObtiva/glimmer/blob/master/README.md#scaffolding):
2115
2257
 
2116
- To use:
2117
- - Create `Rakefile` in your app root directory
2118
- - Add the following line to it: `require 'glimmer/rake_task'`
2119
- - Create a Ruby script under bin (e.g. `bin/math_bowling`) to require the application file that uses Glimmer (e.g. `'../app/my_application.rb'`):
2120
- ```ruby
2121
- require_relative '../app/my_application.rb'
2122
2258
  ```
2123
- - Include Icon (Optional): If you'd like to include an icon for your app (.icns format on the Mac), place it under `package/macosx` matching the humanized application local directory name (e.g. 'Math Bowling.icns' [containing space] for MathBowling or math_bowling). You may generate your Mac icon easily using tools like Image2Icon (http://www.img2icnsapp.com/) or manually using the Mac terminal command `iconutil` (iconutil guide: https://applehelpwriter.com/tag/iconutil/)
2124
- - Include Version (Optional): Create a `VERSION` file in your application and fill it your app version on one line (e.g. `1.1.0`)
2125
- - Include License (Optional): Create a `LICENSE.txt` file in your application and fill it up with your license (e.g. MIT). It will show up to people when installing your app. Note that, you may optionally also specify license type, but you'd have to do so manually via `-BlicenseType=MIT` shown in an [example below](#javapackager-extra-arguments).
2126
- - Extra args (Optional): You may optionally add the following to `Rakefile` to configure extra arguments for javapackager: `Glimmer::Packager.javapackager_extra_args = "..."` (Useful to avoid re-entering extra arguments on every run of rake task.). Read about them in [their section below](#javapackager-extra-arguments).
2127
-
2128
- Now, you can run the following rake command to package your app into a Mac DMG file (using both Warbler and javapackager):
2129
- ```
2130
- rake glimmer:package
2259
+ glimmer package
2131
2260
  ```
2132
2261
 
2133
- This will generate a JAR file under `./dist` directory, which is then used to generate a DMG file (and pkg/app) under `./packages/bundles`.
2262
+ This will automatically generate a JAR file under `./dist` directory using Warbler, which is then used to automatically generate a DMG file (and pkg/app) under `./packages/bundles` using `javapackager`.
2134
2263
  JAR file name will match your application local directory name (e.g. `MathBowling.jar` for `~/code/MathBowling`)
2135
2264
  DMG file name will match the humanized local directory name + dash + application version (e.g. `Math Bowling-1.0.dmg` for `~/code/MathBowling` with version 1.0 or unspecified)
2136
2265
 
2137
- THe rake task will automatically set "mac.CFBundleIdentifier" to ="org.#{project_name}.application.#{project_name}".
2266
+ The `glimmer package` command will automatically set "mac.CFBundleIdentifier" to ="org.#{project_name}.application.#{project_name}".
2138
2267
  You may override by configuring as an extra argument for javapackger (e.g. Glimmer::Package.javapackager_extra_args = " -Bmac.CFBundleIdentifier=org.andymaleh.application.MathBowling")
2139
2268
 
2140
- ### Defaults
2269
+ ### Packaging Defaults
2141
2270
 
2142
2271
  Glimmer employs smart defaults in packaging.
2143
2272
 
@@ -2145,13 +2274,24 @@ The package application name (shows up in top menu bar on the Mac) will be a hum
2145
2274
 
2146
2275
  Also, the package will only include these directories: app, config, db, lib, script, bin, docs, fonts, images, sounds, videos
2147
2276
 
2148
- After running once, you will find a `config/warble.rb` file. It has the JAR packaging configuration. You may adjust included directories in it if needed, and then rerun `rake glimmer:package` and it will pick up your custom configuration. Alternatively, if you'd like to customize the included directories to begin with, don't run `rake glimmer:package` right away. Run this command first:
2277
+ After running once, you will find a `config/warble.rb` file. It has the JAR packaging configuration. You may adjust included directories in it if needed, and then rerun `glimmer package` and it will pick up your custom configuration. Alternatively, if you'd like to customize the included directories to begin with, don't run `glimmer package` right away. Run this command first:
2149
2278
 
2150
2279
  ```
2151
- rake glimmer:package:config
2280
+ glimmer package:config
2152
2281
  ```
2153
2282
 
2154
- This will generate `config/warble.rb`, which you may configure and then run `rake glimmer:package` afterwards.
2283
+ This will generate `config/warble.rb`, which you may configure and then run `glimmer package` afterwards.
2284
+
2285
+ ### Packaging Configuration
2286
+
2287
+ - Ensure you have a Ruby script under `bin` directory that launches the application, preferably matching your project directory name (e.g. `bin/math_bowling`) :
2288
+ ```ruby
2289
+ require_relative '../app/my_application.rb'
2290
+ ```
2291
+ - Include Icon (Optional): If you'd like to include an icon for your app (.icns format on the Mac), place it under `package/macosx` matching the humanized application local directory name (e.g. 'Math Bowling.icns' [containing space] for MathBowling or math_bowling). You may generate your Mac icon easily using tools like Image2Icon (http://www.img2icnsapp.com/) or manually using the Mac terminal command `iconutil` (iconutil guide: https://applehelpwriter.com/tag/iconutil/)
2292
+ - Include Version (Optional): Create a `VERSION` file in your application and fill it your app version on one line (e.g. `1.1.0`)
2293
+ - Include License (Optional): Create a `LICENSE.txt` file in your application and fill it up with your license (e.g. MIT). It will show up to people when installing your app. Note that, you may optionally also specify license type, but you'd have to do so manually via `-BlicenseType=MIT` shown in an [example below](#javapackager-extra-arguments).
2294
+ - Extra args (Optional): You may optionally add the following to `Rakefile` to configure extra arguments for javapackager: `Glimmer::Packager.javapackager_extra_args = "..."` (Useful to avoid re-entering extra arguments on every run of rake task.). Read about them in [their section below](#javapackager-extra-arguments).
2155
2295
 
2156
2296
  ### javapackager Extra Arguments
2157
2297
 
@@ -2169,6 +2309,8 @@ The Glimmer rake task allows passing extra options to javapackager via:
2169
2309
  Example (Rakefile):
2170
2310
 
2171
2311
  ```ruby
2312
+ require 'glimmer/rake_task'
2313
+
2172
2314
  Glimmer::Package.javapackager_extra_args = '-BlicenseType="MIT" -Bmac.category="public.app-category.business" -Bmac.signing-key-developer-id-app="Andy Maleh"'
2173
2315
  ```
2174
2316
 
@@ -2179,7 +2321,7 @@ https://developer.apple.com/library/archive/releasenotes/General/SubmittingToMac
2179
2321
  Example (env var):
2180
2322
 
2181
2323
  ```
2182
- JAVAPACKAGER_EXTRA_ARGS='-Bmac.CFBundleName="Math Bowling Game"' rake glimmer:package
2324
+ JAVAPACKAGER_EXTRA_ARGS='-Bmac.CFBundleName="Math Bowling Game"' glimmer package
2183
2325
  ```
2184
2326
 
2185
2327
  That overrides the default application display name.
@@ -2224,7 +2366,7 @@ Example:
2224
2366
  Glimmer::Package.javapackager_extra_args = '-Bmac.signing-key-developer-id-app="Andy Maleh"'
2225
2367
  ```
2226
2368
 
2227
- Now, when you run `rake glimmer:package`, it builds a self-signed DMG file. When you make available online, and users download, upon launching application, they are presented with your certificate, which they have to sign if they trust you in order to use the application.
2369
+ Now, when you run `glimmer package`, it builds a self-signed DMG file. When you make available online, and users download, upon launching application, they are presented with your certificate, which they have to sign if they trust you in order to use the application.
2228
2370
 
2229
2371
  ### Gotchas
2230
2372
 
@@ -2241,7 +2383,7 @@ Glimmer::Package.javapackager_extra_args = '-srcfiles "ACME.txt" -BlicenseFile="
2241
2383
 
2242
2384
  2. Mounted DMG Residue
2243
2385
 
2244
- If you run `rake glimmer:package` multiple times, sometimes it leaves a mounted DMG project in your finder. Unmount before you run the command again or it might fail with an error saying: "Error: Bundler "DMG Installer" (dmg) failed to produce a bundle."
2386
+ If you run `glimmer package` multiple times, sometimes it leaves a mounted DMG project in your finder. Unmount before you run the command again or it might fail with an error saying: "Error: Bundler "DMG Installer" (dmg) failed to produce a bundle."
2245
2387
 
2246
2388
  By the way, keep in mind that during normal operation, it does also indicate a false-negative while completing successfully similar to the following (please ignore):
2247
2389
 
@@ -2249,13 +2391,18 @@ By the way, keep in mind that during normal operation, it does also indicate a f
2249
2391
  Exec failed with code 2 command [[/usr/bin/SetFile, -c, icnC, /var/folders/4_/g1sw__tx6mjdgyh3mky7vydc0000gp/T/fxbundler4076750801763032201/images/MathBowling/.VolumeIcon.icns] in unspecified directory
2250
2392
  ```
2251
2393
 
2394
+ ## Limitations
2395
+
2396
+ - Glimmer apps have a long startup up time and can take anywhere between 12 and 30 seconds to start depending on the app and the machine. Once started, Glimmer apps run very fast and perform very responsively since Ruby is more than fast and capable for handling desktop GUIs. In any case, one idea to address this limitation is to include a background service (daemon) that can launch Glimmer apps instantly or near instantly by keeping a JRuby runtime started and ready at all times.
2397
+
2252
2398
  ## Resources
2253
2399
 
2254
2400
  * [Code Master Blog](http://andymaleh.blogspot.com/search/label/Glimmer)
2255
- * [Eclipse Zone Tutorial](http://eclipse.dzone.com/articles/an-introduction-glimmer)
2256
- * [InfoQ Article](http://www.infoq.com/news/2008/02/glimmer-jruby-swt)
2257
- * [RubyConf 2008 Video](https://confreaks.tv/videos/rubyconf2008-desktop-development-with-glimmer)
2258
2401
  * [JRuby Cookbook by Justin Edelson & Henry Liu](http://shop.oreilly.com/product/9780596519650.do)
2402
+ * [MountainWest RubyConf 2011 Video](https://confreaks.tv/videos/mwrc2011-whatever-happened-to-desktop-development-in-ruby)
2403
+ * [RubyConf 2008 Video](https://confreaks.tv/videos/rubyconf2008-desktop-development-with-glimmer)
2404
+ * [InfoQ Article](http://www.infoq.com/news/2008/02/glimmer-jruby-swt)
2405
+ * [DZone Tutorial](https://dzone.com/articles/an-introduction-glimmer)
2259
2406
 
2260
2407
  ## Help
2261
2408
 
@@ -2275,7 +2422,7 @@ If you need live help, try the [#glimmer](http://widget.mibbit.com/?settings=751
2275
2422
 
2276
2423
  These features have been suggested. You might see them in a future version of Glimmer. You are welcome to contribute more feature suggestions.
2277
2424
 
2278
- [TODO.md](TODO.md)
2425
+ [TODO.md](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/TODO.md)
2279
2426
 
2280
2427
  ## Change Log
2281
2428