glimmer-dsl-swt 4.21.1.1 → 4.21.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -0
- data/README.md +10 -9
- data/VERSION +1 -1
- data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +48 -27
- data/docs/reference/GLIMMER_PACKAGING_AND_DISTRIBUTION.md +68 -17
- data/glimmer-dsl-swt.gemspec +0 -0
- data/lib/glimmer/rake_task/package.rb +1 -1
- data/lib/glimmer/rake_task/scaffold.rb +4 -22
- data/lib/glimmer/rake_task.rb +1 -5
- data/lib/glimmer/swt/custom/drawable.rb +2 -0
- data/lib/glimmer/swt/image_proxy.rb +5 -3
- data/lib/glimmer/swt/style_constantizable.rb +2 -0
- data/lib/glimmer/swt/widget_proxy.rb +76 -0
- data/samples/hello/hello_drag_and_drop.rb +208 -11
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c54876802ebb7cf1638e2133fda5aaa085e33260423984779c0e304eca419953
|
4
|
+
data.tar.gz: 825ceeaad21c404984c8fc8fd23d2c110be5f046f81826b57d57c7b85b745631
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57c6ce9aca9a50949c357b54f2424ab018e3cba3bc300fa6a5cd2ef3d7a9741b9b6998d716c4b68d3005c74d4849c95637a19f0f8ff9bef4e752af81d857e5ff
|
7
|
+
data.tar.gz: 8adc0b7b8258e858bce65d297c996146a0ca90ec760c34ad08c5663227f8398f8daee7bdcd983a814cb33864cde99c170077be29dfc3fedbdd3c5997aefe9e40
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,28 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
### 4.21.2.3
|
4
|
+
|
5
|
+
- Upgrade to glimmer 2.5.1 to fix an issue with mistakenly referencing `OpenStruct` without `'ostruct'` being loaded
|
6
|
+
|
7
|
+
### 4.21.2.2
|
8
|
+
|
9
|
+
- Demo file drag and drop in Hello, Drag and Drop!
|
10
|
+
- Make shapes added inside a widget with `:default` or `:max` dimensions auto-resize as the widget resizes
|
11
|
+
- Upgrade to glimmer 2.5.0
|
12
|
+
|
13
|
+
### 4.21.2.1
|
14
|
+
|
15
|
+
- Update Hello, Drag and Drop! to include `list`, `label`, `text`, and `spinner` examples
|
16
|
+
- Add manual and fully customizable drag and drop syntax alternatives to Hello, Drag and Drop!
|
17
|
+
- Support simpler drag and drop syntax (`drag_source true`/`drop_target true`) for simple cases concerning `list`, `label`, `text`, and `spinner`
|
18
|
+
|
19
|
+
### 4.21.2.0
|
20
|
+
|
21
|
+
- 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]`)
|
22
|
+
- 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`
|
23
|
+
- Remove scaffolding/packaging building/using of a generated Java `Resource` class
|
24
|
+
- 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)
|
25
|
+
|
3
26
|
### 4.21.1.1
|
4
27
|
|
5
28
|
- Fix samples for Windows, espcially Hello, Cool Bar!, Hello, Tool Bar!, and Weather
|
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.
|
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.3
|
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)
|
@@ -10,12 +10,12 @@
|
|
10
10
|
|
11
11
|
**(The Original Glimmer Library Handling the World’s Ruby GUI Needs Since 2007. Beware of Imitators!)**
|
12
12
|
|
13
|
-
[Glimmer](https://github.com/AndyObtiva/glimmer) DSL for [SWT](https://www.eclipse.org/swt/) is a native-GUI cross-platform desktop development library written in [JRuby](https://www.jruby.org/), an OS-threaded faster JVM version of [Ruby](https://www.ruby-lang.org/en/). [Glimmer](https://github.com/AndyObtiva/glimmer)'s main innovation is a declarative [Ruby DSL](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#glimmer-dsl-syntax) that enables productive and efficient authoring of desktop application user-interfaces by relying on the robust [Eclipse SWT library](https://www.eclipse.org/swt/). [Glimmer](https://rubygems.org/gems/glimmer) additionally innovates by having built-in [data-binding](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#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 afterwards. Not only does Glimmer provide a large set of GUI [widgets](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#widgets), but it also supports drawing Canvas Graphics like [Shapes](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#canvas-shape-dsl) and [Animations](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#canvas-animation-dsl). To get started quickly, [Glimmer](https://rubygems.org/gems/glimmer) offers [scaffolding](docs/reference/GLIMMER_COMMAND.md#scaffolding) options for [Apps](#in-production), [Gems](docs/reference/GLIMMER_COMMAND.md#custom-shell-gem), and [Custom Widgets](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#custom-widgets). [Glimmer](https://rubygems.org/gems/glimmer) also includes native-executable [packaging](docs/reference/GLIMMER_PACKAGING_AND_DISTRIBUTION.md) support, sorely lacking in other libraries, thus enabling the delivery of desktop apps written in [Ruby](https://www.ruby-lang.org/en/) as truly native DMG/PKG/APP files on the [Mac](https://www.apple.com/ca/macos), MSI/EXE files on [Windows](https://www.microsoft.com/en-ca/windows), and
|
13
|
+
[Glimmer](https://github.com/AndyObtiva/glimmer) DSL for [SWT](https://www.eclipse.org/swt/) is a native-GUI cross-platform desktop development library written in [JRuby](https://www.jruby.org/), an OS-threaded faster JVM version of [Ruby](https://www.ruby-lang.org/en/). [Glimmer](https://github.com/AndyObtiva/glimmer)'s main innovation is a declarative [Ruby DSL](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#glimmer-dsl-syntax) that enables productive and efficient authoring of desktop application user-interfaces by relying on the robust [Eclipse SWT library](https://www.eclipse.org/swt/). [Glimmer](https://rubygems.org/gems/glimmer) additionally innovates by having built-in [data-binding](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#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 afterwards. Not only does Glimmer provide a large set of GUI [widgets](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#widgets), but it also supports drawing Canvas Graphics like [Shapes](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#canvas-shape-dsl) and [Animations](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#canvas-animation-dsl). To get started quickly, [Glimmer](https://rubygems.org/gems/glimmer) offers [scaffolding](docs/reference/GLIMMER_COMMAND.md#scaffolding) options for [Apps](#in-production), [Gems](docs/reference/GLIMMER_COMMAND.md#custom-shell-gem), and [Custom Widgets](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#custom-widgets). [Glimmer](https://rubygems.org/gems/glimmer) also includes native-executable [packaging](docs/reference/GLIMMER_PACKAGING_AND_DISTRIBUTION.md) support, sorely lacking in other libraries, thus enabling the delivery of desktop apps written in [Ruby](https://www.ruby-lang.org/en/) as truly native DMG/PKG/APP files on the [Mac](https://www.apple.com/ca/macos), MSI/EXE files on [Windows](https://www.microsoft.com/en-ca/windows), and DEB/RPM files on [Linux](https://www.linux.org/). [Glimmer](https://github.com/AndyObtiva/glimmer) was the [first Ruby gem](https://rubygems.org/gems/glimmer) to bring [SWT](https://www.eclipse.org/swt/) (Standard Widget Toolkit) to [Ruby](https://www.ruby-lang.org/en/), thanks to creator [Andy Maleh](https://andymaleh.blogspot.com/), EclipseCon/EclipseWorld/RubyConf speaker.
|
14
14
|
|
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.
|
18
|
+
[Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.21.2.3 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.
|
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.
|
326
|
+
jgem install glimmer-dsl-swt -v 4.21.2.3
|
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.
|
354
|
+
gem 'glimmer-dsl-swt', '~> 4.21.2.3'
|
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.
|
375
|
+
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.21.2.3
|
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.
|
1
|
+
4.21.2.3
|
@@ -1270,6 +1270,17 @@ It is a graphics `Image` object (not a widget), but is used used in setting the
|
|
1270
1270
|
|
1271
1271
|
Glimmer recently included **EXPERIMENTAL** gif animation support for the `background_image` property on `composite' since SWT does not support animation by default. On Windows, it only works inside composites nested under standard shells, not ones that have the SWT styles :on_top or :no_trim
|
1272
1272
|
|
1273
|
+
When an app is packaged (i.e. JAR inside a DMG or MSI native executable), jruby generates file paths that start with "uri:classloader". The `image` keyword automatically knows how to interpret such paths when passed as an argument.
|
1274
|
+
|
1275
|
+
Should you need to read a file from a JAR file manually, you may use this code (assuming a `file_path` formed using standard Ruby `File.expand_path` call, which jruby automatically overrides when running from a JAR to generate a `uri:classloader` path) :
|
1276
|
+
```ruby
|
1277
|
+
require 'jruby'
|
1278
|
+
file_path = file_path.sub(/^uri\:classloader\:/, '').sub(/^\/+/, '')
|
1279
|
+
jcl = JRuby.runtime.jruby_class_loader
|
1280
|
+
resource = jcl.get_resource_as_stream(file_path)
|
1281
|
+
file_input_stream = resource.to_io.to_input_stream
|
1282
|
+
```
|
1283
|
+
|
1273
1284
|
Learn more about images in general at this SWT Image guide: https://www.eclipse.org/articles/Article-SWT-images/graphics-resources.html
|
1274
1285
|
|
1275
1286
|
#### Image Options
|
@@ -1498,7 +1509,7 @@ https://help.eclipse.org/2019-12/nftopic/org.eclipse.platform.doc.isv/reference/
|
|
1498
1509
|
|
1499
1510
|
### Canvas Shape DSL
|
1500
1511
|
|
1501
|
-
**(
|
1512
|
+
**(BETA FEATURE)**
|
1502
1513
|
|
1503
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.
|
1504
1515
|
|
@@ -1589,7 +1600,7 @@ Screenshot:
|
|
1589
1600
|
|
1590
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`.
|
1591
1602
|
|
1592
|
-
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).
|
1593
1604
|
|
1594
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]`
|
1595
1606
|
|
@@ -1748,11 +1759,11 @@ Shapes can be nested within each other. If you nest a shape within another, its
|
|
1748
1759
|
|
1749
1760
|
As such, if you move the parent, it moves all its children with it.
|
1750
1761
|
|
1751
|
-
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).
|
1752
1763
|
|
1753
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.
|
1754
1765
|
|
1755
|
-
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).
|
1756
1767
|
|
1757
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]`
|
1758
1769
|
|
@@ -1933,7 +1944,7 @@ Check [Hello, Canvas!](GLIMMER_SAMPLES.md#hello-canvas) for an example.
|
|
1933
1944
|
|
1934
1945
|
#### Pixel Graphics
|
1935
1946
|
|
1936
|
-
**(
|
1947
|
+
**(BETA FEATURE)**
|
1937
1948
|
|
1938
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.
|
1939
1950
|
|
@@ -2115,7 +2126,7 @@ As they say, there are many ways to skin a cat! This is in line with the Ruby wa
|
|
2115
2126
|
|
2116
2127
|
### Canvas Path DSL
|
2117
2128
|
|
2118
|
-
**(
|
2129
|
+
**(BETA FEATURE)**
|
2119
2130
|
|
2120
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:
|
2121
2132
|
- `point(x1, y1)`: renders a Point (Dot) as part of a path.
|
@@ -2161,7 +2172,7 @@ Every path segment object (mixing in [`Glimmer::SWT::Custom::PathSegment`](/lib/
|
|
2161
2172
|
|
2162
2173
|
### Canvas Transform DSL
|
2163
2174
|
|
2164
|
-
**(
|
2175
|
+
**(BETA FEATURE)**
|
2165
2176
|
|
2166
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.
|
2167
2178
|
|
@@ -2245,7 +2256,7 @@ Learn more at the [Hello, Canvas Transform! Sample](GLIMMER_SAMPLES.md#hello-can
|
|
2245
2256
|
|
2246
2257
|
### Canvas Animation DSL
|
2247
2258
|
|
2248
|
-
**(
|
2259
|
+
**(ALPHA FEATURE)**
|
2249
2260
|
|
2250
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.)
|
2251
2262
|
|
@@ -2341,14 +2352,10 @@ This example adds on the one above it by specifying converters on read and write
|
|
2341
2352
|
|
2342
2353
|
`text bind(contact, 'address.street', sync_exec: true)`
|
2343
2354
|
|
2344
|
-
**(BETA FEATURE)**
|
2345
|
-
|
2346
2355
|
This example forces GUI updates via [sync_exec](#sync_exec) assuming they are coming from another thread (different from the GUI thread)
|
2347
2356
|
|
2348
2357
|
`text bind(contact, 'address.street', async_exec: true)`
|
2349
2358
|
|
2350
|
-
**(BETA FEATURE)**
|
2351
|
-
|
2352
2359
|
This example forces GUI updates via [async_exec](#async_exec) assuming they are coming from another thread (different from the GUI thread)
|
2353
2360
|
|
2354
2361
|
`text bind(contact, 'address.street', on_read: lambda { |s| s[0..10] })`
|
@@ -3295,8 +3302,6 @@ Keep in mind that if the text grows and required a wider line numbers area, it g
|
|
3295
3302
|
**theme**
|
3296
3303
|
(default: `'glimmer'`)
|
3297
3304
|
|
3298
|
-
**(BETA FEATURE)**
|
3299
|
-
|
3300
3305
|
Changes syntax color highlighting theme. Can be one of the following:
|
3301
3306
|
- glimmer
|
3302
3307
|
- github
|
@@ -3305,8 +3310,6 @@ Changes syntax color highlighting theme. Can be one of the following:
|
|
3305
3310
|
**language**
|
3306
3311
|
(default: `'ruby'`)
|
3307
3312
|
|
3308
|
-
**(BETA FEATURE)**
|
3309
|
-
|
3310
3313
|
Sets the code language, which can be one of the following [rouge gem](#https://rubygems.org/gems/rouge) supported languages:
|
3311
3314
|
- abap
|
3312
3315
|
- actionscript
|
@@ -3616,15 +3619,27 @@ You may check out [Hello, Custom Shell!](GLIMMER_SAMPLES.md#hello-custom-shell)
|
|
3616
3619
|
|
3617
3620
|
### Drag and Drop
|
3618
3621
|
|
3619
|
-
Glimmer
|
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).
|
3620
3623
|
|
3621
|
-
|
3624
|
+
Example:
|
3622
3625
|
|
3623
|
-
|
3626
|
+
```ruby
|
3627
|
+
label {
|
3628
|
+
text 'Text To Drag and Drop'
|
3629
|
+
drag_source true
|
3630
|
+
}
|
3631
|
+
|
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:
|
3624
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)
|
3625
|
-
|
3626
|
-
|
3627
|
-
|
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.
|
3628
3643
|
|
3629
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)):
|
3630
3645
|
|
@@ -3643,18 +3658,22 @@ include Glimmer
|
|
3643
3658
|
|
3644
3659
|
shell {
|
3645
3660
|
text 'Hello, Drag and Drop!'
|
3661
|
+
|
3646
3662
|
list {
|
3647
3663
|
selection bind(@location, :country)
|
3664
|
+
|
3648
3665
|
on_drag_set_data do |event|
|
3649
|
-
list = event.widget.
|
3650
|
-
event.data = list.
|
3666
|
+
list = event.widget.control
|
3667
|
+
event.data = list.selection.first
|
3651
3668
|
end
|
3652
3669
|
}
|
3670
|
+
|
3653
3671
|
label(:center) {
|
3654
3672
|
text 'Drag a country here!'
|
3655
3673
|
font height: 20
|
3674
|
+
|
3656
3675
|
on_drop do |event|
|
3657
|
-
event.widget.
|
3676
|
+
event.widget.control.text = event.data
|
3658
3677
|
end
|
3659
3678
|
}
|
3660
3679
|
}.open
|
@@ -3662,7 +3681,7 @@ shell {
|
|
3662
3681
|
|
3663
3682
|
![Hello Drag and Drop](/images/glimmer-hello-drag-and-drop.gif)
|
3664
3683
|
|
3665
|
-
|
3684
|
+
As a third most advanced option, you may:
|
3666
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.
|
3667
3686
|
- Specify `drag_source_style` operation (may be: :drop_copy (default), :drop_link, :drop_move, :drop_none, or an array of multiple operations)
|
3668
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)
|
@@ -3670,6 +3689,8 @@ Optional steps:
|
|
3670
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)
|
3671
3690
|
- Set drag operation in `event.detail` (e.g. DND::DROP_COPY) inside `on_drag_enter`
|
3672
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
|
+
|
3673
3694
|
### Miscellaneous
|
3674
3695
|
|
3675
3696
|
#### Multi-DSL Support
|
@@ -3870,7 +3891,7 @@ class Example
|
|
3870
3891
|
text 'Application Menu Items'
|
3871
3892
|
font height: 30
|
3872
3893
|
}
|
3873
|
-
}
|
3894
|
+
}
|
3874
3895
|
}
|
3875
3896
|
end
|
3876
3897
|
|
@@ -1,18 +1,12 @@
|
|
1
1
|
## Glimmer Packaging and Distribution
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
Note 2: On Windows, ensure system environment PATH includes Java bin directory `"C:\Program Files\Java\jdk-16.0.2\bin"` at the top for `jpackage` command to work during packaging Glimmer applications (the default Oracle setup path for Java after installing the JDK is usually not sufficient).
|
6
|
-
|
7
|
-
Note 3: Glimmer packaging has a strong dependency on JDK16 since it includes the packaging tool `jpackage`. On the Mac, it seems there is a new gotcha in the latest JDK 16 DMG/PKG installable that is resulting in `jpackage` to be missing from `PATH`. To include, you might need to add `export PATH="/Library/Java/JavaVirtualMachines/jdk-16.0.2.jdk/Contents/Home/bin:$PATH"` to `~/.zprofile` or `~/.bashrc`
|
8
|
-
|
9
|
-
Glimmer simplifies the process of native-executable packaging and distribution on Mac and Windows via a single `glimmer package` command:
|
3
|
+
Glimmer simplifies the process of native-executable packaging and distribution on Mac, Windows, and Linux via a single `glimmer package` command:
|
10
4
|
|
11
5
|
```
|
12
6
|
glimmer package
|
13
7
|
```
|
14
8
|
|
15
|
-
It works out of the box for any application scaffolded by [Glimmer Scaffolding](#scaffolding), generating default packaging type on the current platform if not specified (i.e. `app-image`) and displaying a message indicating what pre-requisite setup tools are needed if not installed already (e.g. [Wix Toolset](https://wixtoolset.org/) to generate MSI files on Windows
|
9
|
+
It works out of the box for any application scaffolded by [Glimmer Scaffolding](#scaffolding), generating default packaging type on the current platform if not specified (i.e. `app-image`) and displaying a message indicating what pre-requisite setup tools are needed if not installed already (e.g. [Wix Toolset](https://wixtoolset.org/) to generate MSI files on Windows. If you install Wix, make sure it is on the system PATH by adding for example "C:\Program Files (x86)\WiX Toolset v3.11\bin" to the Windows Environment Variables.).
|
16
10
|
|
17
11
|
You may choose to generate a specific type of packaging instead by addionally passing in the `[type]` option. For example, this generates an MSI setup file on Windows:
|
18
12
|
|
@@ -20,7 +14,9 @@ You may choose to generate a specific type of packaging instead by addionally pa
|
|
20
14
|
glimmer package[msi]
|
21
15
|
```
|
22
16
|
|
23
|
-
|
17
|
+
![glimmer packaging windows msi](/images/glimmer-packaging-windows-msi.png)
|
18
|
+
|
19
|
+
This command generates a DMG file on the Mac:
|
24
20
|
|
25
21
|
```
|
26
22
|
glimmer package[dmg]
|
@@ -32,11 +28,37 @@ Make sure to surround with double-quotes when running from ZShell (zsh):
|
|
32
28
|
glimmer "package[dmg]"
|
33
29
|
```
|
34
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
|
+
|
35
|
+
This command generates a DEB file on a Linux that supports deb packages (e.g. Linux Mint Cinnamon):
|
36
|
+
|
37
|
+
```
|
38
|
+
glimmer package[deb]
|
39
|
+
```
|
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
|
-
- Available Linux packaging types are `deb`, `rpm`, and `app-image` (
|
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`]).
|
38
54
|
|
39
|
-
Note:
|
55
|
+
Note 1: On Windows, ensure system environment PATH includes Java bin directory `"C:\Program Files\Java\jdk-16.0.2\bin"` at the top for `jpackage` command to work during packaging Glimmer applications (the default Oracle setup path for Java after installing the JDK is usually not sufficient).
|
56
|
+
|
57
|
+
Note 2: Glimmer packaging has a strong dependency on JDK16 since it includes the packaging tool `jpackage`. On the Mac, it seems there is a new gotcha in the latest JDK 16 DMG/PKG installable that is resulting in `jpackage` to be missing from `PATH`. To include, you might need to add `export PATH="/Library/Java/JavaVirtualMachines/jdk-16.0.2.jdk/Contents/Home/bin:$PATH"` to `~/.zprofile` or `~/.bashrc`
|
58
|
+
|
59
|
+
Note 3: On Linux, 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`)
|
60
|
+
|
61
|
+
Note 4: if you are using Glimmer packaging with a manually generated app (without scaffolding), in order to make the `glimmer package` command available, you must add the following line to your application `Rakefile` (automatically done for you if you scaffold an app or gem with `glimmer scaffold[AppName]` or `glimmer scaffold:gem:customshell[GemName]`):
|
40
62
|
|
41
63
|
```ruby
|
42
64
|
require 'glimmer/rake_task'
|
@@ -47,7 +69,7 @@ The Glimmer packaging process done in the `glimmer package` command consists of
|
|
47
69
|
1. Lock JAR versions (`glimmer package:lock_jars`): This locks versions of JAR dependencies leveraged by the `jar-dependencies` JRuby gem, downloading them into the `./vendor` directory so they would get inside the top-level Glimmer app/gem JAR file.
|
48
70
|
1. Generate [Warbler](https://github.com/jruby/warbler) config (`glimmer package:config`): Generates initial Warbler config file (under `./config/warble.rb`) to use for generating JAR file.
|
49
71
|
1. Generate JAR file using [Warbler](https://github.com/jruby/warbler) (`glimmer package:jar`): Enables bundling a Glimmer app into a JAR file under the `./dist` directory
|
50
|
-
1. Generate native executable using [jpackage](https://docs.oracle.com/en/java/javase/
|
72
|
+
1. Generate native executable using [jpackage](https://docs.oracle.com/en/java/javase/16/jpackage/packaging-tool-user-guide.pdf) (`glimmer package:native`): Enables packaging a JAR file as a DMG/PKG/APP file on Mac, MSI/EXE/APP on Windows, and DEB/RPM/APP on Linux (Glimmer does not officially support Linux with the `glimmer package` command yet, but it generates the JAR file successfully, and you could use `jpackage` manually afterwards if needed).
|
51
73
|
|
52
74
|
Those steps automatically ensure generating a JAR file under the `./dist` directory using [Warbler](https://github.com/jruby/warbler), which is then used to automatically generate a DMG/MSI file (and other executables) under the `./packages/bundles` directory using `jpackage`.
|
53
75
|
The JAR file name will match your application local directory name (e.g. `MathBowling.jar` for `~/code/MathBowling`)
|
@@ -90,7 +112,7 @@ require_relative '../app/my_application.rb'
|
|
90
112
|
|
91
113
|
In order to explicitly configure jpackage, Mac package attributes, or sign your Mac app to distribute on the App Store, you can follow more advanced instructions for `jpackage` here:
|
92
114
|
- Run `jpackage --help` for more info
|
93
|
-
- https://docs.oracle.com/en/java/javase/
|
115
|
+
- https://docs.oracle.com/en/java/javase/16/jpackage/packaging-tool-user-guide.pdf
|
94
116
|
- https://developer.apple.com/library/archive/releasenotes/General/SubmittingToMacAppStore/index.html#//apple_ref/doc/uid/TP40010572-CH16-SW8
|
95
117
|
|
96
118
|
The Glimmer rake task allows passing extra options to jpackage via:
|
@@ -119,7 +141,7 @@ Pass `-v` to jpackage in `Glimmer::RakeTask::Package.jpackage_extra_args` or by
|
|
119
141
|
|
120
142
|
### Windows Application Packaging
|
121
143
|
|
122
|
-
Windows
|
144
|
+
Windows offers two options for packaging:
|
123
145
|
- `msi` (recommended): simpler packaging option. Requires [WiX Toolset](https://wixtoolset.org/) and [.NET Framework](https://dotnet.microsoft.com/download/dotnet-framework). Simply run `glimmer package[msi]` (or `glimmer package:native[msi]` if it's not your first time) and it will give you more details on the pre-requisites you need to install (e.g. [WiX Toolset](https://wixtoolset.org/) and [.NET Framework 3.5 SP1](https://dotnet.microsoft.com/download/dotnet-framework/net35-sp1)).
|
124
146
|
- `exe`: more advanced packaging option. Requires [Inno Setup](https://jrsoftware.org/isinfo.php). Simply run `glimmer package[exe]` (or `glimmer package:native[exe]` if it's not your first time) and it will tell you what you need to install.
|
125
147
|
|
@@ -127,9 +149,9 @@ If you just want to test out packaging into a native Windows app that is not pac
|
|
127
149
|
|
128
150
|
### Mac Application Distribution
|
129
151
|
|
130
|
-
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.
|
131
153
|
|
132
|
-
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/
|
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
|
133
155
|
|
134
156
|
```
|
135
157
|
--mac-package-signing-prefix <prefix string>
|
@@ -182,10 +204,12 @@ org.apache.maven.InternalErrorException: Internal error: org.jruby.exceptions.Ra
|
|
182
204
|
Caused by: org.jruby.exceptions.RaiseException: (LoadError) library `java' could not be loaded: java.lang.reflect.InaccessibleObjectException: Unable to make protected native java.lang.Object java.lang.Object.clone() throws java.lang.CloneNotSupportedException accessible: module java.base does not "opens java.lang" to unnamed module @138caeca
|
183
205
|
[ERROR]
|
184
206
|
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
|
207
|
+
```
|
185
208
|
|
186
209
|
3. jpackage missing from PATH on the Mac
|
187
210
|
|
188
211
|
On the Mac, the latest JDK 16 installable DMG/PKG is resulting in `jpackage` to be missing from `PATH`. To include, you might need to add `export PATH="/Library/Java/JavaVirtualMachines/jdk-16.0.2.jdk/Contents/Home/bin:$PATH"` to `~/.zprofile` or `~/.bashrc`
|
212
|
+
```
|
189
213
|
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
|
190
214
|
[ERROR]
|
191
215
|
[ERROR] For more information about the errors and possible solutions, please read the following articles:
|
@@ -194,7 +218,7 @@ On the Mac, the latest JDK 16 installable DMG/PKG is resulting in `jpackage` to
|
|
194
218
|
|
195
219
|
Please ignore. It should be harmless. If you get blocked by it for any reason, please open an Issue about it.
|
196
220
|
|
197
|
-
|
221
|
+
4. Java on Windows System PATH
|
198
222
|
|
199
223
|
If you get any errors running Java on Windows, keep in mind that you need to have the Java binaries "C:\Program Files\Java\jdk-16.0.2\bin" on the Windows System PATH environment variable.
|
200
224
|
|
@@ -204,3 +228,30 @@ The problem is Oracle seems to be adding an indirect Java path junction in later
|
|
204
228
|
Simply replace it with the simple path mentioned above (`"C:\Program Files\Java\jdk-16.0.2\bin"` matching your correct version number)
|
205
229
|
|
206
230
|
Lastly, reinstall JRuby to ensure it is using Java from the right path.
|
231
|
+
|
232
|
+
5. File paths in app running from packaged JAR file
|
233
|
+
|
234
|
+
Glimmer packaged apps always reside within a JAR file before being wrapped by a native executable.
|
235
|
+
|
236
|
+
JRuby automatically converts any paths produced by File.expand_path inside packaged JAR file into uri:classloader prefixed paths. They work just fine when performing File.read, but if you need to access as a Java input stream, you need to use special code:
|
237
|
+
|
238
|
+
```ruby
|
239
|
+
require 'jruby'
|
240
|
+
file_path = File.expand_path(some_path, __dir__)
|
241
|
+
file_path = file_path.sub(/^uri\:classloader\:/, '').sub(/^\/+/, '')
|
242
|
+
jcl = JRuby.runtime.jruby_class_loader
|
243
|
+
resource = jcl.get_resource_as_stream(file_path)
|
244
|
+
file_input_stream = resource.to_io.to_input_stream
|
245
|
+
```
|
246
|
+
|
247
|
+
The `image` keyword in Glimmer automatically does that work when passing an image path produced from inside a JAR file.
|
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)
|
data/glimmer-dsl-swt.gemspec
CHANGED
Binary file
|
@@ -112,7 +112,7 @@ module Glimmer
|
|
112
112
|
FileUtils.mkdir_p('packages/bundles')
|
113
113
|
command = "jpackage"
|
114
114
|
command += " --type #{native_type}"
|
115
|
-
command += " --dest 'packages/bundles' --input 'dist' --main-class JarMain --main-jar '#{project_name}.jar' --
|
115
|
+
command += " --dest 'packages/bundles' --input 'dist' --main-class JarMain --main-jar '#{project_name}.jar' --name '#{human_name}' --vendor '#{human_name}' --icon '#{icon}' "
|
116
116
|
command += " --win-per-user-install --win-dir-chooser --win-menu --win-menu-group '#{human_name}' " if OS.windows? && native_type != 'app-image'
|
117
117
|
command += " --linux-menu-group '#{human_name}' " if OS.linux? && native_type != 'app-image'
|
118
118
|
command += " --java-options '-XstartOnFirstThread' --mac-package-name '#{human_name}' --mac-package-identifier 'org.#{project_name}.application.#{project_name}' " if OS.mac?
|
@@ -116,10 +116,12 @@ module Glimmer
|
|
116
116
|
GEMFILE_APP_MIDFIX = <<~MULTI_LINE_STRING
|
117
117
|
|
118
118
|
gem 'glimmer-dsl-swt', '~> #{VERSION}'
|
119
|
+
gem 'psych', '3.3.2' # Fixed temporarily because installing latest on JDK16 was causing issues
|
119
120
|
MULTI_LINE_STRING
|
120
121
|
GEMFILE_GEM_MIDFIX = <<~MULTI_LINE_STRING
|
121
122
|
|
122
123
|
gem 'glimmer-dsl-swt', '~> #{VERSION.split('.')[0...2].join('.')}'
|
124
|
+
gem 'psych', '3.3.2' # Fixed temporarily because installing latest on JDK16 was causing issues
|
123
125
|
MULTI_LINE_STRING
|
124
126
|
GEMFILE_SUFFIX = <<~MULTI_LINE_STRING
|
125
127
|
|
@@ -182,11 +184,6 @@ module Glimmer
|
|
182
184
|
cp File.expand_path('../../../../icons/scaffold_app.png', __FILE__), icon_file
|
183
185
|
puts "Created #{current_dir_name}/#{icon_file}"
|
184
186
|
|
185
|
-
write "Resource.java", resource_java_file(app_name)
|
186
|
-
cd '..'
|
187
|
-
system "javac #{file_name(app_name)}/Resource.java"
|
188
|
-
cd gem_name
|
189
|
-
|
190
187
|
mkdir_p "app/#{file_name(app_name)}"
|
191
188
|
write "app/#{file_name(app_name)}/launch.rb", app_launch_file(app_name)
|
192
189
|
mkdir_p 'bin'
|
@@ -298,11 +295,6 @@ module Glimmer
|
|
298
295
|
cp File.expand_path('../../../../icons/scaffold_app.png', __FILE__), icon_file
|
299
296
|
puts "Created #{current_dir_name}/#{icon_file}"
|
300
297
|
|
301
|
-
write "Resource.java", resource_java_file(custom_shell_name)
|
302
|
-
cd '..'
|
303
|
-
system "javac #{file_name(custom_shell_name)}/Resource.java"
|
304
|
-
cd gem_name
|
305
|
-
|
306
298
|
if OS.windows?
|
307
299
|
system "glimmer package" # TODO handle windows properly with batch file
|
308
300
|
system "\"packages/bundles/#{human_name(custom_shell_name)}/#{human_name(custom_shell_name)}.exe\""
|
@@ -496,16 +488,6 @@ module Glimmer
|
|
496
488
|
MULTI_LINE_STRING
|
497
489
|
end
|
498
490
|
|
499
|
-
def resource_java_file(app_name)
|
500
|
-
<<~MULTI_LINE_STRING
|
501
|
-
package #{file_name(app_name)};
|
502
|
-
|
503
|
-
/** The soul purpose of this class is to retrieve icons for uri:classloader paths used from JAR */
|
504
|
-
class Resource {
|
505
|
-
}
|
506
|
-
MULTI_LINE_STRING
|
507
|
-
end
|
508
|
-
|
509
491
|
def app_bin_command_file(app_name_or_gem_name, custom_shell_name=nil, namespace=nil)
|
510
492
|
if custom_shell_name.nil?
|
511
493
|
runner = "File.expand_path('../../app/#{file_name(app_name_or_gem_name)}/launch.rb', __FILE__)"
|
@@ -545,7 +527,7 @@ module Glimmer
|
|
545
527
|
lines.insert(require_rake_line_index, "require 'glimmer/launcher'")
|
546
528
|
gem_files_line_index = lines.index(lines.detect {|l| l.include?('# dependencies defined in Gemfile') })
|
547
529
|
if custom_shell_name
|
548
|
-
lines.insert(gem_files_line_index, " gem.files = Dir['
|
530
|
+
lines.insert(gem_files_line_index, " gem.files = Dir['VERSION', 'LICENSE.txt', 'app/**/*', 'bin/**/*', 'config/**/*', 'db/**/*', 'docs/**/*', 'fonts/**/*', 'icons/**/*', 'images/**/*', 'lib/**/*', 'script/**/*', 'sounds/**/*', 'vendor/**/*', 'videos/**/*']")
|
549
531
|
# the second executable is needed for warbler as it matches the gem name, which is the default expected file (alternatively in the future, we could do away with it and configure warbler to use the other file)
|
550
532
|
lines.insert(gem_files_line_index+1, " gem.require_paths = ['vendor', 'lib', 'app']")
|
551
533
|
lines.insert(gem_files_line_index+2, " gem.executables = ['#{file_name(custom_shell_name)}']") if custom_shell_name
|
@@ -561,7 +543,7 @@ module Glimmer
|
|
561
543
|
Glimmer::RakeTask::Package.jpackage_extra_args =
|
562
544
|
" --name '#{human_name(custom_shell_name)}'" +
|
563
545
|
" --description '#{human_name(custom_shell_name)}'"
|
564
|
-
# You can add more options from https://docs.oracle.com/en/java/javase/
|
546
|
+
# You can add more options from https://docs.oracle.com/en/java/javase/16/jpackage/packaging-tool-user-guide.pdf
|
565
547
|
MULTI_LINE_STRING
|
566
548
|
end
|
567
549
|
file_content
|
data/lib/glimmer/rake_task.rb
CHANGED
@@ -111,11 +111,7 @@ namespace :glimmer do
|
|
111
111
|
Rake::Task['glimmer:package:lock_jars'].execute
|
112
112
|
Rake::Task['glimmer:package:config'].execute
|
113
113
|
Rake::Task['glimmer:package:jar'].execute
|
114
|
-
|
115
|
-
Rake::Task['glimmer:package:gem'].execute
|
116
|
-
else
|
117
|
-
Rake::Task['glimmer:package:native'].execute(args)
|
118
|
-
end
|
114
|
+
Rake::Task['glimmer:package:native'].execute(args)
|
119
115
|
end
|
120
116
|
|
121
117
|
desc 'Scaffold Glimmer application directory structure to build a new app'
|
@@ -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
|
@@ -122,9 +122,11 @@ module Glimmer
|
|
122
122
|
def input_stream
|
123
123
|
if @file_path.start_with?('uri:classloader')
|
124
124
|
@jar_file_path = @file_path
|
125
|
-
file_path = @jar_file_path.sub(/^uri\:classloader\:/, '').sub(
|
126
|
-
|
127
|
-
|
125
|
+
file_path = @jar_file_path.sub(/^uri\:classloader\:/, '').sub(/^\/+/, '')
|
126
|
+
require 'jruby'
|
127
|
+
jcl = JRuby.runtime.jruby_class_loader
|
128
|
+
resource = jcl.get_resource_as_stream(file_path)
|
129
|
+
file_input_stream = resource.to_io.to_input_stream
|
128
130
|
else
|
129
131
|
file_input_stream = java.io.FileInputStream.new(@file_path)
|
130
132
|
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
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
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
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
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.
|
4
|
+
version: 4.21.2.3
|
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
|
+
date: 2021-11-20 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.
|
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.
|
26
|
+
version: 2.5.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
@@ -376,9 +376,9 @@ description: Glimmer DSL for SWT (JRuby Desktop Development GUI Framework) is a
|
|
376
376
|
started quickly, Glimmer offers scaffolding options for Apps, Gems, and Custom Widgets.
|
377
377
|
Glimmer also includes native-executable packaging support, sorely lacking in other
|
378
378
|
libraries, thus enabling the delivery of desktop apps written in Ruby as truly native
|
379
|
-
DMG/PKG/APP files on the Mac, MSI/EXE files on Windows, and
|
380
|
-
|
381
|
-
to
|
379
|
+
DMG/PKG/APP files on the Mac, MSI/EXE files on Windows, and DEB/RPM files on Linux.
|
380
|
+
Glimmer was the first Ruby gem to bring SWT (Standard Widget Toolkit) to Ruby, thanks
|
381
|
+
to creator Andy Maleh, EclipseCon/EclipseWorld/RubyConf speaker.
|
382
382
|
email: andy.am@gmail.com
|
383
383
|
executables:
|
384
384
|
- glimmer
|