glimmer-dsl-swt 4.22.2.4 → 4.22.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +15 -7
- data/VERSION +1 -1
- data/docs/reference/GLIMMER_COMMAND.md +3 -1
- data/docs/reference/GLIMMER_SAMPLES.md +2 -9
- data/glimmer-dsl-swt.gemspec +0 -0
- data/lib/glimmer/launcher.rb +7 -4
- data/lib/glimmer/rake_task/scaffold.rb +25 -13
- data/samples/elaborate/calculator.rb +12 -12
- data/samples/elaborate/contact_manager.rb +26 -14
- data/samples/elaborate/game_of_life.rb +8 -8
- data/samples/elaborate/klondike_solitaire/view/action_panel.rb +2 -2
- data/samples/elaborate/klondike_solitaire/view/klondike_solitaire_menu_bar.rb +15 -10
- data/samples/elaborate/login.rb +16 -10
- data/samples/elaborate/mandelbrot_fractal.rb +26 -20
- data/samples/elaborate/meta_sample.rb +6 -6
- data/samples/elaborate/metronome.rb +4 -4
- data/samples/elaborate/stock_ticker.rb +12 -12
- data/samples/elaborate/tetris.rb +4 -4
- data/samples/elaborate/timer.rb +36 -26
- data/samples/elaborate/user_profile.rb +53 -14
- data/samples/elaborate/weather.rb +2 -2
- data/samples/hello/hello_button.rb +3 -3
- data/samples/hello/hello_canvas_animation.rb +2 -2
- data/samples/hello/hello_color_dialog.rb +4 -4
- data/samples/hello/hello_custom_shell.rb +2 -2
- data/samples/hello/hello_dialog.rb +4 -4
- data/samples/hello/hello_directory_dialog.rb +2 -2
- data/samples/hello/hello_expand_bar.rb +4 -5
- data/samples/hello/hello_file_dialog.rb +2 -2
- data/samples/hello/hello_font_dialog.rb +2 -2
- data/samples/hello/hello_link.rb +5 -4
- data/samples/hello/hello_list_multi_selection.rb +3 -1
- data/samples/hello/hello_list_single_selection.rb +3 -1
- data/samples/hello/hello_menu_bar.rb +28 -28
- data/samples/hello/hello_message_box.rb +2 -2
- data/samples/hello/hello_pop_up_context_menu.rb +18 -8
- data/samples/hello/hello_shell.rb +16 -16
- data/samples/hello/hello_styled_text.rb +2 -2
- data/samples/hello/hello_table.rb +4 -4
- data/samples/hello/hello_tray_item.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ddae7932813d7434f6ea1013668ca03d899eae9dc6a0aacece9139f1172f98a
|
4
|
+
data.tar.gz: dcf0088e2b10c5861f5833c6962c3f253e043f82e7d304fdd35b3a923241c5ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd84fc1cebaf9e93eff102853f27198cc3bfb4bd5cdad95c63a26a73a05e9331caf54c430883e14f41e8e58688d5e889d9ad0c9758da59341b98f60ec59a4330
|
7
|
+
data.tar.gz: 99021203e9835c9204c248f6bffd333f48cf99dccc3ad5b6a223bb2db61217ff364110948b46da7999e9c3c1b0b8f452040270daf12e18f1d79f4b48b3a84808
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 4.22.2.5
|
4
|
+
|
5
|
+
- Update all samples to match the [GLIMMER_STYLE_GUIDE.md](/docs/reference/GLIMMER_STYLE_GUIDE.md)
|
6
|
+
- Update scaffolding code to match the [GLIMMER_STYLE_GUIDE.md](/docs/reference/GLIMMER_STYLE_GUIDE.md)
|
7
|
+
|
3
8
|
## 4.22.2.4
|
4
9
|
|
5
10
|
- Address the warning regarding using Ruby singletons on Java objects (shows up when running `glimmer samples`)
|
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.22.2.
|
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.22.2.5
|
2
2
|
## JRuby Desktop Development GUI Framework
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/glimmer-dsl-swt.svg)](http://badge.fury.io/rb/glimmer-dsl-swt)
|
4
4
|
[![Travis CI](https://travis-ci.com/AndyObtiva/glimmer-dsl-swt.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer-dsl-swt)
|
@@ -17,16 +17,16 @@ Featured in JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do) an
|
|
17
17
|
|
18
18
|
![Eclipse SWT RCP NASA Mars Rover](/images/glimmer-eclipse-swt-rcp-nasa-mars-rover.png)
|
19
19
|
|
20
|
-
[Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.22.2.
|
20
|
+
[Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.22.2.5 includes [SWT 4.22](https://download.eclipse.org/eclipse/downloads/drops4/R-4.22-202111241800/), which was released on November 24, 2021. Gem version numbers are in sync with the SWT library versions. The first two digits represent the SWT version number. The last two digits represent the minor and patch versions of Glimmer DSL for SWT.
|
21
21
|
|
22
22
|
**Starting in version 4.20.0.0, [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) comes with the new [***Shine***](/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#shine) syntax** for highly intuitive and visually expressive View/Model Attribute Mapping, relying on `<=>` for bidirectional (two-way) data-binding and `<=` for unidirectional (one-way) data-binding, providing an alternative to the `bind` keyword.
|
23
23
|
|
24
24
|
Please help make [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) better by providing feedback and [contributing](#contributing) whenever possible. Any feature suggestions that are accepted could be implemented within weeks if not days.
|
25
25
|
|
26
|
-
**[Glimmer](https://
|
26
|
+
**[Glimmer](https://github.com/AndyObtiva/glimmer) DSL Comparison Table:**
|
27
27
|
DSL | Platforms | Native? | Vector Graphics? | Pros | Cons | Prereqs
|
28
28
|
----|-----------|---------|------------------|------|------|--------
|
29
|
-
[Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)](https://github.com/AndyObtiva/glimmer-dsl-swt) | Mac / Windows / Linux | Yes | Yes (Canvas Shape DSL) | Very Mature / Scaffolding / Native Executable Packaging / Custom Widgets | Slow JRuby Startup Time / Heavy Memory Footprint | Java / JRuby
|
29
|
+
[Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)](https://github.com/AndyObtiva/glimmer-dsl-swt) | Mac / Windows / Linux | Yes | Yes (Canvas Shape DSL) | Very Mature / Scaffolding / Native Executable Packaging / Custom Widgets | Slow JRuby Startup Time / Heavy Memory Footprint | Java / JRuby
|
30
30
|
[Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps)](https://github.com/AndyObtiva/glimmer-dsl-opal) | All Web Browsers | No | Yes (Canvas Shape DSL) | Simpler than All JavaScript Technologies / Auto-Webify Desktop Apps | Setup Process / Only Rails 5 Support for Now | Rails
|
31
31
|
[Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-libui) | Mac / Windows / Linux | Yes | Yes (Area API) | Fast Startup Time / Light Memory Footprint | LibUI is an Incomplete Mid-Alpha Only | None Other Than MRI Ruby
|
32
32
|
[Glimmer DSL for Tk (MRI Ruby Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-tk) | Mac / Windows / Linux | Some Native-Themed Widgets (Not Truly Native) | Yes (Canvas) | Fast Startup Time / Light Memory Footprint | Widgets Do Not Look Truly Native, Espcially on Linux | ActiveTcl / MRI Ruby
|
@@ -331,7 +331,7 @@ jgem install glimmer-dsl-swt
|
|
331
331
|
|
332
332
|
Or this command if you want a specific version:
|
333
333
|
```
|
334
|
-
jgem install glimmer-dsl-swt -v 4.22.2.
|
334
|
+
jgem install glimmer-dsl-swt -v 4.22.2.5
|
335
335
|
```
|
336
336
|
|
337
337
|
`jgem` is JRuby's version of `gem` command.
|
@@ -359,7 +359,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
|
|
359
359
|
|
360
360
|
Add the following to `Gemfile`:
|
361
361
|
```
|
362
|
-
gem 'glimmer-dsl-swt', '~> 4.22.2.
|
362
|
+
gem 'glimmer-dsl-swt', '~> 4.22.2.5'
|
363
363
|
```
|
364
364
|
|
365
365
|
And, then run:
|
@@ -382,7 +382,7 @@ glimmer
|
|
382
382
|
```
|
383
383
|
|
384
384
|
```
|
385
|
-
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.22.2.
|
385
|
+
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.22.2.5
|
386
386
|
|
387
387
|
Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
|
388
388
|
|
@@ -552,6 +552,14 @@ If you have a Glimmer app you would like referenced here, please mention in a Pu
|
|
552
552
|
|
553
553
|
[Befunge 98 GUI](https://github.com/AndyObtiva/befunge98/tree/gui)
|
554
554
|
|
555
|
+
### Glimmer Metronome
|
556
|
+
|
557
|
+
[<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer_metronome/master/icons/linux/Glimmer%20Metronome.png" height=40 /> Glimmer Metronome](https://github.com/AndyObtiva/glimmer_metronome)
|
558
|
+
|
559
|
+
### Glimmer Wordle
|
560
|
+
|
561
|
+
[<img src='https://raw.githubusercontent.com/AndyObtiva/glimmer_wordle/master/icons/linux/Glimmer Wordle.png' height=40 /> Glimmer Wordle - Word Game](https://github.com/AndyObtiva/glimmer_wordle)
|
562
|
+
|
555
563
|
## Packaging & Distribution
|
556
564
|
|
557
565
|
Glimmer simplifies the process of native-executable packaging and distribution on Mac and Windows via a single command:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.22.2.
|
1
|
+
4.22.2.5
|
@@ -10,6 +10,8 @@ glimmer
|
|
10
10
|
|
11
11
|
On Mac and Linux, it additionally brings up a TUI (Text-based User Interface) for interactive navigation and execution of Glimmer tasks (courtesy of [rake-tui](https://github.com/AndyObtiva/rake-tui)).
|
12
12
|
|
13
|
+
(note that in ARM64 machines, the TUI does not seem to work at the moment, so simply use glimmer commands directly without the TUI until this is fixed)
|
14
|
+
|
13
15
|
On Windows, it simply lists the available Glimmer tasks at the end (courtsey of [rake](https://github.com/ruby/rake)).
|
14
16
|
|
15
17
|
If you are new to Glimmer, you may read the Basic Usage section and skip the rest until you have gone through [Girb (Glimmer irb) Command](#girb-glimmer-irb-command), [Glimmer GUI DSL Syntax](#glimmer-gui-dsl-syntax), and [Samples](#samples).
|
@@ -107,7 +109,7 @@ glimmer samples/hello/hello_world.rb samples/hello/hello_tab.rb
|
|
107
109
|
|
108
110
|
Launches samples/hello/hello_world.rb and samples/hello_tab.rb at the same time, each in a separate JRuby thread.
|
109
111
|
|
110
|
-
Note: under Zsh (Z Shell), glimmer can only be used in its advanced
|
112
|
+
Note: under Zsh (Z Shell), glimmer can only be used in its advanced \ mode (e.g. `glimmer` and then selecting a task) not the primitive rake task mode (e.g. `glimmer scaffold[app]`)
|
111
113
|
|
112
114
|
### Glimmer Samples
|
113
115
|
|
@@ -85,7 +85,6 @@
|
|
85
85
|
- [Gladiator](#gladiator)
|
86
86
|
- [Timer](#timer)
|
87
87
|
- [Glimmer Klondike Solitaire](#glimmer-klondike-solitaire)
|
88
|
-
- [Glimmer Metronome](#glimmer-metronome)
|
89
88
|
- [License](#license)
|
90
89
|
|
91
90
|
## Samples
|
@@ -1336,6 +1335,8 @@ This sample demonstrates a Metronome that accepts a beat count and bpm rate, tic
|
|
1336
1335
|
|
1337
1336
|
It takes advantage of the Canvas Shape DSL, data-binding, and the Java Sound library. It employs a hybrid approach of relying on standard widget layouts (grid layout) and canvas shape x,y placement.
|
1338
1337
|
|
1338
|
+
An external more full-fledged version exists too as [Glimmer Metronome](https://github.com/AndyObtiva/glimmer_metronome).
|
1339
|
+
|
1339
1340
|
Code:
|
1340
1341
|
|
1341
1342
|
[samples/elaborate/metronome.rb](/samples/elaborate/metronome.rb)
|
@@ -1429,14 +1430,6 @@ This is a souped up version of the Klondike Solitaire elaborate sample, which is
|
|
1429
1430
|
|
1430
1431
|
![Glimmer Klondike Solitaire](https://raw.githubusercontent.com/AndyObtiva/glimmer_klondike_solitaire/master/images/glimmer-klondike-solitaire.png)
|
1431
1432
|
|
1432
|
-
#### Glimmer Metronome
|
1433
|
-
|
1434
|
-
This is an external enhanced version of [Metronome](#metronome) that can be packaged as an independent native executable.
|
1435
|
-
|
1436
|
-
[<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer_metronome/master/icons/linux/Glimmer%20Metronome.png" height=40 /> Glimmer Metronome](https://github.com/AndyObtiva/glimmer_metronome)
|
1437
|
-
|
1438
|
-
![Metronome](https://raw.githubusercontent.com/AndyObtiva/glimmer_metronome/master/screenshots/glimmer-metronome.png)
|
1439
|
-
|
1440
1433
|
## License
|
1441
1434
|
|
1442
1435
|
[MIT](LICENSE.txt)
|
data/glimmer-dsl-swt.gemspec
CHANGED
Binary file
|
data/lib/glimmer/launcher.rb
CHANGED
@@ -72,10 +72,13 @@ module Glimmer
|
|
72
72
|
OPERATING_SYSTEMS_SUPPORTED.detect {|os| OS.send("#{os}?")}
|
73
73
|
end
|
74
74
|
|
75
|
-
def
|
75
|
+
def is_arm64?
|
76
76
|
host_cpu = OS.host_cpu.downcase
|
77
|
-
|
78
|
-
|
77
|
+
host_cpu.include?('aarch64') || host_cpu.include?('arm')
|
78
|
+
end
|
79
|
+
|
80
|
+
def special_cpu_architecture_suffix
|
81
|
+
is_arm64? ? "_aarch64" : ''
|
79
82
|
end
|
80
83
|
|
81
84
|
def swt_jar_file
|
@@ -187,7 +190,7 @@ module Glimmer
|
|
187
190
|
end
|
188
191
|
|
189
192
|
def display_tasks
|
190
|
-
if OS.windows?
|
193
|
+
if OS.windows? || Launcher.is_arm64?
|
191
194
|
require 'rake'
|
192
195
|
Rake::TaskManager.record_task_metadata = true
|
193
196
|
require_relative 'rake_task'
|
@@ -597,12 +597,13 @@ module Glimmer
|
|
597
597
|
Display.app_name = '#{shell_type == :gem ? human_name(custom_shell_name) : human_name(namespace)}'
|
598
598
|
Display.app_version = VERSION
|
599
599
|
@display = display {
|
600
|
-
on_about
|
600
|
+
on_about do
|
601
601
|
display_about_dialog
|
602
|
-
|
603
|
-
|
602
|
+
end
|
603
|
+
|
604
|
+
on_preferences do
|
604
605
|
#{shell_type == :desktopify ? 'display_about_dialog' : 'display_preferences_dialog'}
|
605
|
-
|
606
|
+
end
|
606
607
|
}
|
607
608
|
end
|
608
609
|
MULTI_LINE_STRING
|
@@ -658,17 +659,21 @@ module Glimmer
|
|
658
659
|
menu_bar {
|
659
660
|
menu {
|
660
661
|
text '&File'
|
662
|
+
|
661
663
|
menu_item {
|
662
664
|
text '&About...'
|
663
|
-
|
665
|
+
|
666
|
+
on_widget_selected do
|
664
667
|
display_about_dialog
|
665
|
-
|
668
|
+
end
|
666
669
|
}
|
670
|
+
|
667
671
|
menu_item {
|
668
672
|
text '&Preferences...'
|
669
|
-
|
673
|
+
|
674
|
+
on_widget_selected do
|
670
675
|
#{shell_type == :desktopify ? 'display_about_dialog' : 'display_preferences_dialog'}
|
671
|
-
|
676
|
+
end
|
672
677
|
}
|
673
678
|
}
|
674
679
|
}
|
@@ -697,31 +702,37 @@ module Glimmer
|
|
697
702
|
custom_shell_file_content += <<-MULTI_LINE_STRING
|
698
703
|
def display_preferences_dialog
|
699
704
|
dialog(swt_widget) {
|
700
|
-
text 'Preferences'
|
701
705
|
grid_layout {
|
702
706
|
margin_height 5
|
703
707
|
margin_width 5
|
704
708
|
}
|
709
|
+
|
710
|
+
text 'Preferences'
|
711
|
+
|
705
712
|
group {
|
706
713
|
row_layout {
|
707
714
|
type :vertical
|
708
715
|
spacing 10
|
709
716
|
}
|
717
|
+
|
710
718
|
text 'Greeting'
|
711
719
|
font style: :bold
|
720
|
+
|
712
721
|
[
|
713
722
|
'Hello, World!',
|
714
723
|
'Howdy, Partner!'
|
715
724
|
].each do |greeting_text|
|
716
725
|
button(:radio) {
|
717
|
-
text greeting_text
|
718
|
-
selection <= [self, :greeting, on_read: ->(g) { g == greeting_text }]
|
719
726
|
layout_data {
|
720
727
|
width 160
|
721
728
|
}
|
722
|
-
|
729
|
+
|
730
|
+
text greeting_text
|
731
|
+
selection <= [self, :greeting, on_read: ->(g) { g == greeting_text }]
|
732
|
+
|
733
|
+
on_widget_selected do |event|
|
723
734
|
self.greeting = event.widget.getText
|
724
|
-
|
735
|
+
end
|
725
736
|
}
|
726
737
|
end
|
727
738
|
}
|
@@ -823,6 +834,7 @@ end
|
|
823
834
|
background background_color
|
824
835
|
cubic size_width - size_width*0.66, size_height/2 - size_height*0.33, size_width*0.65 - size_width*0.66, 0 - size_height*0.33, size_width/2 - size_width*0.66, size_height*0.75 - size_height*0.33, size_width - size_width*0.66, size_height - size_height*0.33
|
825
836
|
}
|
837
|
+
|
826
838
|
path {
|
827
839
|
background background_color
|
828
840
|
cubic size_width - size_width*0.66, size_height/2 - size_height*0.33, size_width*1.35 - size_width*0.66, 0 - size_height*0.33, size_width*1.5 - size_width*0.66, size_height*0.75 - size_height*0.33, size_width - size_width*0.66, size_height - size_height*0.33
|
@@ -21,14 +21,14 @@ class Calculator
|
|
21
21
|
Display.setAppName('Glimmer Calculator')
|
22
22
|
|
23
23
|
display {
|
24
|
-
on_swt_keydown
|
24
|
+
on_swt_keydown do |key_event|
|
25
25
|
char = key_event.character.chr rescue nil
|
26
26
|
@presenter.press(char)
|
27
|
-
|
27
|
+
end
|
28
28
|
|
29
|
-
on_about
|
29
|
+
on_about do
|
30
30
|
display_about_dialog
|
31
|
-
|
31
|
+
end
|
32
32
|
}
|
33
33
|
end
|
34
34
|
|
@@ -59,16 +59,16 @@ class Calculator
|
|
59
59
|
operation_button('÷')
|
60
60
|
operation_button('×')
|
61
61
|
operation_button('−')
|
62
|
-
(7..9).each
|
62
|
+
(7..9).each do |number|
|
63
63
|
number_button(number)
|
64
|
-
|
64
|
+
end
|
65
65
|
operation_button('+', font: BUTTON_FONT_BIG, vertical_span: 2)
|
66
|
-
(4..6).each
|
66
|
+
(4..6).each do |number|
|
67
67
|
number_button(number)
|
68
|
-
|
69
|
-
(1..3).each
|
68
|
+
end
|
69
|
+
(1..3).each do |number|
|
70
70
|
number_button(number)
|
71
|
-
|
71
|
+
end
|
72
72
|
command_button('=', font: BUTTON_FONT_BIG, vertical_span: 2)
|
73
73
|
number_button(0, horizontal_span: 2)
|
74
74
|
operation_button('.')
|
@@ -98,9 +98,9 @@ class Calculator
|
|
98
98
|
vertical_span options[:vertical_span]
|
99
99
|
}
|
100
100
|
|
101
|
-
on_widget_selected
|
101
|
+
on_widget_selected do
|
102
102
|
@presenter.press(command)
|
103
|
-
|
103
|
+
end
|
104
104
|
}
|
105
105
|
end
|
106
106
|
|
@@ -40,6 +40,7 @@ class ContactManager
|
|
40
40
|
margin_width 0
|
41
41
|
margin_height 0
|
42
42
|
}
|
43
|
+
|
43
44
|
layout_data :fill, :center, true, false
|
44
45
|
text 'Lookup Contacts'
|
45
46
|
font height: 24
|
@@ -52,9 +53,10 @@ class ContactManager
|
|
52
53
|
text {
|
53
54
|
layout_data :fill, :center, true, false
|
54
55
|
text <=> [@contact_manager_presenter, :first_name]
|
55
|
-
|
56
|
+
|
57
|
+
on_key_pressed do |key_event|
|
56
58
|
@contact_manager_presenter.find if key_event.keyCode == swt(:cr)
|
57
|
-
|
59
|
+
end
|
58
60
|
}
|
59
61
|
|
60
62
|
label {
|
@@ -65,9 +67,10 @@ class ContactManager
|
|
65
67
|
text {
|
66
68
|
layout_data :fill, :center, true, false
|
67
69
|
text <=> [@contact_manager_presenter, :last_name]
|
68
|
-
|
70
|
+
|
71
|
+
on_key_pressed do |key_event|
|
69
72
|
@contact_manager_presenter.find if key_event.keyCode == swt(:cr)
|
70
|
-
|
73
|
+
end
|
71
74
|
}
|
72
75
|
|
73
76
|
label {
|
@@ -78,9 +81,10 @@ class ContactManager
|
|
78
81
|
text {
|
79
82
|
layout_data :fill, :center, true, false
|
80
83
|
text <=> [@contact_manager_presenter, :email]
|
81
|
-
|
84
|
+
|
85
|
+
on_key_pressed do |key_event|
|
82
86
|
@contact_manager_presenter.find if key_event.keyCode == swt(:cr)
|
83
|
-
|
87
|
+
end
|
84
88
|
}
|
85
89
|
|
86
90
|
composite {
|
@@ -94,18 +98,26 @@ class ContactManager
|
|
94
98
|
|
95
99
|
button {
|
96
100
|
text "&Find"
|
97
|
-
|
98
|
-
|
101
|
+
|
102
|
+
on_widget_selected do
|
103
|
+
@contact_manager_presenter.find
|
104
|
+
end
|
105
|
+
|
106
|
+
on_key_pressed do |key_event|
|
99
107
|
@contact_manager_presenter.find if key_event.keyCode == swt(:cr)
|
100
|
-
|
108
|
+
end
|
101
109
|
}
|
102
110
|
|
103
111
|
button {
|
104
112
|
text "&List All"
|
105
|
-
|
106
|
-
|
113
|
+
|
114
|
+
on_widget_selected do
|
115
|
+
@contact_manager_presenter.list
|
116
|
+
end
|
117
|
+
|
118
|
+
on_key_pressed do |key_event|
|
107
119
|
@contact_manager_presenter.list if key_event.keyCode == swt(:cr)
|
108
|
-
|
120
|
+
end
|
109
121
|
}
|
110
122
|
}
|
111
123
|
}
|
@@ -134,9 +146,9 @@ class ContactManager
|
|
134
146
|
|
135
147
|
items <=> [@contact_manager_presenter, :results, column_properties: [:first_name, :last_name, :email]]
|
136
148
|
|
137
|
-
on_mouse_up
|
149
|
+
on_mouse_up do |event|
|
138
150
|
table_proxy.edit_table_item(event.table_item, event.column_index)
|
139
|
-
|
151
|
+
end
|
140
152
|
}
|
141
153
|
}
|
142
154
|
}
|
@@ -50,9 +50,9 @@ class GameOfLife
|
|
50
50
|
rectangle(column_index*CELL_WIDTH, row_index*CELL_HEIGHT, CELL_WIDTH, CELL_HEIGHT) {
|
51
51
|
background <= [@grid.cell_rows[row_index][column_index], "alive", on_read: ->(a) {a ? :black : :white}]
|
52
52
|
|
53
|
-
on_mouse_down
|
53
|
+
on_mouse_down do
|
54
54
|
@grid.cell_rows[row_index][column_index].toggle_aliveness!
|
55
|
-
|
55
|
+
end
|
56
56
|
}
|
57
57
|
end
|
58
58
|
end
|
@@ -67,26 +67,26 @@ class GameOfLife
|
|
67
67
|
text 'Step'
|
68
68
|
enabled <= [@grid, :playing, on_read: :! ]
|
69
69
|
|
70
|
-
on_widget_selected
|
70
|
+
on_widget_selected do
|
71
71
|
@grid.step!
|
72
|
-
|
72
|
+
end
|
73
73
|
}
|
74
74
|
|
75
75
|
button {
|
76
76
|
text 'Clear'
|
77
77
|
enabled <= [@grid, :playing, on_read: :! ]
|
78
78
|
|
79
|
-
on_widget_selected
|
79
|
+
on_widget_selected do
|
80
80
|
@grid.clear!
|
81
|
-
|
81
|
+
end
|
82
82
|
}
|
83
83
|
|
84
84
|
button {
|
85
85
|
text <= [@grid, :playing, on_read: ->(p) { p ? 'Stop' : 'Play' }]
|
86
86
|
|
87
|
-
on_widget_selected
|
87
|
+
on_widget_selected do
|
88
88
|
@grid.toggle_playback!
|
89
|
-
|
89
|
+
end
|
90
90
|
}
|
91
91
|
|
92
92
|
label {
|
@@ -7,12 +7,13 @@ class KlondikeSolitaire
|
|
7
7
|
|
8
8
|
before_body do
|
9
9
|
@display = display {
|
10
|
-
on_about
|
10
|
+
on_about do
|
11
11
|
display_about_dialog
|
12
|
-
|
13
|
-
|
12
|
+
end
|
13
|
+
|
14
|
+
on_preferences do
|
14
15
|
display_about_dialog
|
15
|
-
|
16
|
+
end
|
16
17
|
}
|
17
18
|
end
|
18
19
|
|
@@ -20,30 +21,34 @@ class KlondikeSolitaire
|
|
20
21
|
menu_bar {
|
21
22
|
menu {
|
22
23
|
text '&Game'
|
24
|
+
|
23
25
|
menu_item {
|
24
26
|
text '&Restart'
|
25
27
|
accelerator (OS.mac? ? :command : :ctrl), :r
|
26
28
|
|
27
|
-
on_widget_selected
|
29
|
+
on_widget_selected do
|
28
30
|
game.restart!
|
29
|
-
|
31
|
+
end
|
30
32
|
}
|
33
|
+
|
31
34
|
menu_item {
|
32
35
|
text 'E&xit'
|
33
36
|
accelerator :alt, :f4
|
34
37
|
|
35
|
-
on_widget_selected
|
38
|
+
on_widget_selected do
|
36
39
|
exit(0)
|
37
|
-
|
40
|
+
end
|
38
41
|
}
|
39
42
|
}
|
40
43
|
menu {
|
41
44
|
text '&Help'
|
45
|
+
|
42
46
|
menu_item {
|
43
47
|
text '&About...'
|
44
|
-
|
48
|
+
|
49
|
+
on_widget_selected do
|
45
50
|
display_about_dialog
|
46
|
-
|
51
|
+
end
|
47
52
|
}
|
48
53
|
}
|
49
54
|
}
|
data/samples/elaborate/login.rb
CHANGED
@@ -81,9 +81,9 @@ class Login
|
|
81
81
|
text <=> [@presenter, :user_name]
|
82
82
|
enabled <= [@presenter, :logged_out?, computed_by: :status]
|
83
83
|
|
84
|
-
on_key_pressed
|
84
|
+
on_key_pressed do |event|
|
85
85
|
@password_text.set_focus if event.keyCode == swt(:cr)
|
86
|
-
|
86
|
+
end
|
87
87
|
}
|
88
88
|
|
89
89
|
label { text "Password:" }
|
@@ -91,9 +91,9 @@ class Login
|
|
91
91
|
text <=> [@presenter, :password]
|
92
92
|
enabled <= [@presenter, :logged_out?, computed_by: :status]
|
93
93
|
|
94
|
-
on_key_pressed
|
94
|
+
on_key_pressed do |event|
|
95
95
|
@presenter.login! if event.keyCode == swt(:cr)
|
96
|
-
|
96
|
+
end
|
97
97
|
}
|
98
98
|
|
99
99
|
label { text "Status:" }
|
@@ -103,25 +103,31 @@ class Login
|
|
103
103
|
text "Login"
|
104
104
|
enabled <= [@presenter, :logged_out?, computed_by: :status]
|
105
105
|
|
106
|
-
on_widget_selected
|
107
|
-
|
106
|
+
on_widget_selected do
|
107
|
+
@presenter.login!
|
108
|
+
end
|
109
|
+
|
110
|
+
on_key_pressed do |event|
|
108
111
|
if event.keyCode == swt(:cr)
|
109
112
|
@presenter.login!
|
110
113
|
end
|
111
|
-
|
114
|
+
end
|
112
115
|
}
|
113
116
|
|
114
117
|
button {
|
115
118
|
text "Logout"
|
116
119
|
enabled <= [@presenter, :logged_in?, computed_by: :status]
|
117
120
|
|
118
|
-
on_widget_selected
|
119
|
-
|
121
|
+
on_widget_selected do
|
122
|
+
@presenter.logout!
|
123
|
+
end
|
124
|
+
|
125
|
+
on_key_pressed do |event|
|
120
126
|
if event.keyCode == swt(:cr)
|
121
127
|
@presenter.logout!
|
122
128
|
@user_name_text.set_focus
|
123
129
|
end
|
124
|
-
|
130
|
+
end
|
125
131
|
}
|
126
132
|
}
|
127
133
|
}
|