glimmer-dsl-swt 4.17.10.2 → 4.17.10.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +25 -1
- data/README.md +72 -54
- data/VERSION +1 -1
- data/glimmer-dsl-swt.gemspec +16 -14
- data/lib/glimmer/data_binding/table_items_binding.rb +8 -9
- data/lib/glimmer/data_binding/tree_items_binding.rb +7 -7
- data/lib/glimmer/swt/menu_proxy.rb +0 -1
- data/lib/glimmer/swt/table_proxy.rb +14 -14
- data/lib/glimmer/swt/widget_proxy.rb +27 -7
- data/samples/elaborate/login.rb +10 -13
- data/samples/hello/hello_button.rb +46 -0
- data/samples/hello/hello_link.rb +80 -0
- data/samples/hello/hello_list_multi_selection.rb +22 -17
- data/samples/hello/hello_list_single_selection.rb +5 -5
- data/samples/hello/hello_table.rb +0 -4
- metadata +35 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00b44b39eadc5263ddccde3ac95a754a9b4ad32c9412c268e9cf481ce89b7b05
|
4
|
+
data.tar.gz: 7a72f47c3a36921160c3217652cc98a1b377f8c5202c2c24ade6288106d87b7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c630340b8dad5f0fe4f12481aec9dd039e21cd5be5fec8350c8624b23d3a76aa4cd84ce3e5b85fd1506c1037ab5094e2872548061029cf02c906a13b56df5f5b
|
7
|
+
data.tar.gz: 1bd3f35d763bb34095e3b600abaf013d38ad7c4545bbcff6e1f1739a9702d760e79b533bc29b863587307bac567e34604fe212980cac3552eb96b05595bbd5c9
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,29 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
### 4.17.10.7
|
4
|
+
|
5
|
+
- Loosened dependencies on most Glimmer author-owned gems
|
6
|
+
- Refactored/Simplified/Fixed Hello, Link! Sample
|
7
|
+
|
8
|
+
### 4.17.10.6
|
9
|
+
|
10
|
+
- Hello, Link! Sample
|
11
|
+
- Refactor hello list samples
|
12
|
+
|
13
|
+
### 4.17.10.5
|
14
|
+
|
15
|
+
- Hello, Button! Sample
|
16
|
+
|
17
|
+
### 4.17.10.4
|
18
|
+
|
19
|
+
- Do not select first row in a table by default (keep unselected)
|
20
|
+
- Prevented extra call to model data in table items data-binding
|
21
|
+
- Upgraded to glimmer v1.0.5
|
22
|
+
|
23
|
+
### 4.17.10.3
|
24
|
+
|
25
|
+
- Fixed issue in StyledText data-binding relating to capturing selection changes on mouse click
|
26
|
+
|
3
27
|
### 4.17.10.2
|
4
28
|
|
5
29
|
- Upgraded glimmer gem to version 1.0.4
|
@@ -416,4 +440,4 @@
|
|
416
440
|
|
417
441
|
## 0.1.0
|
418
442
|
|
419
|
-
- Extracted Glimmer DSL for SWT (glimmer-dsl-swt gem) from Glimmer
|
443
|
+
- 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.10.
|
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.10.7
|
2
2
|
|
3
3
|
## JRuby Desktop Development GUI Framework
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/glimmer-dsl-swt.svg)](http://badge.fury.io/rb/glimmer-dsl-swt)
|
@@ -33,7 +33,7 @@ Glimmer DSL gems:
|
|
33
33
|
|
34
34
|
### Hello, World!
|
35
35
|
|
36
|
-
Glimmer code (from [samples/hello/hello_world.rb](
|
36
|
+
Glimmer code (from [samples/hello/hello_world.rb](samples/hello/hello_world.rb)):
|
37
37
|
```ruby
|
38
38
|
include Glimmer
|
39
39
|
|
@@ -57,12 +57,10 @@ Glimmer app:
|
|
57
57
|
|
58
58
|
### Tic Tac Toe
|
59
59
|
|
60
|
-
Glimmer code (from [samples/elaborate/tic_tac_toe.rb](
|
60
|
+
Glimmer code (from [samples/elaborate/tic_tac_toe.rb](samples/elaborate/tic_tac_toe.rb)):
|
61
61
|
|
62
62
|
```ruby
|
63
63
|
# ...
|
64
|
-
@tic_tac_toe_board = Board.new
|
65
|
-
|
66
64
|
@shell = shell {
|
67
65
|
text "Tic-Tac-Toe"
|
68
66
|
minimum_size 150, 178
|
@@ -83,11 +81,6 @@ Glimmer code (from [samples/elaborate/tic_tac_toe.rb](https://github.com/AndyObt
|
|
83
81
|
}
|
84
82
|
}
|
85
83
|
}
|
86
|
-
|
87
|
-
observe(@tic_tac_toe_board, :game_status) { |game_status|
|
88
|
-
display_win_message if game_status == Board::WIN
|
89
|
-
display_draw_message if game_status == Board::DRAW
|
90
|
-
}
|
91
84
|
# ...
|
92
85
|
```
|
93
86
|
|
@@ -103,7 +96,7 @@ Glimmer app:
|
|
103
96
|
|
104
97
|
### Contact Manager
|
105
98
|
|
106
|
-
Glimmer code (from [samples/elaborate/contact_manager.rb](
|
99
|
+
Glimmer code (from [samples/elaborate/contact_manager.rb](samples/elaborate/contact_manager.rb)):
|
107
100
|
|
108
101
|
```ruby
|
109
102
|
# ...
|
@@ -353,7 +346,6 @@ Glimmer App:
|
|
353
346
|
- [Hello, Expand Bar!](#hello-expand-bar)
|
354
347
|
- [Hello, Radio!](#hello-radio)
|
355
348
|
- [Hello, Radio Group!](#hello-radio-group)
|
356
|
-
- [Hello, Checkbox!](#hello-checkbox)
|
357
349
|
- [Hello, Group!](#hello-group)
|
358
350
|
- [Hello, Checkbox!](#hello-checkbox)
|
359
351
|
- [Hello, Checkbox Group!](#hello-checkbox-group)
|
@@ -362,6 +354,8 @@ Glimmer App:
|
|
362
354
|
- [Hello, Date Time!](#hello-date-time)
|
363
355
|
- [Hello, Spinner!](#hello-spinner)
|
364
356
|
- [Hello, Table!](#hello-table)
|
357
|
+
- [Hello, Button!](#hello-button)
|
358
|
+
- [Hello, Link!](#hello-link)
|
365
359
|
- [Elaborate Samples](#elaborate-samples)
|
366
360
|
- [User Profile](#user-profile)
|
367
361
|
- [Login](#login)
|
@@ -455,7 +449,7 @@ jgem install glimmer-dsl-swt
|
|
455
449
|
|
456
450
|
Or this command if you want a specific version:
|
457
451
|
```
|
458
|
-
jgem install glimmer-dsl-swt -v 4.17.10.
|
452
|
+
jgem install glimmer-dsl-swt -v 4.17.10.7
|
459
453
|
|
460
454
|
```
|
461
455
|
|
@@ -532,7 +526,7 @@ bin/glimmer samples
|
|
532
526
|
Below are the full usage instructions that come up when running `glimmer` without args.
|
533
527
|
|
534
528
|
```
|
535
|
-
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.17.10.
|
529
|
+
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.17.10.7
|
536
530
|
|
537
531
|
|
538
532
|
Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
|
@@ -710,7 +704,7 @@ glimmer bin/greeter
|
|
710
704
|
|
711
705
|
#### Desktopify
|
712
706
|
|
713
|
-
|
707
|
+
Desktopify basically turns a website into a desktop application by wrapping the website within a [Browser Widget](#browser-widget).
|
714
708
|
|
715
709
|
The desktopify app is similar to the standard scaffolded app. It can be extended and the [browser may even be instrumented](https://help.eclipse.org/2020-09/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/browser/Browser.html).
|
716
710
|
|
@@ -1010,7 +1004,7 @@ Output:
|
|
1010
1004
|
|
1011
1005
|
Css glimmer-dsl-css 1.1.0 AndyMaleh Glimmer DSL for CSS
|
1012
1006
|
Opal glimmer-dsl-opal 0.4.0 AndyMaleh Glimmer DSL for Opal
|
1013
|
-
Swt glimmer-dsl-swt 4.17.10.
|
1007
|
+
Swt glimmer-dsl-swt 4.17.10.7
|
1014
1008
|
AndyMaleh Glimmer DSL for SWT
|
1015
1009
|
Tk glimmer-dsl-tk 0.0.6 AndyMaleh Glimmer DSL for Tk
|
1016
1010
|
Xml glimmer-dsl-xml 1.1.0 AndyMaleh Glimmer DSL for XML
|
@@ -3651,7 +3645,7 @@ For hello-type simple samples, check the following.
|
|
3651
3645
|
|
3652
3646
|
Code:
|
3653
3647
|
|
3654
|
-
[samples/hello/hello_world.rb](
|
3648
|
+
[samples/hello/hello_world.rb](samples/hello/hello_world.rb)
|
3655
3649
|
|
3656
3650
|
![Hello World](images/glimmer-hello-world.png)
|
3657
3651
|
|
@@ -3659,7 +3653,7 @@ Code:
|
|
3659
3653
|
|
3660
3654
|
Code:
|
3661
3655
|
|
3662
|
-
[samples/hello/hello_tab.rb](
|
3656
|
+
[samples/hello/hello_tab.rb](samples/hello/hello_tab.rb)
|
3663
3657
|
|
3664
3658
|
![Hello Tab English](images/glimmer-hello-tab-english.png)
|
3665
3659
|
![Hello Tab French](images/glimmer-hello-tab-french.png)
|
@@ -3670,7 +3664,7 @@ This sample demonstrates combo data-binding.
|
|
3670
3664
|
|
3671
3665
|
Code:
|
3672
3666
|
|
3673
|
-
[samples/hello/hello_combo.rb](
|
3667
|
+
[samples/hello/hello_combo.rb](samples/hello/hello_combo.rb)
|
3674
3668
|
|
3675
3669
|
![Hello Combo](images/glimmer-hello-combo.png)
|
3676
3670
|
![Hello Combo Expanded](images/glimmer-hello-combo-expanded.png)
|
@@ -3681,7 +3675,7 @@ This sample demonstrates list single-selection data-binding.
|
|
3681
3675
|
|
3682
3676
|
Code:
|
3683
3677
|
|
3684
|
-
[samples/hello/hello_list_single_selection.rb](
|
3678
|
+
[samples/hello/hello_list_single_selection.rb](samples/hello/hello_list_single_selection.rb)
|
3685
3679
|
|
3686
3680
|
![Hello List Single Selection](images/glimmer-hello-list-single-selection.png)
|
3687
3681
|
|
@@ -3691,7 +3685,7 @@ This sample demonstrates list multi-selection data-binding.
|
|
3691
3685
|
|
3692
3686
|
Code:
|
3693
3687
|
|
3694
|
-
[samples/hello/hello_list_multi_selection.rb](
|
3688
|
+
[samples/hello/hello_list_multi_selection.rb](samples/hello/hello_list_multi_selection.rb)
|
3695
3689
|
|
3696
3690
|
![Hello List Multi Selection](images/glimmer-hello-list-multi-selection.png)
|
3697
3691
|
|
@@ -3701,7 +3695,7 @@ This sample demonstrates computed data-binding.
|
|
3701
3695
|
|
3702
3696
|
Code:
|
3703
3697
|
|
3704
|
-
[samples/hello/hello_computed.rb](
|
3698
|
+
[samples/hello/hello_computed.rb](samples/hello/hello_computed.rb)
|
3705
3699
|
|
3706
3700
|
![Hello Browser](images/glimmer-hello-computed.png)
|
3707
3701
|
|
@@ -3711,7 +3705,7 @@ This sample demonstrates a `message_box` dialog.
|
|
3711
3705
|
|
3712
3706
|
Code:
|
3713
3707
|
|
3714
|
-
[samples/hello/hello_message_box.rb](
|
3708
|
+
[samples/hello/hello_message_box.rb](samples/hello/hello_message_box.rb)
|
3715
3709
|
|
3716
3710
|
![Hello Message Box](images/glimmer-hello-message-box.png)
|
3717
3711
|
![Hello Message Box Dialog](images/glimmer-hello-message-box-dialog.png)
|
@@ -3722,7 +3716,7 @@ This sample demonstrates the `browser` widget.
|
|
3722
3716
|
|
3723
3717
|
Code:
|
3724
3718
|
|
3725
|
-
[samples/hello/hello_browser.rb](
|
3719
|
+
[samples/hello/hello_browser.rb](samples/hello/hello_browser.rb)
|
3726
3720
|
|
3727
3721
|
![Hello Browser](images/glimmer-hello-browser.png)
|
3728
3722
|
|
@@ -3732,7 +3726,7 @@ This sample demonstrates drag and drop in Glimmer.
|
|
3732
3726
|
|
3733
3727
|
Code:
|
3734
3728
|
|
3735
|
-
[samples/hello/hello_drag_and_drop.rb](
|
3729
|
+
[samples/hello/hello_drag_and_drop.rb](samples/hello/hello_drag_and_drop.rb)
|
3736
3730
|
|
3737
3731
|
![Hello Drag and Drop](images/glimmer-hello-drag-and-drop.gif)
|
3738
3732
|
|
@@ -3742,7 +3736,7 @@ This sample demonstrates menus in Glimmer.
|
|
3742
3736
|
|
3743
3737
|
Code:
|
3744
3738
|
|
3745
|
-
[samples/hello/hello_menu_bar.rb](
|
3739
|
+
[samples/hello/hello_menu_bar.rb](samples/hello/hello_menu_bar.rb)
|
3746
3740
|
|
3747
3741
|
![Hello Menu Bar](images/glimmer-hello-menu-bar.png)
|
3748
3742
|
![Hello Menu Bar File Menu](images/glimmer-hello-menu-bar-file-menu.png)
|
@@ -3754,7 +3748,7 @@ This sample demonstrates pop up context menus in Glimmer.
|
|
3754
3748
|
|
3755
3749
|
Code:
|
3756
3750
|
|
3757
|
-
[samples/hello/hello_pop_up_context_menu.rb](
|
3751
|
+
[samples/hello/hello_pop_up_context_menu.rb](samples/hello/hello_pop_up_context_menu.rb)
|
3758
3752
|
|
3759
3753
|
![Hello Pop Up Context Menu](images/glimmer-hello-pop-up-context-menu.png)
|
3760
3754
|
![Hello Pop Up Context Menu Popped Up](images/glimmer-hello-pop-up-context-menu-popped-up.png)
|
@@ -3765,7 +3759,7 @@ This sample demonstrates the use of a custom widget in Glimmer.
|
|
3765
3759
|
|
3766
3760
|
Code:
|
3767
3761
|
|
3768
|
-
[samples/hello/hello_custom_widget.rb](
|
3762
|
+
[samples/hello/hello_custom_widget.rb](samples/hello/hello_custom_widget.rb)
|
3769
3763
|
|
3770
3764
|
![Hello Custom Widget](images/glimmer-hello-custom-widget.gif)
|
3771
3765
|
|
@@ -3775,7 +3769,7 @@ This sample demonstrates the use of a custom shell (aka custom window) in Glimme
|
|
3775
3769
|
|
3776
3770
|
Code:
|
3777
3771
|
|
3778
|
-
[samples/hello/hello_custom_shell.rb](
|
3772
|
+
[samples/hello/hello_custom_shell.rb](samples/hello/hello_custom_shell.rb)
|
3779
3773
|
|
3780
3774
|
![Hello Custom Shell](images/glimmer-hello-custom-shell.png)
|
3781
3775
|
![Hello Custom Shell Email1](images/glimmer-hello-custom-shell-email1.png)
|
@@ -3788,7 +3782,7 @@ This sample demonstrates the use of a `sash_form` in Glimmer.
|
|
3788
3782
|
|
3789
3783
|
Code:
|
3790
3784
|
|
3791
|
-
[samples/hello/hello_sash_form.rb](
|
3785
|
+
[samples/hello/hello_sash_form.rb](samples/hello/hello_sash_form.rb)
|
3792
3786
|
|
3793
3787
|
Hello, Sash Form! Horizontal Orientation
|
3794
3788
|
|
@@ -3820,7 +3814,7 @@ This sample demonstrates the use of a `styled_text` in Glimmer.
|
|
3820
3814
|
|
3821
3815
|
Code:
|
3822
3816
|
|
3823
|
-
[samples/hello/hello_styled_text.rb](
|
3817
|
+
[samples/hello/hello_styled_text.rb](samples/hello/hello_styled_text.rb)
|
3824
3818
|
|
3825
3819
|
Hello, Styled Text!
|
3826
3820
|
|
@@ -3832,7 +3826,7 @@ This sample demonstrates the use of a `expand_bar` and `expand_item` in Glimmer.
|
|
3832
3826
|
|
3833
3827
|
Code:
|
3834
3828
|
|
3835
|
-
[samples/hello/hello_expand_bar.rb](
|
3829
|
+
[samples/hello/hello_expand_bar.rb](samples/hello/hello_expand_bar.rb)
|
3836
3830
|
|
3837
3831
|
Hello, Expand Bar! All Expanded
|
3838
3832
|
|
@@ -3856,7 +3850,7 @@ This sample demonstrates the use of a `radio` (aka `button(:radio)`) in Glimmer.
|
|
3856
3850
|
|
3857
3851
|
Code:
|
3858
3852
|
|
3859
|
-
[samples/hello/hello_radio.rb](
|
3853
|
+
[samples/hello/hello_radio.rb](samples/hello/hello_radio.rb)
|
3860
3854
|
|
3861
3855
|
Hello, Radio!
|
3862
3856
|
|
@@ -3868,27 +3862,19 @@ This sample demonstrates the use of a `radio_group` in Glimmer, which provides t
|
|
3868
3862
|
|
3869
3863
|
Code:
|
3870
3864
|
|
3871
|
-
[samples/hello/hello_radio_group.rb](
|
3865
|
+
[samples/hello/hello_radio_group.rb](samples/hello/hello_radio_group.rb)
|
3872
3866
|
|
3873
3867
|
Hello, Radio Group!
|
3874
3868
|
|
3875
3869
|
![Hello Radio Group](images/glimmer-hello-radio-group.png)
|
3876
3870
|
|
3877
|
-
#### Hello, Checkbox!
|
3878
|
-
|
3879
|
-
This sample demonstrates the use of a `checkbox` (aka `check` or `button(:check)`) in Glimmer.
|
3880
|
-
|
3881
|
-
Code:
|
3882
|
-
|
3883
|
-
[samples/hello/hello_checkbox.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_checkbox.rb)
|
3884
|
-
|
3885
3871
|
#### Hello, Group!
|
3886
3872
|
|
3887
3873
|
This sample demonstrates the use of a `group` in Glimmer (not to be confused with the logical radio group custom widget, this is just an alternative to `composite` that provides a border around content).
|
3888
3874
|
|
3889
3875
|
Code:
|
3890
3876
|
|
3891
|
-
[samples/hello/hello_group.rb](
|
3877
|
+
[samples/hello/hello_group.rb](samples/hello/hello_group.rb)
|
3892
3878
|
|
3893
3879
|
Hello, Group!
|
3894
3880
|
|
@@ -3900,7 +3886,7 @@ This sample demonstrates the use of a `checkbox` (aka `check` or `button(:check)
|
|
3900
3886
|
|
3901
3887
|
Code:
|
3902
3888
|
|
3903
|
-
[samples/hello/hello_checkbox.rb](
|
3889
|
+
[samples/hello/hello_checkbox.rb](samples/hello/hello_checkbox.rb)
|
3904
3890
|
|
3905
3891
|
Hello, Checkbox!
|
3906
3892
|
|
@@ -3912,7 +3898,7 @@ This sample demonstrates the use of a `checkbox_group` (aka `check_group`) in Gl
|
|
3912
3898
|
|
3913
3899
|
Code:
|
3914
3900
|
|
3915
|
-
[samples/hello/hello_checkbox_group.rb](
|
3901
|
+
[samples/hello/hello_checkbox_group.rb](samples/hello/hello_checkbox_group.rb)
|
3916
3902
|
|
3917
3903
|
Hello, Checkbox Group!
|
3918
3904
|
|
@@ -3924,7 +3910,7 @@ This sample demonstrates the use of a `directory_dialog` in Glimmer.
|
|
3924
3910
|
|
3925
3911
|
Code:
|
3926
3912
|
|
3927
|
-
[samples/hello/hello_directory_dialog.rb](
|
3913
|
+
[samples/hello/hello_directory_dialog.rb](samples/hello/hello_directory_dialog.rb)
|
3928
3914
|
|
3929
3915
|
Hello, Directory Dialog!
|
3930
3916
|
|
@@ -3944,7 +3930,7 @@ This sample demonstrates the use of a `file_dialog` in Glimmer.
|
|
3944
3930
|
|
3945
3931
|
Code:
|
3946
3932
|
|
3947
|
-
[samples/hello/hello_file_dialog.rb](
|
3933
|
+
[samples/hello/hello_file_dialog.rb](samples/hello/hello_file_dialog.rb)
|
3948
3934
|
|
3949
3935
|
Hello, File Dialog!
|
3950
3936
|
|
@@ -3964,7 +3950,7 @@ This sample demonstrates the use of [date_time](#datetime) widget keywords in Gl
|
|
3964
3950
|
|
3965
3951
|
Code:
|
3966
3952
|
|
3967
|
-
[samples/hello/hello_date_time.rb](
|
3953
|
+
[samples/hello/hello_date_time.rb](samples/hello/hello_date_time.rb)
|
3968
3954
|
|
3969
3955
|
Hello, Date Time!
|
3970
3956
|
|
@@ -3976,7 +3962,7 @@ This sample demonstrates the use of `spinner` widget in Glimmer
|
|
3976
3962
|
|
3977
3963
|
Code:
|
3978
3964
|
|
3979
|
-
[samples/hello/hello_spinner.rb](
|
3965
|
+
[samples/hello/hello_spinner.rb](samples/hello/hello_spinner.rb)
|
3980
3966
|
|
3981
3967
|
Hello, Spinner!
|
3982
3968
|
|
@@ -3988,7 +3974,7 @@ This sample demonstrates the use of [table](#table) widget in Glimmer, including
|
|
3988
3974
|
|
3989
3975
|
Code:
|
3990
3976
|
|
3991
|
-
[samples/hello/hello_table.rb](
|
3977
|
+
[samples/hello/hello_table.rb](samples/hello/hello_table.rb)
|
3992
3978
|
|
3993
3979
|
Hello, Table!
|
3994
3980
|
|
@@ -4030,6 +4016,38 @@ Hello, Table! Context Menu
|
|
4030
4016
|
|
4031
4017
|
![Hello Table](images/glimmer-hello-table-context-menu.png)
|
4032
4018
|
|
4019
|
+
#### Hello, Button!
|
4020
|
+
|
4021
|
+
This sample demonstrates the use of the `button` widget in Glimmer, including data-binding and click event triggering via `on_widget_selected`.
|
4022
|
+
|
4023
|
+
Code:
|
4024
|
+
|
4025
|
+
[samples/hello/hello_button.rb](samples/hello/hello_button.rb)
|
4026
|
+
|
4027
|
+
Hello, Button!
|
4028
|
+
|
4029
|
+
![Hello Button](images/glimmer-hello-button.png)
|
4030
|
+
|
4031
|
+
Hello, Button! Incremented 7 times!
|
4032
|
+
|
4033
|
+
![Hello Button Incremented](images/glimmer-hello-button-incremented.png)
|
4034
|
+
|
4035
|
+
#### Hello, Link!
|
4036
|
+
|
4037
|
+
This sample demonstrates the use of the `link` widget in Glimmer, including identifying which link was clicked and performing an action (displaying help) based on its location.
|
4038
|
+
|
4039
|
+
Code:
|
4040
|
+
|
4041
|
+
[samples/hello/hello_link.rb](samples/hello/hello_link.rb)
|
4042
|
+
|
4043
|
+
Hello, Link!
|
4044
|
+
|
4045
|
+
![Hello Link](images/glimmer-hello-link.png)
|
4046
|
+
|
4047
|
+
Hello, Link! Clicked
|
4048
|
+
|
4049
|
+
![Hello Link Clicked](images/glimmer-hello-link-clicked.png)
|
4050
|
+
|
4033
4051
|
### Elaborate Samples
|
4034
4052
|
|
4035
4053
|
For more elaborate samples, check the following:
|
@@ -4042,7 +4060,7 @@ Please note that the code has changed since that article was written (the GUI DS
|
|
4042
4060
|
|
4043
4061
|
Code:
|
4044
4062
|
|
4045
|
-
[samples/elaborate/user_profile.rb](
|
4063
|
+
[samples/elaborate/user_profile.rb](samples/elaborate/user_profile.rb)
|
4046
4064
|
|
4047
4065
|
![User Profile](images/glimmer-user-profile.png)
|
4048
4066
|
|
@@ -4052,7 +4070,7 @@ This sample demonstrates basic data-binding, password and text fields, and field
|
|
4052
4070
|
|
4053
4071
|
Code:
|
4054
4072
|
|
4055
|
-
[samples/elaborate/login.rb](
|
4073
|
+
[samples/elaborate/login.rb](samples/elaborate/login.rb)
|
4056
4074
|
|
4057
4075
|
![Login](images/glimmer-login.png)
|
4058
4076
|
![Login Filled In](images/glimmer-login-filled-in.png)
|
@@ -4066,7 +4084,7 @@ Code:
|
|
4066
4084
|
|
4067
4085
|
(Please note that on some Linux instances where the display x-axis is set to double-scale, you need to set the `shell` `minimum_size` to `300, 178` instead of `150, 178`)
|
4068
4086
|
|
4069
|
-
[samples/elaborate/tic_tac_toe.rb](
|
4087
|
+
[samples/elaborate/tic_tac_toe.rb](samples/elaborate/tic_tac_toe.rb)
|
4070
4088
|
|
4071
4089
|
![Tic Tac Toe](images/glimmer-tic-tac-toe.png)
|
4072
4090
|
![Tic Tac Toe In Progress](images/glimmer-tic-tac-toe-in-progress.png)
|
@@ -4078,7 +4096,7 @@ This sample demonstrates table data-binding, sorting, filtering, GUI layout, MVP
|
|
4078
4096
|
|
4079
4097
|
Code:
|
4080
4098
|
|
4081
|
-
[samples/elaborate/contact_manager.rb](
|
4099
|
+
[samples/elaborate/contact_manager.rb](samples/elaborate/contact_manager.rb)
|
4082
4100
|
|
4083
4101
|
Contact Manager
|
4084
4102
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.17.10.
|
1
|
+
4.17.10.7
|
data/glimmer-dsl-swt.gemspec
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: glimmer-dsl-swt 4.17.10.
|
5
|
+
# stub: glimmer-dsl-swt 4.17.10.7 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "glimmer-dsl-swt".freeze
|
9
|
-
s.version = "4.17.10.
|
9
|
+
s.version = "4.17.10.7"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["AndyMaleh".freeze]
|
14
|
-
s.date = "2020-
|
15
|
-
s.description = "Glimmer DSL for SWT (JRuby Desktop Development GUI
|
14
|
+
s.date = "2020-12-15"
|
15
|
+
s.description = "Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)".freeze
|
16
16
|
s.email = "andy.am@gmail.com".freeze
|
17
17
|
s.executables = ["glimmer".freeze, "girb".freeze]
|
18
18
|
s.extra_rdoc_files = [
|
@@ -131,6 +131,7 @@ Gem::Specification.new do |s|
|
|
131
131
|
"samples/elaborate/tic_tac_toe/cell.rb",
|
132
132
|
"samples/elaborate/user_profile.rb",
|
133
133
|
"samples/hello/hello_browser.rb",
|
134
|
+
"samples/hello/hello_button.rb",
|
134
135
|
"samples/hello/hello_checkbox.rb",
|
135
136
|
"samples/hello/hello_checkbox_group.rb",
|
136
137
|
"samples/hello/hello_combo.rb",
|
@@ -144,6 +145,7 @@ Gem::Specification.new do |s|
|
|
144
145
|
"samples/hello/hello_expand_bar.rb",
|
145
146
|
"samples/hello/hello_file_dialog.rb",
|
146
147
|
"samples/hello/hello_group.rb",
|
148
|
+
"samples/hello/hello_link.rb",
|
147
149
|
"samples/hello/hello_list_multi_selection.rb",
|
148
150
|
"samples/hello/hello_list_single_selection.rb",
|
149
151
|
"samples/hello/hello_menu_bar.rb",
|
@@ -172,17 +174,17 @@ Gem::Specification.new do |s|
|
|
172
174
|
end
|
173
175
|
|
174
176
|
if s.respond_to? :add_runtime_dependency then
|
175
|
-
s.add_runtime_dependency(%q<glimmer>.freeze, ["~> 1.0.
|
176
|
-
s.add_runtime_dependency(%q<super_module>.freeze, ["
|
177
|
-
s.add_runtime_dependency(%q<nested_inherited_jruby_include_package>.freeze, ["
|
178
|
-
s.add_runtime_dependency(%q<puts_debuggerer>.freeze, ["
|
177
|
+
s.add_runtime_dependency(%q<glimmer>.freeze, ["~> 1.0.5"])
|
178
|
+
s.add_runtime_dependency(%q<super_module>.freeze, [">= 1.4.1", "< 2.0.0"])
|
179
|
+
s.add_runtime_dependency(%q<nested_inherited_jruby_include_package>.freeze, [">= 0.3.0", "< 2.0.0"])
|
180
|
+
s.add_runtime_dependency(%q<puts_debuggerer>.freeze, [">= 0.11.0", "< 2.0.0"])
|
179
181
|
s.add_runtime_dependency(%q<rake-tui>.freeze, [">= 0.2.3", "< 2.0.0"])
|
180
182
|
s.add_runtime_dependency(%q<git-glimmer>.freeze, ["= 1.7.0"])
|
181
183
|
s.add_runtime_dependency(%q<logging>.freeze, [">= 2.3.0", "< 3.0.0"])
|
182
184
|
s.add_runtime_dependency(%q<os>.freeze, [">= 1.0.0", "< 2.0.0"])
|
183
185
|
s.add_runtime_dependency(%q<rake>.freeze, [">= 10.1.0", "< 14.0.0"])
|
184
186
|
s.add_runtime_dependency(%q<text-table>.freeze, [">= 1.2.4", "< 2.0.0"])
|
185
|
-
s.add_runtime_dependency(%q<rouge>.freeze, [">= 3.
|
187
|
+
s.add_runtime_dependency(%q<rouge>.freeze, [">= 3.26.0", "< 4.0.0"])
|
186
188
|
s.add_development_dependency(%q<juwelier>.freeze, [">= 2.4.9", "< 3.0.0"])
|
187
189
|
s.add_development_dependency(%q<warbler>.freeze, [">= 2.0.5", "< 3.0.0"])
|
188
190
|
s.add_development_dependency(%q<rspec-mocks>.freeze, ["~> 3.5.0"])
|
@@ -191,17 +193,17 @@ Gem::Specification.new do |s|
|
|
191
193
|
s.add_development_dependency(%q<simplecov>.freeze, ["~> 0.16.1"])
|
192
194
|
s.add_development_dependency(%q<simplecov-lcov>.freeze, ["~> 0.7.0"])
|
193
195
|
else
|
194
|
-
s.add_dependency(%q<glimmer>.freeze, ["~> 1.0.
|
195
|
-
s.add_dependency(%q<super_module>.freeze, ["
|
196
|
-
s.add_dependency(%q<nested_inherited_jruby_include_package>.freeze, ["
|
197
|
-
s.add_dependency(%q<puts_debuggerer>.freeze, ["
|
196
|
+
s.add_dependency(%q<glimmer>.freeze, ["~> 1.0.5"])
|
197
|
+
s.add_dependency(%q<super_module>.freeze, [">= 1.4.1", "< 2.0.0"])
|
198
|
+
s.add_dependency(%q<nested_inherited_jruby_include_package>.freeze, [">= 0.3.0", "< 2.0.0"])
|
199
|
+
s.add_dependency(%q<puts_debuggerer>.freeze, [">= 0.11.0", "< 2.0.0"])
|
198
200
|
s.add_dependency(%q<rake-tui>.freeze, [">= 0.2.3", "< 2.0.0"])
|
199
201
|
s.add_dependency(%q<git-glimmer>.freeze, ["= 1.7.0"])
|
200
202
|
s.add_dependency(%q<logging>.freeze, [">= 2.3.0", "< 3.0.0"])
|
201
203
|
s.add_dependency(%q<os>.freeze, [">= 1.0.0", "< 2.0.0"])
|
202
204
|
s.add_dependency(%q<rake>.freeze, [">= 10.1.0", "< 14.0.0"])
|
203
205
|
s.add_dependency(%q<text-table>.freeze, [">= 1.2.4", "< 2.0.0"])
|
204
|
-
s.add_dependency(%q<rouge>.freeze, [">= 3.
|
206
|
+
s.add_dependency(%q<rouge>.freeze, [">= 3.26.0", "< 4.0.0"])
|
205
207
|
s.add_dependency(%q<juwelier>.freeze, [">= 2.4.9", "< 3.0.0"])
|
206
208
|
s.add_dependency(%q<warbler>.freeze, [">= 2.0.5", "< 3.0.0"])
|
207
209
|
s.add_dependency(%q<rspec-mocks>.freeze, ["~> 3.5.0"])
|
@@ -38,16 +38,16 @@ module Glimmer
|
|
38
38
|
@model_binding = model_binding
|
39
39
|
@table.swt_widget.data = @model_binding
|
40
40
|
@column_properties = column_properties
|
41
|
+
@table.on_widget_disposed do |dispose_event|
|
42
|
+
unregister_all_observables
|
43
|
+
end
|
41
44
|
if @table.respond_to?(:column_properties=)
|
42
45
|
@table.column_properties = @column_properties
|
43
46
|
else # assume custom widget
|
44
47
|
@table.body_root.column_properties = @column_properties
|
45
48
|
end
|
46
|
-
call(@model_binding.evaluate_property)
|
47
49
|
@table_observer_registration = observe(model_binding)
|
48
|
-
|
49
|
-
unregister_all_observables
|
50
|
-
end
|
50
|
+
call
|
51
51
|
end
|
52
52
|
|
53
53
|
def call(new_model_collection=nil)
|
@@ -65,7 +65,7 @@ module Glimmer
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def populate_table(model_collection, parent, column_properties)
|
68
|
-
selected_table_item_models = parent.swt_widget.getSelection.map(&:
|
68
|
+
selected_table_item_models = parent.swt_widget.getSelection.map(&:get_data)
|
69
69
|
parent.finish_edit!
|
70
70
|
parent.swt_widget.items.each(&:dispose)
|
71
71
|
parent.swt_widget.removeAll
|
@@ -74,11 +74,10 @@ module Glimmer
|
|
74
74
|
for index in 0..(column_properties.size-1)
|
75
75
|
table_item.setText(index, model.send(column_properties[index]).to_s)
|
76
76
|
end
|
77
|
-
table_item.
|
77
|
+
table_item.set_data(model)
|
78
78
|
end
|
79
|
-
selected_table_items = parent.search {|item| selected_table_item_models.include?(item.
|
80
|
-
|
81
|
-
parent.swt_widget.setSelection(selected_table_items) unless selected_table_items.empty?
|
79
|
+
selected_table_items = parent.search {|item| selected_table_item_models.include?(item.get_data) }
|
80
|
+
parent.swt_widget.setSelection(selected_table_items)
|
82
81
|
parent.sort!
|
83
82
|
parent.swt_widget.redraw if parent&.swt_widget&.respond_to?(:redraw)
|
84
83
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (c) 2007-2020 Andy Maleh
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
# a copy of this software and associated documentation files (the
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -69,7 +69,7 @@ module Glimmer
|
|
69
69
|
old_tree_item_expansion_by_data = old_tree_items.reduce({}) {|hash, ti| hash.merge(ti.getData => ti.getExpanded)}
|
70
70
|
old_tree_items.each do |tree_item|
|
71
71
|
tree_item.getData('observer_registrations').each(&:unregister)
|
72
|
-
end
|
72
|
+
end
|
73
73
|
parent.swt_widget.items.each(&:dispose)
|
74
74
|
parent.swt_widget.removeAll
|
75
75
|
populate_tree_node(model_tree_root_node, parent.swt_widget, tree_properties)
|
@@ -85,9 +85,9 @@ module Glimmer
|
|
85
85
|
array + [observe(model_tree_node, key_value_pair.last)]
|
86
86
|
end
|
87
87
|
|
88
|
-
tree_item.
|
89
|
-
tree_item.
|
90
|
-
tree_item.
|
88
|
+
tree_item.set_data('observer_registrations', observer_registrations)
|
89
|
+
tree_item.set_data(model_tree_node)
|
90
|
+
tree_item.text = (model_tree_node && model_tree_node.send(tree_properties[:text])).to_s
|
91
91
|
[model_tree_node && model_tree_node.send(tree_properties[:children])].flatten.to_a.compact.each do |child|
|
92
92
|
populate_tree_node(child, tree_item, tree_properties)
|
93
93
|
end
|
@@ -245,7 +245,7 @@ module Glimmer
|
|
245
245
|
end
|
246
246
|
end
|
247
247
|
|
248
|
-
attr_reader :table_editor, :table_editor_widget_proxy, :sort_property, :sort_direction, :sort_block, :sort_type, :sort_by_block, :additional_sort_properties, :editor, :editable
|
248
|
+
attr_reader :table_editor, :table_editor_widget_proxy, :sort_property, :sort_direction, :sort_block, :sort_type, :sort_by_block, :additional_sort_properties, :editor, :editable
|
249
249
|
attr_accessor :column_properties
|
250
250
|
alias editable? editable
|
251
251
|
|
@@ -353,19 +353,6 @@ module Glimmer
|
|
353
353
|
@additional_sort_properties = args unless args.empty?
|
354
354
|
end
|
355
355
|
|
356
|
-
def editor=(args)
|
357
|
-
@editor = args
|
358
|
-
end
|
359
|
-
|
360
|
-
def cells_for(model)
|
361
|
-
column_properties.map {|property| model.send(property)}
|
362
|
-
end
|
363
|
-
|
364
|
-
def cells
|
365
|
-
column_count = @table.column_properties.size
|
366
|
-
swt_widget.items.map {|item| column_count.times.map {|i| item.get_text(i)} }
|
367
|
-
end
|
368
|
-
|
369
356
|
def sort!
|
370
357
|
return unless sort_property && (sort_type || sort_block || sort_by_block)
|
371
358
|
array = model_binding.evaluate_property
|
@@ -395,6 +382,19 @@ module Glimmer
|
|
395
382
|
model_binding.call(sorted_array)
|
396
383
|
end
|
397
384
|
|
385
|
+
def editor=(args)
|
386
|
+
@editor = args
|
387
|
+
end
|
388
|
+
|
389
|
+
def cells_for(model)
|
390
|
+
column_properties.map {|property| model.send(property)}
|
391
|
+
end
|
392
|
+
|
393
|
+
def cells
|
394
|
+
column_count = @table.column_properties.size
|
395
|
+
swt_widget.items.map {|item| column_count.times.map {|i| item.get_text(i)} }
|
396
|
+
end
|
397
|
+
|
398
398
|
# Performs a search for table items matching block condition
|
399
399
|
# If no condition block is passed, returns all table items
|
400
400
|
# Returns a Java TableItem array to easily set as selection on org.eclipse.swt.Table if needed
|
@@ -69,7 +69,7 @@ module Glimmer
|
|
69
69
|
}
|
70
70
|
|
71
71
|
DEFAULT_INITIALIZERS = {
|
72
|
-
|
72
|
+
composite: lambda do |composite|
|
73
73
|
if composite.get_layout.nil?
|
74
74
|
layout = GridLayout.new
|
75
75
|
layout.marginWidth = 15
|
@@ -77,18 +77,18 @@ module Glimmer
|
|
77
77
|
composite.layout = layout
|
78
78
|
end
|
79
79
|
end,
|
80
|
-
|
80
|
+
scrolled_composite: lambda do |scrolled_composite|
|
81
81
|
scrolled_composite.expand_horizontal = true
|
82
82
|
scrolled_composite.expand_vertical = true
|
83
83
|
end,
|
84
|
-
|
84
|
+
table: lambda do |table|
|
85
85
|
table.setHeaderVisible(true)
|
86
86
|
table.setLinesVisible(true)
|
87
87
|
end,
|
88
|
-
|
88
|
+
table_column: lambda do |table_column|
|
89
89
|
table_column.setWidth(80)
|
90
90
|
end,
|
91
|
-
|
91
|
+
group: lambda do |group|
|
92
92
|
group.layout = GridLayout.new if group.get_layout.nil?
|
93
93
|
end,
|
94
94
|
}
|
@@ -160,7 +160,7 @@ module Glimmer
|
|
160
160
|
end
|
161
161
|
if @swt_widget&.get_data('proxy').nil?
|
162
162
|
@swt_widget.set_data('proxy', self)
|
163
|
-
DEFAULT_INITIALIZERS[underscored_widget_name]&.call(@swt_widget)
|
163
|
+
DEFAULT_INITIALIZERS[underscored_widget_name.to_s.to_sym]&.call(@swt_widget)
|
164
164
|
@parent_proxy.post_initialize_child(self)
|
165
165
|
end
|
166
166
|
end
|
@@ -212,6 +212,7 @@ module Glimmer
|
|
212
212
|
end
|
213
213
|
|
214
214
|
def set_attribute(attribute_name, *args)
|
215
|
+
# TODO Think about widget subclasses overriding set_attribute to add more attributes vs adding as Ruby attributes directly
|
215
216
|
widget_custom_attribute = widget_custom_attribute_mapping[attribute_name.to_s]
|
216
217
|
if widget_custom_attribute
|
217
218
|
widget_custom_attribute[:setter][:invoker].call(@swt_widget, args)
|
@@ -376,16 +377,34 @@ module Glimmer
|
|
376
377
|
on_widget_selected { |event|
|
377
378
|
observer.call(@swt_widget.getSelection) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
378
379
|
}
|
380
|
+
on_swt_keyup { |event|
|
381
|
+
observer.call(@swt_widget.getSelection) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
382
|
+
}
|
383
|
+
on_swt_mouseup { |event|
|
384
|
+
observer.call(@swt_widget.getSelection) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
385
|
+
}
|
379
386
|
end,
|
380
387
|
:selection_count => lambda do |observer|
|
381
388
|
on_widget_selected { |event|
|
382
389
|
observer.call(@swt_widget.getSelectionCount) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
383
390
|
}
|
391
|
+
on_swt_keyup { |event|
|
392
|
+
observer.call(@swt_widget.getSelectionCount) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
393
|
+
}
|
394
|
+
on_swt_mouseup { |event|
|
395
|
+
observer.call(@swt_widget.getSelectionCount) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
396
|
+
}
|
384
397
|
end,
|
385
398
|
:selection_range => lambda do |observer|
|
386
399
|
on_widget_selected { |event|
|
387
400
|
observer.call(@swt_widget.getSelectionRange) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
388
401
|
}
|
402
|
+
on_swt_keyup { |event|
|
403
|
+
observer.call(@swt_widget.getSelectionRange) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
404
|
+
}
|
405
|
+
on_swt_mouseup { |event|
|
406
|
+
observer.call(@swt_widget.getSelectionRange) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
407
|
+
}
|
389
408
|
end,
|
390
409
|
:top_index => lambda do |observer|
|
391
410
|
@last_top_index = @swt_widget.getTopIndex
|
@@ -839,6 +858,7 @@ module Glimmer
|
|
839
858
|
!!value
|
840
859
|
end,
|
841
860
|
:foreground => color_converter,
|
861
|
+
:link_foreground => color_converter,
|
842
862
|
:font => lambda do |value|
|
843
863
|
if value.is_a?(Hash)
|
844
864
|
font_properties = value
|
@@ -887,4 +907,4 @@ module Glimmer
|
|
887
907
|
end
|
888
908
|
end
|
889
909
|
end
|
890
|
-
end
|
910
|
+
end
|
data/samples/elaborate/login.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (c) 2007-2020 Andy Maleh
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
# a copy of this software and associated documentation files (the
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -19,7 +19,6 @@
|
|
19
19
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
20
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
21
|
|
22
|
-
#Presents login screen data
|
23
22
|
class LoginPresenter
|
24
23
|
|
25
24
|
attr_accessor :user_name
|
@@ -35,7 +34,6 @@ class LoginPresenter
|
|
35
34
|
def status=(status)
|
36
35
|
@status = status
|
37
36
|
|
38
|
-
#TODO add feature to bind dependent properties to master property (2017-07-25 nested data binding)
|
39
37
|
notify_observers("logged_in")
|
40
38
|
notify_observers("logged_out")
|
41
39
|
end
|
@@ -65,7 +63,6 @@ class LoginPresenter
|
|
65
63
|
|
66
64
|
end
|
67
65
|
|
68
|
-
#Login screen
|
69
66
|
class Login
|
70
67
|
include Glimmer
|
71
68
|
|
@@ -77,10 +74,10 @@ class Login
|
|
77
74
|
grid_layout 2, false #two columns with differing widths
|
78
75
|
|
79
76
|
label { text "Username:" } # goes in column 1
|
80
|
-
@user_name_text = text {
|
77
|
+
@user_name_text = text { # goes in column 2
|
81
78
|
text bind(presenter, :user_name)
|
82
79
|
enabled bind(presenter, :logged_out)
|
83
|
-
on_key_pressed { |event|
|
80
|
+
on_key_pressed { |event|
|
84
81
|
@password_text.set_focus if event.keyCode == swt(:cr)
|
85
82
|
}
|
86
83
|
}
|
@@ -89,7 +86,7 @@ class Login
|
|
89
86
|
@password_text = text(:password, :border) {
|
90
87
|
text bind(presenter, :password)
|
91
88
|
enabled bind(presenter, :logged_out)
|
92
|
-
on_key_pressed { |event|
|
89
|
+
on_key_pressed { |event|
|
93
90
|
presenter.login if event.keyCode == swt(:cr)
|
94
91
|
}
|
95
92
|
}
|
@@ -101,21 +98,21 @@ class Login
|
|
101
98
|
text "Login"
|
102
99
|
enabled bind(presenter, :logged_out)
|
103
100
|
on_widget_selected { presenter.login }
|
104
|
-
on_key_pressed { |event|
|
101
|
+
on_key_pressed { |event|
|
105
102
|
presenter.login if event.keyCode == swt(:cr)
|
106
|
-
}
|
103
|
+
}
|
107
104
|
}
|
108
105
|
|
109
106
|
button {
|
110
107
|
text "Logout"
|
111
108
|
enabled bind(presenter, :logged_in)
|
112
109
|
on_widget_selected { presenter.logout }
|
113
|
-
on_key_pressed { |event|
|
110
|
+
on_key_pressed { |event|
|
114
111
|
if event.keyCode == swt(:cr)
|
115
112
|
presenter.logout
|
116
113
|
@user_name_text.set_focus
|
117
114
|
end
|
118
|
-
}
|
115
|
+
}
|
119
116
|
}
|
120
117
|
}
|
121
118
|
}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# Copyright (c) 2007-2020 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
class HelloButton
|
23
|
+
include Glimmer
|
24
|
+
|
25
|
+
attr_accessor :count
|
26
|
+
|
27
|
+
def initialize
|
28
|
+
@count = 0
|
29
|
+
end
|
30
|
+
|
31
|
+
def launch
|
32
|
+
shell {
|
33
|
+
text 'Hello, Button!'
|
34
|
+
|
35
|
+
button {
|
36
|
+
text bind(self, :count) {|value| "Click To Increment: #{value} "}
|
37
|
+
|
38
|
+
on_widget_selected {
|
39
|
+
self.count += 1
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}.open
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
HelloButton.new.launch
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# Copyright (c) 2007-2020 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
include Glimmer
|
23
|
+
|
24
|
+
shell { |main_shell|
|
25
|
+
grid_layout {
|
26
|
+
margin_width 20
|
27
|
+
margin_height 10
|
28
|
+
}
|
29
|
+
|
30
|
+
background :white
|
31
|
+
text 'Hello, Link!'
|
32
|
+
|
33
|
+
@link = link {
|
34
|
+
background :white
|
35
|
+
link_foreground :dark_green
|
36
|
+
font height: 16
|
37
|
+
text <<~MULTI_LINE_STRING
|
38
|
+
|
39
|
+
You may click on any <a>link</a> to get help.
|
40
|
+
|
41
|
+
How do you know <a href="which-link-href-value">which link</a> you clicked?
|
42
|
+
|
43
|
+
Just keep clicking <a href="all links">links</a> to find out!
|
44
|
+
MULTI_LINE_STRING
|
45
|
+
|
46
|
+
on_widget_selected { |selection_event|
|
47
|
+
# This retrieves the clicked link href (or contained text if no href is set)
|
48
|
+
@selected_link = selection_event.text
|
49
|
+
}
|
50
|
+
on_mouse_up { |mouse_event|
|
51
|
+
unless @selected_link.nil?
|
52
|
+
@help_shell.close unless @help_shell.nil? || @help_shell.is_disposed
|
53
|
+
@help_shell = shell(:no_trim) {
|
54
|
+
grid_layout {
|
55
|
+
margin_width 10
|
56
|
+
margin_height 10
|
57
|
+
}
|
58
|
+
|
59
|
+
background :yellow
|
60
|
+
|
61
|
+
label {
|
62
|
+
background :yellow
|
63
|
+
text "Did someone ask for help about \"#{@selected_link}\"?\nYou don't really need help. You did it!"
|
64
|
+
}
|
65
|
+
|
66
|
+
on_swt_show {
|
67
|
+
x = main_shell.location.x + @link.location.x + mouse_event.x
|
68
|
+
y = main_shell.location.y + @link.location.y + mouse_event.y + 20
|
69
|
+
@help_shell.location = Point.new(x, y)
|
70
|
+
}
|
71
|
+
on_focus_lost {
|
72
|
+
@selected_link = nil
|
73
|
+
@help_shell.close
|
74
|
+
}
|
75
|
+
}
|
76
|
+
@help_shell.open
|
77
|
+
end
|
78
|
+
}
|
79
|
+
}
|
80
|
+
}.open
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (c) 2007-2020 Andy Maleh
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
# a copy of this software and associated documentation files (the
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -24,22 +24,27 @@ class HelloListMultiSelection
|
|
24
24
|
attr_accessor :provinces, :provinces_options
|
25
25
|
|
26
26
|
def initialize
|
27
|
-
self.provinces_options=[
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
27
|
+
self.provinces_options = [
|
28
|
+
'',
|
29
|
+
'Alberta',
|
30
|
+
'British Columbia',
|
31
|
+
'Manitoba',
|
32
|
+
'New Brunswick',
|
33
|
+
'Newfoundland and Labrador',
|
34
|
+
'Northwest Territories',
|
35
|
+
'Nova Scotia',
|
36
|
+
'Nunavut',
|
37
|
+
'Ontario',
|
38
|
+
'Prince Edward Island',
|
39
|
+
'Quebec',
|
40
|
+
'Saskatchewan',
|
41
|
+
'Yukon'
|
37
42
|
]
|
38
|
-
|
43
|
+
reset_provinces
|
39
44
|
end
|
40
45
|
|
41
46
|
def reset_provinces
|
42
|
-
self.provinces = [
|
47
|
+
self.provinces = ['Quebec', 'Manitoba', 'Alberta']
|
43
48
|
end
|
44
49
|
end
|
45
50
|
|
@@ -49,7 +54,7 @@ class HelloListMultiSelection
|
|
49
54
|
person = Person.new
|
50
55
|
|
51
56
|
shell {
|
52
|
-
grid_layout
|
57
|
+
grid_layout
|
53
58
|
|
54
59
|
text 'Hello, List Multi Selection!'
|
55
60
|
|
@@ -58,7 +63,7 @@ class HelloListMultiSelection
|
|
58
63
|
}
|
59
64
|
|
60
65
|
button {
|
61
|
-
text
|
66
|
+
text 'Reset Selections To Default Values'
|
62
67
|
|
63
68
|
on_widget_selected { person.reset_provinces }
|
64
69
|
}
|
@@ -24,12 +24,12 @@ class HelloListSingleSelection
|
|
24
24
|
attr_accessor :country, :country_options
|
25
25
|
|
26
26
|
def initialize
|
27
|
-
self.country_options=[
|
28
|
-
|
27
|
+
self.country_options = ['', 'Canada', 'US', 'Mexico']
|
28
|
+
reset_country
|
29
29
|
end
|
30
30
|
|
31
31
|
def reset_country
|
32
|
-
self.country =
|
32
|
+
self.country = 'Canada'
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -48,7 +48,7 @@ class HelloListSingleSelection
|
|
48
48
|
}
|
49
49
|
|
50
50
|
button {
|
51
|
-
text
|
51
|
+
text 'Reset Selection To Default Value'
|
52
52
|
|
53
53
|
on_widget_selected { person.reset_country }
|
54
54
|
}
|
@@ -56,4 +56,4 @@ class HelloListSingleSelection
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
-
HelloListSingleSelection.new.launch
|
59
|
+
HelloListSingleSelection.new.launch
|
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.17.10.
|
4
|
+
version: 4.17.10.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AndyMaleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-15 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: 1.0.
|
18
|
+
version: 1.0.5
|
19
19
|
name: glimmer
|
20
20
|
prerelease: false
|
21
21
|
type: :runtime
|
@@ -23,49 +23,67 @@ dependencies:
|
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.0.
|
26
|
+
version: 1.0.5
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
30
|
-
- - "
|
30
|
+
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 1.4.1
|
33
|
+
- - "<"
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 2.0.0
|
33
36
|
name: super_module
|
34
37
|
prerelease: false
|
35
38
|
type: :runtime
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
|
-
- - "
|
41
|
+
- - ">="
|
39
42
|
- !ruby/object:Gem::Version
|
40
43
|
version: 1.4.1
|
44
|
+
- - "<"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 2.0.0
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
requirement: !ruby/object:Gem::Requirement
|
43
49
|
requirements:
|
44
|
-
- - "
|
50
|
+
- - ">="
|
45
51
|
- !ruby/object:Gem::Version
|
46
52
|
version: 0.3.0
|
53
|
+
- - "<"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 2.0.0
|
47
56
|
name: nested_inherited_jruby_include_package
|
48
57
|
prerelease: false
|
49
58
|
type: :runtime
|
50
59
|
version_requirements: !ruby/object:Gem::Requirement
|
51
60
|
requirements:
|
52
|
-
- - "
|
61
|
+
- - ">="
|
53
62
|
- !ruby/object:Gem::Version
|
54
63
|
version: 0.3.0
|
64
|
+
- - "<"
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 2.0.0
|
55
67
|
- !ruby/object:Gem::Dependency
|
56
68
|
requirement: !ruby/object:Gem::Requirement
|
57
69
|
requirements:
|
58
|
-
- - "
|
70
|
+
- - ">="
|
59
71
|
- !ruby/object:Gem::Version
|
60
|
-
version: 0.
|
72
|
+
version: 0.11.0
|
73
|
+
- - "<"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.0.0
|
61
76
|
name: puts_debuggerer
|
62
77
|
prerelease: false
|
63
78
|
type: :runtime
|
64
79
|
version_requirements: !ruby/object:Gem::Requirement
|
65
80
|
requirements:
|
66
|
-
- - "
|
81
|
+
- - ">="
|
67
82
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
83
|
+
version: 0.11.0
|
84
|
+
- - "<"
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: 2.0.0
|
69
87
|
- !ruby/object:Gem::Dependency
|
70
88
|
requirement: !ruby/object:Gem::Requirement
|
71
89
|
requirements:
|
@@ -185,7 +203,7 @@ dependencies:
|
|
185
203
|
requirements:
|
186
204
|
- - ">="
|
187
205
|
- !ruby/object:Gem::Version
|
188
|
-
version: 3.
|
206
|
+
version: 3.26.0
|
189
207
|
- - "<"
|
190
208
|
- !ruby/object:Gem::Version
|
191
209
|
version: 4.0.0
|
@@ -196,7 +214,7 @@ dependencies:
|
|
196
214
|
requirements:
|
197
215
|
- - ">="
|
198
216
|
- !ruby/object:Gem::Version
|
199
|
-
version: 3.
|
217
|
+
version: 3.26.0
|
200
218
|
- - "<"
|
201
219
|
- !ruby/object:Gem::Version
|
202
220
|
version: 4.0.0
|
@@ -310,7 +328,7 @@ dependencies:
|
|
310
328
|
- - "~>"
|
311
329
|
- !ruby/object:Gem::Version
|
312
330
|
version: 0.7.0
|
313
|
-
description: Glimmer DSL for SWT (JRuby Desktop Development GUI
|
331
|
+
description: Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
|
314
332
|
email: andy.am@gmail.com
|
315
333
|
executables:
|
316
334
|
- glimmer
|
@@ -431,6 +449,7 @@ files:
|
|
431
449
|
- samples/elaborate/tic_tac_toe/cell.rb
|
432
450
|
- samples/elaborate/user_profile.rb
|
433
451
|
- samples/hello/hello_browser.rb
|
452
|
+
- samples/hello/hello_button.rb
|
434
453
|
- samples/hello/hello_checkbox.rb
|
435
454
|
- samples/hello/hello_checkbox_group.rb
|
436
455
|
- samples/hello/hello_combo.rb
|
@@ -444,6 +463,7 @@ files:
|
|
444
463
|
- samples/hello/hello_expand_bar.rb
|
445
464
|
- samples/hello/hello_file_dialog.rb
|
446
465
|
- samples/hello/hello_group.rb
|
466
|
+
- samples/hello/hello_link.rb
|
447
467
|
- samples/hello/hello_list_multi_selection.rb
|
448
468
|
- samples/hello/hello_list_single_selection.rb
|
449
469
|
- samples/hello/hello_menu_bar.rb
|