glimmer-dsl-swt 4.24.4.2 → 4.24.4.4

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: 3a089b978fce806c9396adb1f971c4ba8f5344f0b927e8781c6a6985d9c234d2
4
- data.tar.gz: 82e0a576ebf56dd83bafda03378aec4cee32cfa0de1d2bf61bc247c2c33562a1
3
+ metadata.gz: e66b329b7d9bf09db34b1b4b9d98a42b52793a6822512ecb1cd95b55a9a8e664
4
+ data.tar.gz: 2840c2f1c4cb5064afd54e8723668de648541568cdc9d23626fd07c791bfe1bd
5
5
  SHA512:
6
- metadata.gz: 620cc756c24723f0e7443055b9f156e71a7312e07093142dc606f16692af7cd7f37eb97294586bbf79239ccd9fc3c34c9fb107efd28eb5713a287dd882ad1b48
7
- data.tar.gz: 6c954efcf5550479ab13ef3f21b1f68f3f1ab32823fe638ef13618c5e3c12292f1d1fbb8ed42d2158a480a344ac64c12f2f87d8b96deeadda7373302e01167fb
6
+ metadata.gz: 5072ef09d0a73a58f4e8957c1e69efb69843fb31eeb658513368287754357833f69ab263acc36395242c12f9089a48e48541d68abc4dbf1bb1acc06ef4dfd0d5
7
+ data.tar.gz: 9ea20dfe409781ec75beed5f5f68afee7e91e09d4a0c14bb43b002525497dcd3948257eccabd8c9513597b108b4e5d051f38faa0c2459c5e44a7a398ee4601f9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Change Log
2
2
 
3
+ ## 4.24.4.4
4
+
5
+ - Support `refined_table` `selection` data-binding
6
+ - Remove extra horizontal/vertical margins in `refined_table` pagination area
7
+ - Update Hello, Refined Table! to support booking a game with right-click pop up context menu
8
+ - Have `Glimmer::UI::CustomWidget` better delegate listners and data-binding observers to `@children_owner` when set
9
+
10
+ ## 4.24.4.3
11
+
12
+ - Fix issue with failed `table` extra property data-binding (e.g. foreground color, background color) due to asynchronous multi-threading optimization (now it works).
13
+
3
14
  ## 4.24.4.2
4
15
 
5
16
  - `refined_table` filtering support
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.24.4.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.24.4.4
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)
@@ -21,7 +21,7 @@ Featured in JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do) an
21
21
 
22
22
  ![Eclipse SWT RCP NASA Mars Rover](/images/glimmer-eclipse-swt-rcp-nasa-mars-rover.png)
23
23
 
24
- [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.24.4.2 includes [SWT 4.24](https://download.eclipse.org/eclipse/downloads/drops4/R-4.24-202206070700/), which was released on June 7, 2022. 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.
24
+ [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.24.4.4 includes [SWT 4.24](https://download.eclipse.org/eclipse/downloads/drops4/R-4.24-202206070700/), which was released on June 7, 2022. 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.
25
25
 
26
26
  **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. That was [originally conceived back in 2007](https://andymaleh.blogspot.com/2007/12/data-shining-in-glimmer.html).
27
27
 
@@ -338,7 +338,7 @@ jgem install glimmer-dsl-swt
338
338
 
339
339
  Or this command if you want a specific version:
340
340
  ```
341
- jgem install glimmer-dsl-swt -v 4.24.4.2
341
+ jgem install glimmer-dsl-swt -v 4.24.4.4
342
342
  ```
343
343
 
344
344
  `jgem` is JRuby's version of `gem` command.
@@ -366,7 +366,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
366
366
 
367
367
  Add the following to `Gemfile`:
368
368
  ```
369
- gem 'glimmer-dsl-swt', '~> 4.24.4.2'
369
+ gem 'glimmer-dsl-swt', '~> 4.24.4.4'
370
370
  ```
371
371
 
372
372
  And, then run:
@@ -389,7 +389,7 @@ glimmer
389
389
  ```
390
390
 
391
391
  ```
392
- Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.24.4.2
392
+ Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.24.4.4
393
393
 
394
394
  Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
395
395
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.24.4.2
1
+ 4.24.4.4
@@ -3732,7 +3732,7 @@ shell {
3732
3732
 
3733
3733
  Screenshot:
3734
3734
 
3735
- ![Canvas Animation Example](/images/glimmer-example-canvas-animation.png)
3735
+ ![Canvas Animation Example](/images/glimmer-example-canvas-animation.gif)
3736
3736
 
3737
3737
  Keywords:
3738
3738
  - `animation` declares an animation under a canvas, which renders frames using a frame block indefinitely or finitely depending on (cycle_count/frame_count) properties
@@ -4320,7 +4320,7 @@ Options:
4320
4320
  - `page` (default: `1` if table is filled and `0` otherwise): specifies initial page
4321
4321
  - `query` (default: `''`): specifies filter query term (empty shows all results)
4322
4322
 
4323
- Note that currently `refined_table` only supports displaying a **read-only** table (meaning it can read updates from the model, but it cannot write back to the model through `TableEditor` cells).
4323
+ Note that currently `refined_table` only supports displaying a **read-only** table (meaning it can read updates from the model, but it cannot write back to the model through `TableEditor` cells). Also, it does not support selection or sorting by clicking columns yet.
4324
4324
 
4325
4325
  Example taken from [Hello, Refined Table!](/docs/reference/GLIMMER_SAMPLES.md#hello-refined-table):
4326
4326
 
@@ -793,6 +793,14 @@ Hello, Refined Table!
793
793
 
794
794
  ![Hello Refined Table](/images/glimmer-hello-refined-table.png)
795
795
 
796
+ Hello, Refined Table! Booking Menu
797
+
798
+ ![Hello Refined Table](/images/glimmer-hello-refined-table-booking-menu.png)
799
+
800
+ Hello, Refined Table! Game Booked
801
+
802
+ ![Hello Refined Table](/images/glimmer-hello-refined-table-game-booked.png)
803
+
796
804
  #### Hello, Link!
797
805
 
798
806
  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.
Binary file
@@ -86,6 +86,8 @@ module Glimmer
86
86
  @model_observer_registrations ||= {}
87
87
  @table_item_property_observation_mutex ||= Mutex.new
88
88
 
89
+ brand_new_model_collection = !same_model_collection_with_different_sort?(new_model_collection)
90
+
89
91
  Thread.new do
90
92
  @data_binding_done = false
91
93
  @table_item_property_observation_mutex.synchronize do
@@ -100,7 +102,7 @@ module Glimmer
100
102
  end
101
103
  end
102
104
 
103
- if !same_model_collection_with_different_sort?(new_model_collection)
105
+ if brand_new_model_collection
104
106
  new_model_collection.each_with_index do |model, model_index|
105
107
  TABLE_ITEM_PROPERTIES.each do |table_item_property|
106
108
  @column_properties.each do |column_property|
@@ -220,13 +222,7 @@ module Glimmer
220
222
  end
221
223
 
222
224
  def table_item_model_collection
223
- Glimmer::SWT::DisplayProxy.instance.auto_exec do
224
- if @table.disposed?
225
- []
226
- else
227
- @table.swt_widget.items.map(&:get_data)
228
- end
229
- end
225
+ @table.swt_widget.items.map(&:get_data)
230
226
  end
231
227
 
232
228
  def deregister_model_observer_registrations
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2007-2022 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
@@ -54,7 +54,7 @@ module Glimmer
54
54
  filter_and_paginate
55
55
  end
56
56
  @table_proxy.content {
57
- items(dsl: true) <=> [self, :refined_model_array, model_binding.binding_options.merge(read_only: true)]
57
+ items <=> [self, :refined_model_array, model_binding.binding_options.merge(read_only: true)]
58
58
  }
59
59
  filter_and_paginate
60
60
  end
@@ -82,7 +82,10 @@ module Glimmer
82
82
  composite {
83
83
  layout_data(:fill, :center, true, false)
84
84
 
85
- fill_layout(:horizontal)
85
+ fill_layout(:horizontal) {
86
+ margin_width 0
87
+ margin_height 0
88
+ }
86
89
 
87
90
  @first_button_proxy = button {
88
91
  text '<<'
@@ -169,29 +172,7 @@ module Glimmer
169
172
  def last_button_block=(block)
170
173
  @last_button_proxy.content(&block)
171
174
  end
172
-
173
- def method_missing(method_name, *args, &block)
174
- dsl_mode = @dsl_mode || args.last.is_a?(Hash) && args.last[:dsl]
175
- if dsl_mode
176
- args.pop if args.last.is_a?(Hash) && args.last[:dsl]
177
- super(method_name, *args, &block)
178
- elsif @table_proxy&.respond_to?(method_name, *args, &block)
179
- @table_proxy&.send(method_name, *args, &block)
180
- else
181
- super
182
- end
183
- end
184
-
185
- def respond_to?(method_name, *args, &block)
186
- dsl_mode = @dsl_mode || args.last.is_a?(Hash) && args.last[:dsl]
187
- if dsl_mode
188
- args = args[0...-1] if args.last.is_a?(Hash) && args.last[:dsl]
189
- super(method_name, *args, &block)
190
- else
191
- super || @table_proxy&.respond_to?(method_name, *args, &block)
192
- end
193
- end
194
-
175
+
195
176
  def page_count
196
177
  (filtered_model_array && (filtered_model_array.count / per_page.to_f).ceil) || 0
197
178
  end
@@ -57,6 +57,7 @@ module Glimmer
57
57
 
58
58
  swt_widget_class = self.class.swt_widget_class_for('menu')
59
59
  if parent.swt_widget.is_a?(Menu)
60
+ # TODO support CustomWidget children_owner
60
61
  @menu_item_proxy = SWT::WidgetProxy.new('menu_item', parent, [:cascade] + [index].compact)
61
62
  @swt_menu_item = @menu_item_proxy.swt_widget
62
63
  @swt_widget = swt_widget_class.new(@menu_item_proxy.swt_widget)
@@ -64,6 +65,7 @@ module Glimmer
64
65
  elsif parent.swt_widget.is_a?(Shell)
65
66
  @swt_widget = swt_widget_class.new(parent.swt_widget, style('menu', styles))
66
67
  elsif parent.swt_widget.is_a?(TrayItem)
68
+ # TODO support CustomWidget children_owner
67
69
  @swt_widget = swt_widget_class.new(parent.shell_proxy.swt_widget, style('menu', styles))
68
70
  parent.menu_proxy = self
69
71
  else
@@ -159,8 +159,7 @@ module Glimmer
159
159
  @parent_proxy = parent
160
160
  styles, extra_options = extract_args(underscored_widget_name, args)
161
161
  swt_widget_class = self.class.swt_widget_class_for(underscored_widget_name)
162
- swt_widget_producer = @parent_proxy.respond_to?(:children_owner) ? @parent_proxy.children_owner : @parent_proxy
163
- @swt_widget = swt_widget_class.new(swt_widget_producer.swt_widget, style(underscored_widget_name, styles), *extra_options)
162
+ @swt_widget = swt_widget_class.new(@parent_proxy.swt_widget, style(underscored_widget_name, styles), *extra_options)
164
163
  else
165
164
  @swt_widget = swt_widget
166
165
  underscored_widget_name = self.class.underscored_widget_name(@swt_widget)
@@ -40,13 +40,21 @@ module Glimmer
40
40
 
41
41
  def initialize(parent, *swt_constants, options, &content)
42
42
  super
43
- auto_exec do
44
- @swt_widget.set_data('custom_shell', self)
45
- @swt_widget.set_data('custom_window', self)
46
- end
47
43
  raise Error, 'Invalid custom shell (window) body root! Must be a shell (window) or another custom shell (window).' unless body_root.swt_widget.is_a?(org.eclipse.swt.widgets.Shell)
48
44
  end
49
45
 
46
+ def swt_widget
47
+ if @swt_widget.nil? && children_owner
48
+ @swt_widget = children_owner.swt_widget
49
+ auto_exec do
50
+ @swt_widget.set_data('custom_widget', self)
51
+ @swt_widget.set_data('custom_shell', self)
52
+ @swt_widget.set_data('custom_window', self)
53
+ end
54
+ end
55
+ @swt_widget
56
+ end
57
+
50
58
  # Classes may override
51
59
  def open
52
60
  body_root.open
@@ -161,13 +161,13 @@ module Glimmer
161
161
  end
162
162
  end
163
163
 
164
- attr_reader :body_root, :swt_widget, :parent, :parent_proxy, :swt_style, :options
164
+ attr_reader :body_root, :parent, :parent_proxy, :swt_style, :options
165
165
 
166
166
  def initialize(parent, *swt_constants, options, &content)
167
167
  SWT::DisplayProxy.current_custom_widgets_and_shapes << self
168
168
  @parent_proxy = @parent = parent
169
169
  @parent_proxy = @parent&.get_data('proxy') if @parent.respond_to?(:get_data) && @parent.get_data('proxy')
170
- @swt_style = SWT::SWTProxy[*swt_constants]
170
+ @swt_style = SWT::SWTProxy[*swt_constants] # TODO support non-standard styles like :editable, perhaps by packing in an array instead of interpreting right away
171
171
  options ||= {}
172
172
  @options = self.class.options.merge(options)
173
173
  @content = Util::ProcTracker.new(content) if content
@@ -176,9 +176,8 @@ module Glimmer
176
176
  raise Glimmer::Error, 'Invalid custom widget for having no body! Please define body block!' if body_block.nil?
177
177
  @body_root = auto_exec { instance_exec(&body_block) }
178
178
  raise Glimmer::Error, 'Invalid custom widget for having an empty body! Please fill body block!' if @body_root.nil?
179
- @swt_widget = @body_root.swt_widget
180
179
  auto_exec do
181
- @swt_widget.set_data('custom_widget', self)
180
+ @body_root.set_data('custom_widget', self)
182
181
  end
183
182
  auto_exec { execute_hook('after_body') }
184
183
  auto_exec do
@@ -201,6 +200,16 @@ module Glimmer
201
200
  SWT::DisplayProxy.current_custom_widgets_and_shapes.delete(self)
202
201
  end
203
202
 
203
+ def swt_widget
204
+ if @swt_widget.nil? && children_owner
205
+ @swt_widget = children_owner.swt_widget
206
+ auto_exec do
207
+ @swt_widget.set_data('custom_widget', self)
208
+ end
209
+ end
210
+ @swt_widget
211
+ end
212
+
204
213
  def observer_registrations
205
214
  @observer_registrations ||= []
206
215
  end
@@ -212,7 +221,9 @@ module Glimmer
212
221
  property = observation_request.sub(/^on_updated_/, '')
213
222
  result = can_add_observer?(property)
214
223
  end
215
- result || body_root&.can_handle_observation_request?(observation_request)
224
+ result ||
225
+ (children_owner != body_root && children_owner&.can_handle_observation_request?(observation_request)) ||
226
+ body_root&.can_handle_observation_request?(observation_request)
216
227
  end
217
228
 
218
229
  def handle_observation_request(observation_request, &block)
@@ -220,18 +231,25 @@ module Glimmer
220
231
  if observation_request.start_with?('on_updated_')
221
232
  property = observation_request.sub(/^on_updated_/, '') # TODO look into eliminating duplication from above
222
233
  add_observer(DataBinding::Observer.proc(&block), property) if can_add_observer?(property)
234
+ elsif children_owner != body_root && children_owner&.can_handle_observation_request?(observation_request)
235
+ children_owner.handle_observation_request(observation_request, &block)
223
236
  else
224
237
  body_root.handle_observation_request(observation_request, &block)
225
238
  end
226
239
  end
227
240
 
228
241
  def can_add_observer?(attribute_name)
229
- has_instance_method?(attribute_name) || has_instance_method?("#{attribute_name}?") || @body_root.can_add_observer?(attribute_name)
242
+ has_instance_method?(attribute_name) ||
243
+ has_instance_method?("#{attribute_name}?") ||
244
+ (children_owner != @body_root && children_owner.can_add_observer?(attribute_name)) ||
245
+ @body_root.can_add_observer?(attribute_name)
230
246
  end
231
247
 
232
248
  def add_observer(observer, attribute_name)
233
249
  if has_instance_method?(attribute_name)
234
250
  super
251
+ elsif children_owner != @body_root && children_owner.can_add_observer?(attribute_name)
252
+ children_owner.add_observer(observer, attribute_name)
235
253
  else
236
254
  @body_root.add_observer(observer, attribute_name)
237
255
  end
@@ -239,12 +257,15 @@ module Glimmer
239
257
 
240
258
  def has_attribute?(attribute_name, *args)
241
259
  has_instance_method?(attribute_setter(attribute_name)) ||
260
+ (children_owner != @body_root && children_owner.has_attribute?(attribute_name, *args)) ||
242
261
  @body_root.has_attribute?(attribute_name, *args)
243
262
  end
244
263
 
245
264
  def set_attribute(attribute_name, *args)
246
265
  if has_instance_method?(attribute_setter(attribute_name))
247
266
  send(attribute_setter(attribute_name), *args)
267
+ elsif (children_owner != @body_root && children_owner.has_attribute?(attribute_name, *args))
268
+ children_owner.set_attribute(attribute_name, *args)
248
269
  else
249
270
  @body_root.set_attribute(attribute_name, *args)
250
271
  end
@@ -262,6 +283,8 @@ module Glimmer
262
283
  def get_attribute(attribute_name)
263
284
  if has_instance_method?(attribute_name)
264
285
  send(attribute_name)
286
+ elsif children_owner != @body_root && children_owner.has_attribute?(attribute_name)
287
+ children_owner.get_attribute(attribute_name)
265
288
  else
266
289
  @body_root.get_attribute(attribute_name)
267
290
  end
@@ -317,6 +340,8 @@ module Glimmer
317
340
  # but fail the glimmer DSL for the right reason to avoid seeing noise in the log output
318
341
  if block && can_handle_observation_request?(method)
319
342
  handle_observation_request(method, &block)
343
+ elsif children_owner != @body_root && children_owner.respond_to?(method, *args, &block)
344
+ children_owner.send(method, *args, &block)
320
345
  else
321
346
  body_root.send(method, *args, &block)
322
347
  end
@@ -326,6 +351,7 @@ module Glimmer
326
351
  def respond_to?(method, *args, &block)
327
352
  super or
328
353
  can_handle_observation_request?(method) or
354
+ children_owner.respond_to?(method, *args, &block) or
329
355
  body_root.respond_to?(method, *args, &block)
330
356
  end
331
357
 
@@ -23,7 +23,7 @@ class KlondikeSolitaire
23
23
  else
24
24
  @game.dealt_pile.push!(playing_card)
25
25
  end
26
- end
26
+ end
27
27
 
28
28
  def playing_cards
29
29
  @playing_cards ||= []
@@ -27,7 +27,6 @@ class KlondikeSolitaire
27
27
  card_source_model = card_parent_pile.model
28
28
  cards = card_source_model.remove!(card)
29
29
  cards[1..-1].each { |card| model.add!(card) } if cards.is_a?(Array) # if it is a column pile
30
- drop_event.dragged_shape.dispose
31
30
  rescue => e
32
31
  Glimmer::Config.logger.debug { "Error encountered on drop of a card to a column pile: #{e.full_message}" }
33
32
  drop_event.doit = false
@@ -28,6 +28,10 @@ class KlondikeSolitaire
28
28
  body {
29
29
  shape(pile_x, pile_y) {
30
30
  hidden_playing_card
31
+
32
+ on_mouse_up do |event|
33
+ model.deal!
34
+ end
31
35
  }
32
36
  }
33
37
 
@@ -18,11 +18,9 @@ class KlondikeSolitaire
18
18
  empty_playing_card
19
19
  }
20
20
  else
21
- body_root.shapes.each { |shape| shape.drag_source = false }
22
21
  before_last_shape = body_root.shapes[-2] && body_root.shapes[-2].get_data('custom_shape').respond_to?(:model) && body_root.shapes[-2].get_data('custom_shape').model
23
22
  if model.playing_cards.last == before_last_shape # happens when dragging card out
24
23
  body_root.shapes.last.dispose
25
- body_root.shapes.last.drag_source = true
26
24
  else
27
25
  body_root.content {
28
26
  playing_card(model: model.playing_cards.last, parent_pile: self) {
@@ -42,7 +42,6 @@ class KlondikeSolitaire
42
42
  raise 'Cannot accept multiple cards' if card_source_model.playing_cards.index(card) != (card_source_model.playing_cards.size - 1)
43
43
  model.add!(card)
44
44
  card_source_model.remove!(card)
45
- drop_event.dragged_shape.dispose
46
45
  rescue => e
47
46
  Glimmer::Config.logger.debug { "Error encountered on drop of a card to a foundation pile: #{e.full_message}" }
48
47
  drop_event.doit = false
@@ -27,12 +27,6 @@ class KlondikeSolitaire
27
27
  @column_piles = 7.times.map do |n|
28
28
  column_pile(pile_x: MARGIN + n*(PLAYING_CARD_WIDTH + PLAYING_CARD_SPACING), pile_y: PLAYING_CARD_HEIGHT + PLAYING_CARD_SPACING, model: game.column_piles[n])
29
29
  end
30
-
31
- on_mouse_up do |event|
32
- if @dealing_pile.body_root.include?(event.x, event.y)
33
- game.dealing_pile.deal!
34
- end
35
- end
36
30
  }
37
31
  }
38
32
 
@@ -1,3 +1,24 @@
1
+ # Copyright (c) 2007-2022 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
+
1
22
  require 'glimmer-dsl-swt'
2
23
 
3
24
  require_relative 'klondike_solitaire/model/game'
@@ -78,9 +78,15 @@ class HelloRefinedTable
78
78
  def ballpark
79
79
  home_team.ballpark
80
80
  end
81
+
82
+ def to_s
83
+ "#{home_team_name} vs #{away_team_name} at #{ballpark}"
84
+ end
81
85
  end
82
86
 
83
87
  BaseballSeason = Struct.new(:year) do
88
+ attr_accessor :selected_game
89
+
84
90
  def games
85
91
  if @games.nil?
86
92
  @games = []
@@ -149,7 +155,21 @@ class HelloRefinedTable
149
155
  text 'Away Team'
150
156
  }
151
157
 
158
+ menu {
159
+ menu_item {
160
+ text 'Book'
161
+
162
+ on_widget_selected do
163
+ message_box {
164
+ text 'Game Booked!'
165
+ message "The game \"#{@baseball_season.selected_game}\" has been booked!"
166
+ }.open
167
+ end
168
+ }
169
+ }
170
+
152
171
  model_array <= [@baseball_season, :games, column_attributes: {'Home Team' => :home_team_name, 'Away Team' => :away_team_name}]
172
+ selection <=> [@baseball_season, :selected_game]
153
173
  }
154
174
  }
155
175
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-swt
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.24.4.2
4
+ version: 4.24.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-11 00:00:00.000000000 Z
11
+ date: 2022-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement