glimmer-dsl-swt 4.18.4.11 → 4.18.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +33 -0
  3. data/README.md +7 -5
  4. data/VERSION +1 -1
  5. data/bin/glimmer +3 -3
  6. data/docs/reference/GLIMMER_CONFIGURATION.md +7 -3
  7. data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +121 -5
  8. data/docs/reference/GLIMMER_SAMPLES.md +17 -4
  9. data/glimmer-dsl-swt.gemspec +19 -9
  10. data/lib/ext/glimmer/config.rb +3 -7
  11. data/lib/glimmer/data_binding/list_selection_binding.rb +13 -7
  12. data/lib/glimmer/data_binding/table_items_binding.rb +22 -17
  13. data/lib/glimmer/data_binding/tree_items_binding.rb +19 -15
  14. data/lib/glimmer/data_binding/widget_binding.rb +9 -27
  15. data/lib/glimmer/dsl/swt/auto_exec_expression.rb +36 -0
  16. data/lib/glimmer/dsl/swt/checkbox_group_selection_data_binding_expression.rb +9 -6
  17. data/lib/glimmer/dsl/swt/combo_selection_data_binding_expression.rb +16 -14
  18. data/lib/glimmer/dsl/swt/data_binding_expression.rb +1 -2
  19. data/lib/glimmer/dsl/swt/exec_expression.rb +1 -1
  20. data/lib/glimmer/dsl/swt/image_expression.rb +8 -1
  21. data/lib/glimmer/dsl/swt/list_selection_data_binding_expression.rb +11 -8
  22. data/lib/glimmer/dsl/swt/pixel_expression.rb +1 -1
  23. data/lib/glimmer/dsl/swt/radio_group_selection_data_binding_expression.rb +8 -5
  24. data/lib/glimmer/dsl/swt/shape_expression.rb +1 -1
  25. data/lib/glimmer/dsl/swt/widget_expression.rb +4 -3
  26. data/lib/glimmer/launcher.rb +3 -0
  27. data/lib/glimmer/rake_task/scaffold.rb +3 -0
  28. data/lib/glimmer/swt/custom/code_text.rb +11 -11
  29. data/lib/glimmer/swt/custom/drawable.rb +4 -0
  30. data/lib/glimmer/swt/custom/shape.rb +129 -20
  31. data/lib/glimmer/swt/custom/shape/arc.rb +43 -0
  32. data/lib/glimmer/swt/custom/shape/focus.rb +43 -0
  33. data/lib/glimmer/swt/custom/shape/image.rb +86 -0
  34. data/lib/glimmer/swt/custom/shape/line.rb +58 -0
  35. data/lib/glimmer/swt/custom/shape/oval.rb +43 -0
  36. data/lib/glimmer/swt/custom/shape/point.rb +52 -0
  37. data/lib/glimmer/swt/custom/shape/polygon.rb +73 -0
  38. data/lib/glimmer/swt/custom/shape/polyline.rb +73 -0
  39. data/lib/glimmer/swt/custom/shape/rectangle.rb +87 -0
  40. data/lib/glimmer/swt/custom/shape/text.rb +73 -0
  41. data/lib/glimmer/swt/date_time_proxy.rb +9 -3
  42. data/lib/glimmer/swt/directory_dialog_proxy.rb +20 -18
  43. data/lib/glimmer/swt/display_proxy.rb +62 -2
  44. data/lib/glimmer/swt/expand_item_proxy.rb +18 -12
  45. data/lib/glimmer/swt/file_dialog_proxy.rb +20 -18
  46. data/lib/glimmer/swt/font_proxy.rb +1 -1
  47. data/lib/glimmer/swt/image_proxy.rb +1 -1
  48. data/lib/glimmer/swt/layout_data_proxy.rb +21 -15
  49. data/lib/glimmer/swt/layout_proxy.rb +19 -15
  50. data/lib/glimmer/swt/menu_proxy.rb +2 -2
  51. data/lib/glimmer/swt/message_box_proxy.rb +20 -7
  52. data/lib/glimmer/swt/scrolled_composite_proxy.rb +6 -2
  53. data/lib/glimmer/swt/shell_proxy.rb +94 -80
  54. data/lib/glimmer/swt/swt_proxy.rb +16 -0
  55. data/lib/glimmer/swt/tab_item_proxy.rb +5 -3
  56. data/lib/glimmer/swt/table_proxy.rb +32 -11
  57. data/lib/glimmer/swt/tree_proxy.rb +11 -16
  58. data/lib/glimmer/swt/widget_listener_proxy.rb +6 -2
  59. data/lib/glimmer/swt/widget_proxy.rb +200 -117
  60. data/lib/glimmer/ui.rb +5 -0
  61. data/lib/glimmer/ui/custom_shell.rb +11 -5
  62. data/lib/glimmer/ui/custom_widget.rb +4 -5
  63. data/samples/elaborate/contact_manager.rb +7 -7
  64. data/samples/elaborate/login.rb +25 -21
  65. data/samples/elaborate/mandelbrot_fractal.rb +3 -5
  66. data/samples/elaborate/tetris.rb +1 -0
  67. data/samples/elaborate/tic_tac_toe.rb +16 -14
  68. data/samples/elaborate/tic_tac_toe/board.rb +5 -5
  69. data/samples/elaborate/tic_tac_toe/cell.rb +5 -5
  70. data/samples/hello/hello_button.rb +7 -7
  71. data/samples/hello/hello_canvas.rb +43 -2
  72. data/samples/hello/hello_checkbox.rb +16 -14
  73. data/samples/hello/hello_checkbox_group.rb +11 -9
  74. data/samples/hello/hello_combo.rb +14 -12
  75. data/samples/hello/hello_computed.rb +7 -7
  76. data/samples/hello/hello_cursor.rb +2 -1
  77. data/samples/hello/hello_custom_shell.rb +17 -21
  78. data/samples/hello/hello_custom_widget.rb +4 -6
  79. data/samples/hello/hello_date_time.rb +14 -12
  80. data/samples/hello/hello_directory_dialog.rb +7 -7
  81. data/samples/hello/hello_expand_bar.rb +8 -8
  82. data/samples/hello/hello_file_dialog.rb +7 -7
  83. data/samples/hello/hello_group.rb +18 -16
  84. data/samples/hello/hello_list_multi_selection.rb +13 -11
  85. data/samples/hello/hello_list_single_selection.rb +13 -11
  86. data/samples/hello/hello_progress_bar.rb +3 -7
  87. data/samples/hello/hello_radio.rb +18 -16
  88. data/samples/hello/hello_radio_group.rb +14 -12
  89. data/samples/hello/hello_spinner.rb +7 -7
  90. data/samples/hello/hello_tab.rb +5 -5
  91. data/samples/hello/hello_table.rb +10 -5
  92. data/samples/hello/hello_tree.rb +485 -0
  93. metadata +17 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb72ad5f93c5c27a2f2ead87225e0ee045e2663e50b04346f5be6065fbf269c2
4
- data.tar.gz: 394f955a01f7d5b568ae433dcab240f86b48749e5db428296299388ceaff5773
3
+ metadata.gz: dae230b3e4a50ef2425a4b5155e98ff598e0bb0e3d1f7a5c15eaadcbf5688d41
4
+ data.tar.gz: 7ec51028f89ec3ff207aecbb2f91ad43b03e1e6db8d03885e681972cdd9fd1f9
5
5
  SHA512:
6
- metadata.gz: 18dd1f7062fdb14e063820d29168815df77b70f04275559fc812b605d2daf6053815b94579030a749cfc942188115150db093b0f0fc9863247177d112d165d90
7
- data.tar.gz: c1809fda609b22045fd5872624cbc234b1353173522f2430767b8f36e4afd096063d5b4fe5fc41b0a24b0f96ec00d9fc0aada8df9537201d1d87fe8eebe26d59
6
+ metadata.gz: '0954400586b6df73a08070b2f7bd0669b11dca0ecb9ba614e1719b0a41e9966dad2f7d16c5f3b344bb14cbc4074978b793d206d6034dc3ce5034aee98e9732de'
7
+ data.tar.gz: '086c20606c6319fa70c480b3633d60682723d246a46c7d4f3d2b2e8d3c9ed83f2d22a7e7f3288cc35fb38f11f0895ed3b98b8297ee607767094f179612aabbc2'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,38 @@
1
1
  # Change Log
2
2
 
3
+ ### 4.18.5.0
4
+
5
+ - Automatic `sync_exec` usage from threads other than the GUI thread, thus absolving software engineers from the need to use `sync_exec` explicitly anymore.
6
+ - `auto_exec` keyword to automatically use `sync_exec` with SWT code when needed (running from a thread other than GUI thread)
7
+ - Implement `sync_exec:` option in `bind` keyword with table, tree, combo, and list data-binding (other data-binding types than the standard)
8
+ - Add `async_exec` option to `bind` keyword (covering `data_binding_expression.rb` with `async_exec` properly)
9
+ - Support tree multi-selection data-binding
10
+ - Hello, Tree! sample
11
+ - Enhance Hello, Canvas! with Shape Movement
12
+ - Add Jars.lock to scaffold .gitignore file
13
+ - Add Glimmer::GUI alias for Glimmer::UI module, thus permitting inclusion of Glimmer::GUI::CustomWidget, Glimmer::GUI::CustomShell, and Glimmer::GUI::CustomWindow
14
+ - Provide a quick method for grabbing all available cursor/color options off of SWTProxy (SWTProxy.cursor_options, SWTProxy.cursor_styles, SWTProxy.color_options, SWTProxy.color_styles)
15
+ - Remove explicit git gem dependency given that it is installed via juwelier during scaffolding and is not needed otherwise
16
+ - Support partial image shape drawing by passing source and destination dimensions to `image` shape [documented in docs]
17
+ - Support alternate Canvas Shape DSL syntax for `image` by passing nested properties
18
+ - Canvas Shape DSL argument data-binding support for `image`
19
+ - Support alternate Canvas Shape DSL syntax for `rectangle` by passing nested properties
20
+ - Canvas Shape DSL argument data-binding support for `rectangle(x, y, width, height, fill: false)` standard rectangle, which can be optionally filled
21
+ - Canvas Shape DSL argument data-binding support for `rectangle(x, y, width, height, arcWidth = 60, arcHeight = 60, fill: false, round: true)` round rectangle, which can be optionally filled, and takes optional extra round angle arguments
22
+ - Canvas Shape DSL argument data-binding support for `rectangle(x, y, width, height, vertical = true, fill: true, gradient: true)` gradient rectangle, which is always filled, and takes an optional extra argument to specify true for vertical gradient (default) and false for horizontal gradient
23
+ - Canvas Shape DSL argument data-binding support for `arc(x, y, width, height, startAngle, arcAngle, fill: false)` arc is part of a circle within an oval area, denoted by start angle (degrees) and end angle (degrees)
24
+ - Canvas Shape DSL argument data-binding support for `focus(x, y, width, height)` this is just like rectangle but its foreground color is always that of the OS widget focus color (useful when capturing user interaction via a shape)
25
+ - Canvas Shape DSL argument data-binding support for `line(x1, y1, x2, y2)` line
26
+ - Canvas Shape DSL argument data-binding support for `oval(x, y, width, height, fill: false)` oval if width does not match heigh and circle if width matches height. Can be optionally filled.
27
+ - Canvas Shape DSL argument data-binding support for `point(x, y)` point
28
+ - Canvas Shape DSL argument data-binding support for `polygon(pointArray, fill: false)` polygon consisting of points, which close automatically to form a shape that can be optionally filled (when points only form a line, it does not show up as filled)
29
+ - Canvas Shape DSL argument data-binding support for `polyline(pointArray)` polyline is just like a polygon, but it does not close up to form a shape, remaining open (unless the points close themselves by having the last point or an intermediate point match the first)
30
+ - Canvas Shape DSL argument data-binding support for `text(string, x, y, flags = nil)` text with optional flags (flag format is `swt(comma_separated_flags)` where flags can be :draw_delimiter (i.e. new lines), :draw_tab, :draw_mnemonic, and :draw_transparent as explained in [GC API](https://help.eclipse.org/2020-12/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/graphics/GC.html))
31
+ - Update Hello, Button!, Hello, Table! sample, Hello, Checkbox Group! sample, Hello, Radio Group! sample, Hello, Combo! sample, Hello, List Single Selection! sample, Hello, List Multi Selection! sample to utilize a CustomShell
32
+ - Refactor all samples to rely on Glimmer::UI::CustomShell given its new class launch method for productive app declaration
33
+ - Fix issue with logging remaining async in debug mode
34
+ - Fix issue with combo, list, radio group, and checkbox group not supporting nested data-binding
35
+
3
36
  ### 4.18.4.11
4
37
 
5
38
  - Support creating images pixel by pixel with `image(width, height) {|x,y| [r, g, b]}` keyword, which takes a block with x, y coordinates based on the image width and height and returns a pixel foreground color per point
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.18.4.11
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.18.5.0
2
2
  ## JRuby Desktop Development GUI Framework
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)
@@ -342,7 +342,7 @@ jgem install glimmer-dsl-swt
342
342
 
343
343
  Or this command if you want a specific version:
344
344
  ```
345
- jgem install glimmer-dsl-swt -v 4.18.4.11
345
+ jgem install glimmer-dsl-swt -v 4.18.5.0
346
346
  ```
347
347
 
348
348
  `jgem` is JRuby's version of `gem` command.
@@ -360,7 +360,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
360
360
 
361
361
  Add the following to `Gemfile`:
362
362
  ```
363
- gem 'glimmer-dsl-swt', '~> 4.18.4.11'
363
+ gem 'glimmer-dsl-swt', '~> 4.18.5.0'
364
364
  ```
365
365
 
366
366
  And, then run:
@@ -404,10 +404,12 @@ Glimmer configuration may be done via the `Glimmer::Config` module.
404
404
 
405
405
  ## Samples
406
406
 
407
- 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`).
408
-
409
407
  [docs/reference/GLIMMER_SAMPLES.md](docs/reference/GLIMMER_SAMPLES.md)
410
408
 
409
+ 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-dsl-swt` 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`).
410
+
411
+ ![Glimmer Meta-Sample](/images/glimmer-meta-sample.png)
412
+
411
413
  ## In Production
412
414
 
413
415
  The following production apps have been built with Glimmer.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.18.4.11
1
+ 4.18.5.0
data/bin/glimmer CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env jruby
2
2
 
3
3
  # Copyright (c) 2007-2021 Andy Maleh
4
- #
4
+ #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining
6
6
  # a copy of this software and associated documentation files (the
7
7
  # "Software"), to deal in the Software without restriction, including
@@ -9,10 +9,10 @@
9
9
  # distribute, sublicense, and/or sell copies of the Software, and to
10
10
  # permit persons to whom the Software is furnished to do so, subject to
11
11
  # the following conditions:
12
- #
12
+ #
13
13
  # The above copyright notice and this permission notice shall be
14
14
  # included in all copies or substantial portions of the Software.
15
- #
15
+ #
16
16
  # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
17
  # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
18
  # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -170,11 +170,15 @@ This just tells Glimmer whether to log excluded keywords or not (at the debug le
170
170
 
171
171
  ### auto_sync_exec
172
172
 
173
- (default = false)
173
+ (default = true)
174
+
175
+ This automatically uses sync_exec on GUI calls from threads other than the main GUI thread instead of requiring users to manually use sync_exec.
174
176
 
175
- This automatically uses sync_exec on GUI calls from threads other than the main GUI thread instead of requiring users to manually use sync_exec. Default value to false.
177
+ Keep in mind that this could cause redraws on every minor change in the models instead of applying large scope changes together.
178
+ In rare cases where you need to avoid causing stutter in the GUI as a result, you can wrap large-scale GUI updates in `auto_exec` manually.
176
179
 
177
- Keep in mind the caveat that it would force redraws on every minor changein the models instead of applying large scope changes all together, thus causing too much drawing/stutter in the GUI. As such, this is a good fit for simpler GUIs, not ones used with highly sophisticated 2D graphics. It may be mitigated in the future by introducing the idea of large-scale observation events that wrap around smaller events. Until then, keep the caveat in mind or just use sync_exec manually as usually done with Java SWT apps.
180
+ As such, this saves developers a lot of headache by not requiring wrapping every bit of GUI update in other threads with `sync_exec`, yet only
181
+ large scale updates in the rare cases where optimization is needed.
178
182
 
179
183
  ## License
180
184
 
@@ -1,7 +1,96 @@
1
- ## Glimmer GUI DSL Syntax
2
-
3
1
  This guide should help you get started with Glimmer DSL for SWT. For more advanced SWT details, please refer to the [SWT Reference](/README.md#swt-reference).
4
2
 
3
+ - [Glimmer GUI DSL Syntax](#glimmer-gui-dsl-syntax)
4
+ - [DSL Auto-Expansion](#dsl-auto-expansion)
5
+ - [Widgets](#widgets)
6
+ - [Glimmer GUI DSL Keywords](#glimmer-gui-dsl-keywords)
7
+ - [SWT Proxies](#swt-proxies)
8
+ - [swt_widget](#swt_widget)
9
+ - [Shell widget proxy methods](#shell-widget-proxy-methods)
10
+ - [Widget Content Block](#widget-content-block)
11
+ - [Shell Icon](#shell-icon)
12
+ - [Shell Icon Tip for Packaging on Windows](#shell-icon-tip-for-packaging-on-windows)
13
+ - [Dialog](#dialog)
14
+ - [message_box](#message_box)
15
+ - [Display](#display)
16
+ - [Multi-Threading](#multi-threading)
17
+ - [async_exec](#async_exec)
18
+ - [sync_exec](#sync_exec)
19
+ - [timer_exec](#timer_exec)
20
+ - [Menus](#menus)
21
+ - [ScrolledComposite](#scrolledcomposite)
22
+ - [Sash Form Widget](#sash-form-widget)
23
+ - [Browser Widget](#browser-widget)
24
+ - [Widget Styles](#widget-styles)
25
+ - [Explicit SWT Style Bit](#explicit-swt-style-bit)
26
+ - [Negative SWT Style Bits](#negative-swt-style-bits)
27
+ - [Extra SWT Styles](#extra-swt-styles)
28
+ - [Non-resizable Window](#non-resizable-window)
29
+ - [Widget Properties](#widget-properties)
30
+ - [Color](#color)
31
+ - [`#swt_color`](#swt_color)
32
+ - [Font](#font)
33
+ - [Image](#image)
34
+ - [Image Options](#image-options)
35
+ - [Cursor](#cursor)
36
+ - [Layouts](#layouts)
37
+ - [Layout Data](#layout-data)
38
+ - [Canvas Shape DSL](#canvas-shape-dsl)
39
+ - [Shapes inside a Widget](#shapes-inside-a-widget)
40
+ - [Shapes inside an Image](#shapes-inside-an-image)
41
+ - [Canvas Shape API](#canvas-shape-api)
42
+ - [Pixel Graphics](#pixel-graphics)
43
+ - [Canvas Transform DSL](#canvas-transform-dsl)
44
+ - [Top-Level Transform Fluent Interface](#top-level-transform-fluent-interface)
45
+ - [Canvas Animation DSL](#canvas-animation-dsl)
46
+ - [Animation via Data-Binding](#animation-via-data-binding)
47
+ - [Data-Binding](#data-binding)
48
+ - [General Examples](#general-examples)
49
+ - [Combo](#combo)
50
+ - [List](#list)
51
+ - [Table](#table)
52
+ - [Table Selection](#table-selection)
53
+ - [Table Editing](#table-editing)
54
+ - [Table Sorting](#table-sorting)
55
+ - [Tree](#tree)
56
+ - [DateTime](#datetime)
57
+ - [Observer](#observer)
58
+ - [Observing Widgets](#observing-widgets)
59
+ - [Alternative Syntax](#alternative-syntax)
60
+ - [Observing Models](#observing-models)
61
+ - [Custom Widgets](#custom-widgets)
62
+ - [Simple Example](#simple-example)
63
+ - [Method-Based Custom Widget Example](#method-based-custom-widget-example)
64
+ - [Class-Based Custom Widget Example](#class-based-custom-widget-example)
65
+ - [Custom Widget Lifecycle Hooks](#custom-widget-lifecycle-hooks)
66
+ - [Lifecycle Hooks Example](#lifecycle-hooks-example)
67
+ - [Custom Widget API](#custom-widget-api)
68
+ - [Content/Options Example](#contentoptions-example)
69
+ - [Custom Widget Gotchas](#custom-widget-gotchas)
70
+ - [Built-In Custom Widgets](#built-in-custom-widgets)
71
+ - [Checkbox Group Custom Widget](#checkbox-group-custom-widget)
72
+ - [Radio Group Custom Widget](#radio-group-custom-widget)
73
+ - [Code Text Custom Widget](#code-text-custom-widget)
74
+ - [Options](#options)
75
+ - [Video Custom Custom Widget](#video-custom-custom-widget)
76
+ - [Custom Widget Final Notes](#custom-widget-final-notes)
77
+ - [Custom Shells](#custom-shells)
78
+ - [Drag and Drop](#drag-and-drop)
79
+ - [Miscellaneous](#miscellaneous)
80
+ - [Multi-DSL Support](#multi-dsl-support)
81
+ - [SWT](#swt)
82
+ - [Opal](#opal)
83
+ - [XML](#xml)
84
+ - [CSS](#css)
85
+ - [Listing / Enabling / Disabling DSLs](#listing--enabling--disabling-dsls)
86
+ - [Application Menu Items (About/Preferences)](#application-menu-items-aboutpreferences)
87
+ - [App Name and Version](#app-name-and-version)
88
+ - [Performance Profiling](#performance-profiling)
89
+ - [SWT Browser Style Options](#swt-browser-style-options)
90
+ - [License](#license)
91
+
92
+ ## Glimmer GUI DSL Syntax
93
+
5
94
  Glimmer's core is a GUI DSL with a lightweight visual syntax that makes it easy to visualize the nesting of widgets in the GUI hierarchy tree.
6
95
 
7
96
  It is available through mixing in the `Glimmer` module, which makes [Glimmer GUI DSL Keywords](#glimmer-gui-dsl-keywords) available to both the instance scope and class scope:
@@ -257,6 +346,7 @@ This is not an exaustive list, but should give you a good start in learning Glim
257
346
  - `async_exec`: featured in [Hello, Custom Widget!](GLIMMER_SAMPLES.md#hello-custom-widget) / [Hello, Custom Shell!](GLIMMER_SAMPLES.md#hello-custom-shell)
258
347
  - `sync_exec`: executes a block on the event loop synchronously (usually from another thread)
259
348
  - `timer_exec`: executes a block after a delay of time has passed
349
+ - `auto_exec`: executes a block on the event loop synchronously only when needed (when running from a thread other than GUI thread)
260
350
 
261
351
  #### SWT Proxies
262
352
 
@@ -415,6 +505,11 @@ Most of the time, you simply get away with Ruby [Threads](https://ruby-doc.org/c
415
505
 
416
506
  Otherwise, if you need more advanced concurrency, Glimmer includes the [concurrent-ruby gem](https://rubygems.org/gems/concurrent-ruby), which supports many helpful concurrency techniques such as [Thread Pools](http://ruby-concurrency.github.io/concurrent-ruby/master/file.thread_pools.html) (used in the [Mandelbrot Fractal](GLIMMER_SAMPLES.md#mandelbrot-fractal) sample).
417
507
 
508
+ One thing Glimmer DSL for SWT innovates over plain old SWT is not requiring developers to explicitly use `Display.syncExec` from threads other than the GUI threads.
509
+ Glimmer automatically detects if you're running in a different thread and uses `Display.syncExec` automatically using its own enhanced `auto_exec`
510
+
511
+ In any case, Glimmer still allows developers to manually use `sync_exec`, `async_exec`, `timer_exec`, and `auto_exec` when needed. M
512
+
418
513
  ##### async_exec
419
514
 
420
515
  `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.
@@ -445,7 +540,11 @@ Thread.new {
445
540
 
446
541
  ##### sync_exec
447
542
 
448
- `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.
543
+ `sync_exec {}` is required by SWT when running GUI update from a thread other than the GUI thread. In Glimmer, it is automatically invoked for you so that you wouldn't have to worry about it. It works just like `async_exec` except it executes the block synchronously at the earliest opportunity possible, waiting for the block to be finished.
544
+
545
+ ##### auto_exec
546
+
547
+ `auto_exec(override_sync_exec:, override_async_exec) {}` only executes code block with `sync_exec` when necessary (running from a thread other than the GUI thread). It is used automatically all over the Glimmer DSL for SWT codebase, so you wouldn't need it unless you grab a direct handle on `swt_widget` from a widget proxy.
449
548
 
450
549
  ##### timer_exec
451
550
 
@@ -1296,6 +1395,7 @@ Shape keywords and their args (including defaults) are listed below (they basica
1296
1395
  - `arc(x, y, width, height, startAngle, arcAngle, fill: false)` arc is part of a circle within an oval area, denoted by start angle (degrees) and end angle (degrees)
1297
1396
  - `focus(x, y, width, height)` this is just like rectangle but its foreground color is always that of the OS widget focus color (useful when capturing user interaction via a shape)
1298
1397
  - `image(image, x = 0, y = 0)` sets [image](#image), which could be an [org.eclipse.swt.graphics.Image](https://help.eclipse.org/2020-12/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/graphics/Image.html) object or just a file path string
1398
+ - `image(image, source_x, source_y, source_width, source_height, destination_x, destination_y, destination_width, destination_height)` sets part of an [image](#image) and scales it to fit destination dimensions on parent canvas/widget
1299
1399
  - `line(x1, y1, x2, y2)` line
1300
1400
  - `oval(x, y, width, height, fill: false)` oval if width does not match heigh and circle if width matches height. Can be optionally filled.
1301
1401
  - `point(x, y)` point
@@ -1515,6 +1615,16 @@ shell {
1515
1615
 
1516
1616
  ![Image Shape DSL](/images/glimmer-example-image-shape-dsl-app-switcher-icon.png)
1517
1617
 
1618
+ #### Canvas Shape API
1619
+
1620
+ These Canvas Shape API methods help with manipulating shapes upon user interaction, such as mouse clicking a specific shape.
1621
+
1622
+ - `WidgetProxy#shape_at_location(x, y)` : returns shape object at x, y location from a widget proxy like canvas
1623
+ - `Shape#include?(x, y)` : indicates if shape includes x, y point (`arc` and `oval` shapes currently include their entire rectangular region in their checks, `text` shapes always return false)
1624
+ - `Shape#move_by(x_delta, y_delta)` : moves shape object at x, y location
1625
+
1626
+ Check [Hello, Canvas!](GLIMMER_SAMPLES.md#hello-canvas) for an example.
1627
+
1518
1628
  #### Pixel Graphics
1519
1629
 
1520
1630
  **(Early Alpha Feature)**
@@ -1876,11 +1986,15 @@ This example adds on the one above it by specifying converters on read and write
1876
1986
 
1877
1987
  `text bind(contact, 'address.street', sync_exec: true)`
1878
1988
 
1879
- This example adds does GUI updates via [sync_exec](#sync_exec) assuming they are coming from another thread (different from the GUI thread)
1989
+ **(ALPHA FEATURE)**
1990
+
1991
+ This example forces GUI updates via [sync_exec](#sync_exec) assuming they are coming from another thread (different from the GUI thread)
1880
1992
 
1881
1993
  `text bind(contact, 'address.street', async_exec: true)`
1882
1994
 
1883
- This example adds does GUI updates via [async_exec](#async_exec) assuming they are coming from another thread (different from the GUI thread)
1995
+ **(ALPHA FEATURE)**
1996
+
1997
+ This example forces GUI updates via [async_exec](#async_exec) assuming they are coming from another thread (different from the GUI thread)
1884
1998
 
1885
1999
  `text bind(contact, 'address.street', on_read: lambda { |s| s[0..10] })`
1886
2000
 
@@ -2317,6 +2431,8 @@ This finds the root node. The array is a Java array. This enables easy passing o
2317
2431
  To edit a tree, you must invoke `TreeProxy#edit_selected_tree_item` or `TreeProxy#edit_tree_item`. This automatically leverages the SWT TreeEditor custom class behind the scenes, displaying
2318
2432
  a text widget to the user to change the selected or passed tree item text into something else. It automatically persists the change to `items` data-bound model on ENTER/FOCUS-OUT or cancels on ESC/NO-CHANGE.
2319
2433
 
2434
+ Learn more at the [Hello, Tree!](GLIMMER_SAMPLES.md#hello-tree) and [Gladiator](GLIMMER_SAMPLES.md#gladiator) samples.
2435
+
2320
2436
  #### DateTime
2321
2437
 
2322
2438
  `date_time` represents the SWT DateTime widget.
@@ -1,5 +1,3 @@
1
- ## Samples
2
-
3
1
  - [Samples](#samples)
4
2
  - [Hello Samples](#hello-samples)
5
3
  - [Hello, World!](#hello-world)
@@ -37,6 +35,7 @@
37
35
  - [Hello, Canvas Transform!](#hello-canvas-transform)
38
36
  - [Hello, Cursor!](#hello-cursor)
39
37
  - [Hello, Progress Bar!](#hello-progress-bar)
38
+ - [Hello, Tree!](#hello-tree)
40
39
  - [Elaborate Samples](#elaborate-samples)
41
40
  - [User Profile](#user-profile)
42
41
  - [Login](#login)
@@ -50,7 +49,9 @@
50
49
  - [Timer](#timer)
51
50
  - [License](#license)
52
51
 
53
- 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`).
52
+ ## Samples
53
+
54
+ 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-dsl-swt` 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`).
54
55
 
55
56
  You may run any sample via this command:
56
57
 
@@ -607,7 +608,7 @@ This sample demonstrates the use of the `progress_bar` widget keyword.
607
608
 
608
609
  It includes an `:indeterminate` progress bar on top, for cases when you could not calculate progress, but still want to inform the user there is an operation happening in the background.
609
610
 
610
- Below it, there are a determinate `:horizontal` (default) progress bar and a `:vertical` progress bar.
611
+ Below it, there are a determinate `:horizontal` (default) progress bar and a `:vertical` progress bar.
611
612
 
612
613
  Code:
613
614
 
@@ -617,6 +618,18 @@ Hello, Progress Bar!
617
618
 
618
619
  ![Hello Progress Bar](/images/glimmer-hello-progress-bar.gif)
619
620
 
621
+ #### Hello, Tree!
622
+
623
+ This sample demonstrates the use of the `tree` widget along with tree data-binding.
624
+
625
+ Code:
626
+
627
+ [samples/hello/hello_tree.rb](/samples/hello/hello_tree.rb)
628
+
629
+ Hello, Tree!
630
+
631
+ ![Hello Tree](/images/glimmer-hello-tree.png)
632
+
620
633
  ### Elaborate Samples
621
634
 
622
635
  For more elaborate samples, check the following:
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: glimmer-dsl-swt 4.18.4.11 ruby lib
5
+ # stub: glimmer-dsl-swt 4.18.5.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "glimmer-dsl-swt".freeze
9
- s.version = "4.18.4.11"
9
+ s.version = "4.18.5.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["AndyMaleh".freeze]
14
- s.date = "2021-02-19"
14
+ s.date = "2021-02-22"
15
15
  s.description = "Glimmer DSL for SWT (JRuby Desktop Development GUI Framework) is a native-GUI cross-platform desktop development library written in JRuby, an OS-threaded faster JVM version of Ruby. Glimmer's main innovation is a declarative Ruby DSL that enables productive and efficient authoring of desktop application user-interfaces by relying on the robust Eclipse SWT library. Glimmer additionally innovates by having built-in 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, or alternatively drive development GUI-first, and then write clean business models (test-first) afterwards. Not only does Glimmer provide a large set of GUI widgets, but it also supports drawing Canvas Graphics like Shapes and Animations. To get started quickly, Glimmer offers scaffolding options for Apps, Gems, and Custom Widgets. Glimmer also includes native-executable packaging support, sorely lacking in other libraries, thus enabling the delivery of desktop apps written in Ruby as truly native DMG/PKG/APP files on the Mac + App Store, MSI/EXE files on Windows, and Gem Packaged Shell Scripts on Linux.".freeze
16
16
  s.email = "andy.am@gmail.com".freeze
17
17
  s.executables = ["glimmer".freeze, "girb".freeze]
@@ -58,6 +58,7 @@ Gem::Specification.new do |s|
58
58
  "lib/glimmer/data_binding/widget_binding.rb",
59
59
  "lib/glimmer/dsl/swt/animation_expression.rb",
60
60
  "lib/glimmer/dsl/swt/async_exec_expression.rb",
61
+ "lib/glimmer/dsl/swt/auto_exec_expression.rb",
61
62
  "lib/glimmer/dsl/swt/bind_expression.rb",
62
63
  "lib/glimmer/dsl/swt/block_property_expression.rb",
63
64
  "lib/glimmer/dsl/swt/checkbox_group_selection_data_binding_expression.rb",
@@ -115,6 +116,16 @@ Gem::Specification.new do |s|
115
116
  "lib/glimmer/swt/custom/drawable.rb",
116
117
  "lib/glimmer/swt/custom/radio_group.rb",
117
118
  "lib/glimmer/swt/custom/shape.rb",
119
+ "lib/glimmer/swt/custom/shape/arc.rb",
120
+ "lib/glimmer/swt/custom/shape/focus.rb",
121
+ "lib/glimmer/swt/custom/shape/image.rb",
122
+ "lib/glimmer/swt/custom/shape/line.rb",
123
+ "lib/glimmer/swt/custom/shape/oval.rb",
124
+ "lib/glimmer/swt/custom/shape/point.rb",
125
+ "lib/glimmer/swt/custom/shape/polygon.rb",
126
+ "lib/glimmer/swt/custom/shape/polyline.rb",
127
+ "lib/glimmer/swt/custom/shape/rectangle.rb",
128
+ "lib/glimmer/swt/custom/shape/text.rb",
118
129
  "lib/glimmer/swt/date_time_proxy.rb",
119
130
  "lib/glimmer/swt/directory_dialog_proxy.rb",
120
131
  "lib/glimmer/swt/display_proxy.rb",
@@ -142,6 +153,7 @@ Gem::Specification.new do |s|
142
153
  "lib/glimmer/swt/tree_proxy.rb",
143
154
  "lib/glimmer/swt/widget_listener_proxy.rb",
144
155
  "lib/glimmer/swt/widget_proxy.rb",
156
+ "lib/glimmer/ui.rb",
145
157
  "lib/glimmer/ui/custom_shell.rb",
146
158
  "lib/glimmer/ui/custom_widget.rb",
147
159
  "lib/glimmer/util/proc_tracker.rb",
@@ -202,6 +214,7 @@ Gem::Specification.new do |s|
202
214
  "samples/hello/hello_tab.rb",
203
215
  "samples/hello/hello_table.rb",
204
216
  "samples/hello/hello_table/baseball_park.png",
217
+ "samples/hello/hello_tree.rb",
205
218
  "samples/hello/hello_world.rb",
206
219
  "vendor/swt/linux/swt.jar",
207
220
  "vendor/swt/mac/swt.jar",
@@ -217,12 +230,11 @@ Gem::Specification.new do |s|
217
230
  s.specification_version = 4
218
231
 
219
232
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
220
- s.add_runtime_dependency(%q<glimmer>.freeze, ["~> 1.1.1"])
233
+ s.add_runtime_dependency(%q<glimmer>.freeze, ["~> 1.1.2"])
221
234
  s.add_runtime_dependency(%q<super_module>.freeze, [">= 1.4.1", "< 2.0.0"])
222
235
  s.add_runtime_dependency(%q<nested_inherited_jruby_include_package>.freeze, [">= 0.3.0", "< 2.0.0"])
223
236
  s.add_runtime_dependency(%q<puts_debuggerer>.freeze, [">= 0.11.0", "< 2.0.0"])
224
237
  s.add_runtime_dependency(%q<rake-tui>.freeze, [">= 0.2.3", "< 2.0.0"])
225
- s.add_runtime_dependency(%q<git>.freeze, ["= 1.8.1"])
226
238
  s.add_runtime_dependency(%q<logging>.freeze, [">= 2.3.0", "< 3.0.0"])
227
239
  s.add_runtime_dependency(%q<os>.freeze, [">= 1.0.0", "< 2.0.0"])
228
240
  s.add_runtime_dependency(%q<rake>.freeze, [">= 10.1.0", "< 14.0.0"])
@@ -236,12 +248,11 @@ Gem::Specification.new do |s|
236
248
  s.add_development_dependency(%q<simplecov>.freeze, ["~> 0.16.1"])
237
249
  s.add_development_dependency(%q<simplecov-lcov>.freeze, ["~> 0.7.0"])
238
250
  else
239
- s.add_dependency(%q<glimmer>.freeze, ["~> 1.1.1"])
251
+ s.add_dependency(%q<glimmer>.freeze, ["~> 1.1.2"])
240
252
  s.add_dependency(%q<super_module>.freeze, [">= 1.4.1", "< 2.0.0"])
241
253
  s.add_dependency(%q<nested_inherited_jruby_include_package>.freeze, [">= 0.3.0", "< 2.0.0"])
242
254
  s.add_dependency(%q<puts_debuggerer>.freeze, [">= 0.11.0", "< 2.0.0"])
243
255
  s.add_dependency(%q<rake-tui>.freeze, [">= 0.2.3", "< 2.0.0"])
244
- s.add_dependency(%q<git>.freeze, ["= 1.8.1"])
245
256
  s.add_dependency(%q<logging>.freeze, [">= 2.3.0", "< 3.0.0"])
246
257
  s.add_dependency(%q<os>.freeze, [">= 1.0.0", "< 2.0.0"])
247
258
  s.add_dependency(%q<rake>.freeze, [">= 10.1.0", "< 14.0.0"])
@@ -256,12 +267,11 @@ Gem::Specification.new do |s|
256
267
  s.add_dependency(%q<simplecov-lcov>.freeze, ["~> 0.7.0"])
257
268
  end
258
269
  else
259
- s.add_dependency(%q<glimmer>.freeze, ["~> 1.1.1"])
270
+ s.add_dependency(%q<glimmer>.freeze, ["~> 1.1.2"])
260
271
  s.add_dependency(%q<super_module>.freeze, [">= 1.4.1", "< 2.0.0"])
261
272
  s.add_dependency(%q<nested_inherited_jruby_include_package>.freeze, [">= 0.3.0", "< 2.0.0"])
262
273
  s.add_dependency(%q<puts_debuggerer>.freeze, [">= 0.11.0", "< 2.0.0"])
263
274
  s.add_dependency(%q<rake-tui>.freeze, [">= 0.2.3", "< 2.0.0"])
264
- s.add_dependency(%q<git>.freeze, ["= 1.8.1"])
265
275
  s.add_dependency(%q<logging>.freeze, [">= 2.3.0", "< 3.0.0"])
266
276
  s.add_dependency(%q<os>.freeze, [">= 1.0.0", "< 2.0.0"])
267
277
  s.add_dependency(%q<rake>.freeze, [">= 10.1.0", "< 14.0.0"])