glimmer-dsl-swt 4.20.13.15 → 4.20.14.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b6f16ea275e3ce37889ed445d6cc3ab42bbcb7068eb1e57f51017d1625ac2582
4
- data.tar.gz: d5dc4c387caa917f1c20db29cbf27c06148736b52bc7bd4cfb63d75854e866f6
3
+ metadata.gz: ff80eeabdc2f2185c4c15a9a02bb3d6d06596f5bc803fa6badbdf6a22a9c6dec
4
+ data.tar.gz: 7b86a2fb40bd3423e1e6f24534de4e09dc865da4671add6d3db493a9c53e1a69
5
5
  SHA512:
6
- metadata.gz: 7e9ab4f42471a424a335d5f39a395639601b88c4694eeb016f4d5b3b2449114eea07e3395058892b22b1c4e5b9b11c1e1b3e24a0fc7b687393cfb8218c548142
7
- data.tar.gz: 472f326d596fbcb2e551549bb6bb6411839acb86437ad789e4ecc29841facbd2a27c32a696ac4c2a2c68d8b754517a35fff7570a05441c18db5033f1774c671b
6
+ metadata.gz: c90efdd83bee0f72a24525e8c33b8e36b9242be961995576f0251bbef139ffe41b7af4a99063f72bc1074c83c7252fd03263e02b037d2a5f831ca193c74aa71a
7
+ data.tar.gz: fe2c6640ee05b3f55481c1355debb96252d5428e6443a5d0df06f915fe8018da58157a07e2fcc3df2b5648fc54797dc1c1d6dd9af4a766d5c5a84950e8816997
data/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Change Log
2
2
 
3
+ ### 4.20.14.0
4
+
5
+ - Extract ObserveExpression into Glimmer
6
+ - Upgrade to Glimmer 2.1.0
7
+
8
+ ### 4.20.13.18
9
+
10
+ - Change `arrow` widget default SWT style to include `:down`
11
+ - Hello, Arrow! sample
12
+
13
+ ### 4.20.13.17
14
+
15
+ - Hello, Slider! sample
16
+
17
+ ### 4.20.13.16
18
+
19
+ - Fix issue with setting app name (via `Display.app_name=`) when app is not packaged (always gets set to Glimmer)
20
+ - Fix Hello, Custom Shell! sample
21
+
3
22
  ### 4.20.13.15
4
23
 
5
24
  - Battleship elaborate sample
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.20.13.15
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.20.13.18
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)
@@ -15,7 +15,7 @@
15
15
  [<img src="https://covers.oreillystatic.com/images/9780596519650/lrg.jpg" width=105 /><br />
16
16
  Featured in JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do) and [Chalmers/Gothenburg University Software Engineering Master's Lecture Material](http://www.cse.chalmers.se/~bergert/slides/guest_lecture_DSLs.pdf)
17
17
 
18
- [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.20.13.15 includes [SWT 4.20](https://download.eclipse.org/eclipse/downloads/drops4/R-4.20-202106111600/), which was released on June 11, 2021. Gem version numbers are in sync with the SWT library versions. The first two digits represent the SWT version number. The last two digits represent the minor and patch versions of Glimmer DSL for SWT. Note that SWT now supports AARCH64 on Mac and Linux, but it is not fully tested in Glimmer DSL for SWT yet, so deem its support experimental for the time being without guarantees for functionality until declared otherwise (report any issues you may encounter).
18
+ [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.20.13.18 includes [SWT 4.20](https://download.eclipse.org/eclipse/downloads/drops4/R-4.20-202106111600/), which was released on June 11, 2021. Gem version numbers are in sync with the SWT library versions. The first two digits represent the SWT version number. The last two digits represent the minor and patch versions of Glimmer DSL for SWT. Note that SWT now supports AARCH64 on Mac and Linux, but it is not fully tested in Glimmer DSL for SWT yet, so deem its support experimental for the time being without guarantees for functionality until declared otherwise (please report any issues you may encounter).
19
19
 
20
20
  **Starting in version 4.20.0.0, [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) comes with the new [***Shine***](/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#shine) syntax** for highly intuitive and visually expressive View/Model Attribute Mapping, relying on `<=>` for bidirectional (two-way) data-binding and `<=` for unidirectional (one-way) data-binding, providing an alternative to the `bind` keyword (keep in mind that it is still a beta, so default back to `bind` whenever needed).
21
21
 
@@ -199,11 +199,6 @@ Glimmer app:
199
199
 
200
200
  [![Math Bowling App Screenshot](https://raw.githubusercontent.com/AndyObtiva/MathBowling/master/Math-Bowling-Screenshot.png)](https://github.com/AndyObtiva/MathBowling)
201
201
 
202
- **Note:** I offer Glimmer DSL for SWT as a free and open-source [Ruby Gem](https://rubygems.org/gems/glimmer-dsl-swt) that represents my interests in Ruby Programming, Desktop GUI application development with SWT, Object Oriented Design, Design Patterns, and Software Architecture.
203
- Additionally, I am sharing my professional experience and expertise in Eclipse SWT given that I am an [EclipseCon](http://andymaleh.blogspot.com/2007/03/eclipsecon-2007-day-3.html)/[EclipseWorld](http://andymaleh.blogspot.com/2008/11/eclipseworld-2008-highlights.html) presenter and have built professional applications in SWT/JFace/RCP for Obtiva and the Pampered Chef in the past. This is also done in the hopes that it would indirectly bring me work in a field I am extremely passionate about.
204
- That said, please keep in mind that I myself am learning topics in Software Engineering too everyday, including newer editions of SWT and JRuby, which seem to pop up every quarter.
205
- If you see anything that needs to be improved, please do not hesitate to contact me on [Gitter](https://gitter.im/AndyObtiva/glimmer) or submit [Issues](https://github.com/AndyObtiva/glimmer-dsl-swt/issues)/[Pull-Requests](https://github.com/AndyObtiva/glimmer-dsl-swt/pulls).
206
-
207
202
  ## Table of contents
208
203
 
209
204
  - [Glimmer (JRuby Desktop Development GUI Framework)](#jruby-desktop-development-gui-framework)
@@ -326,7 +321,7 @@ jgem install glimmer-dsl-swt
326
321
 
327
322
  Or this command if you want a specific version:
328
323
  ```
329
- jgem install glimmer-dsl-swt -v 4.20.13.15
324
+ jgem install glimmer-dsl-swt -v 4.20.13.18
330
325
  ```
331
326
 
332
327
  `jgem` is JRuby's version of `gem` command.
@@ -354,7 +349,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
354
349
 
355
350
  Add the following to `Gemfile`:
356
351
  ```
357
- gem 'glimmer-dsl-swt', '~> 4.20.13.15'
352
+ gem 'glimmer-dsl-swt', '~> 4.20.13.18'
358
353
  ```
359
354
 
360
355
  And, then run:
@@ -375,7 +370,7 @@ glimmer
375
370
  ```
376
371
 
377
372
  ```
378
- Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.20.13.15
373
+ Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.20.13.18
379
374
 
380
375
  Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
381
376
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.20.13.15
1
+ 4.20.14.0
@@ -19,6 +19,7 @@
19
19
  - [Hello, Drag and Drop!](#hello-drag-and-drop)
20
20
  - [Hello, Menu Bar!](#hello-menu-bar)
21
21
  - [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu)
22
+ - [Hello, Arrow!](#hello-arrow)
22
23
  - [Hello, Custom Widget!](#hello-custom-widget)
23
24
  - [Hello, Custom Shell!](#hello-custom-shell)
24
25
  - [Hello, Sash Form!](#hello-sash-form)
@@ -33,6 +34,7 @@
33
34
  - [Hello, File Dialog!](#hello-file-dialog)
34
35
  - [Hello, Date Time!](#hello-date-time)
35
36
  - [Hello, Scale!](#hello-scale)
37
+ - [Hello, Slider!](#hello-slider)
36
38
  - [Hello, Spinner!](#hello-spinner)
37
39
  - [Hello, Table!](#hello-table)
38
40
  - [Hello, Link!](#hello-link)
@@ -399,6 +401,20 @@ Code:
399
401
  ![Hello Pop Up Context Menu](/images/glimmer-hello-pop-up-context-menu.png)
400
402
  ![Hello Pop Up Context Menu Popped Up](/images/glimmer-hello-pop-up-context-menu-popped-up.png)
401
403
 
404
+ #### Hello, Arrow!
405
+
406
+ This sample demonstrates `arrow` button (aka `button(:arrow)`).
407
+
408
+ Code:
409
+
410
+ [samples/hello/hello_arrow.rb](/samples/hello/hello_arrow.rb)
411
+
412
+ ![Hello Arrow](/images/glimmer-hello-arrow.png)
413
+
414
+ ![Hello Arrow Menu](/images/glimmer-hello-arrow-menu.png)
415
+
416
+ ![Hello Arrow Item Selected](/images/glimmer-hello-arrow-item-selected.png)
417
+
402
418
  #### Hello, Custom Widget!
403
419
 
404
420
  This sample demonstrates the use of a custom widget in Glimmer.
@@ -614,6 +630,18 @@ Hello, Scale!
614
630
 
615
631
  ![Hello Scale](/images/glimmer-hello-scale.png)
616
632
 
633
+ #### Hello, Slider!
634
+
635
+ This sample demonstrates the use of `slider` widget in Glimmer
636
+
637
+ Code:
638
+
639
+ [samples/hello/hello_slider.rb](/samples/hello/hello_slider.rb)
640
+
641
+ Hello, Slider!
642
+
643
+ ![Hello Slider](/images/glimmer-hello-slider.png)
644
+
617
645
  #### Hello, Spinner!
618
646
 
619
647
  This sample demonstrates the use of `spinner` widget in Glimmer
Binary file
@@ -21,7 +21,6 @@
21
21
 
22
22
  require 'glimmer/dsl/static_expression'
23
23
  require 'glimmer/dsl/bind_expression'
24
- require 'glimmer/data_binding/model_binding'
25
24
 
26
25
  module Glimmer
27
26
  module DSL
@@ -21,8 +21,7 @@
21
21
 
22
22
  require 'glimmer/dsl/static_expression'
23
23
  require 'glimmer/dsl/top_level_expression'
24
- require 'glimmer/data_binding/observer'
25
- require 'glimmer/data_binding/model_binding'
24
+ require 'glimmer/dsl/observe_expression'
26
25
  require 'glimmer/ui/custom_widget'
27
26
 
28
27
  module Glimmer
@@ -30,23 +29,10 @@ module Glimmer
30
29
  module SWT
31
30
  class ObserveExpression < StaticExpression
32
31
  include TopLevelExpression
32
+ include Glimmer::DSL::ObserveExpression
33
33
 
34
- REGEX_NESTED_OR_INDEXED_PROPERTY = /([^\[]+)(\[[^\]]+\])?/
35
-
36
- def can_interpret?(parent, keyword, *args, &block)
37
- keyword == 'observe' and
38
- block_given? and
39
- (args.size == 2) and
40
- textual?(args[1])
41
- end
42
-
43
34
  def interpret(parent, keyword, *args, &block)
44
- observer = DataBinding::Observer.proc(&block)
45
- if args[1].to_s.match(REGEX_NESTED_OR_INDEXED_PROPERTY)
46
- observer_registration = observer.observe(DataBinding::ModelBinding.new(args[0], args[1]))
47
- else
48
- observer_registration = observer.observe(args[0], args[1])
49
- end
35
+ observer_registration = super
50
36
  Glimmer::UI::CustomWidget.current_custom_widgets.last&.observer_registrations&.push(observer_registration)
51
37
  observer_registration
52
38
  end
@@ -200,12 +200,14 @@ module Glimmer
200
200
  elsif observation_request.start_with?('on_')
201
201
  event_name = observation_request.sub(/^on_/, '')
202
202
  if OBSERVED_MENU_ITEMS.include?(event_name) && OS.mac?
203
- system_menu = swt_display.getSystemMenu
204
- menu_item = system_menu.getItems.find {|menu_item| menu_item.getID == SWTProxy["ID_#{event_name.upcase}"]}
205
- listener = ConcreteListener.new(&block)
206
- display_mac_event_registration = menu_item.addListener(SWTProxy[:Selection], listener)
207
- Glimmer::UI::CustomWidget.current_custom_widgets.last&.observer_registrations&.push(display_mac_event_registration)
208
- display_mac_event_registration
203
+ auto_exec do
204
+ system_menu = swt_display.getSystemMenu
205
+ menu_item = system_menu.getItems.find {|menu_item| menu_item.getID == SWTProxy["ID_#{event_name.upcase}"]}
206
+ listener = ConcreteListener.new(&block)
207
+ display_mac_event_registration = menu_item.addListener(SWTProxy[:Selection], listener)
208
+ Glimmer::UI::CustomWidget.current_custom_widgets.last&.observer_registrations&.push(display_mac_event_registration)
209
+ display_mac_event_registration
210
+ end
209
211
  end
210
212
  end
211
213
  end
@@ -48,7 +48,7 @@ module Glimmer
48
48
  include Custom::Drawable
49
49
 
50
50
  DEFAULT_STYLES = {
51
- 'arrow' => [:arrow],
51
+ 'arrow' => [:arrow, :down],
52
52
  'button' => [:push],
53
53
  'canvas' => ([:double_buffered] unless OS.mac?),
54
54
  'ccombo' => [:border],
@@ -30,8 +30,8 @@ module Glimmer
30
30
 
31
31
  class << self
32
32
  def launch(*args, &content)
33
+ launched_custom_shell = send(keyword, *args, &content)
33
34
  auto_exec do
34
- launched_custom_shell = send(keyword, *args, &content)
35
35
  launched_custom_shell.swt_widget.set_data('launched', true)
36
36
  launched_custom_shell.open
37
37
  end
@@ -176,16 +176,16 @@ module Glimmer
176
176
  options ||= {}
177
177
  @options = self.class.options.merge(options)
178
178
  @content = Util::ProcTracker.new(content) if content
179
- execute_hook('before_body')
179
+ auto_exec { execute_hook('before_body') }
180
180
  body_block = self.class.instance_variable_get("@body_block")
181
181
  raise Glimmer::Error, 'Invalid custom widget for having no body! Please define body block!' if body_block.nil?
182
- @body_root = instance_exec(&body_block)
182
+ @body_root = auto_exec { instance_exec(&body_block) }
183
183
  raise Glimmer::Error, 'Invalid custom widget for having an empty body! Please fill body block!' if @body_root.nil?
184
184
  @swt_widget = @body_root.swt_widget
185
185
  auto_exec do
186
186
  @swt_widget.set_data('custom_widget', self)
187
187
  end
188
- execute_hook('after_body')
188
+ auto_exec { execute_hook('after_body') }
189
189
  auto_exec do
190
190
  @dispose_listener_registration = @body_root.on_widget_disposed do
191
191
  observer_registrations.compact.each(&:deregister)
@@ -0,0 +1,67 @@
1
+ # Copyright (c) 2007-2021 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
+ require 'glimmer-dsl-swt'
23
+
24
+ include Glimmer
25
+
26
+ shell {
27
+ row_layout(:vertical) {
28
+ fill true
29
+ center true
30
+ }
31
+
32
+ text 'Hello, Arrow!'
33
+
34
+ label(:center) {
35
+ text 'Click the arrow to get a menu.'
36
+ }
37
+
38
+ arrow { # can be customized by passing `:arrow` SWT style + `:left`, `:right`, `:up`, or `:down` (default)
39
+ menu {
40
+ menu_item {
41
+ text 'Item &1'
42
+
43
+ on_widget_selected do
44
+ message_box {
45
+ text 'Item 1'
46
+ message 'Item 1 selected!'
47
+ }.open
48
+ end
49
+ }
50
+ menu_item {
51
+ text 'Item &2'
52
+
53
+ on_widget_selected do
54
+ message_box {
55
+ text 'Item 2'
56
+ message 'Item 2 selected!'
57
+ }.open
58
+ end
59
+ }
60
+ }
61
+
62
+ on_widget_selected do |event|
63
+ event.widget.menu.visible = true
64
+ end
65
+ }
66
+
67
+ }.open
@@ -88,6 +88,8 @@ class EmailShell
88
88
  end
89
89
 
90
90
  class HelloCustomShell
91
+ include Glimmer
92
+
91
93
  Email = Struct.new(:date, :subject, :from, :message, keyword_init: true)
92
94
  EmailSystem = Struct.new(:emails, keyword_init: true)
93
95
 
@@ -0,0 +1,58 @@
1
+ # Copyright (c) 2007-2021 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
+ require 'glimmer-dsl-swt'
23
+
24
+ class HelloScale
25
+ include Glimmer::UI::CustomShell
26
+
27
+ attr_accessor :value
28
+
29
+ before_body do
30
+ @value = 50
31
+ end
32
+
33
+ body {
34
+ shell {
35
+ row_layout(:vertical) {
36
+ fill true
37
+ center true
38
+ }
39
+
40
+ text 'Hello, Slider!'
41
+
42
+ label(:center) {
43
+ text <= [self, :value]
44
+ }
45
+
46
+ slider { # optionally takes :vertical or :horizontal (default) SWT style
47
+ minimum 0
48
+ maximum 110 # leave room for 10 extra (slider stops at 100)
49
+ page_increment 10 # page increment occurs when clicking area between slider and beginning or end
50
+ selection <=> [self, :value]
51
+ }
52
+
53
+ }
54
+
55
+ }
56
+ end
57
+
58
+ HelloScale.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.20.13.15
4
+ version: 4.20.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-06 00:00:00.000000000 Z
11
+ date: 2021-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: 2.0.0
18
+ version: 2.1.0
19
19
  name: glimmer
20
20
  prerelease: false
21
21
  type: :runtime
@@ -23,7 +23,7 @@ dependencies:
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.0.0
26
+ version: 2.1.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
@@ -605,6 +605,7 @@ files:
605
605
  - samples/elaborate/timer/sounds/alarm1.wav
606
606
  - samples/elaborate/user_profile.rb
607
607
  - samples/elaborate/weather.rb
608
+ - samples/hello/hello_arrow.rb
608
609
  - samples/hello/hello_browser.rb
609
610
  - samples/hello/hello_button.rb
610
611
  - samples/hello/hello_c_combo.rb
@@ -652,6 +653,7 @@ files:
652
653
  - samples/hello/hello_scale.rb
653
654
  - samples/hello/hello_shape.rb
654
655
  - samples/hello/hello_shell.rb
656
+ - samples/hello/hello_slider.rb
655
657
  - samples/hello/hello_spinner.rb
656
658
  - samples/hello/hello_styled_text.rb
657
659
  - samples/hello/hello_tab.rb