glimmer-dsl-swt 4.21.2.0 → 4.21.2.1

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: 07f68ad917d0e734926d2f4064fdaa7c7982d3164cb1ca8e26b183b49da1d2ef
4
+ data.tar.gz: 859a163ecd57d0324135b8c29fced778c2f008a078af54c17d6497525ceda9dc
5
5
  SHA512:
6
- metadata.gz: 4a16bdc52e1fa03b29f602b163e170d00acddd9858a438dbedff4d60895521f3b9597b5bca920a2bc8b657854772ee79c367b95e2433545c954975ab3fb81f17
7
- data.tar.gz: 3a414799220cf1257a5c8c5af278e924a547a54ba17c6c201dfde25dcdf3f91f522ee42326e35ce3b34e00a1b039d2e9604aa400dda1457f1ddcea65d3cd922b
6
+ metadata.gz: d9ff675ec4fc1b36815a1198be7aebcc35bc73c16fecb329f8ebfb2e182f0c9dff279098299ae665ea9edfe3f53c387e8e9ca841193c2b309558f4d3fcfba13a
7
+ data.tar.gz: 93fbf2d0bed61c27cfe64163ed0a05e878ad588c93ca87522ace6b0e67c0e8c4cf559119cf0562ba4d9d864a93fcec18438f6035037dd37a9a6a5c19fab8989d
data/CHANGELOG.md CHANGED
@@ -1,8 +1,14 @@
1
1
  # Change Log
2
2
 
3
+ ### 4.21.2.1
4
+
5
+ - Update Hello, Drag and Drop! to include `list`, `label`, `text`, and `spinner` examples
6
+ - Add manual and fully customizable drag and drop syntax alternatives to Hello, Drag and Drop!
7
+ - Support simpler drag and drop syntax (`drag_source true`/`drop_target true`) for simple cases concerning `list`, `label`, `text`, and `spinner`
8
+
3
9
  ### 4.21.2.0
4
10
 
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]`)
11
+ - 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
12
  - 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
13
  - Remove scaffolding/packaging building/using of a generated Java `Resource` class
8
14
  - 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.1
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,7 +15,7 @@
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.1 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
 
@@ -24,10 +24,11 @@ Please help make [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt
24
24
  Glimmer DSL gems:
25
25
  - [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
26
26
  - [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
27
  - [glimmer-dsl-tk](https://github.com/AndyObtiva/glimmer-dsl-tk): Glimmer DSL for Tk (MRI Ruby Desktop Development GUI Library)
30
28
  - [glimmer-dsl-libui](https://github.com/AndyObtiva/glimmer-dsl-libui): Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development GUI Library)
29
+ - [glimmer-dsl-gtk](https://github.com/AndyObtiva/glimmer-dsl-gtk): Glimmer DSL for GTK (Ruby-GNOME Desktop Development GUI Library)
30
+ - [glimmer-dsl-xml](https://github.com/AndyObtiva/glimmer-dsl-xml): Glimmer DSL for XML (& HTML)
31
+ - [glimmer-dsl-css](https://github.com/AndyObtiva/glimmer-dsl-css): Glimmer DSL for CSS
31
32
 
32
33
  ## Examples
33
34
 
@@ -292,7 +293,7 @@ https://www.eclipse.org/swt/faq.php
292
293
 
293
294
  - 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
295
  - [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])
296
+ - 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
297
  - 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
298
  - Git (comes with Mac and Linux. Install on Windows: https://git-scm.com/download/win )
298
299
 
@@ -322,7 +323,7 @@ jgem install glimmer-dsl-swt
322
323
 
323
324
  Or this command if you want a specific version:
324
325
  ```
325
- jgem install glimmer-dsl-swt -v 4.21.2.0
326
+ jgem install glimmer-dsl-swt -v 4.21.2.1
326
327
  ```
327
328
 
328
329
  `jgem` is JRuby's version of `gem` command.
@@ -350,7 +351,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
350
351
 
351
352
  Add the following to `Gemfile`:
352
353
  ```
353
- gem 'glimmer-dsl-swt', '~> 4.21.2.0'
354
+ gem 'glimmer-dsl-swt', '~> 4.21.2.1'
354
355
  ```
355
356
 
356
357
  And, then run:
@@ -371,7 +372,7 @@ glimmer
371
372
  ```
372
373
 
373
374
  ```
374
- Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.21.2.0
375
+ Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.21.2.1
375
376
 
376
377
  Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
377
378
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.21.2.0
1
+ 4.21.2.1
@@ -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
 
@@ -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
@@ -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,179 @@ 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 :unique # does not add same data twice
80
+ drop_target true
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
+ # drop_widget = event.widget.control.data('proxy') # obtain Glimmer widget proxy since it permits nicer syntax for setting background via symbol
95
+ # drop_widget.background = :red
96
+ # end
97
+ #
98
+ # on_drag_leave do |event|
99
+ # drop_widget = event.widget.control.data('proxy') # obtain Glimmer widget proxy since it permits nicer syntax for setting background via symbol
100
+ # drop_widget.background = :white
101
+ # end
102
+ #
103
+ # on_drop do |event|
104
+ # drop_widget = event.widget.control.data('proxy') # obtain Glimmer widget proxy since it permits nicer syntax for setting background/cursor via symbol
105
+ # drop_widget.background = :white
106
+ # drop_widget.add(event.data)
107
+ # drop_widget.select(drop_widget.items.count - 1)
108
+ # drop_widget.cursor = :arrow
109
+ # end
110
+ # }
111
+ }
43
112
  }
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)
113
+
114
+ tab_item {
115
+ grid_layout 2, true
116
+ text 'Label'
117
+
118
+ label {
119
+ layout_data {
120
+ horizontal_span 2
121
+ }
122
+ text 'Drag text from any label and drop it unto another label'
123
+ }
124
+
125
+ {
126
+ Argentina: :green,
127
+ Brazil: :red,
128
+ Finland: :yellow,
129
+ Sweden: :magenta,
130
+ Denmark: :gray,
131
+ Iceland: :cyan
132
+ }.each do |country, color|
133
+ label {
134
+ layout_data :fill, :fill, true, true
135
+ text country
136
+ font height: 20
137
+ background color
138
+ drag_source true
139
+ drop_target true
140
+ }
141
+ end
142
+ }
143
+
144
+ tab_item {
145
+ grid_layout 2, true
146
+ text 'Text'
147
+
148
+ label {
149
+ text 'Drag'
150
+ }
151
+
152
+ label {
153
+ text 'Drop To Insert'
154
+ }
155
+
156
+ text {
157
+ layout_data :fill, :center, true, false
158
+ text 'Text1'
159
+ drag_source true
160
+ }
161
+
162
+ text {
163
+ layout_data :fill, :center, true, false
164
+ text 'Drop To Insert'
165
+ drop_target true
166
+ }
167
+
168
+ label {
169
+ text 'Drag'
170
+ }
171
+
172
+ label {
173
+ text 'Drop To Replace'
174
+ }
175
+
176
+ text {
177
+ layout_data :fill, :center, true, false
178
+ text 'Text2'
179
+ drag_source true
180
+ }
181
+
182
+ text {
183
+ layout_data :fill, :center, true, false
184
+ text 'Drop To Replace'
185
+ drop_target :replace
186
+ }
187
+ }
188
+
189
+ tab_item {
190
+ grid_layout 2, true
191
+ text 'Spinner'
192
+
193
+ label {
194
+ text 'Drag'
195
+ }
196
+
197
+ label {
198
+ text 'Drop To Insert'
199
+ }
200
+
201
+ spinner {
202
+ layout_data :fill, :center, true, false
203
+ selection 30
204
+ drag_source true
205
+ }
206
+
207
+ spinner {
208
+ layout_data :fill, :center, true, false
209
+ drop_target true
210
+ }
50
211
  }
51
212
  }
52
213
  }.open
metadata CHANGED
@@ -1,14 +1,14 @@
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.1
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-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement