glimmer-dsl-swt 4.17.10.1 → 4.17.10.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -0
- data/README.md +72 -54
- data/VERSION +1 -1
- data/glimmer-dsl-swt.gemspec +8 -6
- 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/styled_text_proxy.rb +8 -13
- data/lib/glimmer/swt/table_proxy.rb +14 -14
- data/lib/glimmer/swt/widget_proxy.rb +35 -14
- data/samples/elaborate/login.rb +10 -13
- data/samples/hello/hello_button.rb +46 -0
- data/samples/hello/hello_link.rb +82 -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 +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 527278f09cf48caee9d3cdcc5c5ed1c5a066ff822ea1828c17605aeb7e6f07a9
|
4
|
+
data.tar.gz: cd4ae35f2a0e7312c57eb3d998579793687d9240b51c70a76be07e50f5e700dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 799ed5391c3d1e0a658d9f11a94b705bc96889648993a287560355daa0bd567fee8dade2118e2f232115938e5775a17a4500944cc4f1c693a19cfd3e2e452063
|
7
|
+
data.tar.gz: 1ca39bc3fa61931c2cf2b1b39caaca18938b2014ec73b0d8bcd47291f40895df0abe3b5d23158126ca457d2e9b27fce382c6216361d798fa928476d5625f7a97
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,29 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
### 4.17.10.6
|
4
|
+
|
5
|
+
- Hello, Link! Sample
|
6
|
+
- Refactor hello list samples
|
7
|
+
|
8
|
+
### 4.17.10.5
|
9
|
+
|
10
|
+
- Hello, Button! Sample
|
11
|
+
|
12
|
+
### 4.17.10.4
|
13
|
+
|
14
|
+
- Do not select first row in a table by default (keep unselected)
|
15
|
+
- Prevented extra call to model data in table items data-binding
|
16
|
+
- Upgraded to glimmer v1.0.5
|
17
|
+
|
18
|
+
### 4.17.10.3
|
19
|
+
|
20
|
+
- Fixed issue in StyledText data-binding relating to capturing selection changes on mouse click
|
21
|
+
|
22
|
+
### 4.17.10.2
|
23
|
+
|
24
|
+
- Upgraded glimmer gem to version 1.0.4
|
25
|
+
- Fixed issues relating to data-binding `styled_text` widget
|
26
|
+
|
3
27
|
### 4.17.10.1
|
4
28
|
|
5
29
|
- Upgraded glimmer gem to version 1.0.3
|
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.6
|
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.6
|
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.6
|
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.6
|
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.6
|
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.6 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.6"
|
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-11
|
15
|
-
s.description = "Glimmer DSL for SWT (JRuby Desktop Development GUI
|
14
|
+
s.date = "2020-12-11"
|
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,7 +174,7 @@ 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.
|
177
|
+
s.add_runtime_dependency(%q<glimmer>.freeze, ["~> 1.0.5"])
|
176
178
|
s.add_runtime_dependency(%q<super_module>.freeze, ["~> 1.4.1"])
|
177
179
|
s.add_runtime_dependency(%q<nested_inherited_jruby_include_package>.freeze, ["~> 0.3.0"])
|
178
180
|
s.add_runtime_dependency(%q<puts_debuggerer>.freeze, ["~> 0.10.2"])
|
@@ -191,7 +193,7 @@ 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.
|
196
|
+
s.add_dependency(%q<glimmer>.freeze, ["~> 1.0.5"])
|
195
197
|
s.add_dependency(%q<super_module>.freeze, ["~> 1.4.1"])
|
196
198
|
s.add_dependency(%q<nested_inherited_jruby_include_package>.freeze, ["~> 0.3.0"])
|
197
199
|
s.add_dependency(%q<puts_debuggerer>.freeze, ["~> 0.10.2"])
|
@@ -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
|
@@ -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
|
@@ -27,17 +27,12 @@ module Glimmer
|
|
27
27
|
#
|
28
28
|
# Follows the Proxy Design Pattern
|
29
29
|
class StyledTextProxy < WidgetProxy
|
30
|
-
def
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
end
|
36
|
-
else
|
37
|
-
super(attribute_name, *args)
|
38
|
-
end
|
30
|
+
def initialize(*args)
|
31
|
+
super
|
32
|
+
on_modify_text { |event|
|
33
|
+
@last_modify_text = text
|
34
|
+
}
|
39
35
|
end
|
40
|
-
|
41
36
|
end
|
42
37
|
end
|
43
38
|
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
|
@@ -357,35 +357,52 @@ module Glimmer
|
|
357
357
|
}
|
358
358
|
end,
|
359
359
|
:caret_position => lambda do |observer|
|
360
|
+
on_caret_moved { |event|
|
361
|
+
observer.call(@swt_widget.getSelection.x) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
362
|
+
}
|
360
363
|
on_swt_keyup { |event|
|
361
|
-
observer.call(@swt_widget.getCaretOffset
|
364
|
+
observer.call(@swt_widget.getSelection.x) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
362
365
|
}
|
363
366
|
on_swt_mouseup { |event|
|
364
|
-
observer.call(@swt_widget.getCaretOffset
|
367
|
+
observer.call(@swt_widget.getSelection.x) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
365
368
|
}
|
366
369
|
end,
|
367
370
|
:caret_offset => lambda do |observer|
|
371
|
+
on_caret_moved { |event|
|
372
|
+
observer.call(@swt_widget.getCaretOffset) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
373
|
+
}
|
374
|
+
end,
|
375
|
+
:selection => lambda do |observer|
|
376
|
+
on_widget_selected { |event|
|
377
|
+
observer.call(@swt_widget.getSelection) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
378
|
+
}
|
368
379
|
on_swt_keyup { |event|
|
369
|
-
observer.call(@swt_widget.getCaretOffset
|
380
|
+
observer.call(@swt_widget.getSelection) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
370
381
|
}
|
371
382
|
on_swt_mouseup { |event|
|
372
|
-
observer.call(@swt_widget.getCaretOffset
|
383
|
+
observer.call(@swt_widget.getSelection) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
373
384
|
}
|
374
385
|
end,
|
375
|
-
:
|
386
|
+
:selection_count => lambda do |observer|
|
387
|
+
on_widget_selected { |event|
|
388
|
+
observer.call(@swt_widget.getSelectionCount) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
389
|
+
}
|
376
390
|
on_swt_keyup { |event|
|
377
|
-
observer.call(@swt_widget.
|
391
|
+
observer.call(@swt_widget.getSelectionCount) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
378
392
|
}
|
379
393
|
on_swt_mouseup { |event|
|
380
|
-
observer.call(@swt_widget.
|
394
|
+
observer.call(@swt_widget.getSelectionCount) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
381
395
|
}
|
382
396
|
end,
|
383
|
-
:
|
397
|
+
:selection_range => lambda do |observer|
|
398
|
+
on_widget_selected { |event|
|
399
|
+
observer.call(@swt_widget.getSelectionRange) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
400
|
+
}
|
384
401
|
on_swt_keyup { |event|
|
385
|
-
observer.call(@swt_widget.
|
402
|
+
observer.call(@swt_widget.getSelectionRange) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
386
403
|
}
|
387
404
|
on_swt_mouseup { |event|
|
388
|
-
observer.call(@swt_widget.
|
405
|
+
observer.call(@swt_widget.getSelectionRange) unless @swt_widget.getCaretOffset == 0 && @last_modify_text != text
|
389
406
|
}
|
390
407
|
end,
|
391
408
|
:top_index => lambda do |observer|
|
@@ -714,14 +731,17 @@ module Glimmer
|
|
714
731
|
setter: {name: 'setFocus', invoker: lambda { |widget, args| @swt_widget.setFocus if args.first }},
|
715
732
|
},
|
716
733
|
'caret_position' => {
|
717
|
-
getter: {name: 'getCaretPosition', invoker: lambda { |widget, args| @swt_widget.respond_to?(:getCaretPosition) ? @swt_widget.getCaretPosition : @swt_widget.
|
718
|
-
setter: {name: 'setSelection', invoker: lambda { |widget, args| @swt_widget.setSelection(args.first) if args.first }},
|
734
|
+
getter: {name: 'getCaretPosition', invoker: lambda { |widget, args| @swt_widget.respond_to?(:getCaretPosition) ? @swt_widget.getCaretPosition : @swt_widget.getSelection.x}},
|
735
|
+
setter: {name: 'setSelection', invoker: lambda { |widget, args| @swt_widget.setSelection(args.first, args.first + @swt_widget.getSelectionCount) if args.first }},
|
719
736
|
},
|
720
737
|
'selection_count' => {
|
721
738
|
getter: {name: 'getSelectionCount'},
|
722
739
|
setter: {name: 'setSelection', invoker: lambda { |widget, args|
|
723
|
-
|
724
|
-
|
740
|
+
if args.first
|
741
|
+
caret_position = @swt_widget.respond_to?(:getCaretPosition) ? @swt_widget.getCaretPosition : @swt_widget.getSelection.x
|
742
|
+
# TODO handle negative length
|
743
|
+
@swt_widget.setSelection(caret_position, caret_position + args.first)
|
744
|
+
end
|
725
745
|
}},
|
726
746
|
},
|
727
747
|
}
|
@@ -837,6 +857,7 @@ module Glimmer
|
|
837
857
|
!!value
|
838
858
|
end,
|
839
859
|
:foreground => color_converter,
|
860
|
+
:link_foreground => color_converter,
|
840
861
|
:font => lambda do |value|
|
841
862
|
if value.is_a?(Hash)
|
842
863
|
font_properties = value
|
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,82 @@
|
|
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="href">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
|
+
@help_shell.close
|
73
|
+
}
|
74
|
+
on_shell_closed {
|
75
|
+
@selected_link = nil
|
76
|
+
}
|
77
|
+
}
|
78
|
+
@help_shell.open
|
79
|
+
end
|
80
|
+
}
|
81
|
+
}
|
82
|
+
}.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.6
|
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
|
11
|
+
date: 2020-12-11 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,7 +23,7 @@ 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:
|
@@ -310,7 +310,7 @@ dependencies:
|
|
310
310
|
- - "~>"
|
311
311
|
- !ruby/object:Gem::Version
|
312
312
|
version: 0.7.0
|
313
|
-
description: Glimmer DSL for SWT (JRuby Desktop Development GUI
|
313
|
+
description: Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
|
314
314
|
email: andy.am@gmail.com
|
315
315
|
executables:
|
316
316
|
- glimmer
|
@@ -431,6 +431,7 @@ files:
|
|
431
431
|
- samples/elaborate/tic_tac_toe/cell.rb
|
432
432
|
- samples/elaborate/user_profile.rb
|
433
433
|
- samples/hello/hello_browser.rb
|
434
|
+
- samples/hello/hello_button.rb
|
434
435
|
- samples/hello/hello_checkbox.rb
|
435
436
|
- samples/hello/hello_checkbox_group.rb
|
436
437
|
- samples/hello/hello_combo.rb
|
@@ -444,6 +445,7 @@ files:
|
|
444
445
|
- samples/hello/hello_expand_bar.rb
|
445
446
|
- samples/hello/hello_file_dialog.rb
|
446
447
|
- samples/hello/hello_group.rb
|
448
|
+
- samples/hello/hello_link.rb
|
447
449
|
- samples/hello/hello_list_multi_selection.rb
|
448
450
|
- samples/hello/hello_list_single_selection.rb
|
449
451
|
- samples/hello/hello_menu_bar.rb
|