glimmer-dsl-swt 4.21.2.0 → 4.21.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: 06baa33f2bcb64eee399561cbc5b92ea160d677462b690d36746816385d5c81a
4
- data.tar.gz: de77d266007ed06d74ff5f28374167561f6989620d3293ab0597bc006b7e1af3
3
+ metadata.gz: 4d596fb2ca88959177c7939be48e94a9b033fc014968b6bf4e796d5232ff86ae
4
+ data.tar.gz: 1b23f174e063d63213f596559a4aee0acda45004238a85dd7715d72a3e5b42eb
5
5
  SHA512:
6
- metadata.gz: 4a16bdc52e1fa03b29f602b163e170d00acddd9858a438dbedff4d60895521f3b9597b5bca920a2bc8b657854772ee79c367b95e2433545c954975ab3fb81f17
7
- data.tar.gz: 3a414799220cf1257a5c8c5af278e924a547a54ba17c6c201dfde25dcdf3f91f522ee42326e35ce3b34e00a1b039d2e9604aa400dda1457f1ddcea65d3cd922b
6
+ metadata.gz: f4579fd24daa2af0b69581b3f474e68b2470033c24f7a34767f2de5acd3454c85ad327cc430dea68e5a17111c052db54eee6a3722a0b348be86cf72d21c7c4b9
7
+ data.tar.gz: 6820f52be1d3b0ea75746a238b17c1cf47f9c619e9552afe3254aff08f1624164658e9845ad26a280f2dd6d4ab050bc3fb885b1339ffb33ef8c282debe261a02
data/CHANGELOG.md CHANGED
@@ -1,8 +1,28 @@
1
1
  # Change Log
2
2
 
3
+ ### 4.21.2.4
4
+
5
+ - Update gem `post_install_message` to clearly indicate that `-J-XstartOnFirstThread` jruby option is needed on the Mac and is handled automatically with global configuration after running `glimmer-setup`.
6
+
7
+ ### 4.21.2.3
8
+
9
+ - Upgrade to glimmer 2.5.1 to fix an issue with mistakenly referencing `OpenStruct` without `'ostruct'` being loaded
10
+
11
+ ### 4.21.2.2
12
+
13
+ - Demo file drag and drop in Hello, Drag and Drop!
14
+ - Make shapes added inside a widget with `:default` or `:max` dimensions auto-resize as the widget resizes
15
+ - Upgrade to glimmer 2.5.0
16
+
17
+ ### 4.21.2.1
18
+
19
+ - Update Hello, Drag and Drop! to include `list`, `label`, `text`, and `spinner` examples
20
+ - Add manual and fully customizable drag and drop syntax alternatives to Hello, Drag and Drop!
21
+ - Support simpler drag and drop syntax (`drag_source true`/`drop_target true`) for simple cases concerning `list`, `label`, `text`, and `spinner`
22
+
3
23
  ### 4.21.2.0
4
24
 
5
- - Support Linux packaging into deb/rpm native executables (not just gems) through standard `glimmer package` call (e.g. `glimmer package[deb]` or `glimmer package[rpm]`)
25
+ - Support Linux packaging of deb/rpm native executable installers (not just gems) through standard `glimmer package` call (e.g. `glimmer package[deb]` or `glimmer package[rpm]`)
6
26
  - Update `Glimmer::SWT::ImageProxy` implementation of image loading from JAR to use `JRuby.runtime.jruby_class_loader.get_resource_as_stream(file_path).to_io.to_input_stream`
7
27
  - Remove scaffolding/packaging building/using of a generated Java `Resource` class
8
28
  - Force installing `gem 'psych', '3.3.2'` in scaffolded app as a temporary workaround to `psych` issues with the latest jruby (jruby-9.3.1.0)
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.21.2.0
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.21.2.4
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)
@@ -15,19 +15,19 @@
15
15
  [<img src="https://covers.oreillystatic.com/images/9780596519650/lrg.jpg" width=105 /><br />
16
16
  Featured in JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do) and [Chalmers/Gothenburg University Software Engineering Master's Lecture Material](http://www.cse.chalmers.se/~bergert/slides/guest_lecture_DSLs.pdf)
17
17
 
18
- [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.21.2.0 includes [SWT 4.21](https://download.eclipse.org/eclipse/downloads/drops4/R-4.21-202109060500/), which was released on September 6, 2021. 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. Note that SWT now supports AARCH64 on Mac and Linux, but it is not fully tested in Glimmer DSL for SWT yet, so deem its support experimental for the time being without guarantees for functionality until declared otherwise (please report any issues you may encounter).
18
+ [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.21.2.4 includes [SWT 4.21](https://download.eclipse.org/eclipse/downloads/drops4/R-4.21-202109060500/), which was released on September 6, 2021. 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. Note that SWT now supports AARCH64 on Mac and Linux, but it is not fully tested in Glimmer DSL for SWT yet, so deem its support experimental for the time being without guarantees for functionality until declared otherwise (please report any issues you may encounter).
19
19
 
20
20
  **Starting in version 4.20.0.0, [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) comes with the new [***Shine***](/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#shine) syntax** for highly intuitive and visually expressive View/Model Attribute Mapping, relying on `<=>` for bidirectional (two-way) data-binding and `<=` for unidirectional (one-way) data-binding, providing an alternative to the `bind` keyword (keep in mind that it is still a beta, so default back to `bind` whenever needed).
21
21
 
22
22
  Please help make [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) better by providing feedback and [contributing](#contributing) whenever possible. Any feature suggestions that are accepted could be implemented within weeks if not days.
23
23
 
24
- Glimmer DSL gems:
25
- - [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
24
+ Other [Glimmer](https://rubygems.org/gems/glimmer) DSL gems you might be interested in:
26
25
  - [glimmer-dsl-opal](https://github.com/AndyObtiva/glimmer-dsl-opal): Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps)
27
- - [glimmer-dsl-xml](https://github.com/AndyObtiva/glimmer-dsl-xml): Glimmer DSL for XML (& HTML)
28
- - [glimmer-dsl-css](https://github.com/AndyObtiva/glimmer-dsl-css): Glimmer DSL for CSS
29
26
  - [glimmer-dsl-tk](https://github.com/AndyObtiva/glimmer-dsl-tk): Glimmer DSL for Tk (MRI Ruby Desktop Development GUI Library)
30
27
  - [glimmer-dsl-libui](https://github.com/AndyObtiva/glimmer-dsl-libui): Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development GUI Library)
28
+ - [glimmer-dsl-gtk](https://github.com/AndyObtiva/glimmer-dsl-gtk): Glimmer DSL for GTK (Ruby-GNOME Desktop Development GUI Library)
29
+ - [glimmer-dsl-xml](https://github.com/AndyObtiva/glimmer-dsl-xml): Glimmer DSL for XML (& HTML)
30
+ - [glimmer-dsl-css](https://github.com/AndyObtiva/glimmer-dsl-css): Glimmer DSL for CSS
31
31
 
32
32
  ## Examples
33
33
 
@@ -292,7 +292,7 @@ https://www.eclipse.org/swt/faq.php
292
292
 
293
293
  - JDK 16 (16.0.2) (find at https://www.oracle.com/java/technologies/javase/jdk16-archive-downloads.html / Ensure PATH includes Java bin directory for `jpackage` command to work when packaging Glimmer applications)
294
294
  - [RVM](http://rvm.io) on Mac & Linux (not available on Windows)
295
- - JRuby 9.3.0.0 (supporting Ruby 2.6.x syntax) (get via [RVM](http://rvm.io) on Mac and Linux by running `rvm install jruby-9.3.0.0`; On Windows, find at [https://www.jruby.org/download](https://www.jruby.org/download) [you might have to dual-install JDK8 temporarily as it might be required by jruby installer and then switch JAVA_HOME to JDK16 once done installing and restart command prompt/git bash])
295
+ - JRuby 9.3.1.0 (supporting Ruby 2.6.x syntax) (get via [RVM](http://rvm.io) on Mac and Linux by running `rvm install jruby-9.3.1.0`; On Windows, find at [https://www.jruby.org/download](https://www.jruby.org/download))
296
296
  - SWT 4.21 (already included in the [glimmer-dsl-swt](https://rubygems.org/gems/glimmer-dsl-swt) gem). Note that SWT now supports AARCH64 on Mac and Linux, but it is not fully tested with Glimmer DSL for SWT yet, so it is considered experimental until declared otherwise.
297
297
  - Git (comes with Mac and Linux. Install on Windows: https://git-scm.com/download/win )
298
298
 
@@ -322,7 +322,7 @@ jgem install glimmer-dsl-swt
322
322
 
323
323
  Or this command if you want a specific version:
324
324
  ```
325
- jgem install glimmer-dsl-swt -v 4.21.2.0
325
+ jgem install glimmer-dsl-swt -v 4.21.2.4
326
326
  ```
327
327
 
328
328
  `jgem` is JRuby's version of `gem` command.
@@ -350,7 +350,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
350
350
 
351
351
  Add the following to `Gemfile`:
352
352
  ```
353
- gem 'glimmer-dsl-swt', '~> 4.21.2.0'
353
+ gem 'glimmer-dsl-swt', '~> 4.21.2.4'
354
354
  ```
355
355
 
356
356
  And, then run:
@@ -371,7 +371,7 @@ glimmer
371
371
  ```
372
372
 
373
373
  ```
374
- Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.21.2.0
374
+ Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.21.2.4
375
375
 
376
376
  Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
377
377
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.21.2.0
1
+ 4.21.2.4
@@ -1509,7 +1509,7 @@ https://help.eclipse.org/2019-12/nftopic/org.eclipse.platform.doc.isv/reference/
1509
1509
 
1510
1510
  ### Canvas Shape DSL
1511
1511
 
1512
- **(ALPHA FEATURE)**
1512
+ **(BETA FEATURE)**
1513
1513
 
1514
1514
  While other GUI toolkits only offer a way to draw graphics imperatively (e.g. fill_rectangle, draw_point, etc...), Glimmer DSL for SWT breaks away from the mold by enabling software engineers to draw graphics declaratively. Simply declare all the shapes you want to see with their attributes, like background/foreground colors, and Glimmer DSL for SWT takes care of the rest, painting graphics on a blank `canvas` widget or amending/decorating an existing widget. This is accomplished through the Canvas Shape DSL, a sub-DSL of the Glimmer GUI DSL, which makes it possible to draw graphics declaratively with very understandable and maintainable syntax. Still, for the rare cases where imperative logic is needed, Glimmer DSL for SWT supports imperative painting of graphics through direct usage of SWT.
1515
1515
 
@@ -1600,7 +1600,7 @@ Screenshot:
1600
1600
 
1601
1601
  If you specify the x and y coordinates as `:default`, `nil`, or leave them out, they get calculated automatically by centering the shape within its parent `canvas`.
1602
1602
 
1603
- If you specify the `width` and `height` parameters as `:max`, they get calculated from the parent's size, filling the parent maximally.
1603
+ If you specify the `width` and `height` parameters as `:max`, they get calculated from the parent's size, filling the parent maximally (and they are auto-calculated on parent resize).
1604
1604
 
1605
1605
  Note that you could shift a shape off its centered position within its parent `canvas` by setting `x` to `[:default, x_delta]` and `y` to `[:default, y_delta]`
1606
1606
 
@@ -1759,11 +1759,11 @@ Shapes can be nested within each other. If you nest a shape within another, its
1759
1759
 
1760
1760
  As such, if you move the parent, it moves all its children with it.
1761
1761
 
1762
- If you specify the `x` and `y` coordinates as `:default`, `nil`, or leave them out, they get calculated automatically by centering the shape within its parent shape relatively.
1762
+ If you specify the `x` and `y` coordinates as `:default`, `nil`, or leave them out, they get calculated automatically by centering the shape within its parent shape relatively (and auto-recalculated on parent resize).
1763
1763
 
1764
1764
  If you specify the `width` and `height` parameters as `:default`, `nil`, or leave them out, they get calculated automatically from the shape's nested children shapes if any (e.g calculating the dimensions of a text from its extent according to its font size) or from the parent's size otherwise.
1765
1765
 
1766
- If you specify the `width` and `height` parameters as `:max`, they get calculated from the parent's size, filling the parent maximally.
1766
+ If you specify the `width` and `height` parameters as `:max`, they get calculated from the parent's size, filling the parent maximally (and auto-recalculated on parent resize).
1767
1767
 
1768
1768
  Note that you could shift a shape off its centered position within its parent shape by setting `x` to `[:default, x_delta]` and `y` to `[:default, y_delta]`
1769
1769
 
@@ -1944,7 +1944,7 @@ Check [Hello, Canvas!](GLIMMER_SAMPLES.md#hello-canvas) for an example.
1944
1944
 
1945
1945
  #### Pixel Graphics
1946
1946
 
1947
- **(Early Alpha Feature)**
1947
+ **(BETA FEATURE)**
1948
1948
 
1949
1949
  If you need to paint pixel graphics, use the optimized `pixel` keyword alternative to `point`, which takes foreground as a hash argument and bypasses the [Glimmer DSL Engine chain of responsibility](https://github.com/AndyObtiva/glimmer#dsl-engine), thus rendering faster when having very large pixel counts.
1950
1950
 
@@ -2126,7 +2126,7 @@ As they say, there are many ways to skin a cat! This is in line with the Ruby wa
2126
2126
 
2127
2127
  ### Canvas Path DSL
2128
2128
 
2129
- **(ALPHA FEATURE)**
2129
+ **(BETA FEATURE)**
2130
2130
 
2131
2131
  Unlike common imperative GUI graphing toolkits, Glimmer enables declarative rendering of paths with the new Canvas Path DSL (Early Alpha) via the new `path { }` keyword and by nesting one of the following path segment keywords underneath:
2132
2132
  - `point(x1, y1)`: renders a Point (Dot) as part of a path.
@@ -2172,7 +2172,7 @@ Every path segment object (mixing in [`Glimmer::SWT::Custom::PathSegment`](/lib/
2172
2172
 
2173
2173
  ### Canvas Transform DSL
2174
2174
 
2175
- **(ALPHA FEATURE)**
2175
+ **(BETA FEATURE)**
2176
2176
 
2177
2177
  The transform DSL builds [org.eclipse.swt.graphics.Transform](https://help.eclipse.org/2020-12/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/graphics/Transform.html) objects with a nice declarative syntax.
2178
2178
 
@@ -2256,7 +2256,7 @@ Learn more at the [Hello, Canvas Transform! Sample](GLIMMER_SAMPLES.md#hello-can
2256
2256
 
2257
2257
  ### Canvas Animation DSL
2258
2258
 
2259
- **(EXPERIMENTAL EARLY ALPHA FEATURE)**
2259
+ **(ALPHA FEATURE)**
2260
2260
 
2261
2261
  (note: this is a very new feature of Glimmer. It may change a bit while getting battle tested. As always, you could default to basic SWT usage if needed.)
2262
2262
 
@@ -2352,14 +2352,10 @@ This example adds on the one above it by specifying converters on read and write
2352
2352
 
2353
2353
  `text bind(contact, 'address.street', sync_exec: true)`
2354
2354
 
2355
- **(BETA FEATURE)**
2356
-
2357
2355
  This example forces GUI updates via [sync_exec](#sync_exec) assuming they are coming from another thread (different from the GUI thread)
2358
2356
 
2359
2357
  `text bind(contact, 'address.street', async_exec: true)`
2360
2358
 
2361
- **(BETA FEATURE)**
2362
-
2363
2359
  This example forces GUI updates via [async_exec](#async_exec) assuming they are coming from another thread (different from the GUI thread)
2364
2360
 
2365
2361
  `text bind(contact, 'address.street', on_read: lambda { |s| s[0..10] })`
@@ -3306,8 +3302,6 @@ Keep in mind that if the text grows and required a wider line numbers area, it g
3306
3302
  **theme**
3307
3303
  (default: `'glimmer'`)
3308
3304
 
3309
- **(BETA FEATURE)**
3310
-
3311
3305
  Changes syntax color highlighting theme. Can be one of the following:
3312
3306
  - glimmer
3313
3307
  - github
@@ -3316,8 +3310,6 @@ Changes syntax color highlighting theme. Can be one of the following:
3316
3310
  **language**
3317
3311
  (default: `'ruby'`)
3318
3312
 
3319
- **(BETA FEATURE)**
3320
-
3321
3313
  Sets the code language, which can be one of the following [rouge gem](#https://rubygems.org/gems/rouge) supported languages:
3322
3314
  - abap
3323
3315
  - actionscript
@@ -3627,15 +3619,27 @@ You may check out [Hello, Custom Shell!](GLIMMER_SAMPLES.md#hello-custom-shell)
3627
3619
 
3628
3620
  ### Drag and Drop
3629
3621
 
3630
- Glimmer s Drag and Drop support, thanks to [SWT](https://www.eclipse.org/swt/) and Glimmer's lightweight [DSL syntax](#glimmer-dsl-syntax).
3622
+ As a first option, Glimmer's Drag and Drop support requires no more than adding `drag_source true` and `drop_target true` for the most basic case concerning `list`, `label`, `text`, and `spinner`, thanks to [SWT](https://www.eclipse.org/swt/) and Glimmer's lightweight [DSL syntax](#glimmer-dsl-syntax).
3623
+
3624
+ Example:
3631
3625
 
3632
- You may learn more about SWT Drag and Drop support over here: [https://www.eclipse.org/articles/Article-SWT-DND/DND-in-SWT.html](https://www.eclipse.org/articles/Article-SWT-DND/DND-in-SWT.html)
3626
+ ```ruby
3627
+ label {
3628
+ text 'Text To Drag and Drop'
3629
+ drag_source true
3630
+ }
3633
3631
 
3634
- To get started, simply follow these steps:
3632
+ label {
3633
+ text 'Text To Replace'
3634
+ drop_target true
3635
+ }
3636
+ ```
3637
+
3638
+ As a second option, you may customize the data being transferred through drag and drop:
3635
3639
  1. On the drag source widget, add `on_drag_set_data` [DragSourceListener](https://help.eclipse.org/2020-03/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/dnd/DragSourceListener.html) event handler block at minimum (you may also add `on_drag_start` and `on_drag_finished` if needed)
3636
- 1. Set `event.data` to transfer via drag and drop inside the `on_drag_set_data` event handler block (defaults to `transfer` type of `:text`, as in a Ruby String)
3637
- 1. On the drop target widget, add `on_drop` [DropTargetListener](https://help.eclipse.org/2020-03/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/dnd/DropTargetListener.html) event handler block at minimum (you may also add `on_drag_enter` [must set [`event.detail`](https://help.eclipse.org/2020-06/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/dnd/DropTargetEvent.html#detail) if added], `on_drag_over`, `on_drag_leave`, `on_drag_operation_changed` and `on_drop_accept` if needed)
3638
- 1. Read `event.data` and consume it (e.g. change widget text) inside the `on_drop` event handler block.
3640
+ 2. Set `event.data` to transfer via drag and drop inside the `on_drag_set_data` event handler block (defaults to `transfer` type of `:text`, as in a Ruby String)
3641
+ 3. On the drop target widget, add `on_drop` [DropTargetListener](https://help.eclipse.org/2020-03/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/dnd/DropTargetListener.html) event handler block at minimum (you may also add `on_drag_enter` [must set [`event.detail`](https://help.eclipse.org/2020-06/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/dnd/DropTargetEvent.html#detail) if added], `on_drag_over`, `on_drag_leave`, `on_drag_operation_changed` and `on_drop_accept` if needed)
3642
+ 4. Read `event.data` and consume it (e.g. change widget text) inside the `on_drop` event handler block.
3639
3643
 
3640
3644
  Example (taken from [samples/hello/hello_drag_and_drop.rb](GLIMMER_SAMPLES.md#hello-drag-and-drop) / you may copy/paste in [`girb`](GLIMMER_GIRB.md)):
3641
3645
 
@@ -3654,18 +3658,22 @@ include Glimmer
3654
3658
 
3655
3659
  shell {
3656
3660
  text 'Hello, Drag and Drop!'
3661
+
3657
3662
  list {
3658
3663
  selection bind(@location, :country)
3664
+
3659
3665
  on_drag_set_data do |event|
3660
- list = event.widget.getControl
3661
- event.data = list.getSelection.first
3666
+ list = event.widget.control
3667
+ event.data = list.selection.first
3662
3668
  end
3663
3669
  }
3670
+
3664
3671
  label(:center) {
3665
3672
  text 'Drag a country here!'
3666
3673
  font height: 20
3674
+
3667
3675
  on_drop do |event|
3668
- event.widget.getControl.setText(event.data)
3676
+ event.widget.control.text = event.data
3669
3677
  end
3670
3678
  }
3671
3679
  }.open
@@ -3673,7 +3681,7 @@ shell {
3673
3681
 
3674
3682
  ![Hello Drag and Drop](/images/glimmer-hello-drag-and-drop.gif)
3675
3683
 
3676
- Optional steps:
3684
+ As a third most advanced option, you may:
3677
3685
  - Set a `transfer` property (defaults to `:text`). Values may be: :text (default), :html :image, :rtf, :url, and :file, or an array of multiple values. The `transfer` property will automatically convert your option into a [Transfer](https://help.eclipse.org/2020-03/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/dnd/Transfer.html) object as per the SWT API.
3678
3686
  - Specify `drag_source_style` operation (may be: :drop_copy (default), :drop_link, :drop_move, :drop_none, or an array of multiple operations)
3679
3687
  - Specify `drag_source_effect` (Check [DragSourceEffect](https://help.eclipse.org/2020-06/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/dnd/DragSourceEffect.html) SWT API for details)
@@ -3681,6 +3689,8 @@ Optional steps:
3681
3689
  - Specify `drop_target_effect` (Check [DropTargetEffect](https://help.eclipse.org/2020-06/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/dnd/DropTargetEffect.html) SWT API for details)
3682
3690
  - Set drag operation in `event.detail` (e.g. DND::DROP_COPY) inside `on_drag_enter`
3683
3691
 
3692
+ You may learn more about advanced SWT Drag and Drop cases over here: [https://www.eclipse.org/articles/Article-SWT-DND/DND-in-SWT.html](https://www.eclipse.org/articles/Article-SWT-DND/DND-in-SWT.html)
3693
+
3684
3694
  ### Miscellaneous
3685
3695
 
3686
3696
  #### Multi-DSL Support
@@ -14,6 +14,8 @@ You may choose to generate a specific type of packaging instead by addionally pa
14
14
  glimmer package[msi]
15
15
  ```
16
16
 
17
+ ![glimmer packaging windows msi](/images/glimmer-packaging-windows-msi.png)
18
+
17
19
  This command generates a DMG file on the Mac:
18
20
 
19
21
  ```
@@ -26,12 +28,26 @@ Make sure to surround with double-quotes when running from ZShell (zsh):
26
28
  glimmer "package[dmg]"
27
29
  ```
28
30
 
31
+ ![glimmer packaging mac dmg license screen](/images/glimmer-packaging-mac-dmg-license-screen.png)
32
+
33
+ ![glimmer packaging mac dmg](/images/glimmer-packaging-mac-dmg.png)
34
+
29
35
  This command generates a DEB file on a Linux that supports deb packages (e.g. Linux Mint Cinnamon):
30
36
 
31
37
  ```
32
38
  glimmer package[deb]
33
39
  ```
34
40
 
41
+ ![glimmer packaging linux deb](/images/glimmer-packaging-linux-deb.png)
42
+
43
+ This command generates an RPM file on a Linux that supports rpm packages (e.g. Red Hat Enterprise Linux):
44
+
45
+ ```
46
+ glimmer package[rpm]
47
+ ```
48
+
49
+ ![glimmer packaging linux rpm](/images/glimmer-packaging-linux-rpm.png)
50
+
35
51
  - Available Mac packaging types are `dmg`, `pkg`, and `app-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.
36
52
  - Available Windows packaging types are `msi`, `exe`, and `app-image` (image means a Windows application directory without a setup program). Learn more about Windows packaging are [over here](#windows-application-packaging).
37
53
  - Available Linux packaging types are `deb`, `rpm`, and `app-image` (note the prerequisites: for Red Hat Linux, the `rpm-build` package is required (for rpm) and for Ubuntu Linux, the `fakeroot` package is required (for deb). Also, use common sense to know which package type to generate on what Linux [e.g. use `deb` on `Linux Mint Cinnamon` or use `rpm` on `Fedora Linux`]).
@@ -133,7 +149,7 @@ If you just want to test out packaging into a native Windows app that is not pac
133
149
 
134
150
  ### Mac Application Distribution
135
151
 
136
- 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.
152
+ 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 -> Security & 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.
137
153
 
138
154
  Afterwards, you may add signing arguments to `jpackage` via `Glimmer::RakeTask::Package.jpackage_extra_args` or `JPACKAGE_EXTRA_ARGS` according to this webpage: https://docs.oracle.com/en/java/javase/16/jpackage/packaging-tool-user-guide.pdf
139
155
 
@@ -230,3 +246,12 @@ file_input_stream = resource.to_io.to_input_stream
230
246
 
231
247
  The `image` keyword in Glimmer automatically does that work when passing an image path produced from inside a JAR file.
232
248
 
249
+ 6. NAME.app is damaged and can't be opened. You should move it to the trash
250
+
251
+ If you package an app for the Mac and an end-user gets the error message above upon installing, note that you probably have a system incompatibility issue between your OS/CPU Architecture and the end-user's OS/CPU Architecture. To resolve the issue, make sure to repackage the app for the Mac on a system perfectly matching the end-user's OS/CPU Architecture (sometimes, packaging on a newer MacOS with the same CPU Architecture also works, but you would have to test that to confirm and ensure full compatibility).
252
+
253
+ 7. Message about a Mac app for which the developer cannot be verified (Move To Trash or Cancel)
254
+
255
+ If you get the above message when running a packaged Mac app for the first time, choose cancel and then immediately go to System Preferences -> Security & Privacy -> General Tab -> Choose Open Anyway at the bottom where the app name should be showing.
256
+
257
+ This would not be an issue if the app was [signed by Apple as per Mac Application Distribution instructions](#mac-application-distribution)
Binary file
@@ -33,7 +33,7 @@ module Glimmer
33
33
  # of a ModelBinding, which is then connected to an anonymous widget observer
34
34
  # (aka widget_data_binder as per widget_data_binders array)
35
35
  #
36
- # Depends on BindCommandHandler
36
+ # Depends on BindExpression
37
37
  class DataBindingExpression < Expression
38
38
  def can_interpret?(parent, keyword, *args, &block)
39
39
  args.size == 1 and
@@ -110,6 +110,7 @@ module Glimmer
110
110
 
111
111
  def deregister_shape_painting
112
112
  @paint_listener_proxy&.deregister
113
+ @resize_listener_proxy&.deregister
113
114
  end
114
115
 
115
116
  def setup_shape_painting
@@ -143,6 +144,7 @@ module Glimmer
143
144
  shape_painter.call(self) # treat self as paint event since image has its own gc and doesn't do repaints (it's a one time deal for now though could be adjusted in the future.)
144
145
  else
145
146
  @paint_listener_proxy = on_swt_paint(&shape_painter)
147
+ @resize_listener_proxy = on_swt_Resize { shapes.each(&:calculated_args_changed!) }
146
148
  end
147
149
  else
148
150
  redraw if respond_to?(:redraw) && @finished_add_content && !is_disposed
@@ -151,6 +151,8 @@ module Glimmer
151
151
  def include?(swt_constant, *symbols)
152
152
  swt_constant & self[symbols] == self[symbols]
153
153
  end
154
+
155
+ # TODO support listing all symbols
154
156
  end
155
157
  end
156
158
  end
@@ -743,6 +743,13 @@ module Glimmer
743
743
 
744
744
  def handle_observation_request(observation_request, &block)
745
745
  observation_request = normalize_observation_request(observation_request)
746
+ if observation_request.start_with?('on_drag_enter')
747
+ original_block = block
748
+ block = Proc.new do |event|
749
+ event.detail = DNDProxy[:drop_copy]
750
+ original_block.call(event)
751
+ end
752
+ end
746
753
  if observation_request.start_with?('on_swt_')
747
754
  constant_name = observation_request.sub(/^on_swt_/, '')
748
755
  add_swt_event_listener(constant_name, &block)
@@ -886,6 +893,75 @@ module Glimmer
886
893
  def widget_custom_attribute_mapping
887
894
  # TODO scope per widget class type just like other mappings
888
895
  @swt_widget_custom_attribute_mapping ||= {
896
+ 'drag_source' => {
897
+ getter: {name: 'getShell', invoker: lambda { |widget, args|
898
+ @drag_source
899
+ }},
900
+ setter: {name: 'getShell', invoker: lambda { |widget, args|
901
+ @drag_source = args.first
902
+ if @drag_source
903
+ case @swt_widget
904
+ when List
905
+ on_drag_set_data do |event|
906
+ drag_widget = event.widget.control
907
+ event.data = drag_widget.selection.first
908
+ end
909
+ when Label
910
+ on_drag_set_data do |event|
911
+ drag_widget = event.widget.control
912
+ event.data = drag_widget.text
913
+ end
914
+ when Text
915
+ on_drag_set_data do |event|
916
+ drag_widget = event.widget.control
917
+ event.data = drag_widget.selection_text
918
+ end
919
+ when Spinner
920
+ on_drag_set_data do |event|
921
+ drag_widget = event.widget.control
922
+ event.data = drag_widget.selection.to_s
923
+ end
924
+ end
925
+ end
926
+ }},
927
+ },
928
+ 'drop_target' => {
929
+ getter: {name: 'getShell', invoker: lambda { |widget, args|
930
+ @drop_target
931
+ }},
932
+ setter: {name: 'getShell', invoker: lambda { |widget, args|
933
+ @drop_target = args.first
934
+ if @drop_target
935
+ case @swt_widget
936
+ when List
937
+ on_drop do |event|
938
+ drop_widget = event.widget.control
939
+ drop_widget.add(event.data) unless @drop_target == :unique && drop_widget.items.include?(event.data)
940
+ drop_widget.select(drop_widget.items.count - 1)
941
+ end
942
+ when Label
943
+ on_drop do |event|
944
+ drop_widget = event.widget.control
945
+ drop_widget.text = event.data
946
+ end
947
+ when Text
948
+ on_drop do |event|
949
+ drop_widget = event.widget.control
950
+ if @drop_target == :replace
951
+ drop_widget.text = event.data
952
+ else
953
+ drop_widget.insert(event.data)
954
+ end
955
+ end
956
+ when Spinner
957
+ on_drop do |event|
958
+ drop_widget = event.widget.control
959
+ drop_widget.selection = event.data.to_f
960
+ end
961
+ end
962
+ end
963
+ }},
964
+ },
889
965
  'window' => {
890
966
  getter: {name: 'getShell'},
891
967
  setter: {name: 'getShell', invoker: lambda { |widget, args| @swt_widget.getShell }}, # No Op
@@ -35,18 +35,215 @@ include Glimmer
35
35
 
36
36
  shell {
37
37
  text 'Hello, Drag and Drop!'
38
- list {
39
- selection <=> [@location, :country]
40
- on_drag_set_data { |event|
41
- list = event.widget.getControl
42
- event.data = list.getSelection.first
38
+
39
+ tab_folder {
40
+ tab_item {
41
+ fill_layout
42
+ text 'List'
43
+
44
+ list {
45
+ selection <=> [@location, :country]
46
+
47
+ # Option 1: Automatic Drag Data Setting
48
+ drag_source true
49
+
50
+ # Option 2: Manual Drag Data Setting
51
+ # on_drag_set_data do |event|
52
+ # drag_widget = event.widget.control
53
+ # event.data = drag_widget.selection.first
54
+ # end
55
+
56
+ # Option 3: Full Customization of Drag Source (details at: https://www.eclipse.org/articles/Article-SWT-DND/DND-in-SWT.html)
57
+ # drag_source(:drop_copy) { # options: :drop_copy, :drop_link, :drop_move, :drop_target_move
58
+ # transfer :text # options: :text, :file, :rtf
59
+ #
60
+ # on_drag_start do |event|
61
+ # drag_widget = event.widget.control.data('proxy') # obtain Glimmer widget proxy since it permits nicer syntax for setting cursor via symbol
62
+ # drag_widget.cursor = :wait
63
+ # end
64
+ #
65
+ # on_drag_set_data do |event|
66
+ # drag_widget = event.widget.control
67
+ # event.data = drag_widget.selection.first
68
+ # end
69
+ #
70
+ # on_drag_finished do |event|
71
+ # drag_widget = event.widget.control.data('proxy') # obtain Glimmer widget proxy since it permits nicer syntax for setting cursor via symbol
72
+ # drag_widget.cursor = :arrow
73
+ # end
74
+ # }
75
+ }
76
+
77
+ list {
78
+ # Option 1: Automatic Drop Data Consumption
79
+ drop_target true
80
+ # drop_target :unique # setting drop_target to :unique makes the list not add the same data twice
81
+
82
+ # Option 2: Manual Drop Data Consumption
83
+ # on_drop do |event|
84
+ # drop_widget = event.widget.control
85
+ # drop_widget.add(event.data)
86
+ # drop_widget.select(drop_widget.items.count - 1)
87
+ # end
88
+
89
+ # Option 3: Full Customization of Drop Target (details at: https://www.eclipse.org/articles/Article-SWT-DND/DND-in-SWT.html)
90
+ # drop_target(:drop_copy) { # options: :drop_copy, :drop_link, :drop_move, :drop_target_move
91
+ # transfer :text # options: :text, :file, :rtf
92
+ #
93
+ # on_drag_enter do |event|
94
+ # ### event.detail = DND::DROP_NONE # To reject a drop, you can set event.detail to DND::DROP_NONE
95
+ # drop_widget = event.widget.control.data('proxy') # obtain Glimmer widget proxy since it permits nicer syntax for setting background via symbol
96
+ # drop_widget.background = :red
97
+ # end
98
+ #
99
+ # on_drag_leave do |event|
100
+ # drop_widget = event.widget.control.data('proxy') # obtain Glimmer widget proxy since it permits nicer syntax for setting background via symbol
101
+ # drop_widget.background = :white
102
+ # end
103
+ #
104
+ # on_drop do |event|
105
+ # drop_widget = event.widget.control.data('proxy') # obtain Glimmer widget proxy since it permits nicer syntax for setting background/cursor via symbol
106
+ # drop_widget.background = :white
107
+ # drop_widget.add(event.data)
108
+ # drop_widget.select(drop_widget.items.count - 1)
109
+ # drop_widget.cursor = :arrow
110
+ # end
111
+ # }
112
+ }
43
113
  }
44
- }
45
- label(:center) {
46
- text 'Drag a country here!'
47
- font height: 20
48
- on_drop { |event|
49
- event.widget.getControl.setText(event.data)
114
+
115
+ tab_item {
116
+ grid_layout 2, true
117
+ text 'Label'
118
+
119
+ label {
120
+ layout_data {
121
+ horizontal_span 2
122
+ }
123
+ text 'Drag text from any label and drop it unto another label'
124
+ }
125
+
126
+ {
127
+ Argentina: :green,
128
+ Brazil: :red,
129
+ Finland: :yellow,
130
+ Sweden: :magenta,
131
+ Denmark: :gray,
132
+ Iceland: :cyan
133
+ }.each do |country, color|
134
+ label {
135
+ layout_data :fill, :fill, true, true
136
+ text country
137
+ font height: 20
138
+ background color
139
+ drag_source true
140
+ drop_target true
141
+ }
142
+ end
143
+ }
144
+
145
+ tab_item {
146
+ grid_layout 2, true
147
+ text 'Text'
148
+
149
+ label {
150
+ text 'Drag'
151
+ }
152
+
153
+ label {
154
+ text 'Drop To Insert'
155
+ }
156
+
157
+ text {
158
+ layout_data :fill, :center, true, false
159
+ text 'Text1'
160
+ drag_source true
161
+ }
162
+
163
+ text {
164
+ layout_data :fill, :center, true, false
165
+ text 'Drop To Insert'
166
+ drop_target true
167
+ }
168
+
169
+ label {
170
+ text 'Drag'
171
+ }
172
+
173
+ label {
174
+ text 'Drop To Replace'
175
+ }
176
+
177
+ text {
178
+ layout_data :fill, :center, true, false
179
+ text 'Text2'
180
+ drag_source true
181
+ }
182
+
183
+ text {
184
+ layout_data :fill, :center, true, false
185
+ text 'Drop To Replace'
186
+ drop_target :replace
187
+ }
188
+ }
189
+
190
+ tab_item {
191
+ grid_layout 2, true
192
+ text 'Spinner'
193
+
194
+ label {
195
+ text 'Drag'
196
+ }
197
+
198
+ label {
199
+ text 'Drop To Replace'
200
+ }
201
+
202
+ spinner {
203
+ layout_data :fill, :center, true, false
204
+ selection 30
205
+ drag_source true
206
+ }
207
+
208
+ spinner {
209
+ layout_data :fill, :center, true, false
210
+ drop_target true
211
+ }
212
+ }
213
+ tab_item {
214
+ fill_layout
215
+ text 'File'
216
+
217
+ @drop_zone_label = label(:center, :wrap) {
218
+ text 'Drop One File Or More Here'
219
+ background :white
220
+
221
+ rectangle {
222
+ foreground :black
223
+ line_width 4
224
+ line_style :dash
225
+ }
226
+
227
+ drop_target(:drop_copy) {
228
+ transfer :file
229
+
230
+ on_drag_enter do |event|
231
+ drop_widget = event.widget.control.data('proxy') # obtain Glimmer widget proxy since it permits nicer syntax for setting background via symbol
232
+ drop_widget.background = :yellow
233
+ end
234
+
235
+ on_drag_leave do |event|
236
+ drop_widget = event.widget.control.data('proxy') # obtain Glimmer widget proxy since it permits nicer syntax for setting background via symbol
237
+ drop_widget.background = :white
238
+ end
239
+
240
+ on_drop do |event|
241
+ drop_widget = event.widget.control.data('proxy') # obtain Glimmer widget proxy since it permits nicer syntax for setting background/cursor via symbol
242
+ drop_widget.background = :white
243
+ @drop_zone_label.text = event.data.to_a.join("\n")
244
+ end
245
+ }
246
+ }
50
247
  }
51
248
  }
52
249
  }.open
metadata CHANGED
@@ -1,21 +1,21 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-swt
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.21.2.0
4
+ version: 4.21.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-01 00:00:00.000000000 Z
11
+ date: 2021-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: 2.4.0
18
+ version: 2.5.1
19
19
  name: glimmer
20
20
  prerelease: false
21
21
  type: :runtime
@@ -23,7 +23,7 @@ dependencies:
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.4.0
26
+ version: 2.5.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
@@ -709,7 +709,7 @@ post_install_message:
709
709
 
710
710
  You are ready to use `glimmer` and `girb` commands on Windows and Linux.
711
711
 
712
- On the Mac, run `glimmer-setup` command to complete setup of Glimmer DSL for SWT, making `glimmer` and `girb` commands ready for use:
712
+ On the Mac, run `glimmer-setup` command to complete setup of Glimmer DSL for SWT (it will configure a Mac required jruby option globally `-J-XstartOnFirstThread` so that you do not have to add manually), making `glimmer` and `girb` commands ready for use:
713
713
 
714
714
  glimmer-setup
715
715