glimmer-dsl-swt 4.17.4.1 → 4.17.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +41 -3
- data/README.md +267 -107
- data/VERSION +1 -1
- data/glimmer-dsl-swt.gemspec +24 -5
- data/lib/glimmer/data_binding/tree_items_binding.rb +20 -2
- data/lib/glimmer/dsl/swt/checkbox_group_selection_data_binding_expression.rb +61 -0
- data/lib/glimmer/dsl/swt/custom_widget_expression.rb +2 -0
- data/lib/glimmer/dsl/swt/dialog_expression.rb +1 -0
- data/lib/glimmer/dsl/swt/directory_dialog_expression.rb +48 -0
- data/lib/glimmer/dsl/swt/dsl.rb +2 -0
- data/lib/glimmer/dsl/swt/expand_item_expression.rb +60 -0
- data/lib/glimmer/dsl/swt/file_dialog_expression.rb +48 -0
- data/lib/glimmer/dsl/swt/radio_group_selection_data_binding_expression.rb +61 -0
- data/lib/glimmer/dsl/swt/shell_expression.rb +4 -4
- data/lib/glimmer/dsl/swt/widget_expression.rb +9 -8
- data/lib/glimmer/swt/custom/checkbox_group.rb +160 -0
- data/lib/glimmer/swt/custom/code_text.rb +25 -18
- data/lib/glimmer/swt/custom/radio_group.rb +155 -0
- data/lib/glimmer/swt/directory_dialog_proxy.rb +65 -0
- data/lib/glimmer/swt/expand_item_proxy.rb +97 -0
- data/lib/glimmer/swt/file_dialog_proxy.rb +66 -0
- data/lib/glimmer/swt/image_proxy.rb +5 -0
- data/lib/glimmer/swt/menu_proxy.rb +5 -5
- data/lib/glimmer/swt/sash_form_proxy.rb +1 -1
- data/lib/glimmer/swt/shell_proxy.rb +6 -6
- data/lib/glimmer/swt/styled_text_proxy.rb +43 -0
- data/lib/glimmer/swt/tab_item_proxy.rb +1 -1
- data/lib/glimmer/swt/widget_proxy.rb +86 -82
- data/lib/glimmer/ui/custom_shell.rb +4 -4
- data/lib/glimmer/ui/custom_widget.rb +3 -0
- data/samples/elaborate/meta_sample.rb +36 -31
- data/samples/hello/hello_checkbox.rb +85 -0
- data/samples/hello/hello_checkbox_group.rb +68 -0
- data/samples/hello/hello_combo.rb +12 -12
- data/samples/hello/hello_directory_dialog.rb +60 -0
- data/samples/hello/hello_expand_bar.rb +110 -0
- data/samples/hello/hello_file_dialog.rb +60 -0
- data/samples/hello/hello_list_multi_selection.rb +23 -23
- data/samples/hello/hello_list_single_selection.rb +18 -17
- data/samples/hello/hello_radio.rb +108 -0
- data/samples/hello/hello_radio_group.rb +84 -0
- data/samples/hello/hello_styled_text.rb +138 -0
- data/samples/hello/hello_world.rb +4 -4
- metadata +23 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 355a2721d685e2440ad536721df4f543e292e0cf76c2b0740bbe3413eced552c
|
4
|
+
data.tar.gz: 4829dc246b8af10a25cd93050d8866b7bb9be01adab985af3553327216dc98c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4d965caa8a53d051328d04dd65261d4cd80a37b64ddd8d8bf30ddeb569673f4ad0bf4be78e2fb8dd3a09776d780862c5d6561cadcb80a601b2900674e54a36e
|
7
|
+
data.tar.gz: '06994b5fbc21286770e6cf422d208a2ecfa929b485ffce27c80789250a58452ca98e9bcef825aefe748de15f57da7833c98e0848580f4be26297cd811037bfd8'
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,43 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
### 4.17.8.0
|
4
|
+
|
5
|
+
- Officially Support SWT FileDialog with the `file_dialog` keyword (was unofficially supported before via standard SWT)
|
6
|
+
- Officially Support SWT DirectoryDialog with the `directory_dialog` keyword (was unofficially supported before via standard SWT)
|
7
|
+
- Hello, File Dialog! Sample
|
8
|
+
- Hello, Directory Dialog! Sample
|
9
|
+
- Prevent tree items data-binding from updating if no tree data change occurred
|
10
|
+
- Performance optimization for `code_text` syntax highlighting through caching
|
11
|
+
|
12
|
+
### 4.17.7.0
|
13
|
+
|
14
|
+
- `checkbox_group` built-in custom widget
|
15
|
+
- Hello, Checkbox Group! Sample
|
16
|
+
- Refactor `radio_group` to render labels instead of relying on radio button text since they are better stylable
|
17
|
+
- Refactor Glimmer Meta-Sample to use `radio_group` instead of `radio`
|
18
|
+
- Fix issue with ExpandBar fill_layout with the extra element at the end (remove it)
|
19
|
+
|
20
|
+
### 4.17.6.0
|
21
|
+
|
22
|
+
- New `radio_group` built-in Glimmer custom widget
|
23
|
+
- Hello, Radio! Sample
|
24
|
+
- Hello, Radio Group! Sample
|
25
|
+
- Hello, Checkbox! Sample
|
26
|
+
|
27
|
+
### 4.17.5.0
|
28
|
+
|
29
|
+
- Support auto-scaling by aspect ratio of width and height (write specs)
|
30
|
+
- Support SWT ExpandBar via expand_bar keyword
|
31
|
+
- Hello, Expand Bar! Sample
|
32
|
+
- Hello, Styled Text! Sample
|
33
|
+
- Use expand_bar in Glimmer Meta-Sample
|
34
|
+
|
35
|
+
### 4.17.4.2
|
36
|
+
|
37
|
+
- Support StyledText data-binding of caret_offset, selection_count, selection, top_index, and top_pixel, useful for code_text
|
38
|
+
- Support `width, height` hash options for ImageProxy and image properties on widgets
|
39
|
+
- Default SWT styles for tool_bar (:border) and tool_item (:push)
|
40
|
+
|
3
41
|
### 4.17.4.1
|
4
42
|
|
5
43
|
- Optimize code_text line style listener algorithm or avoid setting code_text style via listener for performance reasons
|
@@ -109,7 +147,7 @@
|
|
109
147
|
|
110
148
|
- Add User Profile sample from DZone article
|
111
149
|
- Colored Ruby syntax highlighting for sample:code and sample:run tasks courtesy of tty-markdown
|
112
|
-
- Support `check` as alias to `checkbox` DSL keyword for Button widget with :check style.
|
150
|
+
- Support `check` as alias to `checkbox` DSL keyword for Button widget with :check style.
|
113
151
|
- Validate scaffolded custom shell gem name to ensure it doesn't clash with a built in Ruby method
|
114
152
|
- GLIMMER_LOGGER_ASYNC env var for disabling async logging when needed for immediate troubleshooting purposes
|
115
153
|
- Fix issue with table equivalent sort edge case (that is two sorts that are equivalent causing an infinite loop of resorting since the table is not correctly identified as sorted already)
|
@@ -308,7 +346,7 @@
|
|
308
346
|
## 0.1.3
|
309
347
|
|
310
348
|
- Added 'org.eclipse.swt.dnd' to glimmer auto-included Java packages
|
311
|
-
- Updated Tic Tac Toe sample to use new `message_box` keyword
|
349
|
+
- Updated Tic Tac Toe sample to use new `message_box` keyword
|
312
350
|
- Add DragSource and DropTarget transfer expression that takes a symbol or symbol array representing one or more of the following: FileTransfer, HTMLTransfer, ImageTransfer, RTFTransfer, TextTransfer, URLTransfer
|
313
351
|
- Set default style DND::DROP_COPY in DragSource and DropTarget widgets
|
314
352
|
- Support Glimmer::SWT::DNDProxy for handling Drop & Drop styles
|
@@ -328,4 +366,4 @@
|
|
328
366
|
|
329
367
|
## 0.1.0
|
330
368
|
|
331
|
-
- Extracted Glimmer DSL for SWT (glimmer-dsl-swt gem) from Glimmer
|
369
|
+
- Extracted Glimmer DSL for SWT (glimmer-dsl-swt gem) from Glimmer
|
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.17.
|
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.17.8.0
|
2
2
|
## JRuby Desktop Development GUI Library
|
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,11 +10,15 @@
|
|
10
10
|
|
11
11
|
(The Original Glimmer Library Since 2007. Beware of Imitators!)
|
12
12
|
|
13
|
-
[
|
13
|
+
[Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer) is a native-GUI cross-platform desktop development library written in [JRuby](https://www.jruby.org/), an OS-threaded faster version of [Ruby](https://www.ruby-lang.org/en/). [Glimmer](https://github.com/AndyObtiva/glimmer)'s main innovation is a declarative [Ruby DSL](#glimmer-dsl-syntax) that enables productive and efficient authoring of desktop application user-interfaces while 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](#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. To get started quickly, [Glimmer](https://rubygems.org/gems/glimmer) offers [scaffolding](#scaffolding) options for [Apps](#in-production), [Gems](#custom-shell-gem), and [Custom Widgets](#custom-widgets). [Glimmer](https://rubygems.org/gems/glimmer) also includes native-executable [packaging](#packaging--distribution) 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) + [App Store](https://developer.apple.com/macos/distribution/), MSI/EXE files on [Windows](https://www.microsoft.com/en-ca/windows), and [Gem Packaged Shell Scripts](#custom-shell-gem) on [Linux](https://www.linux.org/).
|
14
14
|
|
15
15
|
[Glimmer receives two updates per month](https://rubygems.org/gems/glimmer-dsl-swt/versions). You can trust [Glimmer](https://rubygems.org/gems/glimmer) with your Ruby desktop GUI development needs. Please make [Glimmer](https://rubygems.org/gems/glimmer) even better by providing feedback and [contributing](#contributing) when possible.
|
16
16
|
|
17
|
-
|
17
|
+
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.
|
18
|
+
|
19
|
+
[Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) versions 4.17.x.y come with [SWT 4.17](https://download.eclipse.org/eclipse/downloads/drops4/R-4.17-202009021800/), which was released on September 2, 2020.
|
20
|
+
|
21
|
+
[<img src="https://covers.oreillystatic.com/images/9780596519650/lrg.jpg" width=105 /><br />
|
18
22
|
Featured in<br />JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do)
|
19
23
|
|
20
24
|
Glimmer DSL gems:
|
@@ -249,7 +253,7 @@ Glimmer App:
|
|
249
253
|
- [Glimmer Command](#glimmer-command)
|
250
254
|
- [Basic Usage](#basic-usage)
|
251
255
|
- [Advanced Usage](#advanced-usage)
|
252
|
-
- [Samples](#samples)
|
256
|
+
- [Glimmer Samples](#glimmer-samples)
|
253
257
|
- [Scaffolding](#scaffolding)
|
254
258
|
- [App](#app)
|
255
259
|
- [Desktopify](#desktopify)
|
@@ -282,6 +286,7 @@ Glimmer App:
|
|
282
286
|
- [Color](#color)
|
283
287
|
- [Font](#font)
|
284
288
|
- [Image](#image)
|
289
|
+
- [Image Options](#image-options)
|
285
290
|
- [Cursor](#cursor)
|
286
291
|
- [Layouts](#layouts)
|
287
292
|
- [Layout Data](#layout-data)
|
@@ -340,6 +345,12 @@ Glimmer App:
|
|
340
345
|
- [Hello, Custom Widget!](#hello-custom-widget)
|
341
346
|
- [Hello, Custom Shell!](#hello-custom-shell)
|
342
347
|
- [Hello, Sash Form!](#hello-sash-form)
|
348
|
+
- [Hello, Styled Text!](#hello-styled-text)
|
349
|
+
- [Hello, Expand Bar!](#hello-expand-bar)
|
350
|
+
- [Hello, Radio!](#hello-radio)
|
351
|
+
- [Hello, Radio Group!](#hello-radio-group)
|
352
|
+
- [Hello, Checkbox!](#hello-checkbox)
|
353
|
+
- [Hello, Checkbox Group!](#hello-checkbox-group)
|
343
354
|
- [Elaborate Samples](#elaborate-samples)
|
344
355
|
- [User Profile](#user-profile)
|
345
356
|
- [Login](#login)
|
@@ -423,7 +434,7 @@ Otherwise, Option 2 ([Bundler](#option-2-bundler)) can be followed in rare cases
|
|
423
434
|
|
424
435
|
Note: if you encounter any [issues](https://github.com/AndyObtiva/glimmer-dsl-swt/issues), please [report](https://github.com/AndyObtiva/glimmer-dsl-swt/issues) and then install a previous version instead from the list of [Glimmer Releases](https://rubygems.org/gems/glimmer-dsl-swt/versions).
|
425
436
|
|
426
|
-
### Option 1: Direct Install
|
437
|
+
### Option 1: Direct Install
|
427
438
|
(Use for [Scaffolding](#scaffolding))
|
428
439
|
|
429
440
|
Run this command to install directly:
|
@@ -433,12 +444,10 @@ jgem install glimmer-dsl-swt
|
|
433
444
|
|
434
445
|
Or this command if you want a specific version:
|
435
446
|
```
|
436
|
-
jgem install glimmer-dsl-swt -v 4.17.
|
447
|
+
jgem install glimmer-dsl-swt -v 4.17.8.0
|
437
448
|
```
|
438
449
|
|
439
|
-
|
440
|
-
|
441
|
-
`jgem` is JRuby's version of `gem` command.
|
450
|
+
`jgem` is JRuby's version of `gem` command.
|
442
451
|
RVM allows running `gem install` directly as an alias.
|
443
452
|
Otherwise, you may also run `jruby -S gem install ...`
|
444
453
|
|
@@ -448,7 +457,7 @@ Otherwise, if you are ready to build a Glimmer app, you can jump to the [Glimmer
|
|
448
457
|
|
449
458
|
Note: if you're using activerecord or activesupport, keep in mind that Glimmer unhooks ActiveSupport::Dependencies as it does not rely on it.
|
450
459
|
|
451
|
-
### Option 2: Bundler
|
460
|
+
### Option 2: Bundler
|
452
461
|
(Use for Manual App Creation)
|
453
462
|
|
454
463
|
Add the following to `Gemfile`:
|
@@ -475,7 +484,7 @@ You can bring up usage instructions by running the `glimmer` command without arg
|
|
475
484
|
glimmer
|
476
485
|
```
|
477
486
|
|
478
|
-
On Mac and Linux, it additionally brings up a TUI (Text-based User Interface) for interactive navigation and execution of Glimmer tasks (courtesy of [rake-tui](https://github.com/AndyObtiva/rake-tui)).
|
487
|
+
On Mac and Linux, it additionally brings up a TUI (Text-based User Interface) for interactive navigation and execution of Glimmer tasks (courtesy of [rake-tui](https://github.com/AndyObtiva/rake-tui)).
|
479
488
|
|
480
489
|
On Windows, it simply lists the available Glimmer tasks at the end (courtsey of [rake](https://github.com/ruby/rake)).
|
481
490
|
|
@@ -511,13 +520,13 @@ bin/glimmer samples
|
|
511
520
|
Below are the full usage instructions that come up when running `glimmer` without args.
|
512
521
|
|
513
522
|
```
|
514
|
-
Glimmer (Ruby Desktop Development GUI Library) - JRuby Gem: glimmer-dsl-swt v4.17.
|
523
|
+
Glimmer (Ruby Desktop Development GUI Library) - JRuby Gem: glimmer-dsl-swt v4.17.8.0
|
515
524
|
|
516
525
|
Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
|
517
526
|
|
518
|
-
Runs Glimmer applications and tasks.
|
527
|
+
Runs Glimmer applications and tasks.
|
519
528
|
|
520
|
-
When applications are specified, they are run using JRuby,
|
529
|
+
When applications are specified, they are run using JRuby,
|
521
530
|
automatically preloading the glimmer Ruby gem and SWT jar dependency.
|
522
531
|
|
523
532
|
Optionally, extra Glimmer options, JRuby options, and/or environment variables may be passed in.
|
@@ -540,11 +549,11 @@ Select a Glimmer task to run: (Press ↑/↓ arrow to move, Enter to select and
|
|
540
549
|
glimmer package[type] # Package app for distribution (generating config, jar, and native files) (type is optional)
|
541
550
|
glimmer package:clean # Clean by removing "dist" and "packages" directories
|
542
551
|
glimmer package:config # Generate JAR config file
|
543
|
-
glimmer package:gemspec # Generate gemspec
|
552
|
+
glimmer package:gemspec # Generate gemspec
|
544
553
|
glimmer package:jar # Generate JAR file
|
545
554
|
glimmer package:lock_jars # Lock JARs
|
546
555
|
glimmer package:native[type] # Generate Native files
|
547
|
-
glimmer run[app_path] # Runs Glimmer app or custom shell gem in the current directory, unless app_path is specified, then runs it instead (app_path is optional)
|
556
|
+
glimmer run[app_path] # Runs Glimmer app or custom shell gem in the current directory, unless app_path is specified, then runs it instead (app_path is optional)
|
548
557
|
glimmer samples # Brings up the Glimmer Meta-Sample app to allow browsing, running, and viewing code of Glimmer samples
|
549
558
|
glimmer scaffold[app_name] # Scaffold Glimmer application directory structure to build a new app
|
550
559
|
glimmer scaffold:customshell[name,namespace] # Scaffold Glimmer::UI::CustomShell subclass (full window view) under app/views (namespace is optional) [alt: scaffold:cs]
|
@@ -584,10 +593,10 @@ This brings up the [Glimmer Meta-Sample (The Sample of Samples)](#samples):
|
|
584
593
|
Glimmer borrows from Rails the idea of Scaffolding, that is generating a structure for your app files that
|
585
594
|
helps you get started just like true building scaffolding helps construction workers, civil engineers, and architects.
|
586
595
|
|
587
|
-
Glimmer scaffolding goes beyond just scaffolding the app files that Rails does. It also packages it and launches it,
|
596
|
+
Glimmer scaffolding goes beyond just scaffolding the app files that Rails does. It also packages it and launches it,
|
588
597
|
getting you to a running and delivered state of an advanced "Hello, World!" Glimmer application right off the bat.
|
589
598
|
|
590
|
-
This should greatly facilitate building a new Glimmer app by helping you be productive and focus on app details while
|
599
|
+
This should greatly facilitate building a new Glimmer app by helping you be productive and focus on app details while
|
591
600
|
letting Glimmer scaffolding take care of initial app file structure concerns, such as adding:
|
592
601
|
- Main application class that includes Glimmer (`app/{app_name}.rb`)
|
593
602
|
- Main application view that houses main window content, menu, about dialog, and preferences dialog
|
@@ -602,7 +611,7 @@ You need to have your Git `user.name` and `github.user` configured before scaffo
|
|
602
611
|
|
603
612
|
#### App
|
604
613
|
|
605
|
-
Before you start, make sure you are in a JRuby environment with Glimmer gem installed as per "Direct Install" pre-requisites.
|
614
|
+
Before you start, make sure you are in a JRuby environment with Glimmer gem installed as per "Direct Install" pre-requisites.
|
606
615
|
|
607
616
|
To scaffold a Glimmer app from scratch, run the following command:
|
608
617
|
|
@@ -622,18 +631,18 @@ You should see output like the following:
|
|
622
631
|
|
623
632
|
```
|
624
633
|
$ glimmer scaffold[greeter]
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
634
|
+
create .gitignore
|
635
|
+
create Rakefile
|
636
|
+
create Gemfile
|
637
|
+
create LICENSE.txt
|
638
|
+
create README.rdoc
|
639
|
+
create .document
|
640
|
+
create lib
|
641
|
+
create lib/greeter.rb
|
642
|
+
create spec
|
643
|
+
create spec/spec_helper.rb
|
644
|
+
create spec/greeter_spec.rb
|
645
|
+
create .rspec
|
637
646
|
Juwelier has prepared your gem in ./greeter
|
638
647
|
Created greeter/.gitignore
|
639
648
|
Created greeter/.ruby-version
|
@@ -696,7 +705,7 @@ The app even remembers your cookies if you log into the website, close the app,
|
|
696
705
|
|
697
706
|
Note that on Linux, the default SWT browser, which runs on webkit, does not support HTML5 Video out of the box. If you need video support, open `Gemfile` after scaffolding and enable the line that has the `glimmer-cw-browser-chromium` gem then replace the `browser` in "app/views/snowboard_utah/app_view.rb" with `browser(:chromium)`
|
698
707
|
|
699
|
-
Before you start, make sure you are in a JRuby environment with Glimmer gem installed as per "Direct Install" pre-requisites.
|
708
|
+
Before you start, make sure you are in a JRuby environment with Glimmer gem installed as per "Direct Install" pre-requisites.
|
700
709
|
|
701
710
|
To scaffold a Glimmer desktopify app from scratch, run the following command:
|
702
711
|
|
@@ -731,15 +740,15 @@ Successfully installed github_api-0.19.0
|
|
731
740
|
Successfully installed nokogiri-1.10.10-java
|
732
741
|
Successfully installed juwelier-2.4.9
|
733
742
|
7 gems installed
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
+
create .gitignore
|
744
|
+
create Rakefile
|
745
|
+
create Gemfile
|
746
|
+
create LICENSE.txt
|
747
|
+
create README.markdown
|
748
|
+
create .document
|
749
|
+
create lib
|
750
|
+
create lib/snowboard_utah.rb
|
751
|
+
create .rspec
|
743
752
|
Juwelier has prepared your gem in ./snowboard_utah
|
744
753
|
Created snowboard_utah/.gitignore
|
745
754
|
Created snowboard_utah/.ruby-version
|
@@ -811,8 +820,8 @@ glimmer scaffold:cw[name]
|
|
811
820
|
|
812
821
|
#### Custom Shell Gem
|
813
822
|
|
814
|
-
Custom shell gems are self-contained Glimmer apps as well as reusable custom shells.
|
815
|
-
They have everything scaffolded Glimmer apps come with in addition to gem content like a [Juwelier](https://rubygems.org/gems/juwelier) Rakefile that can build gemspec and release gems.
|
823
|
+
Custom shell gems are self-contained Glimmer apps as well as reusable custom shells.
|
824
|
+
They have everything scaffolded Glimmer apps come with in addition to gem content like a [Juwelier](https://rubygems.org/gems/juwelier) Rakefile that can build gemspec and release gems.
|
816
825
|
Unlike scaffolded Glimmer apps, custom shell gem content lives under the `lib` directory (not `app`).
|
817
826
|
They can be packaged as both a native executable (e.g. Mac DMG/PKG/APP) and a Ruby gem.
|
818
827
|
Of course, you can just build a Ruby gem and disregard native executable packaging if you do not need it.
|
@@ -839,7 +848,7 @@ Since custom shell gems are both an app and a gem, they provide two ways to run:
|
|
839
848
|
- Run the `glimmer` command and pass it the generated script under the `bin` directory that matches the gem name (e.g. run `glimmer bin/glimmer-cs-calculator`)
|
840
849
|
- Run the executable shell script that ships with the gem directly (does not need the `glimmer` command). It intentionally has a shorter name for convenience since it is meant to be used on the command line (not in a package), so you can leave out the `glimmer-cs-` prefix (e.g. run `bin/calculator` directly). This is also used as the main way of running custom shell gems on Linux.
|
841
850
|
|
842
|
-
Examples:
|
851
|
+
Examples:
|
843
852
|
|
844
853
|
- [glimmer-cs-gladiator](https://github.com/AndyObtiva/glimmer-cs-gladiator): Gladiator (Glimmer Editor)
|
845
854
|
- [glimmer-cs-calculator](https://github.com/AndyObtiva/glimmer-cs-calculator): Glimmer Calculator
|
@@ -865,7 +874,7 @@ The Ruby gem name will follow the convention "glimmer-cw-customwidgetname-namesp
|
|
865
874
|
|
866
875
|
Only official Glimmer gems created by the Glimmer project committers will have no namespace (e.g. [glimmer-cw-video](https://rubygems.org/gems/glimmer-cw-video) Ruby gem)
|
867
876
|
|
868
|
-
Examples:
|
877
|
+
Examples:
|
869
878
|
|
870
879
|
- [glimmer-cw-video](https://github.com/AndyObtiva/glimmer-cw-video): Video Widget
|
871
880
|
- [glimmer-cw-cdatetime-nebula](https://github.com/AndyObtiva/glimmer-cw-cdatetime-nebula): Nebula CDateTime Widget
|
@@ -900,11 +909,11 @@ Output:
|
|
900
909
|
|
901
910
|
Glimmer Custom Shell Gems at rubygems.org:
|
902
911
|
|
903
|
-
Name Gem Version Author Description
|
912
|
+
Name Gem Version Author Description
|
904
913
|
|
905
|
-
Calculator glimmer-cs-calculator 1.0.2 Andy Maleh Calculator - Glimmer Custom Shell
|
906
|
-
Gladiator glimmer-cs-gladiator 0.2.4 Andy Maleh Gladiator (Glimmer Editor) - Glimmer Custom Shell
|
907
|
-
Timer glimmer-cs-timer 1.0.0 Andy Maleh Timer - Glimmer Custom Shell
|
914
|
+
Calculator glimmer-cs-calculator 1.0.2 Andy Maleh Calculator - Glimmer Custom Shell
|
915
|
+
Gladiator glimmer-cs-gladiator 0.2.4 Andy Maleh Gladiator (Glimmer Editor) - Glimmer Custom Shell
|
916
|
+
Timer glimmer-cs-timer 1.0.0 Andy Maleh Timer - Glimmer Custom Shell
|
908
917
|
|
909
918
|
```
|
910
919
|
|
@@ -936,9 +945,9 @@ Output:
|
|
936
945
|
|
937
946
|
Glimmer Custom Widget Gems matching [video] at rubygems.org:
|
938
947
|
|
939
|
-
Name Gem Version Author Description
|
948
|
+
Name Gem Version Author Description
|
940
949
|
|
941
|
-
Video glimmer-cw-video 1.0.0 Andy Maleh Glimmer Custom Widget - Video
|
950
|
+
Video glimmer-cw-video 1.0.0 Andy Maleh Glimmer Custom Widget - Video
|
942
951
|
|
943
952
|
```
|
944
953
|
|
@@ -956,11 +965,11 @@ Output:
|
|
956
965
|
|
957
966
|
Glimmer Custom Widget Gems at rubygems.org:
|
958
967
|
|
959
|
-
Name Gem Version Author Description
|
968
|
+
Name Gem Version Author Description
|
960
969
|
|
961
|
-
Browser (Chromium) glimmer-cw-browser-chromium 1.0.0 Andy Maleh Chromium Browser - Glimmer Custom Widget
|
962
|
-
Cdatetime (Nebula) glimmer-cw-cdatetime-nebula 1.5.0.0.1 Andy Maleh Nebula CDateTime Widget - Glimmer Custom Widget
|
963
|
-
Video glimmer-cw-video 1.0.0 Andy Maleh Glimmer Custom Widget - Video
|
970
|
+
Browser (Chromium) glimmer-cw-browser-chromium 1.0.0 Andy Maleh Chromium Browser - Glimmer Custom Widget
|
971
|
+
Cdatetime (Nebula) glimmer-cw-cdatetime-nebula 1.5.0.0.1 Andy Maleh Nebula CDateTime Widget - Glimmer Custom Widget
|
972
|
+
Video glimmer-cw-video 1.0.0 Andy Maleh Glimmer Custom Widget - Video
|
964
973
|
|
965
974
|
```
|
966
975
|
|
@@ -984,13 +993,13 @@ Output:
|
|
984
993
|
|
985
994
|
Glimmer DSL Gems at rubygems.org:
|
986
995
|
|
987
|
-
Name Gem Version Author Description
|
996
|
+
Name Gem Version Author Description
|
988
997
|
|
989
|
-
Css glimmer-dsl-css 1.1.0 AndyMaleh Glimmer DSL for CSS
|
990
|
-
Opal glimmer-dsl-opal 0.4.0 AndyMaleh Glimmer DSL for Opal
|
991
|
-
Swt glimmer-dsl-swt 4.17.
|
992
|
-
Tk glimmer-dsl-tk 0.0.6 AndyMaleh Glimmer DSL for Tk
|
993
|
-
Xml glimmer-dsl-xml 1.1.0 AndyMaleh Glimmer DSL for XML
|
998
|
+
Css glimmer-dsl-css 1.1.0 AndyMaleh Glimmer DSL for CSS
|
999
|
+
Opal glimmer-dsl-opal 0.4.0 AndyMaleh Glimmer DSL for Opal
|
1000
|
+
Swt glimmer-dsl-swt 4.17.8.0 AndyMaleh Glimmer DSL for SWT
|
1001
|
+
Tk glimmer-dsl-tk 0.0.6 AndyMaleh Glimmer DSL for Tk
|
1002
|
+
Xml glimmer-dsl-xml 1.1.0 AndyMaleh Glimmer DSL for XML
|
994
1003
|
```
|
995
1004
|
|
996
1005
|
### Packaging
|
@@ -1133,7 +1142,7 @@ Static keywords are pre-identified keywords in the Glimmer DSL, such as `shell`,
|
|
1133
1142
|
|
1134
1143
|
Dynamic keywords are dynamically figured out from currently imported (aka required/loaded) SWT widgets and custom widgets. Examples are: `label`, `combo`, and `list` for SWT widgets and `c_date_time`, `video`, and `gantt_chart` for custom widgets.
|
1135
1144
|
|
1136
|
-
The only reason to distinguish between the two is to realize that importing new Glimmer [custom widgets](#custom-widgets) and Java SWT custom widget libraries automatically expands Glimmer's DSL vocabulary with new dynamic keywords.
|
1145
|
+
The only reason to distinguish between the two is to realize that importing new Glimmer [custom widgets](#custom-widgets) and Java SWT custom widget libraries automatically expands Glimmer's DSL vocabulary with new dynamic keywords.
|
1137
1146
|
|
1138
1147
|
For example, if a project adds this custom Java SWT library from the [Nebula Project](https://www.eclipse.org/nebula/):
|
1139
1148
|
|
@@ -1385,10 +1394,10 @@ message_box {
|
|
1385
1394
|
|
1386
1395
|
#### Display
|
1387
1396
|
|
1388
|
-
The SWT `Display` class is a singleton in Glimmer. It is used in SWT to represent your display device, allowing you to manage GUI globally
|
1397
|
+
The SWT `Display` class is a singleton in Glimmer. It is used in SWT to represent your display device, allowing you to manage GUI globally
|
1389
1398
|
and access available monitors. Additionally, it is responsible for the SWT event loop, which runs on the first thread the Glimmer application starts on. In multi-threaded programming, `Display` provides the methods `async_exec` and `sync_exec` to enable enqueuing GUI changes asynchronously or synchronously from threads other than the main (first) thread since direct GUI changes are forbidden from other threads by design.
|
1390
1399
|
|
1391
|
-
`Display` is automatically instantiated upon first instantiation of a `shell` widget.
|
1400
|
+
`Display` is automatically instantiated upon first instantiation of a `shell` widget.
|
1392
1401
|
|
1393
1402
|
Alternatively, for advanced use cases, a `Display` can be created explicitly with the Glimmer `display` keyword. When a `shell` is later declared, it
|
1394
1403
|
automatically uses the `display` created earlier without having to explicitly hook it.
|
@@ -1404,7 +1413,7 @@ automatically uses the `display` created earlier without having to explicitly ho
|
|
1404
1413
|
@shell = shell { # uses display created above
|
1405
1414
|
}
|
1406
1415
|
```
|
1407
|
-
The benefit of instantiating an SWT Display explicitly is to set [Properties](#widget-properties) or [Observers](#observer).
|
1416
|
+
The benefit of instantiating an SWT Display explicitly is to set [Properties](#widget-properties) or [Observers](#observer).
|
1408
1417
|
Although SWT Display is not technically a widget, it has similar APIs and DSL support.
|
1409
1418
|
|
1410
1419
|
#### Multi-Threading
|
@@ -1626,8 +1635,8 @@ https://help.eclipse.org/2019-12/nftopic/org.eclipse.platform.doc.isv/reference/
|
|
1626
1635
|
|
1627
1636
|
When building a widget-related SWT object manually (e.g. `GridData.new(...)`), you are expected to use `SWT::CONSTANT` directly or BIT-OR a few SWT constants together like `SWT::BORDER | SWT::V_SCROLL`.
|
1628
1637
|
|
1629
|
-
Glimmer facilitates that with `swt` keyword by allowing you to pass multiple styles as an argument array of symbols instead of dealing with BIT-OR.
|
1630
|
-
Example:
|
1638
|
+
Glimmer facilitates that with `swt` keyword by allowing you to pass multiple styles as an argument array of symbols instead of dealing with BIT-OR.
|
1639
|
+
Example:
|
1631
1640
|
|
1632
1641
|
```ruby
|
1633
1642
|
style = swt(:border, :v_scroll)
|
@@ -1635,7 +1644,7 @@ style = swt(:border, :v_scroll)
|
|
1635
1644
|
|
1636
1645
|
#### Negative SWT Style Bits
|
1637
1646
|
|
1638
|
-
In rare occasions, you might need to apply & with a negative (not) style bit to negate it from another style bit that includes it.
|
1647
|
+
In rare occasions, you might need to apply & with a negative (not) style bit to negate it from another style bit that includes it.
|
1639
1648
|
Glimmer facilitates that by declaring the negative style bit via postfixing a symbol with `!`.
|
1640
1649
|
|
1641
1650
|
Example:
|
@@ -1644,13 +1653,13 @@ Example:
|
|
1644
1653
|
style = swt(:shell_trim, :max!) # creates a shell trim style without the maximize button (negated)
|
1645
1654
|
```
|
1646
1655
|
|
1647
|
-
#### Extra SWT Styles
|
1656
|
+
#### Extra SWT Styles
|
1648
1657
|
|
1649
1658
|
##### Non-resizable Window
|
1650
1659
|
|
1651
1660
|
SWT Shell widget by default is resizable. To make it non-resizable, one must pass a complicated style bit concoction like `swt(:shell_trim, :resize!, :max!)`.
|
1652
1661
|
|
1653
|
-
Glimmer makes this easier by alternatively offering a `:no_resize` extra SWT style, added for convenience.
|
1662
|
+
Glimmer makes this easier by alternatively offering a `:no_resize` extra SWT style, added for convenience.
|
1654
1663
|
This makes declaring a non-resizable window as easy as:
|
1655
1664
|
|
1656
1665
|
```ruby
|
@@ -1784,6 +1793,23 @@ Glimmer recently included **EXPERIMENTAL** gif animation support for the `backgr
|
|
1784
1793
|
|
1785
1794
|
Learn more about images in general at this SWT Image guide: https://www.eclipse.org/articles/Article-SWT-images/graphics-resources.html
|
1786
1795
|
|
1796
|
+
#### Image Options
|
1797
|
+
|
1798
|
+
Options may be passed in a hash at the end of `image` arguments:
|
1799
|
+
|
1800
|
+
- `width`: width of image
|
1801
|
+
- `height`: height of image
|
1802
|
+
|
1803
|
+
If only the width or height alone are specified, the other is calculated while maintaining the image aspect ratio.
|
1804
|
+
|
1805
|
+
Example:
|
1806
|
+
|
1807
|
+
```
|
1808
|
+
label {
|
1809
|
+
image 'someimage.png', width: 400, height: 300
|
1810
|
+
}
|
1811
|
+
```
|
1812
|
+
|
1787
1813
|
### Cursor
|
1788
1814
|
|
1789
1815
|
SWT widget `cursor` property represents the mouse cursor you see on the screen when you hover over that widget.
|
@@ -1796,7 +1822,7 @@ Example:
|
|
1796
1822
|
|
1797
1823
|
```ruby
|
1798
1824
|
shell {
|
1799
|
-
minimum_size 128, 128
|
1825
|
+
minimum_size 128, 128
|
1800
1826
|
cursor :appstarting
|
1801
1827
|
}
|
1802
1828
|
```
|
@@ -2185,7 +2211,7 @@ It assumes you have defined the table columns via `table_column` widget.
|
|
2185
2211
|
Example:
|
2186
2212
|
|
2187
2213
|
```ruby
|
2188
|
-
shell {
|
2214
|
+
shell {
|
2189
2215
|
@table = table {
|
2190
2216
|
table_column {
|
2191
2217
|
text "Name"
|
@@ -2203,13 +2229,13 @@ shell {
|
|
2203
2229
|
selection bind(group, :selected_person)
|
2204
2230
|
on_mouse_up { |event|
|
2205
2231
|
@table.edit_table_item(event.table_item, event.column_index)
|
2206
|
-
}
|
2232
|
+
}
|
2207
2233
|
}
|
2208
2234
|
}
|
2209
2235
|
```
|
2210
2236
|
|
2211
2237
|
The code above includes two data-bindings:
|
2212
|
-
- Table `items`, which first bind to the model collection property (group.people), and then maps each column property (name, age, adult) for displaying each table item column.
|
2238
|
+
- Table `items`, which first bind to the model collection property (group.people), and then maps each column property (name, age, adult) for displaying each table item column.
|
2213
2239
|
- Table `selection`, which binds the single table item selected by the user to the attribute denoted by the `bind` keyword (or binds multiple table items selected for a table with `:multi` SWT style)
|
2214
2240
|
- The `on_mouse_up` event handler invokes `@table.edit_table_item(event.table_item, event.column_index)` to start edit mode on the clicked table item cell, and then saves or cancel depending on whether the user hits ENTER or ESC once done editing (or focus-out after either making a change or not making any changes.)
|
2215
2241
|
|
@@ -2226,16 +2252,16 @@ found_array = @table.search { |table_item| table_item.getData == company.owner }
|
|
2226
2252
|
|
2227
2253
|
This finds a person. The array is a Java array. This enables easy passing of it to SWT `Table#setSelection` method, which expects a Java array of `TableItem` objects.
|
2228
2254
|
|
2229
|
-
To edit a table, you must invoke `TableProxy#edit_selected_table_item(column_index, before_write: nil, after_write: nil, after_cancel: nil)` or `TableProxy#edit_table_item(table_item, column_index, before_write: nil, after_write: nil, after_cancel: nil)`.
|
2230
|
-
This automatically leverages the SWT TableEditor custom class behind the scenes, displaying a text widget to the user to change the selected or
|
2231
|
-
passed table item text into something else.
|
2255
|
+
To edit a table, you must invoke `TableProxy#edit_selected_table_item(column_index, before_write: nil, after_write: nil, after_cancel: nil)` or `TableProxy#edit_table_item(table_item, column_index, before_write: nil, after_write: nil, after_cancel: nil)`.
|
2256
|
+
This automatically leverages the SWT TableEditor custom class behind the scenes, displaying a text widget to the user to change the selected or
|
2257
|
+
passed table item text into something else.
|
2232
2258
|
It automatically persists the change to `items` data-bound model on ENTER/FOCUS-OUT or cancels on ESC/NO-CHANGE.
|
2233
2259
|
|
2234
2260
|
##### Table Sorting
|
2235
2261
|
|
2236
|
-
Glimmer automatically adds sorting support to the SWT `Table` widget.
|
2262
|
+
Glimmer automatically adds sorting support to the SWT `Table` widget.
|
2237
2263
|
|
2238
|
-
Check out the [Contact Manager](#contact-manager) sample for an example.
|
2264
|
+
Check out the [Contact Manager](#contact-manager) sample for an example.
|
2239
2265
|
You may click on any column and it will sort by ascending order first and descending if you click again.
|
2240
2266
|
|
2241
2267
|
Glimmer automatic table sorting supports `String`, `Integer`, and `Float` columns out of the box as well as any column data that is comparable.
|
@@ -2243,7 +2269,7 @@ Glimmer automatic table sorting supports `String`, `Integer`, and `Float` column
|
|
2243
2269
|
In cases where data is nil, depending on the data-type, it is automatically converted to `Float` with `to_f`, `Integer` with `to_i`, or `String` with `to_s`.
|
2244
2270
|
|
2245
2271
|
Should you have a special data type that could not be compared automatically, Glimmer offers the following 3 alternatives for custom sorting:
|
2246
|
-
- `sort_property`: this may be set to an alternative property to the one data-bound to the table column. For example, a table column called 'adult', which returns `true` or `false` may be sorted with `sort_property :dob` instead. This also support multi-property (aka multi-column) sorting (e.g. `sort_property :dob, :name`).
|
2272
|
+
- `sort_property`: this may be set to an alternative property to the one data-bound to the table column. For example, a table column called 'adult', which returns `true` or `false` may be sorted with `sort_property :dob` instead. This also support multi-property (aka multi-column) sorting (e.g. `sort_property :dob, :name`).
|
2247
2273
|
- `sort_by(&block)`: this works just like Ruby `Enumerable` `sort_by`. The block receives the table column data as argument.
|
2248
2274
|
- `sort(&comparator)`: this works just like Ruby `Enumerable` `sort`. The comparator block receives two objects from the table column data.
|
2249
2275
|
|
@@ -2303,7 +2329,7 @@ This involves using the `bind` keyword mentioned above in addition to a special
|
|
2303
2329
|
Example:
|
2304
2330
|
|
2305
2331
|
```ruby
|
2306
|
-
shell {
|
2332
|
+
shell {
|
2307
2333
|
@tree = tree {
|
2308
2334
|
items bind(company, :owner), tree_properties(children: :coworkers, text: :name)
|
2309
2335
|
selection bind(company, :selected_coworker)
|
@@ -2312,7 +2338,7 @@ shell {
|
|
2312
2338
|
```
|
2313
2339
|
|
2314
2340
|
The code above includes two data-bindings:
|
2315
|
-
- Tree `items`, which first bind to the root node (company.owner), and then dig down via `coworkers` `children` method, using the `name` `text` attribute for displaying each tree item.
|
2341
|
+
- Tree `items`, which first bind to the root node (company.owner), and then dig down via `coworkers` `children` method, using the `name` `text` attribute for displaying each tree item.
|
2316
2342
|
- Tree `selection`, which binds the single tree item selected by the user to the attribute denoted by the `bind` keyword
|
2317
2343
|
|
2318
2344
|
Additionally, Tree `items` data-binding automatically stores each node model unto the SWT TreeItem object via `setData` method. This enables things like searchability.
|
@@ -2366,7 +2392,7 @@ Let's revisit the Tic Tac Toe example shown near the beginning of the page:
|
|
2366
2392
|
shell {
|
2367
2393
|
text "Tic-Tac-Toe"
|
2368
2394
|
minimum_size 150, 178
|
2369
|
-
composite {
|
2395
|
+
composite {
|
2370
2396
|
grid_layout 3, true
|
2371
2397
|
(1..3).each { |row|
|
2372
2398
|
(1..3).each { |column|
|
@@ -2416,7 +2442,7 @@ shell {
|
|
2416
2442
|
@button1.swt_widget.setVisible(false)
|
2417
2443
|
}
|
2418
2444
|
on_widget_selected {
|
2419
|
-
@button1.swt_widget.setVisible(true)
|
2445
|
+
@button1.swt_widget.setVisible(true)
|
2420
2446
|
}
|
2421
2447
|
}
|
2422
2448
|
}.open
|
@@ -2438,7 +2464,7 @@ Example (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
|
|
2438
2464
|
}
|
2439
2465
|
@shell.on_shell_iconified {
|
2440
2466
|
@shell.close
|
2441
|
-
}
|
2467
|
+
}
|
2442
2468
|
@shell.open
|
2443
2469
|
```
|
2444
2470
|
|
@@ -2560,7 +2586,7 @@ Usage:
|
|
2560
2586
|
```ruby
|
2561
2587
|
shell {
|
2562
2588
|
red_label(:center) {
|
2563
|
-
text 'Red Label'
|
2589
|
+
text 'Red Label'
|
2564
2590
|
foreground :green
|
2565
2591
|
}
|
2566
2592
|
}.open
|
@@ -2627,7 +2653,7 @@ Additionally, custom widgets can call the following class methods:
|
|
2627
2653
|
- `::options(*option_names)`: declares a list of options by taking an option name array (symbols/strings). This generates option attribute accessors (e.g. `options :orientation, :bg_color` generates `#orientation`, `#orientation=(v)`, `#bg_color`, and `#bg_color=(v)` attribute accessors)
|
2628
2654
|
- `::option(option_name, default: nil)`: declares a single option taking option name and default value as arguments (also generates attribute accessors just like `::options`)
|
2629
2655
|
|
2630
|
-
#### Content/Options Example
|
2656
|
+
#### Content/Options Example
|
2631
2657
|
|
2632
2658
|
(you may copy/paste in [`girb`](#girb-glimmer-irb-command))
|
2633
2659
|
|
@@ -2759,7 +2785,7 @@ shell { |app_shell|
|
|
2759
2785
|
app_shell.hide
|
2760
2786
|
@wizard_steps[@current_step_number - 1].open
|
2761
2787
|
end
|
2762
|
-
}
|
2788
|
+
}
|
2763
2789
|
}
|
2764
2790
|
}
|
2765
2791
|
button {
|
@@ -3053,6 +3079,55 @@ shell(:no_resize) {
|
|
3053
3079
|
|
3054
3080
|
Also, you may invoke `Display.setAppVersion('1.0.0')` if needed for OS app version identification reasons during development, replacing `'1.0.0'` with your application version.
|
3055
3081
|
|
3082
|
+
#### Checkbox Group Widget
|
3083
|
+
|
3084
|
+
`checkbox_group` (or alias `check_group`) is a Glimmer built-in custom widget that displays a list of `checkbox` buttons (`button(:check)`) based on its `items` property.
|
3085
|
+
|
3086
|
+
`checkbox_group` consists of a root `composite` (with `grid_layout 1, false` by default) that holds nested `checkbox` (`button(:check)`) widgets.
|
3087
|
+
|
3088
|
+
The `selection` property determines which `checkbox` buttons are checked. It expects an `Array` of `String` objects
|
3089
|
+
The `selection_indices` property determines which `checkbox` button indices are checked. It expects an `Array` of index `Integer` objects that are zero-based.
|
3090
|
+
The `checkboxes` property returns the list of nested `checkbox` widgets.
|
3091
|
+
|
3092
|
+
When data-binding `selection`, the model property should have a matching property with `_options` suffix (e.g. `activities_options` for `activities`) to provide an `Array` of `String` objects for `checkbox` buttons.
|
3093
|
+
|
3094
|
+
You may see an example at the [Hello, Checkbox Group!](#hello-checkbox-group) sample.
|
3095
|
+
|
3096
|
+
![Hello Checkbox Group](images/glimmer-hello-checkbox-group.png)
|
3097
|
+
|
3098
|
+
#### Radio Group Widget
|
3099
|
+
|
3100
|
+
`radio_group` is a Glimmer built-in custom widget that displays a list of `radio` buttons (`button(:radio)`) based on its `items` property, which expects an `Array` of `String` objects.
|
3101
|
+
|
3102
|
+
`radio_group` consists of a root `composite` (with `grid_layout 1, false` by default) that holds nested `radio` widgets.
|
3103
|
+
|
3104
|
+
The `selection` property determines which `radio` button is selected. It expects a `String`
|
3105
|
+
The `selection_index` property determines which `radio` button index is selected. It expects an index integer that is zero-based.
|
3106
|
+
The `radios` property returns the list of nested `radio` widgets.
|
3107
|
+
|
3108
|
+
When data-binding `selection`, the model property should have a matching property with `_options` suffix (e.g. `country_options` for `country`) to provide text for `radio` buttons.
|
3109
|
+
|
3110
|
+
This custom widget is used in the [Glimmer Meta-Sample (The Sample of Samples)](#samples):
|
3111
|
+
|
3112
|
+
![Glimmer Meta-Sample](images/glimmer-meta-sample.png)
|
3113
|
+
|
3114
|
+
Glimmer Meta-Sample Code Example:
|
3115
|
+
|
3116
|
+
```ruby
|
3117
|
+
# ...
|
3118
|
+
radio_group { |radio_group_proxy|
|
3119
|
+
row_layout(:vertical) {
|
3120
|
+
fill true
|
3121
|
+
}
|
3122
|
+
selection bind(sample_directory, :selected_sample_name)
|
3123
|
+
font height: 24
|
3124
|
+
}
|
3125
|
+
|
3126
|
+
# ...
|
3127
|
+
```
|
3128
|
+
|
3129
|
+
You may see another example at the [Hello, Radio Group!](#hello-radio-group) sample.
|
3130
|
+
|
3056
3131
|
#### Code Text Widget
|
3057
3132
|
|
3058
3133
|
`code_text` is a Glimmer built-in custom widget that displays syntax highlighted Ruby code in a customized SWT [StyledText](https://help.eclipse.org/2020-09/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/custom/StyledText.html) widget.
|
@@ -3079,7 +3154,7 @@ To use, simply use `code_text` in place of `text` or `styled_text` widget. If yo
|
|
3079
3154
|
|
3080
3155
|
[![Video Widget](images/glimmer-video-widget.png)](https://github.com/AndyObtiva/glimmer-cw-video)
|
3081
3156
|
|
3082
|
-
Glimmer supports a [video custom widget](https://github.com/AndyObtiva/glimmer-cw-video) not in SWT.
|
3157
|
+
Glimmer supports a [video custom widget](https://github.com/AndyObtiva/glimmer-cw-video) not in SWT.
|
3083
3158
|
|
3084
3159
|
You may obtain via `glimmer-cw-video` gem.
|
3085
3160
|
|
@@ -3182,7 +3257,7 @@ Glimmer configuration may be done via the `Glimmer::Config` module.
|
|
3182
3257
|
### logger
|
3183
3258
|
|
3184
3259
|
The Glimmer DSL engine supports logging via a standard `STDOUT` Ruby `Logger` configured in the `Glimmer::Config.logger` config option.
|
3185
|
-
It is set to level Logger::ERROR by default.
|
3260
|
+
It is set to level Logger::ERROR by default.
|
3186
3261
|
Log level may be adjusted via `Glimmer::Config.logger.level` just like any other Ruby Logger.
|
3187
3262
|
|
3188
3263
|
Example:
|
@@ -3224,13 +3299,13 @@ This is an array of these possible values: `:stdout` (default), `:stderr`, `:fil
|
|
3224
3299
|
|
3225
3300
|
It defaults to `[:stdout, :syslog]`
|
3226
3301
|
|
3227
|
-
When `:file` is included, Glimmer creates a 'log' directory directly below the Glimmer app local directory.
|
3302
|
+
When `:file` is included, Glimmer creates a 'log' directory directly below the Glimmer app local directory.
|
3228
3303
|
It may also be customized further via the `logging_device_file_options` option.
|
3229
3304
|
This is useful on Windows as an alternative to `syslog`, which is not available on Windows by default.
|
3230
3305
|
|
3231
3306
|
#### logging_device_file_options
|
3232
3307
|
|
3233
|
-
This is a hash of [`logging`](https://github.com/TwP/logging) gem options for the `:file` logging device.
|
3308
|
+
This is a hash of [`logging`](https://github.com/TwP/logging) gem options for the `:file` logging device.
|
3234
3309
|
|
3235
3310
|
Default: `{size: 1_000_000, age: 'daily', roll_by: 'number'}`
|
3236
3311
|
|
@@ -3248,7 +3323,7 @@ That ensures asynchronous buffered logging that is flushed every 500 messages an
|
|
3248
3323
|
|
3249
3324
|
This is a [`logging`](https://github.com/TwP/logging) gem layout that formats the logging output.
|
3250
3325
|
|
3251
|
-
Default:
|
3326
|
+
Default:
|
3252
3327
|
|
3253
3328
|
```
|
3254
3329
|
Logging.layouts.pattern(
|
@@ -3308,8 +3383,8 @@ https://github.com/jruby/jruby/wiki/CallingJavaFromJRuby
|
|
3308
3383
|
|
3309
3384
|
### loop_max_count
|
3310
3385
|
|
3311
|
-
Glimmer has infinite loop detection support.
|
3312
|
-
It can detect when an infinite loop is about to occur in method_missing and stops it.
|
3386
|
+
Glimmer has infinite loop detection support.
|
3387
|
+
It can detect when an infinite loop is about to occur in method_missing and stops it.
|
3313
3388
|
It detects potential infinite loops when the same keyword and args repeat more than 100 times, which is unusual in a GUI app.
|
3314
3389
|
|
3315
3390
|
The max limit can be changed via the `Glimmer::Config::loop_max_count=(count)` config option.
|
@@ -3587,6 +3662,90 @@ Hello, Sash Form! Red Label Maximized
|
|
3587
3662
|
|
3588
3663
|
![Hello Sash Form Red Maximized](images/glimmer-hello-sash-form-red-maximized.png)
|
3589
3664
|
|
3665
|
+
#### Hello, Styled Text!
|
3666
|
+
|
3667
|
+
This sample demonstrates the use of a `styled_text` in Glimmer.
|
3668
|
+
|
3669
|
+
Code:
|
3670
|
+
|
3671
|
+
[samples/hello/hello_styled_text.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_styled_text.rb)
|
3672
|
+
|
3673
|
+
Hello, Styled Text!
|
3674
|
+
|
3675
|
+
![Hello Styled Text](images/glimmer-hello-styled-text.png)
|
3676
|
+
|
3677
|
+
#### Hello, Expand Bar!
|
3678
|
+
|
3679
|
+
This sample demonstrates the use of a `expand_bar` and `expand_item` in Glimmer.
|
3680
|
+
|
3681
|
+
Code:
|
3682
|
+
|
3683
|
+
[samples/hello/hello_expand_bar.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_expand_bar.rb)
|
3684
|
+
|
3685
|
+
Hello, Expand Bar! All Expanded
|
3686
|
+
|
3687
|
+
![Hello Expand Bar All Expanded](images/glimmer-hello-expand-bar-all-expanded.png)
|
3688
|
+
|
3689
|
+
Hello, Expand Bar! Productivity Expanded
|
3690
|
+
|
3691
|
+
![Hello Expand Bar Productivity Expanded](images/glimmer-hello-expand-bar-productivity-expanded.png)
|
3692
|
+
|
3693
|
+
Hello, Expand Bar! Tools Expanded
|
3694
|
+
|
3695
|
+
![Hello Expand Bar Tools Expanded](images/glimmer-hello-expand-bar-tools-expanded.png)
|
3696
|
+
|
3697
|
+
Hello, Expand Bar! Reading Expanded
|
3698
|
+
|
3699
|
+
![Hello Expand Bar Reading Expanded](images/glimmer-hello-expand-bar-reading-expanded.png)
|
3700
|
+
|
3701
|
+
#### Hello, Radio!
|
3702
|
+
|
3703
|
+
This sample demonstrates the use of a `radio` (aka `button(:radio)`) in Glimmer.
|
3704
|
+
|
3705
|
+
Code:
|
3706
|
+
|
3707
|
+
[samples/hello/hello_radio.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_radio.rb)
|
3708
|
+
|
3709
|
+
Hello, Radio!
|
3710
|
+
|
3711
|
+
![Hello Radio](images/glimmer-hello-radio.png)
|
3712
|
+
|
3713
|
+
#### Hello, Radio Group!
|
3714
|
+
|
3715
|
+
This sample demonstrates the use of a `radio_group` in Glimmer, which provides terser syntax for representing multiple radio buttons by relying on data-binding to automatically spawn the `radio` widgets based on available options on the model.
|
3716
|
+
|
3717
|
+
Code:
|
3718
|
+
|
3719
|
+
[samples/hello/hello_radio_group.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_radio_group.rb)
|
3720
|
+
|
3721
|
+
Hello, Radio Group!
|
3722
|
+
|
3723
|
+
![Hello Radio Group](images/glimmer-hello-radio-group.png)
|
3724
|
+
|
3725
|
+
#### Hello, Checkbox!
|
3726
|
+
|
3727
|
+
This sample demonstrates the use of a `checkbox` (aka `check` or `button(:check)`) in Glimmer.
|
3728
|
+
|
3729
|
+
Code:
|
3730
|
+
|
3731
|
+
[samples/hello/hello_checkbox.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_checkbox.rb)
|
3732
|
+
|
3733
|
+
Hello, Checkbox!
|
3734
|
+
|
3735
|
+
![Hello Checkbox](images/glimmer-hello-checkbox.png)
|
3736
|
+
|
3737
|
+
#### Hello, Checkbox Group!
|
3738
|
+
|
3739
|
+
This sample demonstrates the use of a `checkbox_group` (aka `check_group`) in Glimmer, which provides terser syntax for representing multiple checkbox buttons (`button(:check)`) by relying on data-binding to automatically spawn the `checkbox` widgets (`button(:check)`) based on available options on the model.
|
3740
|
+
|
3741
|
+
Code:
|
3742
|
+
|
3743
|
+
[samples/hello/hello_checkbox_group.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_checkbox_group.rb)
|
3744
|
+
|
3745
|
+
Hello, Checkbox Group!
|
3746
|
+
|
3747
|
+
![Hello Checkbox Group](images/glimmer-hello-checkbox-group.png)
|
3748
|
+
|
3590
3749
|
### Elaborate Samples
|
3591
3750
|
|
3592
3751
|
For more elaborate samples, check the following:
|
@@ -3692,7 +3851,7 @@ Gladiator is a good demonstration of:
|
|
3692
3851
|
|
3693
3852
|
The following production apps have been built with Glimmer.
|
3694
3853
|
|
3695
|
-
If you have a Glimmer app you would like referenced here, please mention in a Pull Request.
|
3854
|
+
If you have a Glimmer app you would like referenced here, please mention in a Pull Request.
|
3696
3855
|
|
3697
3856
|
### Math Bowling
|
3698
3857
|
|
@@ -3740,11 +3899,11 @@ The Glimmer packaging process done in the `glimmer package` command consists of
|
|
3740
3899
|
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
|
3741
3900
|
1. Generate native executable using [javapackager](https://docs.oracle.com/javase/8/docs/technotes/tools/unix/javapackager.html) (`glimmer package:native`): Enables packaging a JAR file as a DMG/PKG/APP file on Mac, MSI/EXE/APP on Windows, and DEB/RPM/APP on Linux (Glimmer does not officially support Linux with the `glimmer package` command yet, but it generates the JAR file successfully, and you could use `javapackager` manually afterwards if needed).
|
3742
3901
|
|
3743
|
-
Those steps automatically ensure generating a JAR file under the `./dist` directory using [Warbler](https://github.com/jruby/warbler), which is then used to automatically generate a DMG/MSI file (and other executables) under the `./packages/bundles` directory using `javapackager`.
|
3902
|
+
Those steps automatically ensure generating a JAR file under the `./dist` directory using [Warbler](https://github.com/jruby/warbler), which is then used to automatically generate a DMG/MSI file (and other executables) under the `./packages/bundles` directory using `javapackager`.
|
3744
3903
|
The JAR file name will match your application local directory name (e.g. `MathBowling.jar` for `~/code/MathBowling`)
|
3745
3904
|
The DMG file name will match the humanized local directory name + dash + application version (e.g. `Math Bowling-1.0.dmg` for `~/code/MathBowling` with version 1.0 or unspecified)
|
3746
3905
|
|
3747
|
-
The `glimmer package` command will automatically set "mac.CFBundleIdentifier" to ="org.#{project_name}.application.#{project_name}".
|
3906
|
+
The `glimmer package` command will automatically set "mac.CFBundleIdentifier" to ="org.#{project_name}.application.#{project_name}".
|
3748
3907
|
You may override by configuring as an extra argument for javapackger (e.g. Glimmer::RakeTask::Package.javapackager_extra_args = " -Bmac.CFBundleIdentifier=org.andymaleh.application.MathBowling")
|
3749
3908
|
|
3750
3909
|
### Packaging Defaults
|
@@ -3796,9 +3955,9 @@ require 'glimmer/rake_task'
|
|
3796
3955
|
Glimmer::RakeTask::Package.javapackager_extra_args = '-BlicenseType="MIT" -Bmac.category="public.app-category.business" -Bmac.signing-key-developer-id-app="Andy Maleh"'
|
3797
3956
|
```
|
3798
3957
|
|
3799
|
-
Note that `mac.category` defaults to "public.app-category.business", but can be overridden with one of the category UTI values mentioned here:
|
3958
|
+
Note that `mac.category` defaults to "public.app-category.business", but can be overridden with one of the category UTI values mentioned here:
|
3800
3959
|
|
3801
|
-
https://developer.apple.com/library/archive/releasenotes/General/SubmittingToMacAppStore/index.html#//apple_ref/doc/uid/TP40010572-CH16-SW8
|
3960
|
+
https://developer.apple.com/library/archive/releasenotes/General/SubmittingToMacAppStore/index.html#//apple_ref/doc/uid/TP40010572-CH16-SW8
|
3802
3961
|
|
3803
3962
|
Example (env var):
|
3804
3963
|
|
@@ -3814,7 +3973,7 @@ Pass `-v` to javapackager in `Glimmer::RakeTask::Package.javapackager_extra_args
|
|
3814
3973
|
|
3815
3974
|
### Windows Application Packaging
|
3816
3975
|
|
3817
|
-
Windows offers two options for setup packaging:
|
3976
|
+
Windows offers two options for setup packaging:
|
3818
3977
|
- `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)).
|
3819
3978
|
- `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.
|
3820
3979
|
|
@@ -3866,7 +4025,7 @@ Now, when you run `glimmer package`, it builds a self-signed DMG file. When you
|
|
3866
4025
|
|
3867
4026
|
1. Specifying License File
|
3868
4027
|
|
3869
|
-
The javapackager documentation states that a license file may be specified with "-BlicenseFile" javapackager option. However, in order for that to work, one must specify as a source file via "-srcfiles" javapackager option.
|
4028
|
+
The javapackager documentation states that a license file may be specified with "-BlicenseFile" javapackager option. However, in order for that to work, one must specify as a source file via "-srcfiles" javapackager option.
|
3870
4029
|
Keep that in mind if you are not going to rely on the default `LICENSE.txt` support.
|
3871
4030
|
|
3872
4031
|
Example:
|
@@ -3879,7 +4038,7 @@ Glimmer::RakeTask::Package.javapackager_extra_args = '-srcfiles "ACME.txt" -Blic
|
|
3879
4038
|
|
3880
4039
|
If you run `glimmer package` multiple times, sometimes it leaves a mounted DMG project in your finder. Unmount before you run the command again or it might fail with an error saying: "Error: Bundler "DMG Installer" (dmg) failed to produce a bundle."
|
3881
4040
|
|
3882
|
-
By the way, keep in mind that during normal operation, it does also indicate a false-negative while completing successfully similar to the following (please ignore):
|
4041
|
+
By the way, keep in mind that during normal operation, it does also indicate a false-negative while completing successfully similar to the following (please ignore):
|
3883
4042
|
|
3884
4043
|
```
|
3885
4044
|
Exec failed with code 2 command [[/usr/bin/SetFile, -c, icnC, /var/folders/4_/g1sw__tx6mjdgyh3mky7vydc0000gp/T/fxbundler4076750801763032201/images/MathBowling/.VolumeIcon.icns] in unspecified directory
|
@@ -3899,13 +4058,14 @@ Here is a list of notable 3rd party gems used by Glimmer:
|
|
3899
4058
|
- [puts_debuggerer](https://github.com/AndyObtiva/puts_debuggerer): helps in troubleshooting when adding `require 'pd'` and using the `pd` command instead of `puts` or `p` (also `#pd_inspect` or `#pdi` instead of `#inspect`)
|
3900
4059
|
- [rake](https://github.com/ruby/rake): used to implement and execute `glimmer` commands
|
3901
4060
|
- [rake-tui](https://github.com/AndyObtiva/rake-tui): Rake Text-based User Interface. Allows navigating rake tasks with arrow keys and filtering task list by typing to quickly find an run a rake task.
|
4061
|
+
- [rouge](https://github.com/rouge-ruby/rouge): Ruby syntax highlighter used in the `code_text` [Glimmer DSL for SWT custom widget](#custom-widgets) leveraged by the [Glimmer Meta-Sample](#samples)
|
3902
4062
|
- [super_module](https://github.com/AndyObtiva/super_module): used to cleanly write the Glimmer::UI:CustomWidget and Glimmer::UI::CustomShell modules
|
3903
4063
|
- [text-table](https://github.com/aptinio/text-table): renders textual data in a textual table for the command-line interface of Glimmer
|
3904
4064
|
- [warbler](https://github.com/jruby/warbler): converts a Glimmer app into a Java JAR file during packaging
|
3905
4065
|
|
3906
4066
|
## Glimmer Process
|
3907
4067
|
|
3908
|
-
[Glimmer Process](https://github.com/AndyObtiva/glimmer/blob/master/PROCESS.md) is the lightweight software development process used for building Glimmer libraries and Glimmer apps, which goes beyond Agile, rendering all Agile processes obsolete. [Glimmer Process](PROCESS.md) is simply made up of 7 guidelines to pick and choose as necessary until software development needs are satisfied.
|
4068
|
+
[Glimmer Process](https://github.com/AndyObtiva/glimmer/blob/master/PROCESS.md) is the lightweight software development process used for building Glimmer libraries and Glimmer apps, which goes beyond Agile, rendering all Agile processes obsolete. [Glimmer Process](PROCESS.md) is simply made up of 7 guidelines to pick and choose as necessary until software development needs are satisfied.
|
3909
4069
|
|
3910
4070
|
Learn more by reading the [GPG](https://github.com/AndyObtiva/glimmer/blob/master/PROCESS.md) (Glimmer Process Guidelines)
|
3911
4071
|
|
@@ -3928,7 +4088,7 @@ You may submit [issues](https://github.com/AndyObtiva/glimmer-dsl-swt/issues) on
|
|
3928
4088
|
|
3929
4089
|
### Chat
|
3930
4090
|
|
3931
|
-
If you need live help, try to [![Join the chat at https://gitter.im/AndyObtiva/glimmer](https://badges.gitter.im/AndyObtiva/glimmer.svg)](https://gitter.im/AndyObtiva/glimmer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
4091
|
+
If you need live help, try to [![Join the chat at https://gitter.im/AndyObtiva/glimmer](https://badges.gitter.im/AndyObtiva/glimmer.svg)](https://gitter.im/AndyObtiva/glimmer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
3932
4092
|
|
3933
4093
|
## Feature Suggestions
|
3934
4094
|
|
@@ -3975,8 +4135,8 @@ If your company would like to invest fulltime in further development of the Glim
|
|
3975
4135
|
|
3976
4136
|
[MIT](LICENSE.txt)
|
3977
4137
|
|
3978
|
-
Copyright (c) 2007-2020 - Andy Maleh.
|
4138
|
+
Copyright (c) 2007-2020 - Andy Maleh.
|
3979
4139
|
|
3980
4140
|
--
|
3981
4141
|
|
3982
|
-
[<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=40 />](https://github.com/AndyObtiva/glimmer) Built for [Glimmer](https://github.com/AndyObtiva/glimmer) (Ruby Desktop Development GUI Library).
|
4142
|
+
[<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=40 />](https://github.com/AndyObtiva/glimmer) Built for [Glimmer](https://github.com/AndyObtiva/glimmer) (Ruby Desktop Development GUI Library).
|