glimmer-dsl-swt 4.17.1.1 → 4.17.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 509796d9977c2f59c3a9044abbf668fbb3899c22741f108cc69e06cbdaa02ef4
4
- data.tar.gz: 7b10e588ced2fee9df89d2c180fd6994d3b60b72107db9b97d90a13082e0e86c
3
+ metadata.gz: 790b2acf622313d3b41027169575662d7eea029bf1fc30555ed1198e6f0d291a
4
+ data.tar.gz: 8d6f48a5eb0a8e3d1469292a8c697acd4106c17bf567188f75ae8929ec3165e1
5
5
  SHA512:
6
- metadata.gz: e0f1fb23814413a61a74fbd47eed5ca3152b759bedf0e8b9dc5e2d43b56e41aaae5f3a2478a837f54cbd1df93ea84e0b4b8904ddd9424dd446f6b5d47fb7c464
7
- data.tar.gz: 30f8dc1a5795d7840618ffe28115d8b39f6f9e4549a5504156a7df02a90a7fa5a4caccfd75f10c864701a46cc0bb3cfe471e4965501c4fad085348c7d92ce1cd
6
+ metadata.gz: d41b1753d14ae5905b157e2fedd75679b8bcf627e5a7ef4277dbf5340ce1fde97b1badea9fe6ff644351c0b43918c4b085e90967ccbfe4cfc17f3d1e5deddcbd
7
+ data.tar.gz: cf2e38dc4254d96b38a0e6c2ed3b414e74df29771e2a3a6f7af4bae5a1c1a36d796eac6b627de3f0b99ffd833ea1089e47bcade4b994fc4e09b0efade7e620c1
@@ -1,5 +1,45 @@
1
1
  # Change Log
2
2
 
3
+ ### 4.17.2.4
4
+
5
+ - New `glimmer run` glimmer command task.
6
+ - Add built in support for handling jar file paths like that in ImageProxy code processing "uri:classloader" path
7
+ - Document that gif background_image only works without on_top and no_trim styles in Windows
8
+ - Give a good error message when Git is not properly setup for Glimmer Scaffolding
9
+ - Give an error message when attempting to scaffold over an already scaffolded directory
10
+ - Fix issue on Windows regarding use of the new EXPERIMENTAL Animated gif support in the `composite#background_image` property
11
+ - Fix SWTProxy.deconstruct method
12
+
13
+
14
+ ### 4.17.2.3
15
+
16
+ - Maintain image file path upon scaling an ImageProxy
17
+ - Add a glimmer rake task that wraps the juwelier rake gemspec:generate task
18
+ - Accept `ImageProxy` as arg for `image` and `background_image` property methods
19
+ - (EXPERIMENTAL) Animate gif images when set as a `background_image` on a `composite`
20
+ - Fix issue with table redraw after data-binding changes leaving old removed table items visible (even if user cannot interact with anymore)
21
+ - Fix issue with running package rake task from `glimmer` command TUI
22
+
23
+ ### 4.17.2.2
24
+
25
+ - Small updates/refactorings in samples
26
+ - Fix issue with displaying `glimmer` command tasks on Windows
27
+
28
+ ### 4.17.2.1
29
+
30
+ - Add `--bundler=group` option to `glimmer` command
31
+ - Add `--pd` option to `glimmer` command
32
+ - Hello, Custom Widget! sample
33
+ - Hello, Custom Shell! sample
34
+
35
+ ### 4.17.2.0
36
+
37
+ - `glimmer` command --bundler option to run with bundler/setup (instead of picking gems directly)
38
+ - Remove Gemfile dependency on Juwelier since it does not relate to GUI (delaying install of it till scaffolding)
39
+ - Remove Gemfile dependency on Warbler since it does not relate to GUI (delaying install of it till packaging)
40
+ - Move Package and Scaffold classes under Glimmer::RakeTask (Glimmer::Package.javapackager_extra_args is now Glimmer::RakeTask::Package.javapackager_extra_args)
41
+ - Fixed issue with scaffolding spec/spec_helper.rb with Juwelier (since it changed from Jeweler)
42
+
3
43
  ### 4.17.1.1
4
44
 
5
45
  - Fixed issue with showing glimmer command tasks twice
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 4.17.1.1
1
+ # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 4.17.2.4
2
2
  ## JRuby Desktop Development GUI Library
3
3
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-swt.svg)](http://badge.fury.io/rb/glimmer-dsl-swt)
4
4
  [![Travis CI](https://travis-ci.com/AndyObtiva/glimmer-dsl-swt.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer-dsl-swt)
@@ -10,11 +10,9 @@
10
10
 
11
11
  (The Original Glimmer Library Since 2007. Beware of Imitators!)
12
12
 
13
- [**Glimmer**](https://rubygems.org/gems/glimmer) is a native-GUI cross-platform desktop development library written in [JRuby](https://www.jruby.org/), an OS-threaded faster version of [Ruby](https://www.ruby-lang.org/en/). [Glimmer](https://rubygems.org/gems/glimmer)'s main innovation is a declarative [Ruby DSL](#glimmer-dsl-syntax) that enables productive and efficient authoring of desktop application user-interfaces while relying on the robust [Eclipse SWT library](https://www.eclipse.org/swt/). [Glimmer](https://rubygems.org/gems/glimmer) additionally innovates by having built-in [data-binding](#data-binding) support, which greatly facilitates synchronizing the GUI with domain models, thus achieving true decoupling of object oriented components and enabling developers to solve business problems (test-first) without worrying about GUI concerns. To get started quickly, [Glimmer](https://rubygems.org/gems/glimmer) offers [scaffolding](#scaffolding) options for [Apps](#in-production), [Gems](#custom-shell-gem), and [Custom Widgets](#custom-widgets). [Glimmer](https://rubygems.org/gems/glimmer) also includes native-executable [packaging](#packaging--distribution) support, sorely lacking in other libraries, thus enabling the delivery of desktop apps written in [Ruby](https://www.ruby-lang.org/en/) as truly native DMG/PKG/APP files on the [Mac](https://www.apple.com/ca/macos) + [App Store](https://developer.apple.com/macos/distribution/) and MSI/EXE files on [Windows](https://www.microsoft.com/en-ca/windows).
13
+ [**Glimmer**](https://rubygems.org/gems/glimmer) is a native-GUI cross-platform desktop development library written in [JRuby](https://www.jruby.org/), an OS-threaded faster version of [Ruby](https://www.ruby-lang.org/en/). [Glimmer](https://rubygems.org/gems/glimmer)'s main innovation is a declarative [Ruby DSL](#glimmer-dsl-syntax) that enables productive and efficient authoring of desktop application user-interfaces while relying on the robust [Eclipse SWT library](https://www.eclipse.org/swt/). [Glimmer](https://rubygems.org/gems/glimmer) additionally innovates by having built-in [data-binding](#data-binding) support, which greatly facilitates synchronizing the GUI with domain models, thus achieving true decoupling of object oriented components and enabling developers to solve business problems (test-first) without worrying about GUI concerns. To get started quickly, [Glimmer](https://rubygems.org/gems/glimmer) offers [scaffolding](#scaffolding) options for [Apps](#in-production), [Gems](#custom-shell-gem), and [Custom Widgets](#custom-widgets). [Glimmer](https://rubygems.org/gems/glimmer) also includes native-executable [packaging](#packaging--distribution) support, sorely lacking in other libraries, thus enabling the delivery of desktop apps written in [Ruby](https://www.ruby-lang.org/en/) as truly native DMG/PKG/APP files on the [Mac](https://www.apple.com/ca/macos) + [App Store](https://developer.apple.com/macos/distribution/), MSI/EXE files on [Windows](https://www.microsoft.com/en-ca/windows), and [Gem Packaged Shell Scripts](#custom-shell-gem) on [Linux](https://www.linux.org/).
14
14
 
15
- [Glimmer receives two updates per month](https://rubygems.org/gems/glimmer-dsl-swt/versions). You can trust [Glimmer](https://rubygems.org/gems/glimmer) with your Ruby desktop GUI development needs.
16
-
17
- NOTE: Glimmer is in beta mode. Please make better by providing feedback and [contributing](#contributing) when possible. The more feedback and issues you report the better.
15
+ [Glimmer receives two updates per month](https://rubygems.org/gems/glimmer-dsl-swt/versions). You can trust [Glimmer](https://rubygems.org/gems/glimmer) with your Ruby desktop GUI development needs. Please make [Glimmer](https://rubygems.org/gems/glimmer) even better by providing feedback and [contributing](#contributing) when possible.
18
16
 
19
17
  [<img src="https://covers.oreillystatic.com/images/9780596519650/lrg.jpg" width=105 /><br />
20
18
  Featured in<br />JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do)
@@ -239,6 +237,7 @@ Glimmer App:
239
237
  - [Hello, World!](#hello-world)
240
238
  - [Tic Tac Toe](#tic-tac-toe)
241
239
  - [Contact Manager](#contact-manager)
240
+ - [Desktop Apps Built with Glimmer DSL for SWT](#desktop-apps-built-with-glimmer-dsl-for-swt)
242
241
  - [Table of contents](#table-of-contents)
243
242
  - [Background](#background)
244
243
  - [Platform Support](#platform-support)
@@ -270,9 +269,10 @@ Glimmer App:
270
269
  - [Glimmer GUI DSL Syntax](#glimmer-gui-dsl-syntax)
271
270
  - [DSL Auto-Expansion](#dsl-auto-expansion)
272
271
  - [Widgets](#widgets)
273
- - [Display](#display)
274
272
  - [SWT Proxies](#swt-proxies)
275
273
  - [Dialog](#dialog)
274
+ - [Display](#display)
275
+ - [Multi-Threading](#multi-threading)
276
276
  - [Menus](#menus)
277
277
  - [ScrolledComposite](#scrolledcomposite)
278
278
  - [Widget Styles](#widget-styles)
@@ -282,6 +282,7 @@ Glimmer App:
282
282
  - [Widget Properties](#widget-properties)
283
283
  - [Color](#color)
284
284
  - [Font](#font)
285
+ - [Image](#image)
285
286
  - [Cursor](#cursor)
286
287
  - [Layouts](#layouts)
287
288
  - [Layout Data](#layout-data)
@@ -296,10 +297,10 @@ Glimmer App:
296
297
  - [Observing Models](#observing-models)
297
298
  - [Custom Widgets](#custom-widgets)
298
299
  - [Simple Example](#simple-example)
299
- - [Lifecycle Hook Example](#lifecycle-hook-example)
300
+ - [Custom Widget Lifecycle Hooks](#custom-widget-lifecycle-hooks)
301
+ - [Lifecycle Hooks Example](#lifecycle-hooks-example)
300
302
  - [Custom Widget API](#custom-widget-api)
301
303
  - [Content/Options Example](#contentoptions-example)
302
- - [Custom Widget Lifecycle Hooks](#custom-widget-lifecycle-hooks)
303
304
  - [Gotcha](#gotcha)
304
305
  - [Final Notes](#final-notes)
305
306
  - [Custom Shells](#custom-shells)
@@ -335,6 +336,8 @@ Glimmer App:
335
336
  - [Hello, Drag and Drop!](#hello-drag-and-drop)
336
337
  - [Hello, Menu Bar!](#hello-menu-bar)
337
338
  - [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu)
339
+ - [Hello, Custom Widget!](#hello-custom-widget)
340
+ - [Hello, Custom Shell!](#hello-custom-shell)
338
341
  - [Elaborate Samples](#elaborate-samples)
339
342
  - [User Profile](#user-profile)
340
343
  - [Login](#login)
@@ -416,6 +419,8 @@ If you intend to build a Glimmer app from scratch with [scaffolding](#scaffoldin
416
419
 
417
420
  Otherwise, Option 2 ([Bundler](#option-2-bundler)) can be followed in rare cases where you want to build an app without [scaffolding](#scaffolding).
418
421
 
422
+ Note: if you encounter any [issues](https://github.com/AndyObtiva/glimmer-dsl-swt/issues), please [report](https://github.com/AndyObtiva/glimmer-dsl-swt/issues) and then install a previous version instead from the list of [Glimmer Releases](https://rubygems.org/gems/glimmer-dsl-swt/versions).
423
+
419
424
  ### Option 1: Direct Install
420
425
  (Use for [Scaffolding](#scaffolding))
421
426
 
@@ -426,7 +431,7 @@ jgem install glimmer-dsl-swt
426
431
 
427
432
  Or this command if you want a specific version:
428
433
  ```
429
- jgem install glimmer-dsl-swt -v 4.17.1.1
434
+ jgem install glimmer-dsl-swt -v 4.17.2.4
430
435
  ```
431
436
 
432
437
  Note: Gem version numbers are in sync with the SWT library versions. The first two digits represent the SWT version number. The last two digits represent the minor and patch versions of Glimmer DSL for SWT.
@@ -437,7 +442,7 @@ Otherwise, you may also run `jruby -S gem install ...`
437
442
 
438
443
  If you are new to Glimmer and would like to continue learning the basics, you may continue to the [Glimmer Command](https://github.com/AndyObtiva/glimmer#glimmer-command) section.
439
444
 
440
- Otherwise, if you are ready to build a Glimmer app on the Mac, you can jump to the [Glimmer Scaffolding](https://github.com/AndyObtiva/glimmer#scaffolding) section next.
445
+ Otherwise, if you are ready to build a Glimmer app, you can jump to the [Glimmer Scaffolding](https://github.com/AndyObtiva/glimmer#scaffolding) section next.
441
446
 
442
447
  Note: if you're using activerecord or activesupport, keep in mind that Glimmer unhooks ActiveSupport::Dependencies as it does not rely on it.
443
448
 
@@ -474,6 +479,8 @@ On Windows, it simply lists the available Glimmer tasks at the end (courtsey of
474
479
 
475
480
  If you are new to Glimmer, you may read the Basic Usage section and skip the rest until you have gone through [Girb (Glimmer irb) Command](#girb-glimmer-irb-command), [Glimmer GUI DSL Syntax](#glimmer-gui-dsl-syntax), and [Samples](#samples).
476
481
 
482
+ Note: If you encounter an issue running the `glimmer` command, run `bundle exec glimmer` instead.
483
+
477
484
  ### Basic Usage
478
485
 
479
486
  ```
@@ -501,9 +508,9 @@ bin/glimmer sample:run[hello_world]
501
508
  Below are the full usage instructions that come up when running `glimmer` without args.
502
509
 
503
510
  ```
504
- Glimmer (Ruby Desktop Development GUI Library) - JRuby Gem: glimmer-dsl-swt v4.17.1.1
511
+ Glimmer (Ruby Desktop Development GUI Library) - JRuby Gem: glimmer-dsl-swt v4.17.2.4
505
512
 
506
- Usage: glimmer [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
513
+ Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
507
514
 
508
515
  Runs Glimmer applications and tasks.
509
516
 
@@ -513,7 +520,9 @@ automatically preloading the glimmer Ruby gem and SWT jar dependency.
513
520
  Optionally, extra Glimmer options, JRuby options, and/or environment variables may be passed in.
514
521
 
515
522
  Glimmer options:
516
- - "--quiet" : Does not announce file path of Glimmer application being launched
523
+ - "--bundler=GROUP" : Activates gems in Bundler default group in Gemfile
524
+ - "--pd=BOOLEAN" : Requires puts_debuggerer to enable pd method
525
+ - "--quiet=BOOLEAN" : Does not announce file path of Glimmer application being launched
517
526
  - "--debug" : Displays extra debugging information, passes "--debug" to JRuby, and enables debug logging
518
527
  - "--log-level=VALUE" : Sets Glimmer's Ruby logger level ("ERROR" / "WARN" / "INFO" / "DEBUG"; default is none)
519
528
 
@@ -528,9 +537,11 @@ Select a Glimmer task to run: (Press ↑/↓ arrow to move, Enter to select and
528
537
  glimmer package[type] # Package app for distribution (generating config, jar, and native files) (type is optional)
529
538
  glimmer package:clean # Clean by removing "dist" and "packages" directories
530
539
  glimmer package:config # Generate JAR config file
540
+ glimmer package:gemspec # Generate gemspec
531
541
  glimmer package:jar # Generate JAR file
532
542
  glimmer package:lock_jars # Lock JARs
533
543
  glimmer package:native[type] # Generate Native files
544
+ glimmer run[app_path] # Runs Glimmer app or custom shell gem in the current directory, unless app_path is specified, then runs it instead (app_path is optional)
534
545
  glimmer sample:code[name] # Outputs code for a Glimmer internal sample [included in gem] (name is required)
535
546
  glimmer sample:list[query] # Lists Glimmer internal samples [included in gem]. Filters by query if specified (query is optional)
536
547
  glimmer sample:run[name] # Runs a Glimmer internal sample [included in gem]. If no name is supplied, it runs all samples
@@ -614,7 +625,7 @@ This will run the hello_tab sample and output its code:
614
625
  ```
615
626
  $ glimmer sample:run[hello_tab]
616
627
 
617
- # /Users/User/.rvm/gems/jruby-9.2.13.0@glimmerapp/gems/glimmer-dsl-swt-4.17.1.1/samples/hello/hello_tab.rb
628
+ # /Users/User/.rvm/gems/jruby-9.2.13.0@glimmerapp/gems/glimmer-dsl-swt-4.17.2.4/samples/hello/hello_tab.rb
618
629
 
619
630
  class HelloTab
620
631
  include Glimmer
@@ -659,7 +670,7 @@ Example:
659
670
  ```
660
671
  $ glimmer sample:code[tic_tac_toe]
661
672
 
662
- # /Users/User/.rvm/gems/jruby-9.2.13.0@glimmerapp/gems/glimmer-dsl-swt-4.17.1.1/samples/elaborate/tic_tac_toe.rb
673
+ # /Users/User/.rvm/gems/jruby-9.2.13.0@glimmerapp/gems/glimmer-dsl-swt-4.17.2.4/samples/elaborate/tic_tac_toe.rb
663
674
 
664
675
  require_relative "tic_tac_toe/board"
665
676
 
@@ -720,7 +731,7 @@ TicTacToe.new.open
720
731
  # # #
721
732
 
722
733
 
723
- # /Users/User/.rvm/gems/jruby-9.2.13.0@glimmerapp/gems/glimmer-dsl-swt-4.17.1.1/samples/elaborate/tic_tac_toe/cell.rb
734
+ # /Users/User/.rvm/gems/jruby-9.2.13.0@glimmerapp/gems/glimmer-dsl-swt-4.17.2.4/samples/elaborate/tic_tac_toe/cell.rb
724
735
 
725
736
  class TicTacToe
726
737
  class Cell
@@ -753,7 +764,7 @@ end
753
764
  # # #
754
765
 
755
766
 
756
- # /Users/User/.rvm/gems/jruby-9.2.13.0@glimmerapp/gems/glimmer-dsl-swt-4.17.1.1/samples/elaborate/tic_tac_toe/board.rb
767
+ # /Users/User/.rvm/gems/jruby-9.2.13.0@glimmerapp/gems/glimmer-dsl-swt-4.17.2.4/samples/elaborate/tic_tac_toe/board.rb
757
768
 
758
769
  require_relative 'cell'
759
770
 
@@ -886,7 +897,7 @@ end
886
897
  ### Scaffolding
887
898
 
888
899
  Glimmer borrows from Rails the idea of Scaffolding, that is generating a structure for your app files that
889
- helps you get started just like true buildinThis g scaffolding helps construction workers, civil engineers, and architects.
900
+ helps you get started just like true building scaffolding helps construction workers, civil engineers, and architects.
890
901
 
891
902
  Glimmer scaffolding goes beyond just scaffolding the app files that Rails does. It also packages it and launches it,
892
903
  getting you to a running and delivered state of an advanced "Hello, World!" Glimmer application right off the bat.
@@ -902,7 +913,7 @@ letting Glimmer scaffolding take care of initial app file structure concerns, su
902
913
  - Icon (under `package/{platform}/{App Name}.{icon_extension}` for `macosx` .icns, `windows` .ico, and `linux` .png)
903
914
  - Bin file for starting application (`bin/{app_name}.rb`)
904
915
 
905
- NOTE: Scaffolding supports Mac and Windows packaging at the moment.
916
+ NOTE: You need to have your Git `user.name` and `github.user` configured before scaffolding since Glimmer uses Juwelier, which relies on them in creating a Git repo for your Glimmer app.
906
917
 
907
918
  #### App
908
919
 
@@ -938,7 +949,7 @@ $ glimmer scaffold[greeter]
938
949
  create spec/spec_helper.rb
939
950
  create spec/greeter_spec.rb
940
951
  create .rspec
941
- Jeweler has prepared your gem in ./greeter
952
+ Juwelier has prepared your gem in ./greeter
942
953
  Created greeter/.gitignore
943
954
  Created greeter/.ruby-version
944
955
  Created greeter/.ruby-gemset
@@ -972,7 +983,19 @@ And, here is the Windows version of the boilerplate Preferences dialog.
972
983
 
973
984
  ![Glimmer Scaffold App Windows Preferences](images/glimmer-scaffolding-app-windows-preferences.png)
974
985
 
975
- In order to run the app after making changes, you must run the `glimmer` command and pass it the generated script under the `bin` directory as an argument:
986
+ In order to run the app after making changes, you must run the `glimmer run`. It automatically detects the generated run script under the `bin` directory and uses it as an argument.
987
+
988
+ ```
989
+ glimmer run
990
+ ```
991
+
992
+ Alternatively, to mantually run the app, you may type:
993
+
994
+ ```
995
+ glimmer run[bin/greeter]
996
+ ```
997
+
998
+ or:
976
999
 
977
1000
  ```
978
1001
  glimmer bin/greeter
@@ -1009,7 +1032,7 @@ glimmer scaffold:cw[name]
1009
1032
  #### Custom Shell Gem
1010
1033
 
1011
1034
  Custom shell gems are self-contained Glimmer apps as well as reusable custom shells.
1012
- They have everything scaffolded Glimmer apps come with in addition to gem content like a [jeweler](https://github.com/technicalpickles/jeweler) Rakefile that can build gemspec and release gems.
1035
+ They have everything scaffolded Glimmer apps come with in addition to gem content like a [Juwelier](https://rubygems.org/gems/juwelier) Rakefile that can build gemspec and release gems.
1013
1036
  Unlike scaffolded Glimmer apps, custom shell gem content lives under the `lib` directory (not `app`).
1014
1037
  They can be packaged as both a native executable (e.g. Mac DMG/PKG/APP) and a Ruby gem.
1015
1038
  Of course, you can just build a Ruby gem and disregard native executable packaging if you do not need it.
@@ -1034,7 +1057,7 @@ Only official Glimmer gems created by the Glimmer project committers will have n
1034
1057
 
1035
1058
  Since custom shell gems are both an app and a gem, they provide two ways to run:
1036
1059
  - Run the `glimmer` command and pass it the generated script under the `bin` directory that matches the gem name (e.g. run `glimmer bin/glimmer-cs-calculator`)
1037
- - Run the executable binary file that ships with the gem directly (without `glimmer`). It intentionally has a shorter name for convenience since it is meant to be used on the command line (not in a package), so you can leave out the `glimmer-cs-` prefix (e.g. run `bin/calculator` directly)
1060
+ - Run the executable shell script that ships with the gem directly (does not need the `glimmer` command). It intentionally has a shorter name for convenience since it is meant to be used on the command line (not in a package), so you can leave out the `glimmer-cs-` prefix (e.g. run `bin/calculator` directly). This is also used as the main way of running custom shell gems on Linux.
1038
1061
 
1039
1062
  Examples:
1040
1063
 
@@ -1139,6 +1162,28 @@ Output:
1139
1162
 
1140
1163
  ```
1141
1164
 
1165
+ Example:
1166
+
1167
+ Check all custom widgets for Glimmer.
1168
+
1169
+ ```
1170
+ glimmer list:gems:cw
1171
+ ```
1172
+
1173
+ Output:
1174
+
1175
+ ```
1176
+
1177
+ Glimmer Custom Widget Gems at rubygems.org:
1178
+
1179
+ Name Gem Version Author Description
1180
+
1181
+ Browser (Chromium) glimmer-cw-browser-chromium 1.0.0 Andy Maleh Chromium Browser - Glimmer Custom Widget
1182
+ Cdatetime (Nebula) glimmer-cw-cdatetime-nebula 1.5.0.0.1 Andy Maleh Nebula CDateTime Widget - Glimmer Custom Widget
1183
+ Video glimmer-cw-video 1.0.0 Andy Maleh Glimmer Custom Widget - Video
1184
+
1185
+ ```
1186
+
1142
1187
  #### Listing DSL Gems
1143
1188
 
1144
1189
  The following command lists available Glimmer [DSL Gems](#multi-dsl-support) (prefixed with "glimmer-dsl-" by convention) created by the the Glimmer community and published on [rubygems.org](http://www.rubygems.org):
@@ -1161,24 +1206,46 @@ Output:
1161
1206
 
1162
1207
  Name Gem Version Author Description
1163
1208
 
1164
- Css glimmer-dsl-css 0.2.0 AndyMaleh Glimmer DSL for CSS
1165
- Opal glimmer-dsl-opal 0.1.0 AndyMaleh Glimmer DSL for Opal
1166
- Swt glimmer-dsl-swt 4.17.1.1 AndyMaleh Glimmer DSL for SWT
1209
+ Css glimmer-dsl-css 1.1.0 AndyMaleh Glimmer DSL for CSS
1210
+ Opal glimmer-dsl-opal 0.3.0 AndyMaleh Glimmer DSL for Opal
1211
+ Swt glimmer-dsl-swt 4.17.2.4 AndyMaleh Glimmer DSL for SWT
1167
1212
  Tk glimmer-dsl-tk 0.0.5 AndyMaleh Glimmer DSL for Tk
1168
- Xml glimmer-dsl-xml 0.2.0 AndyMaleh Glimmer DSL for XML
1213
+ Xml glimmer-dsl-xml 1.1.0 AndyMaleh Glimmer DSL for XML
1169
1214
  ```
1170
1215
 
1171
1216
  ### Packaging
1172
1217
 
1218
+ Glimmer supports packaging applications as native files on Mac and Windows.
1219
+
1173
1220
  Glimmer packaging tasks are detailed under [Packaging & Distribution](#packaging--distribution).
1174
1221
 
1222
+ On Linux, the Glimmer [Custom Shell Gem](#custom-shell-gem) approach provides a [Gem Packaged Shell Script](#custom-shell-gem) (e.g. `calculator` command becomes available after installing the [glimmer-cs-calculator](https://github.com/AndyObtiva/glimmer-cs-calculator) gem)
1223
+
1175
1224
  ### Raw JRuby Command
1176
1225
 
1177
1226
  If there is a need to run Glimmer directly via the `jruby` command, you
1178
- may run the following:
1227
+ may run the following on Windows/Linux:
1228
+
1229
+ ```
1230
+ jruby -r glimmer-dsl-swt -S application.rb
1231
+ ```
1232
+
1233
+ Or, the following on Mac:
1234
+
1235
+ ```
1236
+ jruby -J-XstartOnFirstThread -r glimmer-dsl-swt -S application.rb
1237
+ ```
1238
+
1239
+ If you want to use a specific custom version of SWT, run the following on Windows/Linux:
1240
+
1241
+ ```
1242
+ jruby -J-classpath "path_to/swt.jar" -r glimmer-dsl-swt -S application.rb
1243
+ ```
1244
+
1245
+ Or, the following on Mac:
1179
1246
 
1180
1247
  ```
1181
- jruby -J-classpath "path_to/swt.jar" -r glimmer -S application.rb
1248
+ jruby -J-XstartOnFirstThread -J-classpath "path_to/swt.jar" -r glimmer-dsl-swt -S application.rb
1182
1249
  ```
1183
1250
 
1184
1251
  The `-J-classpath` option specifies the `swt.jar` file path, which can be a
@@ -1196,7 +1263,7 @@ However, if there is a reason to use the raw `jruby` command directly instead of
1196
1263
 
1197
1264
  Example:
1198
1265
  ```
1199
- jruby -J-XstartOnFirstThread -J-classpath "path_to/swt.jar" -r glimmer -S application.rb
1266
+ jruby -J-XstartOnFirstThread -J-classpath "path_to/swt.jar" -r glimmer-dsl-swt -S application.rb
1200
1267
  ```
1201
1268
 
1202
1269
  ## Girb (Glimmer irb) Command
@@ -1280,19 +1347,21 @@ Glimmer DSL syntax consists mainly of:
1280
1347
 
1281
1348
  ### DSL Auto-Expansion
1282
1349
 
1283
- Glimmer supports a new and radical Ruby DSL concept called DSL Auto-Expansion. It is explained by first mentioning the two types of Glimmer GUI DSL keywords: static and dynamic.
1350
+ Glimmer supports a new and radical Ruby DSL concept called DSL Auto-Expansion. To explain, let's first mention the two types of Glimmer GUI DSL keywords: static and dynamic.
1284
1351
 
1285
1352
  Static keywords are pre-identified keywords in the Glimmer DSL, such as `shell`, `display`, `message_box`, `async_exec`, `sync_exec`, and `bind`.
1286
1353
 
1287
- Dynamic keywords are dynamically figured out from currently imported (aka required/loaded) SWT widgets, custom widgets, and widget properties. Examples are: `label`, `combo`, and `list` for widgets and `enabled`, `text`, and `selection` for properties.
1354
+ Dynamic keywords are dynamically figured out from currently imported (aka required/loaded) SWT widgets and custom widgets. Examples are: `label`, `combo`, and `list` for SWT widgets and `c_date_time`, `video`, and `gantt_chart` for custom widgets.
1288
1355
 
1289
- The only reason to distinguish between the two types of Glimmer DSL keywords is to realize that importing new Glimmer [custom widgets](#custom-widgets) and Java SWT custom widget libraries automatically expands Glimmer's DSL vocabulary via new dynamic keywords.
1356
+ The only reason to distinguish between the two is to realize that importing new Glimmer [custom widgets](#custom-widgets) and Java SWT custom widget libraries automatically expands Glimmer's DSL vocabulary with new dynamic keywords.
1290
1357
 
1291
- For example, if a project adds this custom Java SWT library:
1358
+ For example, if a project adds this custom Java SWT library from the [Nebula Project](https://www.eclipse.org/nebula/):
1292
1359
 
1293
- https://www.eclipse.org/nebula/widgets/cdatetime/cdatetime.php?page=operation
1360
+ https://www.eclipse.org/nebula/widgets/gallery/gallery.php
1294
1361
 
1295
- Glimmer will automatically support using the keyword `c_date_time`
1362
+ Glimmer will automatically support using the keyword `gallery`
1363
+
1364
+ This is what DSL Auto-Expansion is.
1296
1365
 
1297
1366
  You will learn more about widgets next.
1298
1367
 
@@ -1407,27 +1476,9 @@ shell {
1407
1476
 
1408
1477
  If you are new to Glimmer, you have learned enough to start running some [samples](#samples). Go ahead and run all Glimmer [samples](#samples), and come back to read the rest in any order you like since this material is more organized like a reference.
1409
1478
 
1410
- #### Display
1479
+ If you are advanced and need more widgets, check out the [Nebula Project](https://www.eclipse.org/nebula/) for an extensive list of high quality custom widgets:
1411
1480
 
1412
- SWT Display is a singleton in Glimmer. It is used in SWT to represent your display device, allowing you to manage GUI globally
1413
- and access available monitors.
1414
- It is automatically instantiated upon first instantiation of a `shell` widget.
1415
- Alternatively, for advanced use cases, it can be created explicitly with Glimmer `display` keyword. When a `shell` is later declared, it
1416
- automatically uses the display created earlier without having to explicitly hook it.
1417
-
1418
- ```ruby
1419
- @display = display {
1420
- cursor_location 300, 300
1421
- on_swt_keydown {
1422
- # ...
1423
- }
1424
- # ...
1425
- }
1426
- @shell = shell { # uses display created above
1427
- }
1428
- ```
1429
- The benefit of instantiating an SWT Display explicitly is to set [Properties](#widget-properties) or [Observers](#observer).
1430
- Although SWT Display is not technically a widget, it has similar APIs in SWT and similar DSL support in Glimmer.
1481
+ https://www.eclipse.org/nebula/
1431
1482
 
1432
1483
  #### SWT Proxies
1433
1484
 
@@ -1444,7 +1495,26 @@ Glimmer follows Proxy Design Pattern by having Ruby proxy wrappers for all SWT o
1444
1495
 
1445
1496
  These proxy objects have an API and provide some convenience methods, some of which are mentioned below.
1446
1497
 
1447
- ##### `#content { ... }`
1498
+ ##### swt_widget
1499
+
1500
+ Glimmer SWT proxies come with the instance method `#swt_widget`, which returns the actual SWT `Widget` object wrapped by the Glimmer widget proxy. It is useful in cases you'd like to do some custom SWT programming outside of Glimmer.
1501
+
1502
+ ##### Shell widget proxy methods
1503
+
1504
+ Shell widget proxy has extra methods specific to SWT Shell:
1505
+ - `#open`: Opens the shell, making it visible and active, and starting the SWT Event Loop (you may learn more about it here: https://help.eclipse.org/2019-12/nftopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/widgets/Display.html). If shell was already open, but hidden, it makes the shell visible.
1506
+ - `#show`: Alias for `#open`
1507
+ - `#hide`: Hides a shell setting "visible" property to false
1508
+ - `#close`: Closes the shell
1509
+ - `#center`: Centers the shell within monitor it is in
1510
+ - `#start_event_loop`: (happens as part of `#open`) Starts SWT Event Loop (you may learn more about it here: https://help.eclipse.org/2019-12/nftopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/widgets/Display.html). This method is not needed except in rare circumstances where there is a need to start the SWT Event Loop before opening the shell.
1511
+ - `#visible?`: Returns whether a shell is visible
1512
+ - `#opened_before?`: Returns whether a shell has been opened at least once before (additionally implying the SWT Event Loop has been started already)
1513
+ - `#visible=`: Setting to true opens/shows shell. Setting to false hides the shell.
1514
+ - `#pack`: Packs contained widgets using SWT's `Shell#pack` method
1515
+ - `#pack_same_size`: Packs contained widgets without changing shell's size when widget sizes change
1516
+
1517
+ ##### Widget Content Block
1448
1518
 
1449
1519
  Glimmer allows re-opening any widget and adding properties or extra content after it has been constructed already by using the `#content` method.
1450
1520
 
@@ -1470,7 +1540,31 @@ Example (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
1470
1540
  @shell.open
1471
1541
  ```
1472
1542
 
1473
- ##### `message_box`
1543
+ ##### Shell Icon
1544
+
1545
+ To set the shell icon, simply set the `image` property under the `shell` widget. This shows up in the operating system toolbar and app-switcher (e.g. CMD+TAB) (and application window top-left corner in Windows)
1546
+
1547
+ Example:
1548
+
1549
+ ```ruby
1550
+ shell {
1551
+ # ...
1552
+ image 'path/to/image.png'
1553
+ # ...
1554
+ }
1555
+ ```
1556
+
1557
+ ###### Shell Icon Tip for Packaging on Windows
1558
+
1559
+ When setting shell icon for a [packaged](#packaging--distribution) app, which has a JAR file at its core, you can reference the `ico` file that ships with the app by going one level up (e.g. `'../AppName.ico'`)
1560
+
1561
+ #### Dialog
1562
+
1563
+ 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.
1564
+
1565
+ 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.
1566
+
1567
+ ##### message_box
1474
1568
 
1475
1569
  The Glimmer DSL `message_box` keyword is similar to `shell`, but renders a modal dialog with a title `text` property and main body `message` property. It may also be opened via the `#open` method.
1476
1570
 
@@ -1509,48 +1603,65 @@ message_box {
1509
1603
  }.open
1510
1604
  ```
1511
1605
 
1512
- ##### `#swt_widget`
1513
-
1514
- Glimmer widget objects come with an instance method `#swt_widget` that returns the actual SWT `Widget` object wrapped by the Glimmer widget object. It is useful in cases you'd like to do some custom SWT programming outside of Glimmer.
1515
-
1516
- ##### Shell widget proxy methods
1517
-
1518
- Shell widget proxy has extra methods specific to SWT Shell:
1519
- - `#open`: Opens the shell, making it visible and active, and starting the SWT Event Loop (you may learn more about it here: https://help.eclipse.org/2019-12/nftopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/widgets/Display.html). If shell was already open, but hidden, it makes the shell visible.
1520
- - `#show`: Alias for `#open`
1521
- - `#hide`: Hides a shell setting "visible" property to false
1522
- - `#close`: Closes the shell
1523
- - `#center`: Centers the shell within monitor it is in
1524
- - `#start_event_loop`: (happens as part of `#open`) Starts SWT Event Loop (you may learn more about it here: https://help.eclipse.org/2019-12/nftopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/widgets/Display.html). This method is not needed except in rare circumstances where there is a need to start the SWT Event Loop before opening the shell.
1525
- - `#visible?`: Returns whether a shell is visible
1526
- - `#opened_before?`: Returns whether a shell has been opened at least once before (additionally implying the SWT Event Loop has been started already)
1527
- - `#visible=`: Setting to true opens/shows shell. Setting to false hides the shell.
1528
- - `#pack`: Packs contained widgets using SWT's `Shell#pack` method
1529
- - `#pack_same_size`: Packs contained widgets without changing shell's size when widget sizes change
1606
+ #### Display
1530
1607
 
1531
- ##### Shell Icon
1608
+ The SWT `Display` class is a singleton in Glimmer. It is used in SWT to represent your display device, allowing you to manage GUI globally
1609
+ and access available monitors. Additionally, it is responsible for the SWT event loop, which runs on the first thread the Glimmer application starts on. In multi-threaded programming, `Display` provides the methods `async_exec` and `sync_exec` to enable enqueuing GUI changes asynchronously or synchronously from threads other than the main (first) thread since direct GUI changes are forbidden from other threads by design.
1532
1610
 
1533
- To set the shell icon, simply set the `image` property under the `shell` widget. This shows up in the operating system toolbar and app-switcher (e.g. CMD+TAB) (and application window top-left corner in Windows)
1611
+ `Display` is automatically instantiated upon first instantiation of a `shell` widget.
1534
1612
 
1535
- Example:
1613
+ Alternatively, for advanced use cases, a `Display` can be created explicitly with the Glimmer `display` keyword. When a `shell` is later declared, it
1614
+ automatically uses the `display` created earlier without having to explicitly hook it.
1536
1615
 
1537
1616
  ```ruby
1538
- shell {
1539
- # ...
1540
- image 'path/to/image.png'
1617
+ @display = display {
1618
+ cursor_location 300, 300
1619
+ on_swt_keydown {
1620
+ # ...
1621
+ }
1541
1622
  # ...
1542
1623
  }
1624
+ @shell = shell { # uses display created above
1625
+ }
1543
1626
  ```
1627
+ The benefit of instantiating an SWT Display explicitly is to set [Properties](#widget-properties) or [Observers](#observer).
1628
+ Although SWT Display is not technically a widget, it has similar APIs and DSL support.
1544
1629
 
1545
- ###### Shell Icon Tip for Packaging on Windows
1630
+ #### Multi-Threading
1546
1631
 
1547
- When setting shell icon for a [packaged](#packaging--distribution) app, which has a JAR file at its core, you can reference the `ico` file that ships with the app by going one level up (e.g. `'../AppName.ico'`)
1632
+ [JRuby](https://www.jruby.org/) supports [truly parallel multi-threading](https://github.com/jruby/jruby/wiki/Concurrency-in-jruby) since it relies on the JVM (Java Virtual Machine). As such, it enables development of highly-interactive desktop applications that can do background work while the user is interacting with the GUI.
1548
1633
 
1549
- #### Dialog
1634
+ ##### async_exec
1550
1635
 
1551
- 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.
1636
+ `async_exec` is a Glimmer DSL keyword in addition to being a method on `display`. It accepts a block and when invoked, adds the block to the end of a queue of GUI events scheduled to run on the SWT event loop, executing asynchronously.
1552
1637
 
1553
- 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.
1638
+ Example (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
1639
+
1640
+ ```
1641
+ @shell = shell {
1642
+ text 'Glimmer'
1643
+ @label = label {
1644
+ text 'Hello, World!'
1645
+ }
1646
+ }
1647
+
1648
+ Thread.new {
1649
+ [:red, :dark_green, :blue].cycle { |color|
1650
+ async_exec {
1651
+ @label.content {
1652
+ foreground color if @shell.visible?
1653
+ }
1654
+ }
1655
+ sleep(1)
1656
+ }
1657
+ }
1658
+
1659
+ @shell.open
1660
+ ```
1661
+
1662
+ ##### sync_exec
1663
+
1664
+ `sync_exec` works just like `async_exec` except it executes the block synchronously at the earliest opportunity possible, waiting for the block to be finished.
1554
1665
 
1555
1666
  #### Menus
1556
1667
 
@@ -1883,6 +1994,16 @@ Example:
1883
1994
  @font = font(name: 'Arial', height: 36, style: :normal)
1884
1995
  ```
1885
1996
 
1997
+ ### Image
1998
+
1999
+ The `image` keyword creates an instance of [org.eclipse.swt.graphics.Image](https://help.eclipse.org/2020-09/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/graphics/Image.html).
2000
+
2001
+ It is a graphics `Image` object (not a widget), but is used used in setting the `image` property on `label` and `background_image` on `composite` (and subclasses)
2002
+
2003
+ Glimmer recently included **EXPERIMENTAL** gif animation support for the `background_image` property on `composite' since SWT does not support animation by default.
2004
+
2005
+ Learn more about images in general at this SWT Image guide: https://www.eclipse.org/articles/Article-SWT-images/graphics-resources.html
2006
+
1886
2007
  ### Cursor
1887
2008
 
1888
2009
  SWT widget `cursor` property represents the mouse cursor you see on the screen when you hover over that widget.
@@ -2602,12 +2723,44 @@ end
2602
2723
 
2603
2724
  ### Custom Widgets
2604
2725
 
2605
- Glimmer supports creating custom widgets with minimal code, which automatically extends Glimmer's DSL syntax with an underscored lowercase keyword.
2726
+ Custom widgets are brand new Glimmer DSL keywords that represent aggregates of existing widgets (e.g. `address_form`), customized existing widgets (e.g. `greeting_label`), or brand new widgets (e.g. `oscilloscope`)
2606
2727
 
2607
- 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 `__`)
2728
+ You can find out about [published Glimmer Custom Widgets](https://github.com/AndyObtiva/glimmer-dsl-swt#gem-listing) by running the `glimmer list:gems:customwidget` command
2729
+
2730
+ Glimmer supports two ways of creating custom widgets with minimal code:
2731
+ 1. Method-based Custom Widgets (for single-view-internal reuse): Extract a method containing Glimmer DSL widget syntax. Useful for quickly eliminating redundant code within a single view.
2732
+ 2. Class-based Custom Widgets (for multiple-view-external reuse): Create a class that includes the `Glimmer::UI::CustomWidget` module and Glimmer DSL widget syntax in a `body {}` block. This will automatically extend Glimmer's DSL syntax with an underscored lowercase keyword matching the class name by convention. Useful in making a custom widget available in many views.
2733
+
2734
+ Approach #1 is a casual Ruby-based approach. Approach #2 is the official Glimmer approach. Typically, when referring to Custom Widgets, we are talking about Class-based Custom Widgets.
2735
+
2736
+ A developer might start with approach #1 to eliminate duplication in a view and later upgrade it to approach #2 when needing to export a custom widget to make it available in many views.
2737
+
2738
+ Class-based Custom Widgets offer a number of benefits over method-based custom widgets, such as built-in support for passing SWT style, nested block of extra widgets and properties, and `before_body`/`after_body` hooks.
2608
2739
 
2609
2740
  #### Simple Example
2610
2741
 
2742
+ ##### Method-Based Custom Widget Example
2743
+
2744
+ (you may copy/paste in [`girb`](#girb-glimmer-irb-command))
2745
+
2746
+ Definition and usage in the same file:
2747
+ ```ruby
2748
+ def red_label(label_text)
2749
+ label {
2750
+ text label_text
2751
+ background :red
2752
+ }
2753
+ end
2754
+
2755
+ shell {
2756
+ red_label('Red Label')
2757
+ }.open
2758
+ ```
2759
+
2760
+ ##### Class-Based Custom Widget Example
2761
+
2762
+ 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 `__`)
2763
+
2611
2764
  (you may copy/paste in [`girb`](#girb-glimmer-irb-command))
2612
2765
 
2613
2766
  Definition:
@@ -2626,15 +2779,22 @@ end
2626
2779
  Usage:
2627
2780
  ```ruby
2628
2781
  shell {
2629
- red_label {
2630
- text 'Red Label'
2782
+ red_label(:center) {
2783
+ text 'Red Label'
2784
+ foreground :green
2631
2785
  }
2632
2786
  }.open
2633
2787
  ```
2634
2788
 
2635
- As you can see, `RedLabel` became Glimmer DSL keyword: `red_label`
2789
+ As you can see, `RedLabel` became the Glimmer DSL keyword `red_label` and worked just like a standard label by taking in SWT style and nested properties. As such, it is a first-class citizen of the Glimmer GUI DSL.
2636
2790
 
2637
- #### Lifecycle Hook Example
2791
+ #### Custom Widget Lifecycle Hooks
2792
+
2793
+ You may execute code before or after evaluating the body with these lifecycle hooks:
2794
+ - `before_body`: takes a block that executes in the custom widget instance scope before calling `body`. Useful for initializing variables to later use in `body`
2795
+ - `after_body`: takes a block that executes in the custom widget instance scope after calling `body`. Useful for setting up observers on widgets built in `body` (set in instance variables) and linking to other shells.
2796
+
2797
+ #### Lifecycle Hooks Example
2638
2798
 
2639
2799
  (you may copy/paste in [`girb`](#girb-glimmer-irb-command))
2640
2800
 
@@ -2729,12 +2889,6 @@ shell {
2729
2889
 
2730
2890
  Notice how `:no_focus` was the `swt_style` value, followed by the `options` hash `{orientation: :horizontal, bg_color: :white}`, and finally the `content` block containing the label with `'SANDWICH CONTENT'`
2731
2891
 
2732
- #### Custom Widget Lifecycle Hooks
2733
-
2734
- Last but not least, these are the available lifecycle hooks:
2735
- - `before_body`: takes a block that executes in the custom widget instance scope before calling `body`. Useful for initializing variables to later use in `body`
2736
- - `after_body`: takes a block that executes in the custom widget instance scope after calling `body`. Useful for setting up observers on widgets built in `body` (set in instance variables) and linking to other shells.
2737
-
2738
2892
  #### Gotcha
2739
2893
 
2740
2894
  Beware of defining a custom attribute that is a common SWT widget property name.
@@ -2770,12 +2924,16 @@ The `text` method invoked in the custom widget body will call the one you define
2770
2924
  This [Eclipse guide](https://www.eclipse.org/articles/Article-Writing%20Your%20Own%20Widget/Writing%20Your%20Own%20Widget.htm) for how to write custom SWT widgets is also applicable to Glimmer Custom Widgets written in Ruby. I recommend reading it:
2771
2925
  [https://www.eclipse.org/articles/Article-Writing%20Your%20Own%20Widget/Writing%20Your%20Own%20Widget.htm](https://www.eclipse.org/articles/Article-Writing%20Your%20Own%20Widget/Writing%20Your%20Own%20Widget.htm)
2772
2926
 
2927
+ Also, you may check out [Hello, Custom Widget!](#hello-custom-widget) for another example.
2928
+
2773
2929
  ### Custom Shells
2774
2930
 
2775
2931
  Custom shells are a kind of custom widgets that have shells only as the body root. They can be self-contained applications that may be opened and hidden/closed independently of the main app.
2776
2932
 
2777
2933
  They may also be chained in a wizard fashion.
2778
2934
 
2935
+ You can find out about [published Glimmer Custom Shells](https://github.com/AndyObtiva/glimmer-dsl-swt#gem-listing) by running the `glimmer list:gems:customshell` command
2936
+
2779
2937
  Example (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
2780
2938
 
2781
2939
  ```ruby
@@ -2835,6 +2993,8 @@ shell { |app_shell|
2835
2993
  }.open
2836
2994
  ```
2837
2995
 
2996
+ You may check out [Hello, Custom Shell!](#hello-custom-shell) for another example.
2997
+
2838
2998
  ### Drag and Drop
2839
2999
 
2840
3000
  Glimmer offers Drag and Drop support, thanks to [SWT](https://www.eclipse.org/swt/) and Glimmer's lightweight [DSL syntax](#glimmer-dsl-syntax).
@@ -3393,6 +3553,18 @@ Here is an SWT Custom Widget guide:
3393
3553
 
3394
3554
  https://www.eclipse.org/articles/Article-Writing%20Your%20Own%20Widget/Writing%20Your%20Own%20Widget.htm
3395
3555
 
3556
+ Here is an SWT Image guide:
3557
+
3558
+ https://www.eclipse.org/articles/Article-SWT-images/graphics-resources.html
3559
+
3560
+ Here is an SWT Graphics / Canvas-Drawing guide:
3561
+
3562
+ https://www.eclipse.org/articles/Article-SWT-graphics/SWT_graphics.html
3563
+
3564
+ Here is the Nebula Project (custom widget library) homepage:
3565
+
3566
+ https://www.eclipse.org/nebula/
3567
+
3396
3568
  ## Samples
3397
3569
 
3398
3570
  Check the [samples](samples) directory in [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) for examples on how to write Glimmer applications. To run a sample, make sure to install the `glimmer` gem first and then use the `glimmer` command to run it (alternatively, you may clone the repo, follow [CONTRIBUTING.md](CONTRIBUTING.md) instructions, and run samples locally with development glimmer command: `bin/glimmer`).
@@ -3585,6 +3757,41 @@ glimmer sample:run[hello_pop_up_context_menu]
3585
3757
  ![Hello Pop Up Context Menu](images/glimmer-hello-pop-up-context-menu.png)
3586
3758
  ![Hello Pop Up Context Menu Popped Up](images/glimmer-hello-pop-up-context-menu-popped-up.png)
3587
3759
 
3760
+ #### Hello, Custom Widget!
3761
+
3762
+ This sample demonstrates the use of a custom widget in Glimmer.
3763
+
3764
+ Code:
3765
+
3766
+ [samples/hello/hello_custom_widget.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_custom_widget.rb)
3767
+
3768
+ Run:
3769
+
3770
+ ```
3771
+ glimmer sample:run[hello_custom_widget]
3772
+ ```
3773
+
3774
+ ![Hello Custom Widget](images/glimmer-hello-custom-widget.gif)
3775
+
3776
+ #### Hello, Custom Shell!
3777
+
3778
+ This sample demonstrates the use of a custom shell (aka custom window) in Glimmer.
3779
+
3780
+ Code:
3781
+
3782
+ [samples/hello/hello_custom_shell.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_custom_shell.rb)
3783
+
3784
+ Run:
3785
+
3786
+ ```
3787
+ glimmer sample:run[hello_custom_shell]
3788
+ ```
3789
+
3790
+ ![Hello Custom Shell](images/glimmer-hello-custom-shell.png)
3791
+ ![Hello Custom Shell Email1](images/glimmer-hello-custom-shell-email1.png)
3792
+ ![Hello Custom Shell Email2](images/glimmer-hello-custom-shell-email2.png)
3793
+ ![Hello Custom Shell Email3](images/glimmer-hello-custom-shell-email3.png)
3794
+
3588
3795
  ### Elaborate Samples
3589
3796
 
3590
3797
  For more elaborate samples, check the following:
@@ -3706,7 +3913,7 @@ Gladiator is a good demonstration of:
3706
3913
 
3707
3914
  #### Timer
3708
3915
 
3709
- [<img alt="Glimmer Timer Icon" src="https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-timer/master/images/glimmer-timer-logo.png" height=40 /> Timer](https://github.com/AndyObtiva/glimmer-cs-timer) is a sample app demonstrating data-binding and multi-threading in a desktop application.
3916
+ [<img alt="Glimmer Timer Icon" src="https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-timer/master/images/glimmer-timer-logo.png" height=40 /> Timer](https://github.com/AndyObtiva/glimmer-cs-timer) is a sample app demonstrating data-binding, multi-threading, and Java (Sound) library integration in a desktop application.
3710
3917
 
3711
3918
  [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-timer/master/glimmer-timer-screenshot.png" />](https://github.com/AndyObtiva/glimmer-cs-timer)
3712
3919
 
@@ -3730,6 +3937,8 @@ If you have a Glimmer app you would like referenced here, please mention in a Pu
3730
3937
 
3731
3938
  ## Packaging & Distribution
3732
3939
 
3940
+ Note: this section mostly applies to Mac and Windows. On Linux, the Glimmer [Custom Shell Gem](#custom-shell-gem) approach provides a [Gem Packaged Shell Script](#custom-shell-gem) (e.g. `calculator` command becomes available after installing the [glimmer-cs-calculator](https://github.com/AndyObtiva/glimmer-cs-calculator) gem)
3941
+
3733
3942
  Glimmer simplifies the process of native-executable packaging and distribution on Mac and Windows via a single `glimmer package` command:
3734
3943
 
3735
3944
  ```
@@ -3754,7 +3963,7 @@ require 'glimmer/rake_task'
3754
3963
  ```
3755
3964
 
3756
3965
  The Glimmer packaging process done in the `glimmer package` command consists of the following steps:
3757
- 1. Generate gemspec via Jeweler (`rake gemspec:generate`): Having a gemspec is required by the [`jar-dependencies`](https://github.com/mkristian/jar-dependencies) JRuby gem, used by JRuby libraries to declare JAR dependencies.
3966
+ 1. Generate gemspec via [Juwelier](https://rubygems.org/gems/juwelier) (`glimmer package:gemspec`): Having a gemspec is required by the [`jar-dependencies`](https://github.com/mkristian/jar-dependencies) JRuby gem, used by JRuby libraries to declare JAR dependencies.
3758
3967
  1. Lock JAR versions (`glimmer package:lock_jars`): This locks versions of JAR dependencies leveraged by the `jar-dependencies` JRuby gem, downloading them into the `./vendor` directory so they would get inside the top-level Glimmer app/gem JAR file.
3759
3968
  1. Generate [Warbler](https://github.com/jruby/warbler) config (`glimmer package:config`): Generates initial Warbler config file (under `./config/warble.rb`) to use for generating JAR file.
3760
3969
  1. Generate JAR file using [Warbler](https://github.com/jruby/warbler) (`glimmer package:jar`): Enables bundling a Glimmer app into a JAR file under the `./dist` directory
@@ -3765,7 +3974,7 @@ The JAR file name will match your application local directory name (e.g. `MathBo
3765
3974
  The 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)
3766
3975
 
3767
3976
  The `glimmer package` command will automatically set "mac.CFBundleIdentifier" to ="org.#{project_name}.application.#{project_name}".
3768
- You may override by configuring as an extra argument for javapackger (e.g. Glimmer::Package.javapackager_extra_args = " -Bmac.CFBundleIdentifier=org.andymaleh.application.MathBowling")
3977
+ You may override by configuring as an extra argument for javapackger (e.g. Glimmer::RakeTask::Package.javapackager_extra_args = " -Bmac.CFBundleIdentifier=org.andymaleh.application.MathBowling")
3769
3978
 
3770
3979
  ### Packaging Defaults
3771
3980
 
@@ -3793,7 +4002,7 @@ require_relative '../app/my_application.rb'
3793
4002
  - Include DMG Background Icon (Optional): Simply place a .png file under `package/macosx/{HumanAppName}-background.png`
3794
4003
  - Include Version (Optional): Create a `VERSION` file in your application and fill it your app version on one line (e.g. `1.1.0`)
3795
4004
  - 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).
3796
- - 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).
4005
+ - Extra args (Optional): You may optionally add the following to `Rakefile` to configure extra arguments for javapackager: `Glimmer::RakeTask::Package.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).
3797
4006
 
3798
4007
  ### javapackager Extra Arguments
3799
4008
 
@@ -3805,7 +4014,7 @@ In order to explicitly configure javapackager, Mac package attributes, or sign y
3805
4014
  - https://developer.apple.com/library/archive/releasenotes/General/SubmittingToMacAppStore/index.html#//apple_ref/doc/uid/TP40010572-CH16-SW8
3806
4015
 
3807
4016
  The Glimmer rake task allows passing extra options to javapackager via:
3808
- - `Glimmer::Packager.javapackager_extra_args="..."` in your application Rakefile
4017
+ - `Glimmer::RakeTask::Package.javapackager_extra_args="..."` in your application Rakefile
3809
4018
  - Environment variable: `JAVAPACKAGER_EXTRA_ARGS`
3810
4019
 
3811
4020
  Example (Rakefile):
@@ -3813,7 +4022,7 @@ Example (Rakefile):
3813
4022
  ```ruby
3814
4023
  require 'glimmer/rake_task'
3815
4024
 
3816
- Glimmer::Package.javapackager_extra_args = '-BlicenseType="MIT" -Bmac.category="public.app-category.business" -Bmac.signing-key-developer-id-app="Andy Maleh"'
4025
+ Glimmer::RakeTask::Package.javapackager_extra_args = '-BlicenseType="MIT" -Bmac.category="public.app-category.business" -Bmac.signing-key-developer-id-app="Andy Maleh"'
3817
4026
  ```
3818
4027
 
3819
4028
  Note that `mac.category` defaults to "public.app-category.business", but can be overridden with one of the category UTI values mentioned here:
@@ -3830,7 +4039,7 @@ That overrides the default application display name.
3830
4039
 
3831
4040
  ### Verbose Mode
3832
4041
 
3833
- Pass `-v` to javapackager in `Glimmer::Package.javapackager_extra_args` or by running `glimmer package:native[type] -v` to learn more about further available customizations for the installer you are requesting to generate.
4042
+ Pass `-v` to javapackager in `Glimmer::RakeTask::Package.javapackager_extra_args` or by running `glimmer package:native[type] -v` to learn more about further available customizations for the installer you are requesting to generate.
3834
4043
 
3835
4044
  ### Windows Application Packaging
3836
4045
 
@@ -3844,7 +4053,7 @@ If you just want to test out packaging into a native Windows app that is not pac
3844
4053
 
3845
4054
  Recent macOS versions (starting with Catalina) have very stringent security requirements requiring all applications to be signed before running (unless the user goes to System Preferences -> Privacy -> General tab and clicks "Open Anyway" after failing to open application the first time they run it). So, to release a desktop application on the Mac, it is recommended to enroll in the [Apple Developer Program](https://developer.apple.com/programs/) to distribute on the [Mac App Store](https://developer.apple.com/distribute/) or otherwise request [app notarization from Apple](https://developer.apple.com/documentation/xcode/notarizing_macos_software_before_distribution) to distribute independently.
3846
4055
 
3847
- Afterwards, you may add developer-id/signing-key arguments to `javapackager` via `Glimmer::Package.javapackager_extra_args` or `JAVAPACKAGER_EXTRA_ARGS` according to this webpage: https://docs.oracle.com/javase/9/tools/javapackager.htm#JSWOR719
4056
+ Afterwards, you may add developer-id/signing-key arguments to `javapackager` via `Glimmer::RakeTask::Package.javapackager_extra_args` or `JAVAPACKAGER_EXTRA_ARGS` according to this webpage: https://docs.oracle.com/javase/9/tools/javapackager.htm#JSWOR719
3848
4057
 
3849
4058
  DMG signing key argument:
3850
4059
  ```
@@ -3872,12 +4081,12 @@ To do so, you may follow these steps (abbreviated version from https://developer
3872
4081
  - Enter Name (referred to below as "CertificateName")
3873
4082
  - Set 'Certificate Type' to 'Code Signing'
3874
4083
  - Create (if you alternatively override defaults, make sure to enable all capabilities)
3875
- - Add the following option to javapackager: `-Bmac.signing-key-developer-id-app="CertificateName"` via `Glimmer::Package.javapackager_extra_args` or `JAVAPACKAGER_EXTRA_ARGS`
4084
+ - Add the following option to javapackager: `-Bmac.signing-key-developer-id-app="CertificateName"` via `Glimmer::RakeTask::Package.javapackager_extra_args` or `JAVAPACKAGER_EXTRA_ARGS`
3876
4085
 
3877
4086
  Example:
3878
4087
 
3879
4088
  ```ruby
3880
- Glimmer::Package.javapackager_extra_args = '-Bmac.signing-key-developer-id-app="Andy Maleh"'
4089
+ Glimmer::RakeTask::Package.javapackager_extra_args = '-Bmac.signing-key-developer-id-app="Andy Maleh"'
3881
4090
  ```
3882
4091
 
3883
4092
  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.
@@ -3892,7 +4101,7 @@ Keep that in mind if you are not going to rely on the default `LICENSE.txt` supp
3892
4101
  Example:
3893
4102
 
3894
4103
  ```ruby
3895
- Glimmer::Package.javapackager_extra_args = '-srcfiles "ACME.txt" -BlicenseFile="ACME.txt" -BlicenseType="ACME"'
4104
+ Glimmer::RakeTask::Package.javapackager_extra_args = '-srcfiles "ACME.txt" -BlicenseFile="ACME.txt" -BlicenseType="ACME"'
3896
4105
  ```
3897
4106
 
3898
4107
  2. Mounted DMG Residue
@@ -3912,7 +4121,7 @@ Glimmer already supports automatic (and manual) app updates via the Mac App Stor
3912
4121
  ## Glimmer Supporting Libraries
3913
4122
 
3914
4123
  Here is a list of notable 3rd party gems used by Glimmer:
3915
- - [jeweler](https://github.com/technicalpickles/jeweler): generates app gems during [Glimmer Scaffolding](#scaffolding)
4124
+ - [juwelier](https://rubygems.org/gems/juwelier): generates app gems during [Glimmer Scaffolding](#scaffolding)
3916
4125
  - [logging](https://github.com/TwP/logging): provides extra logging capabilities not available in Ruby Logger such as multi-threaded buffered asynchronous logging (to avoid affecting app performance) and support for multiple appenders such as stdout, syslog, and log files (the last one is needed on Windows where syslog is not supported)
3917
4126
  - [nested_inherited_jruby_include_package](https://github.com/AndyObtiva/nested_inherited_jruby_include_package): makes included [SWT](https://www.eclipse.org/swt/)/[Java](https://www.java.com/en/) packages available to all classes/modules that mix in the Glimmer module without having to manually reimport
3918
4127
  - [os](https://github.com/rdp/os): provides OS detection capabilities (e.g. `OS.mac?` or `OS.windows?`) to write cross-platform code inexpensively