glimmer-dsl-swt 4.18.4.4 → 4.18.4.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +39 -0
  3. data/LICENSE.txt +20 -20
  4. data/README.md +43 -5058
  5. data/RUBY_VERSION +1 -1
  6. data/VERSION +1 -1
  7. data/bin/girb +31 -31
  8. data/bin/girb_runner.rb +34 -34
  9. data/bin/glimmer +26 -26
  10. data/docs/reference/GLIMMER_COMMAND.md +591 -0
  11. data/docs/reference/GLIMMER_CONFIGURATION.md +183 -0
  12. data/docs/reference/GLIMMER_GIRB.md +30 -0
  13. data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +3367 -0
  14. data/docs/reference/GLIMMER_PACKAGING_AND_DISTRIBUTION.md +202 -0
  15. data/docs/reference/GLIMMER_SAMPLES.md +755 -0
  16. data/docs/reference/GLIMMER_STYLE_GUIDE.md +14 -0
  17. data/glimmer-dsl-swt.gemspec +22 -7
  18. data/lib/ext/glimmer.rb +41 -41
  19. data/lib/ext/glimmer/config.rb +167 -167
  20. data/lib/ext/rouge/themes/glimmer.rb +29 -29
  21. data/lib/glimmer-dsl-swt.rb +44 -44
  22. data/lib/glimmer/Rakefile +26 -26
  23. data/lib/glimmer/data_binding/list_selection_binding.rb +72 -72
  24. data/lib/glimmer/data_binding/observable_widget.rb +38 -38
  25. data/lib/glimmer/data_binding/shine.rb +44 -44
  26. data/lib/glimmer/data_binding/table_items_binding.rb +89 -89
  27. data/lib/glimmer/data_binding/tree_items_binding.rb +108 -108
  28. data/lib/glimmer/data_binding/widget_binding.rb +73 -73
  29. data/lib/glimmer/dsl/swt/animation_expression.rb +43 -43
  30. data/lib/glimmer/dsl/swt/async_exec_expression.rb +35 -35
  31. data/lib/glimmer/dsl/swt/bind_expression.rb +58 -58
  32. data/lib/glimmer/dsl/swt/block_property_expression.rb +41 -41
  33. data/lib/glimmer/dsl/swt/checkbox_group_selection_data_binding_expression.rb +61 -61
  34. data/lib/glimmer/dsl/swt/color_expression.rb +40 -40
  35. data/lib/glimmer/dsl/swt/column_properties_expression.rb +45 -45
  36. data/lib/glimmer/dsl/swt/combo_selection_data_binding_expression.rb +67 -67
  37. data/lib/glimmer/dsl/swt/cursor_expression.rb +44 -44
  38. data/lib/glimmer/dsl/swt/custom_widget_expression.rb +63 -63
  39. data/lib/glimmer/dsl/swt/data_binding_expression.rb +55 -55
  40. data/lib/glimmer/dsl/swt/dialog_expression.rb +48 -48
  41. data/lib/glimmer/dsl/swt/directory_dialog_expression.rb +48 -48
  42. data/lib/glimmer/dsl/swt/display_expression.rb +40 -40
  43. data/lib/glimmer/dsl/swt/dnd_expression.rb +46 -46
  44. data/lib/glimmer/dsl/swt/dsl.rb +63 -63
  45. data/lib/glimmer/dsl/swt/exec_expression.rb +55 -55
  46. data/lib/glimmer/dsl/swt/expand_item_expression.rb +60 -60
  47. data/lib/glimmer/dsl/swt/file_dialog_expression.rb +48 -48
  48. data/lib/glimmer/dsl/swt/font_expression.rb +49 -49
  49. data/lib/glimmer/dsl/swt/image_expression.rb +54 -50
  50. data/lib/glimmer/dsl/swt/layout_data_expression.rb +46 -46
  51. data/lib/glimmer/dsl/swt/layout_expression.rb +50 -50
  52. data/lib/glimmer/dsl/swt/list_selection_data_binding_expression.rb +65 -65
  53. data/lib/glimmer/dsl/swt/menu_bar_expression.rb +54 -54
  54. data/lib/glimmer/dsl/swt/menu_expression.rb +53 -53
  55. data/lib/glimmer/dsl/swt/message_box_expression.rb +54 -54
  56. data/lib/glimmer/dsl/swt/multiply_expression.rb +53 -53
  57. data/lib/glimmer/dsl/swt/observe_expression.rb +56 -53
  58. data/lib/glimmer/dsl/swt/pixel_expression.rb +38 -0
  59. data/lib/glimmer/dsl/swt/property_expression.rb +46 -46
  60. data/lib/glimmer/dsl/swt/radio_group_selection_data_binding_expression.rb +62 -61
  61. data/lib/glimmer/dsl/swt/rgb_expression.rb +33 -33
  62. data/lib/glimmer/dsl/swt/rgba_expression.rb +33 -33
  63. data/lib/glimmer/dsl/swt/shape_expression.rb +54 -54
  64. data/lib/glimmer/dsl/swt/shell_expression.rb +46 -46
  65. data/lib/glimmer/dsl/swt/swt_expression.rb +46 -46
  66. data/lib/glimmer/dsl/swt/sync_exec_expression.rb +36 -36
  67. data/lib/glimmer/dsl/swt/tab_item_expression.rb +54 -54
  68. data/lib/glimmer/dsl/swt/table_items_data_binding_expression.rb +52 -52
  69. data/lib/glimmer/dsl/swt/transform_expression.rb +55 -55
  70. data/lib/glimmer/dsl/swt/tree_items_data_binding_expression.rb +52 -52
  71. data/lib/glimmer/dsl/swt/tree_properties_expression.rb +47 -47
  72. data/lib/glimmer/dsl/swt/widget_expression.rb +67 -66
  73. data/lib/glimmer/dsl/swt/widget_listener_expression.rb +53 -53
  74. data/lib/glimmer/rake_task.rb +220 -220
  75. data/lib/glimmer/rake_task/list.rb +97 -97
  76. data/lib/glimmer/rake_task/package.rb +139 -139
  77. data/lib/glimmer/rake_task/scaffold.rb +765 -765
  78. data/lib/glimmer/swt/color_proxy.rb +108 -107
  79. data/lib/glimmer/swt/cursor_proxy.rb +66 -66
  80. data/lib/glimmer/swt/custom/animation.rb +245 -243
  81. data/lib/glimmer/swt/custom/checkbox_group.rb +181 -181
  82. data/lib/glimmer/swt/custom/code_text.rb +1 -0
  83. data/lib/glimmer/swt/custom/drawable.rb +97 -49
  84. data/lib/glimmer/swt/custom/radio_group.rb +177 -176
  85. data/lib/glimmer/swt/custom/shape.rb +332 -297
  86. data/lib/glimmer/swt/date_time_proxy.rb +85 -85
  87. data/lib/glimmer/swt/directory_dialog_proxy.rb +65 -65
  88. data/lib/glimmer/swt/display_proxy.rb +167 -166
  89. data/lib/glimmer/swt/dnd_proxy.rb +51 -51
  90. data/lib/glimmer/swt/expand_item_proxy.rb +97 -97
  91. data/lib/glimmer/swt/file_dialog_proxy.rb +66 -66
  92. data/lib/glimmer/swt/font_proxy.rb +94 -94
  93. data/lib/glimmer/swt/image_proxy.rb +195 -184
  94. data/lib/glimmer/swt/layout_data_proxy.rb +105 -105
  95. data/lib/glimmer/swt/layout_proxy.rb +112 -112
  96. data/lib/glimmer/swt/menu_proxy.rb +126 -126
  97. data/lib/glimmer/swt/message_box_proxy.rb +89 -89
  98. data/lib/glimmer/swt/packages.rb +37 -37
  99. data/lib/glimmer/swt/properties.rb +74 -49
  100. data/lib/glimmer/swt/sash_form_proxy.rb +53 -53
  101. data/lib/glimmer/swt/scrolled_composite_proxy.rb +46 -37
  102. data/lib/glimmer/swt/style_constantizable.rb +157 -157
  103. data/lib/glimmer/swt/styled_text_proxy.rb +38 -38
  104. data/lib/glimmer/swt/swt_proxy.rb +59 -59
  105. data/lib/glimmer/swt/tab_item_proxy.rb +92 -91
  106. data/lib/glimmer/swt/table_column_proxy.rb +57 -57
  107. data/lib/glimmer/swt/transform_proxy.rb +109 -109
  108. data/lib/glimmer/swt/tree_proxy.rb +145 -145
  109. data/lib/glimmer/swt/widget_listener_proxy.rb +64 -64
  110. data/lib/glimmer/swt/widget_proxy.rb +977 -957
  111. data/lib/glimmer/ui/custom_shell.rb +82 -82
  112. data/lib/glimmer/ui/custom_widget.rb +332 -315
  113. data/lib/glimmer/util/proc_tracker.rb +39 -39
  114. data/samples/elaborate/contact_manager.rb +142 -142
  115. data/samples/elaborate/contact_manager/contact.rb +32 -32
  116. data/samples/elaborate/contact_manager/contact_manager_presenter.rb +47 -47
  117. data/samples/elaborate/contact_manager/contact_repository.rb +169 -169
  118. data/samples/elaborate/login.rb +123 -123
  119. data/samples/elaborate/mandelbrot_fractal.rb +354 -0
  120. data/samples/elaborate/tetris.rb +5 -18
  121. data/samples/elaborate/tetris/model/block.rb +48 -48
  122. data/samples/elaborate/tetris/model/past_game.rb +39 -39
  123. data/samples/elaborate/tetris/view/block.rb +1 -1
  124. data/samples/elaborate/tetris/view/playfield.rb +1 -1
  125. data/samples/elaborate/tic_tac_toe.rb +76 -76
  126. data/samples/elaborate/tic_tac_toe/board.rb +145 -145
  127. data/samples/elaborate/tic_tac_toe/cell.rb +48 -48
  128. data/samples/elaborate/user_profile.rb +76 -76
  129. data/samples/hello/hello_browser.rb +31 -31
  130. data/samples/hello/hello_button.rb +46 -46
  131. data/samples/hello/hello_canvas.rb +64 -64
  132. data/samples/hello/hello_canvas_animation.rb +1 -1
  133. data/samples/hello/hello_checkbox.rb +85 -85
  134. data/samples/hello/hello_checkbox_group.rb +71 -71
  135. data/samples/hello/hello_code_text.rb +104 -104
  136. data/samples/hello/hello_combo.rb +63 -63
  137. data/samples/hello/hello_computed.rb +96 -96
  138. data/samples/hello/hello_computed/contact.rb +42 -42
  139. data/samples/hello/hello_cursor.rb +57 -0
  140. data/samples/hello/hello_custom_shell.rb +155 -155
  141. data/samples/hello/hello_custom_widget.rb +86 -86
  142. data/samples/hello/hello_date_time.rb +63 -63
  143. data/samples/hello/hello_dialog.rb +78 -78
  144. data/samples/hello/hello_directory_dialog.rb +60 -60
  145. data/samples/hello/hello_drag_and_drop.rb +50 -50
  146. data/samples/hello/hello_expand_bar.rb +110 -110
  147. data/samples/hello/hello_file_dialog.rb +60 -60
  148. data/samples/hello/hello_group.rb +104 -104
  149. data/samples/hello/hello_link.rb +80 -80
  150. data/samples/hello/hello_list_multi_selection.rb +74 -74
  151. data/samples/hello/hello_list_single_selection.rb +59 -59
  152. data/samples/hello/hello_menu_bar.rb +241 -241
  153. data/samples/hello/hello_message_box.rb +37 -37
  154. data/samples/hello/hello_pop_up_context_menu.rb +84 -84
  155. data/samples/hello/hello_radio.rb +108 -108
  156. data/samples/hello/hello_radio_group.rb +87 -87
  157. data/samples/hello/hello_sash_form.rb +137 -137
  158. data/samples/hello/hello_spinner.rb +69 -69
  159. data/samples/hello/hello_styled_text.rb +138 -138
  160. data/samples/hello/hello_tab.rb +50 -50
  161. data/samples/hello/hello_table.rb +1 -1
  162. data/samples/hello/hello_table/baseball_park.png +0 -0
  163. data/samples/hello/hello_world.rb +29 -29
  164. metadata +19 -4
@@ -0,0 +1,202 @@
1
+ ## Glimmer Packaging and Distribution
2
+
3
+ Note: this section mostly applies to Mac and Windows. On Linux, you can just run `glimmer package:gem` and after installing the gem, you get an executable matching the name of the app/custom-shell-gem you are building (e.g. `calculator` command becomes available after installing the [glimmer-cs-calculator](https://github.com/AndyObtiva/glimmer-cs-calculator) gem). On Windows, ensure system PATH includes Java bin directory like "C:\Program Files\Java\jdk1.8.0_241\bin" for javapackager command to work during packaging Glimmer applications.
4
+
5
+ Note 2: Glimmer packaging has a strong dependency on JDK8 at the moment. JDK9 & JDK10 might work, but JDK11 and onward definitely won't since they dropped javapackager, which later came back as jpackage in JDK14, but it's not ready for prime time yet. Just stick to JDK8 for now, strongly supported by Oracle for the next 6 years at least.
6
+
7
+ Glimmer simplifies the process of native-executable packaging and distribution on Mac and Windows via a single `glimmer package` command:
8
+
9
+ ```
10
+ glimmer package
11
+ ```
12
+
13
+ It works out of the box for any application scaffolded by [Glimmer Scaffolding](#scaffolding), generating all available packaging types on the current platform (e.g. `DMG`, `PKG`, `APP` on the Mac) and displaying a message indicating what pre-requisite setup tools are needed if not installed already (e.g. [Wix Toolset](https://wixtoolset.org/) to generate MSI files on Windows). If you install Wix, make sure it is on the system PATH by adding for example "C:\Program Files (x86)\WiX Toolset v3.11\bin" to the Windows Environment Variables.
14
+
15
+ You may choose to generate a specific type of packaging instead by addionally passing in the `[type]` option. For example, this generates an MSI setup file on Windows:
16
+
17
+ ```
18
+ glimmer package[msi]
19
+ ```
20
+
21
+ - Available Mac packaging types are `dmg`, `pkg`, and `image` (image means a pure Mac `app` without a setup program). Keep in mind that the packages you produce are compatible with the same MacOS you are on or older.
22
+ - Available Windows packaging types are `msi`, `exe`, and `image` (image means a Windows application directory without a setup program). Learn more about Windows packaging are [over here](#windows-application-packaging).
23
+
24
+ Note: if you are using Glimmer manually, to make the `glimmer package` command available, you must add the following line to your application `Rakefile` (automatically done for you if you scaffold an app or gem with `glimmer scaffold[AppName]` or `glimmer scaffold:gem:customshell[GemName]`):
25
+
26
+ ```ruby
27
+ require 'glimmer/rake_task'
28
+ ```
29
+
30
+ The Glimmer packaging process done in the `glimmer package` command consists of the following steps:
31
+ 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.
32
+ 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.
33
+ 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.
34
+ 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
35
+ 1. Generate native executable using [javapackager](https://docs.oracle.com/javase/8/docs/technotes/tools/unix/javapackager.html) (`glimmer package:native`): Enables packaging a JAR file as a DMG/PKG/APP file on Mac, MSI/EXE/APP on Windows, and DEB/RPM/APP on Linux (Glimmer does not officially support Linux with the `glimmer package` command yet, but it generates the JAR file successfully, and you could use `javapackager` manually afterwards if needed).
36
+
37
+ Those steps automatically ensure generating a JAR file under the `./dist` directory using [Warbler](https://github.com/jruby/warbler), which is then used to automatically generate a DMG/MSI file (and other executables) under the `./packages/bundles` directory using `javapackager`.
38
+ The JAR file name will match your application local directory name (e.g. `MathBowling.jar` for `~/code/MathBowling`)
39
+ 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)
40
+
41
+ The `glimmer package` command will automatically set "mac.CFBundleIdentifier" to ="org.#{project_name}.application.#{project_name}".
42
+ 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")
43
+
44
+ ### Packaging Defaults
45
+
46
+ Glimmer employs smart defaults in packaging.
47
+
48
+ The package application name (shows up in top menu bar on the Mac) will be a human form of the app root directory name (e.g. "Math Bowling" for "MathBowling" or "math_bowling" app root directory name). However, application name and version may be specified explicitly via "-Bmac.CFBundleName" and "-Bmac.CFBundleVersion" options.
49
+
50
+ Also, the package will only include these directories: app, config, db, lib, script, bin, docs, fonts, images, sounds, videos
51
+
52
+ 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:
53
+
54
+ ```
55
+ glimmer package:config
56
+ ```
57
+
58
+ This will generate `config/warble.rb`, which you may configure and then run `glimmer package` afterwards.
59
+
60
+ ### Packaging Configuration
61
+
62
+ - Ensure you have a Ruby script under `bin` directory that launches the application, preferably matching your project directory name (e.g. `bin/math_bowling`) :
63
+ ```ruby
64
+ require_relative '../app/my_application.rb'
65
+ ```
66
+ - 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/)
67
+ - Include DMG Background Icon (Optional): Simply place a .png file under `package/macosx/{HumanAppName}-background.png`
68
+ - Include Version (Optional): Create a `VERSION` file in your application and fill it your app version on one line (e.g. `1.1.0`)
69
+ - 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).
70
+ - 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).
71
+
72
+ ### javapackager Extra Arguments
73
+
74
+ (note: currently `Glimmer::RakeTask::Package.javapackager_extra_args` is only honored when packaging from bash, not zsh)
75
+
76
+ In order to explicitly configure javapackager, Mac package attributes, or sign your Mac app to distribute on the App Store, you can follow more advanced instructions for `javapackager` here:
77
+ - https://docs.oracle.com/javase/9/tools/javapackager.htm#JSWOR719
78
+ - https://docs.oracle.com/javase/8/docs/technotes/tools/unix/javapackager.html
79
+ - https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/self-contained-packaging.html#BCGICFDB
80
+ - https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/self-contained-packaging.html
81
+ - https://developer.apple.com/library/archive/releasenotes/General/SubmittingToMacAppStore/index.html#//apple_ref/doc/uid/TP40010572-CH16-SW8
82
+
83
+ The Glimmer rake task allows passing extra options to javapackager via:
84
+ - `Glimmer::RakeTask::Package.javapackager_extra_args="..."` in your application Rakefile
85
+ - Environment variable: `JAVAPACKAGER_EXTRA_ARGS`
86
+
87
+ Example (Rakefile):
88
+
89
+ ```ruby
90
+ require 'glimmer/rake_task'
91
+
92
+ Glimmer::RakeTask::Package.javapackager_extra_args = '-BlicenseType="MIT" -Bmac.category="public.app-category.business" -Bmac.signing-key-developer-id-app="Andy Maleh"'
93
+ ```
94
+
95
+ Note that `mac.category` defaults to "public.app-category.business", but can be overridden with one of the category UTI values mentioned here:
96
+
97
+ https://developer.apple.com/library/archive/releasenotes/General/SubmittingToMacAppStore/index.html#//apple_ref/doc/uid/TP40010572-CH16-SW8
98
+
99
+ Example (env var):
100
+
101
+ ```
102
+ JAVAPACKAGER_EXTRA_ARGS='-Bmac.CFBundleName="Math Bowling Game"' glimmer package
103
+ ```
104
+
105
+ That overrides the default application display name.
106
+
107
+ ### Verbose Mode
108
+
109
+ 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.
110
+
111
+ ### Windows Application Packaging
112
+
113
+ Windows s two options for setup packaging:
114
+ - `msi` (recommended): simpler packaging option. Requires [WiX Toolset](https://wixtoolset.org/) and [.NET Framework](https://dotnet.microsoft.com/download/dotnet-framework). Simply run `glimmer package[msi]` (or `glimmer package:native[msi]` if it's not your first time) and it will give you more details on the pre-requisites you need to install (e.g. [WiX Toolset](https://wixtoolset.org/) and [.NET Framework 3.5 SP1](https://dotnet.microsoft.com/download/dotnet-framework/net35-sp1)).
115
+ - `exe`: more advanced packaging option. Requires [Inno Setup](https://jrsoftware.org/isinfo.php). Simply run `glimmer package[exe]` (or `glimmer package:native[exe]` if it's not your first time) and it will tell you what you need to install.
116
+
117
+ If you just want to test out packaging into a native Windows app that is not packaged for Windows setup, just pass `image` to generate a native Windows app only.
118
+
119
+ ### Mac Application Distribution
120
+
121
+ 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.
122
+
123
+ 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
124
+
125
+ DMG signing key argument:
126
+ ```
127
+ -Bmac.signing-key-developer-id-app="..."
128
+ ```
129
+
130
+ PKG signing key argument:
131
+ ```
132
+ -Bmac.signing-key-developer-id-installer="..."
133
+ ```
134
+
135
+ Mac App Store signing key arguments:
136
+ ```
137
+ -Bmac.signing-key-app="..."
138
+ -Bmac.signing-key-pkg="..."
139
+ ```
140
+
141
+ ### Self Signed Certificate
142
+
143
+ You may still release a signed DMG file without enrolling into the Apple Developer Program with the caveat that users will always fail in opening the app the first time, and have to go to System Preferences -> Privacy -> General tab to "Open Anyway".
144
+
145
+ To do so, you may follow these steps (abbreviated version from https://developer.apple.com/library/archive/documentation/Security/Conceptual/CodeSigningGuide/Procedures/Procedures.html#//apple_ref/doc/uid/TP40005929-CH4-SW2):
146
+ - Open Keychain Access
147
+ - Choose Keychain Access > Certificate Assistant > Create Certificate ...
148
+ - Enter Name (referred to below as "CertificateName")
149
+ - Set 'Certificate Type' to 'Code Signing'
150
+ - Create (if you alternatively override defaults, make sure to enable all capabilities)
151
+ - Add the following option to javapackager: `-Bmac.signing-key-developer-id-app="CertificateName"` via `Glimmer::RakeTask::Package.javapackager_extra_args` or `JAVAPACKAGER_EXTRA_ARGS`
152
+
153
+ Example:
154
+
155
+ ```ruby
156
+ Glimmer::RakeTask::Package.javapackager_extra_args = '-Bmac.signing-key-developer-id-app="Andy Maleh"'
157
+ ```
158
+
159
+ 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.
160
+
161
+ ### Packaging Gotchas
162
+
163
+ 1. Specifying License File
164
+
165
+ The javapackager documentation states that a license file may be specified with "-BlicenseFile" javapackager option. However, in order for that to work, one must specify as a source file via "-srcfiles" javapackager option.
166
+ Keep that in mind if you are not going to rely on the default `LICENSE.txt` support.
167
+
168
+ Example:
169
+
170
+ ```ruby
171
+ Glimmer::RakeTask::Package.javapackager_extra_args = '-srcfiles "ACME.txt" -BlicenseFile="ACME.txt" -BlicenseType="ACME"'
172
+ ```
173
+
174
+ 2. Mounted DMG Residue
175
+
176
+ 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."
177
+
178
+ 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):
179
+
180
+ ```
181
+ 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
182
+ ```
183
+
184
+ 3. Zsh (Z Shell)
185
+
186
+ Currently, `Glimmer::RakeTask::Package.javapackager_extra_args` is only honored when packaging from bash, not zsh.
187
+
188
+ You can get around that in zsh by running glimmer package commands with `bash -c` prefix:
189
+
190
+ ```
191
+ bash -c 'glimmer package'
192
+ ```
193
+
194
+ 4. Java on Windows System PATH
195
+
196
+ If you get any errors running Java on Windows, keep in mind that you need to have the Java binaries on the Windows System PATH environment variable:
197
+ c:\program files\java\jre1.8.0_241
198
+
199
+ The problem is Oracle seems to be adding an indirect Java path junction in later versions of their installer:
200
+ C:\Program Files (x86)\Common Files\Oracle\Java\javapath
201
+
202
+ Simply replace with the simple one above (setting the correct version number) and then reinstall JRuby to have it use Java from the right path.
@@ -0,0 +1,755 @@
1
+ ## Samples
2
+
3
+ - [Samples](#samples)
4
+ - [Hello Samples](#hello-samples)
5
+ - [Hello, World!](#hello-world)
6
+ - [Hello, Tab!](#hello-tab)
7
+ - [Hello, Combo!](#hello-combo)
8
+ - [Hello, List Single Selection!](#hello-list-single-selection)
9
+ - [Hello, List Multi Selection!](#hello-list-multi-selection)
10
+ - [Hello, Computed!](#hello-computed)
11
+ - [Hello, Message Box!](#hello-message-box)
12
+ - [Hello, Browser!](#hello-browser)
13
+ - [Hello, Drag and Drop!](#hello-drag-and-drop)
14
+ - [Hello, Menu Bar!](#hello-menu-bar)
15
+ - [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu)
16
+ - [Hello, Custom Widget!](#hello-custom-widget)
17
+ - [Hello, Custom Shell!](#hello-custom-shell)
18
+ - [Hello, Sash Form!](#hello-sash-form)
19
+ - [Hello, Styled Text!](#hello-styled-text)
20
+ - [Hello, Expand Bar!](#hello-expand-bar)
21
+ - [Hello, Radio!](#hello-radio)
22
+ - [Hello, Radio Group!](#hello-radio-group)
23
+ - [Hello, Group!](#hello-group)
24
+ - [Hello, Checkbox!](#hello-checkbox)
25
+ - [Hello, Checkbox Group!](#hello-checkbox-group)
26
+ - [Hello, Directory Dialog!](#hello-directory-dialog)
27
+ - [Hello, File Dialog!](#hello-file-dialog)
28
+ - [Hello, Date Time!](#hello-date-time)
29
+ - [Hello, Spinner!](#hello-spinner)
30
+ - [Hello, Table!](#hello-table)
31
+ - [Hello, Button!](#hello-button)
32
+ - [Hello, Link!](#hello-link)
33
+ - [Hello, Dialog!](#hello-dialog)
34
+ - [Hello, Code Text!](#hello-code-text)
35
+ - [Hello, Canvas!](#hello-canvas)
36
+ - [Hello, Canvas Animation!](#hello-canvas-animation)
37
+ - [Hello, Canvas Transform!](#hello-canvas-transform)
38
+ - [Hello, Cursor!](#hello-cursor)
39
+ - [Elaborate Samples](#elaborate-samples)
40
+ - [User Profile](#user-profile)
41
+ - [Login](#login)
42
+ - [Tic Tac Toe](#tic-tac-toe)
43
+ - [Contact Manager](#contact-manager)
44
+ - [Glimmer Tetris](#glimmer-tetris)
45
+ - [Mandelbrot Fractal](#mandelbrot-fractal)
46
+ - [External Samples](#external-samples)
47
+ - [Glimmer Calculator](#glimmer-calculator)
48
+ - [Gladiator](#gladiator)
49
+ - [Timer](#timer)
50
+ - [License](#license)
51
+
52
+ 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 samples` 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`).
53
+
54
+ You may run any sample via this command:
55
+
56
+ ```
57
+ glimmer samples
58
+ ```
59
+
60
+ This brings up the [Glimmer Meta-Sample (The Sample of Samples)](/samples/elaborate/meta_sample.rb)
61
+
62
+ ![Glimmer Meta-Sample](/images/glimmer-meta-sample.png)
63
+
64
+ You may edit the code of any sample before launching it by clicking on the "Launch" button. This helps you learn by experimenting with Glimmer GUI DSL syntax. To go back to original code, simply hit the "Reset" button.
65
+
66
+ Note that if you fail to run any sample through the Glimmer Meta-Sample for whatever reason, you could always run directly by cloning the project, running `bundle`, and then this command (drop the "bin" if you install the glimmer-dsl-swt gem instead):
67
+
68
+ ```ruby
69
+ bin/glimmer samples/hello/hello_canvas_transform.rb
70
+ ```
71
+
72
+ ### Hello Samples
73
+
74
+ For hello-type simple samples, check the following.
75
+
76
+ #### Hello, World!
77
+
78
+ Code:
79
+
80
+ [samples/hello/hello_world.rb](/samples/hello/hello_world.rb)
81
+
82
+ ![Hello World](/images/glimmer-hello-world.png)
83
+
84
+ #### Hello, Tab!
85
+
86
+ Code:
87
+
88
+ [samples/hello/hello_tab.rb](/samples/hello/hello_tab.rb)
89
+
90
+ ![Hello Tab English](/images/glimmer-hello-tab-english.png)
91
+ ![Hello Tab French](/images/glimmer-hello-tab-french.png)
92
+
93
+ #### Hello, Combo!
94
+
95
+ This sample demonstrates combo data-binding.
96
+
97
+ Code:
98
+
99
+ [samples/hello/hello_combo.rb](/samples/hello/hello_combo.rb)
100
+
101
+ ![Hello Combo](/images/glimmer-hello-combo.png)
102
+ ![Hello Combo Expanded](/images/glimmer-hello-combo-expanded.png)
103
+
104
+ #### Hello, List Single Selection!
105
+
106
+ This sample demonstrates list single-selection data-binding.
107
+
108
+ Code:
109
+
110
+ [samples/hello/hello_list_single_selection.rb](/samples/hello/hello_list_single_selection.rb)
111
+
112
+ ![Hello List Single Selection](/images/glimmer-hello-list-single-selection.png)
113
+
114
+ #### Hello, List Multi Selection!
115
+
116
+ This sample demonstrates list multi-selection data-binding.
117
+
118
+ Code:
119
+
120
+ [samples/hello/hello_list_multi_selection.rb](/samples/hello/hello_list_multi_selection.rb)
121
+
122
+ ![Hello List Multi Selection](/images/glimmer-hello-list-multi-selection.png)
123
+
124
+ #### Hello, Computed!
125
+
126
+ This sample demonstrates computed data-binding.
127
+
128
+ Code:
129
+
130
+ [samples/hello/hello_computed.rb](/samples/hello/hello_computed.rb)
131
+
132
+ ![Hello Browser](/images/glimmer-hello-computed.png)
133
+
134
+ #### Hello, Message Box!
135
+
136
+ This sample demonstrates a `message_box` dialog.
137
+
138
+ Code:
139
+
140
+ [samples/hello/hello_message_box.rb](/samples/hello/hello_message_box.rb)
141
+
142
+ ![Hello Message Box](/images/glimmer-hello-message-box.png)
143
+ ![Hello Message Box Dialog](/images/glimmer-hello-message-box-dialog.png)
144
+
145
+ #### Hello, Browser!
146
+
147
+ This sample demonstrates the `browser` widget.
148
+
149
+ Code:
150
+
151
+ [samples/hello/hello_browser.rb](/samples/hello/hello_browser.rb)
152
+
153
+ ![Hello Browser](/images/glimmer-hello-browser.png)
154
+
155
+ #### Hello, Drag and Drop!
156
+
157
+ This sample demonstrates drag and drop in Glimmer.
158
+
159
+ Code:
160
+
161
+ [samples/hello/hello_drag_and_drop.rb](/samples/hello/hello_drag_and_drop.rb)
162
+
163
+ ![Hello Drag and Drop](/images/glimmer-hello-drag-and-drop.gif)
164
+
165
+ #### Hello, Menu Bar!
166
+
167
+ This sample demonstrates menus in Glimmer, including accelerators on the Mac.
168
+
169
+ Code:
170
+
171
+ [samples/hello/hello_menu_bar.rb](/samples/hello/hello_menu_bar.rb)
172
+
173
+ ![Hello Menu Bar](/images/glimmer-hello-menu-bar.png)
174
+
175
+ ![Hello Menu Bar File Menu](/images/glimmer-hello-menu-bar-file-menu.png)
176
+
177
+ The Mac Menu includes Accelerator Keys (keyboard shortcuts).
178
+
179
+ ![Hello Menu Bar File Menu Mac Accelerators](/images/glimmer-hello-menu-bar-file-menu-mac-accelerators.png)
180
+
181
+ ![Hello Menu Bar Edit Menu](/images/glimmer-hello-menu-bar-edit-menu.png)
182
+
183
+ The Mac Menu includes Accelerator Keys (keyboard shortcuts).
184
+
185
+ ![Hello Menu Bar Edit Menu Mac Accelerators](/images/glimmer-hello-menu-bar-edit-menu-mac-accelerators.png)
186
+
187
+ ![Hello Menu Bar Options Menu Disabled](/images/glimmer-hello-menu-bar-options-menu-disabled.png)
188
+
189
+ ![Hello Menu Bar Options Menu Select One](/images/glimmer-hello-menu-bar-options-menu-select-one.png)
190
+
191
+ ![Hello Menu Bar Options Menu Select Multiple](/images/glimmer-hello-menu-bar-options-menu-select-multiple.png)
192
+
193
+ ![Hello Menu Bar Format Menu Background Color](/images/glimmer-hello-menu-bar-format-menu-background-color.png)
194
+
195
+ ![Hello Menu Bar Format Menu Foreground Color](/images/glimmer-hello-menu-bar-format-menu-foreground-color.png)
196
+
197
+ ![Hello Menu Bar View Menu](/images/glimmer-hello-menu-bar-view-menu.png)
198
+
199
+ ![Hello Menu Bar View Small](/images/glimmer-hello-menu-bar-view-small.png)
200
+
201
+ ![Hello Menu Bar View Large](/images/glimmer-hello-menu-bar-view-large.png)
202
+
203
+ ![Hello Menu Bar Help Menu](/images/glimmer-hello-menu-bar-help-menu.png)
204
+
205
+ The Mac Menu includes Accelerator Keys (keyboard shortcuts) and Mac built-in Search.
206
+
207
+ ![Hello Menu Bar Help Menu Mac Accelerators](/images/glimmer-hello-menu-bar-help-menu-mac-accelerators.png)
208
+
209
+ #### Hello, Pop Up Context Menu!
210
+
211
+ This sample demonstrates pop up context menus in Glimmer.
212
+
213
+ Code:
214
+
215
+ [samples/hello/hello_pop_up_context_menu.rb](/samples/hello/hello_pop_up_context_menu.rb)
216
+
217
+ ![Hello Pop Up Context Menu](/images/glimmer-hello-pop-up-context-menu.png)
218
+ ![Hello Pop Up Context Menu Popped Up](/images/glimmer-hello-pop-up-context-menu-popped-up.png)
219
+
220
+ #### Hello, Custom Widget!
221
+
222
+ This sample demonstrates the use of a custom widget in Glimmer.
223
+
224
+ Code:
225
+
226
+ [samples/hello/hello_custom_widget.rb](/samples/hello/hello_custom_widget.rb)
227
+
228
+ ![Hello Custom Widget](/images/glimmer-hello-custom-widget.gif)
229
+
230
+ #### Hello, Custom Shell!
231
+
232
+ This sample demonstrates the use of a custom shell (aka custom window) in Glimmer.
233
+
234
+ Code:
235
+
236
+ [samples/hello/hello_custom_shell.rb](/samples/hello/hello_custom_shell.rb)
237
+
238
+ ![Hello Custom Shell](/images/glimmer-hello-custom-shell.png)
239
+ ![Hello Custom Shell Email1](/images/glimmer-hello-custom-shell-email1.png)
240
+ ![Hello Custom Shell Email2](/images/glimmer-hello-custom-shell-email2.png)
241
+ ![Hello Custom Shell Email3](/images/glimmer-hello-custom-shell-email3.png)
242
+
243
+ #### Hello, Sash Form!
244
+
245
+ This sample demonstrates the use of a `sash_form` in Glimmer.
246
+
247
+ Code:
248
+
249
+ [samples/hello/hello_sash_form.rb](/samples/hello/hello_sash_form.rb)
250
+
251
+ Hello, Sash Form! Horizontal Orientation
252
+
253
+ ![Hello Sash Form](/images/glimmer-hello-sash-form.png)
254
+
255
+ Hello, Sash Form! Resized
256
+
257
+ ![Hello Sash Form Resized](/images/glimmer-hello-sash-form-resized.png)
258
+
259
+ Hello, Sash Form! Sash Width Changed
260
+
261
+ ![Hello Sash Form Sash Width Changed](/images/glimmer-hello-sash-form-sash-width-changed.png)
262
+
263
+ Hello, Sash Form! Vertical Orientation
264
+
265
+ ![Hello Sash Form Vertical](/images/glimmer-hello-sash-form-vertical.png)
266
+
267
+ Hello, Sash Form! Green Label Maximized
268
+
269
+ ![Hello Sash Form Green Maximized](/images/glimmer-hello-sash-form-green-maximized.png)
270
+
271
+ Hello, Sash Form! Red Label Maximized
272
+
273
+ ![Hello Sash Form Red Maximized](/images/glimmer-hello-sash-form-red-maximized.png)
274
+
275
+ #### Hello, Styled Text!
276
+
277
+ This sample demonstrates the use of a `styled_text` in Glimmer.
278
+
279
+ Code:
280
+
281
+ [samples/hello/hello_styled_text.rb](/samples/hello/hello_styled_text.rb)
282
+
283
+ Hello, Styled Text!
284
+
285
+ ![Hello Styled Text](/images/glimmer-hello-styled-text.png)
286
+
287
+ #### Hello, Expand Bar!
288
+
289
+ This sample demonstrates the use of a `expand_bar` and `expand_item` in Glimmer.
290
+
291
+ Code:
292
+
293
+ [samples/hello/hello_expand_bar.rb](/samples/hello/hello_expand_bar.rb)
294
+
295
+ Hello, Expand Bar! All Expanded
296
+
297
+ ![Hello Expand Bar All Expanded](/images/glimmer-hello-expand-bar-all-expanded.png)
298
+
299
+ Hello, Expand Bar! Productivity Expanded
300
+
301
+ ![Hello Expand Bar Productivity Expanded](/images/glimmer-hello-expand-bar-productivity-expanded.png)
302
+
303
+ Hello, Expand Bar! Tools Expanded
304
+
305
+ ![Hello Expand Bar Tools Expanded](/images/glimmer-hello-expand-bar-tools-expanded.png)
306
+
307
+ Hello, Expand Bar! Reading Expanded
308
+
309
+ ![Hello Expand Bar Reading Expanded](/images/glimmer-hello-expand-bar-reading-expanded.png)
310
+
311
+ #### Hello, Radio!
312
+
313
+ This sample demonstrates the use of a `radio` (aka `button(:radio)`) in Glimmer.
314
+
315
+ Code:
316
+
317
+ [samples/hello/hello_radio.rb](/samples/hello/hello_radio.rb)
318
+
319
+ Hello, Radio!
320
+
321
+ ![Hello Radio](/images/glimmer-hello-radio.png)
322
+
323
+ #### Hello, Radio Group!
324
+
325
+ This sample demonstrates the use of a `radio_group` in Glimmer, which provides terser syntax for representing multiple radio buttons by relying on data-binding to automatically spawn the `radio` widgets based on available options on the model.
326
+
327
+ Code:
328
+
329
+ [samples/hello/hello_radio_group.rb](/samples/hello/hello_radio_group.rb)
330
+
331
+ Hello, Radio Group!
332
+
333
+ ![Hello Radio Group](/images/glimmer-hello-radio-group.png)
334
+
335
+ #### Hello, Group!
336
+
337
+ This sample demonstrates the use of a `group` in Glimmer (not to be confused with the logical radio group custom widget, this is just an alternative to `composite` that provides a border around content).
338
+
339
+ Code:
340
+
341
+ [samples/hello/hello_group.rb](/samples/hello/hello_group.rb)
342
+
343
+ Hello, Group!
344
+
345
+ ![Hello Group](/images/glimmer-hello-group.png)
346
+
347
+ #### Hello, Checkbox!
348
+
349
+ This sample demonstrates the use of a `checkbox` (aka `check` or `button(:check)`) in Glimmer.
350
+
351
+ Code:
352
+
353
+ [samples/hello/hello_checkbox.rb](/samples/hello/hello_checkbox.rb)
354
+
355
+ Hello, Checkbox!
356
+
357
+ ![Hello Checkbox](/images/glimmer-hello-checkbox.png)
358
+
359
+ #### Hello, Checkbox Group!
360
+
361
+ This sample demonstrates the use of a `checkbox_group` (aka `check_group`) in Glimmer, which provides terser syntax for representing multiple checkbox buttons (`button(:check)`) by relying on data-binding to automatically spawn the `checkbox` widgets (`button(:check)`) based on available options on the model.
362
+
363
+ Code:
364
+
365
+ [samples/hello/hello_checkbox_group.rb](/samples/hello/hello_checkbox_group.rb)
366
+
367
+ Hello, Checkbox Group!
368
+
369
+ ![Hello Checkbox Group](/images/glimmer-hello-checkbox-group.png)
370
+
371
+ #### Hello, Directory Dialog!
372
+
373
+ This sample demonstrates the use of a `directory_dialog` in Glimmer.
374
+
375
+ Code:
376
+
377
+ [samples/hello/hello_directory_dialog.rb](/samples/hello/hello_directory_dialog.rb)
378
+
379
+ Hello, Directory Dialog!
380
+
381
+ ![Hello Directory Dialog](/images/glimmer-hello-directory-dialog.png)
382
+
383
+ Hello, Directory Dialog! Browse...
384
+
385
+ ![Hello Directory Dialog](/images/glimmer-hello-directory-dialog-browse.png)
386
+
387
+ Hello, Directory Dialog! Selected Directory
388
+
389
+ ![Hello Directory Dialog](/images/glimmer-hello-directory-dialog-selected-directory.png)
390
+
391
+ #### Hello, File Dialog!
392
+
393
+ This sample demonstrates the use of a `file_dialog` in Glimmer.
394
+
395
+ Code:
396
+
397
+ [samples/hello/hello_file_dialog.rb](/samples/hello/hello_file_dialog.rb)
398
+
399
+ Hello, File Dialog!
400
+
401
+ ![Hello File Dialog](/images/glimmer-hello-file-dialog.png)
402
+
403
+ Hello, File Dialog! Browse...
404
+
405
+ ![Hello File Dialog](/images/glimmer-hello-file-dialog-browse.png)
406
+
407
+ Hello, File Dialog! Selected File
408
+
409
+ ![Hello File Dialog](/images/glimmer-hello-file-dialog-selected-file.png)
410
+
411
+ #### Hello, Date Time!
412
+
413
+ This sample demonstrates the use of [date_time](#datetime) widget keywords in Glimmer: `date`, `date_drop_down`, `time`, and `calendar`
414
+
415
+ Code:
416
+
417
+ [samples/hello/hello_date_time.rb](/samples/hello/hello_date_time.rb)
418
+
419
+ Hello, Date Time!
420
+
421
+ ![Hello Date Time](/images/glimmer-hello-date-time.png)
422
+
423
+ #### Hello, Spinner!
424
+
425
+ This sample demonstrates the use of `spinner` widget in Glimmer
426
+
427
+ Code:
428
+
429
+ [samples/hello/hello_spinner.rb](/samples/hello/hello_spinner.rb)
430
+
431
+ Hello, Spinner!
432
+
433
+ ![Hello Spinner](/images/glimmer-hello-spinner.png)
434
+
435
+ #### Hello, Table!
436
+
437
+ This sample demonstrates the use of [table](#table) widget in Glimmer, including data-binding, multi-type editing, sorting, and filtering.
438
+
439
+ Code:
440
+
441
+ [samples/hello/hello_table.rb](/samples/hello/hello_table.rb)
442
+
443
+ Hello, Table!
444
+
445
+ ![Hello Table](/images/glimmer-hello-table.png)
446
+
447
+ Hello, Table! Editing Game Date
448
+
449
+ ![Hello Table](/images/glimmer-hello-table-editing-game-date.png)
450
+
451
+ Hello, Table! Editing Game Time
452
+
453
+ ![Hello Table](/images/glimmer-hello-table-editing-game-time.png)
454
+
455
+ Hello, Table! Editing Home Team
456
+
457
+ ![Hello Table](/images/glimmer-hello-table-editing-home-team.png)
458
+
459
+ Hello, Table! Sorted Game Date Ascending
460
+
461
+ ![Hello Table](/images/glimmer-hello-table-sorted-game-date-ascending.png)
462
+
463
+ Hello, Table! Sorted Game Date Descending
464
+
465
+ ![Hello Table](/images/glimmer-hello-table-sorted-game-date-descending.png)
466
+
467
+ Hello, Table! Playoff Type Combo
468
+
469
+ ![Hello Table](/images/glimmer-hello-table-playoff-type-combo.png)
470
+
471
+ Hello, Table! Playoff Type Changed
472
+
473
+ ![Hello Table](/images/glimmer-hello-table-playoff-type-changed.png)
474
+
475
+ Hello, Table! Game Booked
476
+
477
+ ![Hello Table](/images/glimmer-hello-table-game-booked.png)
478
+
479
+ Hello, Table! Context Menu
480
+
481
+ ![Hello Table](/images/glimmer-hello-table-context-menu.png)
482
+
483
+ #### Hello, Button!
484
+
485
+ This sample demonstrates the use of the `button` widget in Glimmer, including data-binding and click event triggering via `on_widget_selected`.
486
+
487
+ Code:
488
+
489
+ [samples/hello/hello_button.rb](/samples/hello/hello_button.rb)
490
+
491
+ Hello, Button!
492
+
493
+ ![Hello Button](/images/glimmer-hello-button.png)
494
+
495
+ Hello, Button! Incremented 7 times!
496
+
497
+ ![Hello Button Incremented](/images/glimmer-hello-button-incremented.png)
498
+
499
+ #### Hello, Link!
500
+
501
+ This sample demonstrates the use of the `link` widget in Glimmer, including identifying which link was clicked and performing an action (displaying help) based on its location.
502
+
503
+ Code:
504
+
505
+ [samples/hello/hello_link.rb](/samples/hello/hello_link.rb)
506
+
507
+ Hello, Link!
508
+
509
+ ![Hello Link](/images/glimmer-hello-link.png)
510
+
511
+ Hello, Link! Clicked
512
+
513
+ ![Hello Link Clicked](/images/glimmer-hello-link-clicked.png)
514
+
515
+ #### Hello, Dialog!
516
+
517
+ This sample demonstrates the use of the `dialog` widget in Glimmer, which provides a modal `shell` that blocks shells beneath it until closed. And unlike `message_box`, it can contain arbitrary widgets (not just a message).
518
+
519
+ Code:
520
+
521
+ [samples/hello/hello_dialog.rb](/samples/hello/hello_dialog.rb)
522
+
523
+ Hello, Dialog!
524
+
525
+ ![Hello Dialog](/images/glimmer-hello-dialog.png)
526
+
527
+ Hello, Dialog! Open Dialog
528
+
529
+ ![Hello Dialog Open Dialog](/images/glimmer-hello-dialog-open-dialog.png)
530
+
531
+ #### Hello, Code Text!
532
+
533
+ This sample demonstrates the Glimmer Built-In [Code Text Custom Widget](#code-text-custom-widget).
534
+
535
+ Code:
536
+
537
+ [samples/hello/hello_code_text.rb](/samples/hello/hello_code_text.rb)
538
+
539
+ Hello, Code Text! Ruby Language / Glimmer Theme / Show Line Numbers (default width of 4)
540
+
541
+ ![Hello Code Text Ruby](/images/glimmer-hello-code-text-ruby.png)
542
+
543
+ Hello, Code Text! JavaScript Language / Pastie Theme / Show Line Numbers (custom width of 2)
544
+
545
+ ![Hello Code Text JavaScript](/images/glimmer-hello-code-text-javascript.png)
546
+
547
+ Hello, Code Text! HTML Language / GitHub Theme / No Line Numbers
548
+
549
+ ![Hello Code Text HTML](/images/glimmer-hello-code-text-html.png)
550
+
551
+ #### Hello, Canvas!
552
+
553
+ This sample demonstrates the use of the `canvas` widget and [Shape DSL](#canvas-shape-dsl) in Glimmer.
554
+
555
+ Code:
556
+
557
+ [samples/hello/hello_canvas.rb](/samples/hello/hello_canvas.rb)
558
+
559
+ Hello, Canvas!
560
+
561
+ ![Hello Canvas](/images/glimmer-hello-canvas.png)
562
+
563
+ #### Hello, Canvas Animation!
564
+
565
+ This sample demonstrates the use of the `canvas` widget and [Animation DSL](#canvas-animation-dsl) in Glimmer.
566
+
567
+ Code:
568
+
569
+ [samples/hello/hello_canvas_animation.rb](/samples/hello/hello_canvas_animation.rb)
570
+
571
+ Hello, Canvas Animation!
572
+
573
+ ![Hello Canvas Animation](/images/glimmer-hello-canvas-animation.png)
574
+
575
+ Hello, Canvas Animation Another Frame!
576
+
577
+ ![Hello Canvas Animation Frame 2](/images/glimmer-hello-canvas-animation-frame2.png)
578
+
579
+ #### Hello, Canvas Transform!
580
+
581
+ This sample demonstrates the use of the `transform` keyword as part of the [Transform DSL](#canvas-transform-dsl) within the [Shape DSL](#canvas-shape-dsl).
582
+
583
+ Code:
584
+
585
+ [samples/hello/hello_canvas_transform.rb](/samples/hello/hello_canvas_transform.rb)
586
+
587
+ Hello, Canvas Transform!
588
+
589
+ ![Hello Canvas Transform](/images/glimmer-hello-canvas-transform.png)
590
+
591
+ #### Hello, Cursor!
592
+
593
+ This sample demonstrates the use of the `cursor` property keyword to change the mouse cursor.
594
+
595
+ Code:
596
+
597
+ [samples/hello/hello_cursor.rb](/samples/hello/hello_cursor.rb)
598
+
599
+ Hello, Cursor!
600
+
601
+ ![Hello Cursor](/images/glimmer-hello-cursor.gif)
602
+
603
+
604
+ ### Elaborate Samples
605
+
606
+ For more elaborate samples, check the following:
607
+
608
+ #### User Profile
609
+
610
+ This sample was used in the [DZone Article about Glimmer](https://dzone.com/articles/an-introduction-glimmer), demonstrating Glimmer widgets in general.
611
+
612
+ Please note that the code has changed since that article was written (the GUI DSL has been improved/simplified), so use the code sample mentioned here instead as the correct version.
613
+
614
+ Code:
615
+
616
+ [samples/elaborate/user_profile.rb](/samples/elaborate/user_profile.rb)
617
+
618
+ ![User Profile](/images/glimmer-user-profile.png)
619
+
620
+ #### Login
621
+
622
+ This sample demonstrates basic data-binding, password and text fields, and field enablement data-binding.
623
+
624
+ Code:
625
+
626
+ [samples/elaborate/login.rb](/samples/elaborate/login.rb)
627
+
628
+ ![Login](/images/glimmer-login.png)
629
+ ![Login Filled In](/images/glimmer-login-filled-in.png)
630
+ ![Login Logged In](/images/glimmer-login-logged-in.png)
631
+
632
+ #### Tic Tac Toe
633
+
634
+ This sample demonstrates a full MVC application, including GUI layout, text and enablement data-binding, and test-driven development (has [specs](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/spec/samples/elaborate/tic_tac_toe/board_spec.rb)).
635
+
636
+ Code:
637
+
638
+ (Please note that on some Linux instances where the display x-axis is set to double-scale, you need to set the `shell` `minimum_size` to `300, 178` instead of `150, 178`)
639
+
640
+ [samples/elaborate/tic_tac_toe.rb](/samples/elaborate/tic_tac_toe.rb)
641
+
642
+ ![Tic Tac Toe](/images/glimmer-tic-tac-toe.png)
643
+ ![Tic Tac Toe In Progress](/images/glimmer-tic-tac-toe-in-progress.png)
644
+ ![Tic Tac Toe Game Over](/images/glimmer-tic-tac-toe-game-over.png)
645
+
646
+ #### Contact Manager
647
+
648
+ This sample demonstrates table data-binding, sorting, filtering, GUI layout, MVP pattern, and test-driven development (has [specs](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/spec/samples/elaborate/contact_manager/contact_manager_presenter_spec.rb)).
649
+
650
+ Code:
651
+
652
+ [samples/elaborate/contact_manager.rb](/samples/elaborate/contact_manager.rb)
653
+
654
+ Contact Manager
655
+
656
+ ![Contact Manager](/images/glimmer-contact-manager.png)
657
+
658
+ Contact Manager - Find
659
+
660
+ ![Contact Manager](/images/glimmer-contact-manager-find.png)
661
+
662
+ Contact Manager - Edit Started
663
+
664
+ ![Contact Manager](/images/glimmer-contact-manager-edit-started.png)
665
+
666
+ Contact Manager - Edit In Progress
667
+
668
+ ![Contact Manager](/images/glimmer-contact-manager-edit-in-progress.png)
669
+
670
+ Contact Manager - Edit Done
671
+
672
+ ![Contact Manager](/images/glimmer-contact-manager-edit-done.png)
673
+
674
+ #### Glimmer Tetris
675
+
676
+ This sample demonstrates how to build an interactive animated game with MVC architecture, custom-shell/custom-widgets, multi-threading, asynchronous programming, data-binding, canvas shape graphic decorations, canvas shape icon image generation, and keyboard events/shortcuts.
677
+
678
+ Note that it works optimally on the Mac. It is very new, so it has not been optimized for Windows and Linux yet given their minor differences from the Mac.
679
+
680
+ Code:
681
+
682
+ [samples/elaborate/tetris.rb](/samples/elaborate/tetris.rb)
683
+
684
+ ![Tetris Icon](/images/glimmer-tetris-icon.png)
685
+
686
+ ![Tetris](/images/glimmer-tetris.png)
687
+
688
+ ![Tetris Game Over](/images/glimmer-tetris-game-over.png)
689
+
690
+ ![Tetris Game Over](/images/glimmer-tetris-game-over-sorted-by-score.png)
691
+
692
+ ![Tetris High Scores](/images/glimmer-tetris-high-score-dialog.png)
693
+
694
+ ![Tetris Game Menu](/images/glimmer-tetris-game-menu.png)
695
+
696
+ ![Tetris View Menu](/images/glimmer-tetris-view-menu.png)
697
+
698
+ ![Tetris Options Menu](/images/glimmer-tetris-options-menu.png)
699
+
700
+ ![Tetris Help Menu](/images/glimmer-tetris-help-menu.png)
701
+
702
+ #### Mandelbrot Fractal
703
+
704
+ This sample demonstrates how to render canvas graphics with multi-threaded processing taking advantage of all CPU cores and doing background processing of images.
705
+
706
+ It renders the famous Mandelbrot Fractal, enabling zooming and panning (go to Help -> Instructions for more details)
707
+
708
+ The Mandelbrot Fractal is known to take a long time to render, but thanks to multi-core processing, the app starts in about 10 seconds (runs faster the more cores you have)
709
+
710
+ Code:
711
+
712
+ [samples/elaborate/mandelbrot_fractal.rb](/samples/elaborate/mandelbrot_fractal.rb)
713
+
714
+ ![Mandelbrot Fractal Zoom 1](/images/glimmer-mandelbrot-zoom1.png)
715
+
716
+ ![Mandelbrot Fractal Zoom 3](/images/glimmer-mandelbrot-zoom3.png)
717
+
718
+ ![Mandelbrot Fractal Zoom 5](/images/glimmer-mandelbrot-zoom5.png)
719
+
720
+ ### External Samples
721
+
722
+ #### Glimmer Calculator
723
+
724
+ [<img alt="Glimmer Calculator Icon" src="https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-calculator/master/glimmer-cs-calculator-icon.png" height=40 /> Glimmer Calculator](https://github.com/AndyObtiva/glimmer-cs-calculator) is a basic calculator sample app demonstrating data-binding and TDD (test-driven-development) with Glimmer following the MVP pattern (Model-View-Presenter).
725
+
726
+ [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-calculator/master/glimmer-cs-calculator-screenshot.png" />](https://github.com/AndyObtiva/glimmer-cs-calculator)
727
+
728
+ #### Gladiator
729
+
730
+ [<img src='https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-gladiator/master/images/glimmer-cs-gladiator-logo.png' height=40 /> Gladiator](https://github.com/AndyObtiva/glimmer-cs-gladiator) (short for Glimmer Editor) is a Glimmer sample project under on-going development.
731
+ You may check it out to learn how to build a Glimmer Custom Shell gem.
732
+
733
+ [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-gladiator/master/images/glimmer-gladiator.png" />](https://github.com/AndyObtiva/glimmer-cs-gladiator)
734
+
735
+ Gladiator is a good demonstration of:
736
+ - MVP Pattern
737
+ - Tree data-binding
738
+ - List data-binding
739
+ - Text selection data-binding
740
+ - Tabs
741
+ - Context menus
742
+ - Custom Shell
743
+ - Custom widget
744
+
745
+ #### Timer
746
+
747
+ [<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 JSound (Java Sound) library integration in a desktop application.
748
+
749
+ [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-timer/master/glimmer-timer-screenshot.png" />](https://github.com/AndyObtiva/glimmer-cs-timer)
750
+
751
+ ## License
752
+
753
+ [MIT](LICENSE.txt)
754
+
755
+ Copyright (c) 2007-2021 - Andy Maleh.