glimmer-dsl-opal 0.28.3 → 0.29.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/LICENSE.txt +1 -1
- data/README.md +172 -27
- data/VERSION +1 -1
- data/app/assets/images/glimmer/images/ui-icons_444444_256x240.png +0 -0
- data/app/assets/images/glimmer/images/ui-icons_555555_256x240.png +0 -0
- data/app/assets/images/glimmer/images/ui-icons_777620_256x240.png +0 -0
- data/app/assets/images/glimmer/images/ui-icons_777777_256x240.png +0 -0
- data/app/assets/images/glimmer/images/ui-icons_cc0000_256x240.png +0 -0
- data/app/assets/images/glimmer/images/ui-icons_ffffff_256x240.png +0 -0
- data/app/assets/stylesheets/glimmer/jquery-ui.css +109 -106
- data/app/assets/stylesheets/glimmer/jquery-ui.structure.css +91 -91
- data/app/assets/stylesheets/glimmer/jquery-ui.theme.css +18 -15
- data/app/controllers/glimmer/image_paths_controller.rb +0 -1
- data/config/routes.rb +1 -1
- data/lib/display.rb +1 -1
- data/lib/glimmer/data_binding/table_items_binding.rb +1 -1
- data/lib/glimmer/dsl/opal/async_exec_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/bind_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/block_property_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/checkbox_group_selection_data_binding_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/color_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/custom_widget_expression.rb +3 -3
- data/lib/glimmer/dsl/opal/data_binding_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/dialog_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/display_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/exec_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/font_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/image_expression.rb +2 -2
- data/lib/glimmer/dsl/opal/menu_bar_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/menu_expression.rb +2 -2
- data/lib/glimmer/dsl/opal/message_box_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/property_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/radio_group_selection_data_binding_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/rgb_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/rgba_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/shape_expression.rb +2 -1
- data/lib/glimmer/dsl/opal/shell_expression.rb +2 -2
- data/lib/glimmer/dsl/opal/shine_data_binding_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/swt_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/sync_exec_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/widget_expression.rb +1 -1
- data/lib/glimmer/engine.rb +1 -1
- data/lib/glimmer/swt/arrow_proxy.rb +7 -1
- data/lib/glimmer/swt/button_proxy.rb +4 -3
- data/lib/glimmer/swt/c_combo_proxy.rb +1 -1
- data/lib/glimmer/swt/c_tab_folder_proxy.rb +1 -1
- data/lib/glimmer/swt/c_tab_item_proxy.rb +1 -1
- data/lib/glimmer/swt/checkbox_proxy.rb +3 -2
- data/lib/glimmer/swt/color_proxy.rb +1 -1
- data/lib/glimmer/swt/composite_proxy.rb +1 -1
- data/lib/glimmer/swt/control_editor.rb +1 -1
- data/lib/glimmer/swt/custom/checkbox_group.rb +1 -1
- data/lib/glimmer/swt/custom/radio_group.rb +1 -1
- data/lib/glimmer/swt/custom/shape/arc.rb +1 -1
- data/lib/glimmer/swt/custom/shape/image.rb +1 -1
- data/lib/glimmer/swt/custom/shape/line.rb +1 -1
- data/lib/glimmer/swt/custom/shape/oval.rb +1 -1
- data/lib/glimmer/swt/custom/shape/point.rb +1 -1
- data/lib/glimmer/swt/custom/shape/polygon.rb +1 -1
- data/lib/glimmer/swt/custom/shape/polyline.rb +1 -1
- data/lib/glimmer/swt/custom/shape/rectangle.rb +1 -1
- data/lib/glimmer/swt/custom/shape/text.rb +1 -1
- data/lib/glimmer/swt/custom/shape.rb +4 -4
- data/lib/glimmer/swt/date_time_proxy.rb +2 -2
- data/lib/glimmer/swt/dialog_proxy.rb +1 -1
- data/lib/glimmer/swt/font_proxy.rb +1 -1
- data/lib/glimmer/swt/label_proxy.rb +1 -1
- data/lib/glimmer/swt/latest_dialog_proxy.rb +1 -1
- data/lib/glimmer/swt/latest_message_box_proxy.rb +1 -1
- data/lib/glimmer/swt/latest_shell_proxy.rb +4 -4
- data/lib/glimmer/swt/layout_proxy.rb +1 -1
- data/lib/glimmer/swt/make_shift_shell_proxy.rb +1 -1
- data/lib/glimmer/swt/menu_item_proxy.rb +3 -3
- data/lib/glimmer/swt/menu_proxy.rb +22 -16
- data/lib/glimmer/swt/message_box_proxy.rb +1 -1
- data/lib/glimmer/swt/progress_bar_proxy.rb +1 -1
- data/lib/glimmer/swt/scale_proxy.rb +7 -1
- data/lib/glimmer/swt/shell_proxy.rb +1 -1
- data/lib/glimmer/swt/slider_proxy.rb +6 -0
- data/lib/glimmer/swt/spinner_proxy.rb +4 -3
- data/lib/glimmer/swt/style_constantizable.rb +1 -1
- data/lib/glimmer/swt/swt_proxy.rb +1 -1
- data/lib/glimmer/swt/tab_folder_proxy.rb +1 -1
- data/lib/glimmer/swt/tab_item_proxy.rb +1 -1
- data/lib/glimmer/swt/table_editor.rb +1 -1
- data/lib/glimmer/swt/table_item_proxy.rb +3 -3
- data/lib/glimmer/swt/table_proxy.rb +1 -1
- data/lib/glimmer/swt/widget_proxy.rb +28 -28
- data/lib/glimmer/swt.rb +1 -1
- data/lib/glimmer/ui/custom_shell.rb +1 -5
- data/lib/glimmer/ui/custom_widget.rb +5 -5
- data/lib/glimmer/util/proc_tracker.rb +3 -3
- data/lib/glimmer-dsl-opal/ext/date.rb +8 -8
- data/lib/glimmer-dsl-opal/ext/file.rb +1 -1
- data/lib/glimmer-dsl-opal/ext/glimmer/dsl/engine.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/elaborate/contact_manager/contact_repository.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/elaborate/login.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/elaborate/tetris/model/block.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/elaborate/tetris/model/game.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/elaborate/tetris/model/past_game.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/elaborate/tetris/model/tetromino.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/elaborate/tetris/view/block.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/elaborate/tetris/view/high_score_dialog.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/elaborate/tetris/view/playfield.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/elaborate/tetris/view/score_lane.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/elaborate/tetris/view/tetris_menu_bar.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/elaborate/tetris.rb +2 -2
- data/lib/glimmer-dsl-opal/samples/elaborate/tic_tac_toe.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/elaborate/user_profile.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/elaborate/weather.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_arrow.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_browser.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_button.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_c_combo.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_c_tab.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_canvas.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_checkbox.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_checkbox_group.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_combo.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_composite.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_computed.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_cursor.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_custom_shell.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_custom_widget.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_date_time.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_dialog.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_group.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_label.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_layout.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_list_multi_selection.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_list_single_selection.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_menu_bar.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_message_box.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_pop_up_context_menu.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_print.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_progress_bar.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_radio.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_radio_group.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_scale.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_slider.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_spinner.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_tab.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_table.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_text.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_world.rb +1 -1
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/AUTHORS.txt +35 -1
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/index.html +503 -0
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/jquery-ui.min.css +4 -4
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/jquery-ui.min.js +3 -10
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/jquery-ui.structure.min.css +2 -2
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/jquery-ui.theme.min.css +2 -2
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/package.json +26 -26
- data/lib/glimmer-dsl-opal/vendor/jquery.js +10881 -2
- data/lib/glimmer-dsl-opal.rb +1 -1
- data/lib/glimmer-dsl-swt.rb +1 -1
- data/lib/net/http.rb +1 -1
- data/lib/os.rb +1 -1
- metadata +10 -16
- data/app/assets/images/glimmer/images/ui-icons_222222_256x240.png +0 -0
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/images/ui-icons_444444_256x240.png +0 -0
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/images/ui-icons_555555_256x240.png +0 -0
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/images/ui-icons_777620_256x240.png +0 -0
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/images/ui-icons_777777_256x240.png +0 -0
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/images/ui-icons_cc0000_256x240.png +0 -0
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/images/ui-icons_ffffff_256x240.png +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2020-
|
1
|
+
# Copyright (c) 2020-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
|
@@ -98,7 +98,7 @@ module Glimmer
|
|
98
98
|
|
99
99
|
attr_reader :menu_item_proxy, :menu_parent
|
100
100
|
|
101
|
-
def initialize(parent, args)
|
101
|
+
def initialize(parent, args, block = nil)
|
102
102
|
# TODO refactor/simplify code below
|
103
103
|
@children = []
|
104
104
|
index = args.delete(args.last) if args.last.is_a?(Numeric)
|
@@ -111,21 +111,22 @@ module Glimmer
|
|
111
111
|
args = args.unshift(:pop_up)
|
112
112
|
end
|
113
113
|
if parent.is_a?(MenuProxy)
|
114
|
-
@menu_item_proxy = SWT::WidgetProxy.for('menu_item', parent, [:cascade] + [index].compact)
|
115
|
-
super(@menu_item_proxy, args)
|
114
|
+
@menu_item_proxy = SWT::WidgetProxy.for('menu_item', parent, [:cascade] + [index].compact, block)
|
115
|
+
super(@menu_item_proxy, args, nil)
|
116
116
|
@menu_item_proxy.menu = self
|
117
117
|
elsif parent.is_a?(ShellProxy)
|
118
|
-
super(parent, args)
|
118
|
+
super(parent, args, nil)
|
119
119
|
else # widget pop up
|
120
|
-
super(parent, args)
|
120
|
+
super(parent, args, nil)
|
121
121
|
end
|
122
|
-
|
122
|
+
|
123
123
|
if bar?
|
124
124
|
# Assumes a parent shell
|
125
125
|
parent.menu_bar = self
|
126
126
|
elsif pop_up?
|
127
127
|
parent.menu = self
|
128
128
|
end
|
129
|
+
|
129
130
|
# TODO IMPLEMENT PROPERLY
|
130
131
|
# on_focus_lost {
|
131
132
|
# dispose
|
@@ -195,26 +196,30 @@ module Glimmer
|
|
195
196
|
|
196
197
|
def post_add_content
|
197
198
|
if bar?
|
198
|
-
# delay this till all children rendered (perhaps post_add_content block)
|
199
199
|
parent_dom_element.css('position', 'relative')
|
200
200
|
parent_dom_element.css('margin-top', '30px')
|
201
201
|
parent_dom_element.css('height', '114%')
|
202
|
-
|
202
|
+
render
|
203
203
|
`$(#{path}).menu({
|
204
204
|
position: { my: "top", at: "bottom" },
|
205
205
|
icons: { submenu: "ui-icon-blank" }
|
206
206
|
});`
|
207
207
|
the_element = dom_element
|
208
|
-
the_element.on('
|
208
|
+
the_element.on('mouseenter') do |event|
|
209
209
|
if event.page_x.between?(the_element.offset.left, the_element.offset.left + the_element.width) and
|
210
210
|
event.page_y.between?(the_element.offset.top, the_element.offset.top + the_element.height)
|
211
211
|
`$(#{path}).menu('option', 'position', { my: 'left top', at: 'left bottom' })`
|
212
212
|
end
|
213
|
-
|
214
|
-
the_element.on('
|
215
|
-
|
216
|
-
|
217
|
-
|
213
|
+
end
|
214
|
+
the_element.on('mouseout') do |event|
|
215
|
+
if event.page_x.between?(the_element.offset.left, the_element.offset.left + the_element.width) and
|
216
|
+
event.page_y.between?(the_element.offset.top, the_element.offset.top + the_element.height)
|
217
|
+
`$(#{path}).menu('option', 'position', { my: 'left top', at: 'left bottom' })`
|
218
|
+
else
|
219
|
+
`$(#{path}).menu('option', 'position', { my: 'left top', at: 'right top' })`
|
220
|
+
end
|
221
|
+
end
|
222
|
+
minimum_width = children.to_a.map(&:dom_element).map(&:width).map(&:to_f).reduce(:+)
|
218
223
|
the_element.css('min-width', minimum_width)
|
219
224
|
end
|
220
225
|
end
|
@@ -223,6 +228,7 @@ module Glimmer
|
|
223
228
|
@visible = value
|
224
229
|
if @visible
|
225
230
|
parent.menu_requested = true
|
231
|
+
parent.dom_element.css('position', 'relative')
|
226
232
|
render
|
227
233
|
dom_element.css('position', 'absolute')
|
228
234
|
dom_element.css('left', parent.menu_x - parent.dom_element.offset.left)
|
@@ -250,7 +256,7 @@ module Glimmer
|
|
250
256
|
|
251
257
|
def close
|
252
258
|
dom_element.remove
|
253
|
-
Element['body'].off('click',
|
259
|
+
Element['body'].off('click', @close_event_handler)
|
254
260
|
@visible = false
|
255
261
|
end
|
256
262
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2020-
|
1
|
+
# Copyright (c) 2020-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
|
@@ -24,6 +24,12 @@ require 'glimmer/swt/widget_proxy'
|
|
24
24
|
module Glimmer
|
25
25
|
module SWT
|
26
26
|
class ScaleProxy < WidgetProxy
|
27
|
+
STYLE = <<~CSS
|
28
|
+
.scale {
|
29
|
+
width: 100%;
|
30
|
+
}
|
31
|
+
CSS
|
32
|
+
|
27
33
|
attr_reader :selection, :minimum, :maximum, :increment
|
28
34
|
|
29
35
|
def initialize(parent, args, block)
|
@@ -24,6 +24,12 @@ require 'glimmer/swt/widget_proxy'
|
|
24
24
|
module Glimmer
|
25
25
|
module SWT
|
26
26
|
class SliderProxy < WidgetProxy
|
27
|
+
STYLE = <<~CSS
|
28
|
+
.slider {
|
29
|
+
width: 100%;
|
30
|
+
}
|
31
|
+
CSS
|
32
|
+
|
27
33
|
attr_reader :selection, :minimum, :maximum, :page_increment
|
28
34
|
|
29
35
|
def initialize(parent, args, block)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2020-
|
1
|
+
# Copyright (c) 2020-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
|
@@ -159,9 +159,10 @@ module Glimmer
|
|
159
159
|
def dom
|
160
160
|
text_text = @text
|
161
161
|
text_id = id
|
162
|
-
text_style = css
|
162
|
+
text_style = "min-width: 27px; #{css}"
|
163
163
|
text_class = name
|
164
|
-
|
164
|
+
# TODO `:style` key is duplicated twice
|
165
|
+
options = {type: 'text', id: text_id, style: text_style, class: text_class, value: text_text}
|
165
166
|
options = options.merge('disabled': 'disabled') unless @enabled
|
166
167
|
@dom ||= html {
|
167
168
|
input(options)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2020-
|
1
|
+
# Copyright (c) 2020-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
|
@@ -41,9 +41,9 @@ module Glimmer
|
|
41
41
|
def initialize(parent, args, block)
|
42
42
|
super(parent, args, block)
|
43
43
|
# TODO check if there is a need to remove this observer when removing widget from table upon items update
|
44
|
-
on_widget_selected
|
44
|
+
on_widget_selected do |event|
|
45
45
|
parent.select(parent.index_of(self), (event.meta? if event.respond_to?(:meta?)))
|
46
|
-
|
46
|
+
end
|
47
47
|
end
|
48
48
|
|
49
49
|
def get_text(index)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2020-
|
1
|
+
# Copyright (c) 2020-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
|
@@ -128,7 +128,7 @@ module Glimmer
|
|
128
128
|
|
129
129
|
DEFAULT_INITIALIZERS = {
|
130
130
|
# TODO remove if built in class initializer is taking care of this
|
131
|
-
composite:
|
131
|
+
composite: proc do |composite_proxy|
|
132
132
|
if composite_proxy.get_layout.nil?
|
133
133
|
the_layout = GridLayoutProxy.new(composite_proxy, [])
|
134
134
|
composite_proxy.layout = the_layout
|
@@ -136,18 +136,18 @@ module Glimmer
|
|
136
136
|
the_layout.margin_height = 15
|
137
137
|
end
|
138
138
|
end,
|
139
|
-
# scrolled_composite:
|
139
|
+
# scrolled_composite: proc do |scrolled_composite|
|
140
140
|
# scrolled_composite.expand_horizontal = true
|
141
141
|
# scrolled_composite.expand_vertical = true
|
142
142
|
# end,
|
143
|
-
# table:
|
143
|
+
# table: proc do |table|
|
144
144
|
# table.setHeaderVisible(true)
|
145
145
|
# table.setLinesVisible(true)
|
146
146
|
# end,
|
147
|
-
table_column:
|
147
|
+
table_column: proc do |table_column_proxy|
|
148
148
|
table_column_proxy.width = 80
|
149
149
|
end,
|
150
|
-
# group:
|
150
|
+
# group: proc do |group_proxy|
|
151
151
|
# group_proxy.layout = GridLayoutProxy.new(group_proxy, []) if group.get_layout.nil?
|
152
152
|
# end,
|
153
153
|
}
|
@@ -235,7 +235,7 @@ module Glimmer
|
|
235
235
|
event_handler = mapping[:event_handler]
|
236
236
|
event_element_css_selector = mapping[:event_element_css_selector]
|
237
237
|
the_listener_dom_element = event_element_css_selector ? Element[event_element_css_selector] : listener_dom_element
|
238
|
-
the_listener_dom_element.off(event)
|
238
|
+
the_listener_dom_element.off(event, event_listener)
|
239
239
|
# TODO improve to precisely remove the listeners that were added, no more no less. (or use the event_listener_proxies method instead or in collaboration)
|
240
240
|
end
|
241
241
|
end
|
@@ -878,7 +878,7 @@ module Glimmer
|
|
878
878
|
event_element_css_selector = mapping[:event_element_css_selector]
|
879
879
|
potential_event_listener = event_handler&.call(original_event_listener)
|
880
880
|
event_listener = potential_event_listener || original_event_listener
|
881
|
-
async_event_listener =
|
881
|
+
async_event_listener = proc do |event|
|
882
882
|
# TODO look into the issue with using async::task.new here. maybe put it in event listener (like not being able to call preventDefault or return false successfully )
|
883
883
|
# maybe consider pushing inside the widget classes instead where needed only or implement universal doit support correctly to bypass this issue
|
884
884
|
# Async::Task.new do
|
@@ -944,7 +944,7 @@ module Glimmer
|
|
944
944
|
end
|
945
945
|
|
946
946
|
def property_type_converters
|
947
|
-
color_converter =
|
947
|
+
color_converter = proc do |value|
|
948
948
|
if value.is_a?(Symbol) || value.is_a?(String)
|
949
949
|
ColorProxy.new(value)
|
950
950
|
else
|
@@ -953,7 +953,7 @@ module Glimmer
|
|
953
953
|
end
|
954
954
|
@property_type_converters ||= {
|
955
955
|
:background => color_converter,
|
956
|
-
# :background_image =>
|
956
|
+
# :background_image => proc do |value|
|
957
957
|
# if value.is_a?(String)
|
958
958
|
# if value.start_with?('uri:classloader')
|
959
959
|
# value = value.sub(/^uri\:classloader\:\//, '')
|
@@ -973,7 +973,7 @@ module Glimmer
|
|
973
973
|
# end
|
974
974
|
# end,
|
975
975
|
:foreground => color_converter,
|
976
|
-
# :font =>
|
976
|
+
# :font => proc do |value|
|
977
977
|
# if value.is_a?(Hash)
|
978
978
|
# font_properties = value
|
979
979
|
# FontProxy.new(self, font_properties).swt_font
|
@@ -981,14 +981,14 @@ module Glimmer
|
|
981
981
|
# value
|
982
982
|
# end
|
983
983
|
# end,
|
984
|
-
:text =>
|
984
|
+
:text => proc do |value|
|
985
985
|
# if swt_widget.is_a?(Browser)
|
986
986
|
# value.to_s
|
987
987
|
# else
|
988
988
|
value.to_s
|
989
989
|
# end
|
990
990
|
end,
|
991
|
-
# :visible =>
|
991
|
+
# :visible => proc do |value|
|
992
992
|
# !!value
|
993
993
|
# end,
|
994
994
|
}
|
@@ -997,7 +997,7 @@ module Glimmer
|
|
997
997
|
def widget_property_listener_installers
|
998
998
|
@swt_widget_property_listener_installers ||= {
|
999
999
|
# WidgetProxy => {
|
1000
|
-
# :focus =>
|
1000
|
+
# :focus => proc do |observer|
|
1001
1001
|
# on_focus_gained { |focus_event|
|
1002
1002
|
# observer.call(true)
|
1003
1003
|
# }
|
@@ -1007,7 +1007,7 @@ module Glimmer
|
|
1007
1007
|
# end,
|
1008
1008
|
# },
|
1009
1009
|
MenuItemProxy => {
|
1010
|
-
:selection =>
|
1010
|
+
:selection => proc do |observer|
|
1011
1011
|
on_widget_selected { |selection_event|
|
1012
1012
|
# TODO look into validity of this and perhaps move toggle logic to MenuItemProxy
|
1013
1013
|
if check?
|
@@ -1019,33 +1019,33 @@ module Glimmer
|
|
1019
1019
|
end
|
1020
1020
|
},
|
1021
1021
|
ScaleProxy => {
|
1022
|
-
:selection =>
|
1022
|
+
:selection => proc do |observer|
|
1023
1023
|
on_widget_selected { |selection_event|
|
1024
1024
|
observer.call(selection)
|
1025
1025
|
}
|
1026
1026
|
end
|
1027
1027
|
},
|
1028
1028
|
SliderProxy => {
|
1029
|
-
:selection =>
|
1029
|
+
:selection => proc do |observer|
|
1030
1030
|
on_widget_selected { |selection_event|
|
1031
1031
|
observer.call(selection)
|
1032
1032
|
}
|
1033
1033
|
end
|
1034
1034
|
},
|
1035
1035
|
SpinnerProxy => {
|
1036
|
-
:selection =>
|
1036
|
+
:selection => proc do |observer|
|
1037
1037
|
on_widget_selected { |selection_event|
|
1038
1038
|
observer.call(selection)
|
1039
1039
|
}
|
1040
1040
|
end
|
1041
1041
|
},
|
1042
1042
|
TextProxy => {
|
1043
|
-
:text =>
|
1043
|
+
:text => proc do |observer|
|
1044
1044
|
on_modify_text { |modify_event|
|
1045
1045
|
observer.call(text)
|
1046
1046
|
}
|
1047
1047
|
end,
|
1048
|
-
# :caret_position =>
|
1048
|
+
# :caret_position => proc do |observer|
|
1049
1049
|
# on_event_keydown { |event|
|
1050
1050
|
# observer.call(getCaretPosition)
|
1051
1051
|
# }
|
@@ -1059,7 +1059,7 @@ module Glimmer
|
|
1059
1059
|
# observer.call(getCaretPosition)
|
1060
1060
|
# }
|
1061
1061
|
# end,
|
1062
|
-
# :selection =>
|
1062
|
+
# :selection => proc do |observer|
|
1063
1063
|
# on_event_keydown { |event|
|
1064
1064
|
# observer.call(getSelection)
|
1065
1065
|
# }
|
@@ -1073,7 +1073,7 @@ module Glimmer
|
|
1073
1073
|
# observer.call(getSelection)
|
1074
1074
|
# }
|
1075
1075
|
# end,
|
1076
|
-
# :selection_count =>
|
1076
|
+
# :selection_count => proc do |observer|
|
1077
1077
|
# on_event_keydown { |event|
|
1078
1078
|
# observer.call(getSelectionCount)
|
1079
1079
|
# }
|
@@ -1087,7 +1087,7 @@ module Glimmer
|
|
1087
1087
|
# observer.call(getSelectionCount)
|
1088
1088
|
# }
|
1089
1089
|
# end,
|
1090
|
-
# :top_index =>
|
1090
|
+
# :top_index => proc do |observer|
|
1091
1091
|
# @last_top_index = getTopIndex
|
1092
1092
|
# on_paint_control { |event|
|
1093
1093
|
# if getTopIndex != @last_top_index
|
@@ -1098,35 +1098,35 @@ module Glimmer
|
|
1098
1098
|
# end,
|
1099
1099
|
},
|
1100
1100
|
# Java::OrgEclipseSwtCustom::StyledText => {
|
1101
|
-
# :text =>
|
1101
|
+
# :text => proc do |observer|
|
1102
1102
|
# on_modify_text { |modify_event|
|
1103
1103
|
# observer.call(getText)
|
1104
1104
|
# }
|
1105
1105
|
# end,
|
1106
1106
|
# },
|
1107
1107
|
DateTimeProxy => {
|
1108
|
-
:date_time =>
|
1108
|
+
:date_time => proc do |observer|
|
1109
1109
|
on_widget_selected { |selection_event|
|
1110
1110
|
observer.call(date_time)
|
1111
1111
|
}
|
1112
1112
|
end
|
1113
1113
|
},
|
1114
1114
|
RadioProxy => { #radio?
|
1115
|
-
:selection =>
|
1115
|
+
:selection => proc do |observer|
|
1116
1116
|
on_widget_selected { |selection_event|
|
1117
1117
|
observer.call(selection)
|
1118
1118
|
}
|
1119
1119
|
end
|
1120
1120
|
},
|
1121
1121
|
TableProxy => {
|
1122
|
-
:selection =>
|
1122
|
+
:selection => proc do |observer|
|
1123
1123
|
on_widget_selected { |selection_event|
|
1124
1124
|
observer.call(selection_event.table_item.get_data) # TODO ensure selection doesn't conflict with editing
|
1125
1125
|
}
|
1126
1126
|
end,
|
1127
1127
|
},
|
1128
1128
|
# Java::OrgEclipseSwtWidgets::MenuItem => {
|
1129
|
-
# :selection =>
|
1129
|
+
# :selection => proc do |observer|
|
1130
1130
|
# on_widget_selected { |selection_event|
|
1131
1131
|
# observer.call(getSelection)
|
1132
1132
|
# }
|
data/lib/glimmer/swt.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2020-
|
1
|
+
# Copyright (c) 2020-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
|
@@ -101,10 +101,6 @@ module Glimmer
|
|
101
101
|
body_root.visible?
|
102
102
|
end
|
103
103
|
|
104
|
-
def center
|
105
|
-
body_root.center
|
106
|
-
end
|
107
|
-
|
108
104
|
def start_event_loop
|
109
105
|
body_root.start_event_loop
|
110
106
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2020-
|
1
|
+
# Copyright (c) 2020-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
|
@@ -285,10 +285,10 @@ module Glimmer
|
|
285
285
|
end
|
286
286
|
|
287
287
|
alias local_respond_to? respond_to?
|
288
|
-
def respond_to?(
|
289
|
-
super or
|
290
|
-
can_handle_observation_request?(
|
291
|
-
body_root.respond_to?(
|
288
|
+
def respond_to?(method_name, include_private = false)
|
289
|
+
super(method_name, include_private) or
|
290
|
+
can_handle_observation_request?(method_name) or
|
291
|
+
body_root.respond_to?(method_name, include_private)
|
292
292
|
end
|
293
293
|
|
294
294
|
private
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2020-
|
1
|
+
# Copyright (c) 2020-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
|
@@ -42,8 +42,8 @@ module Glimmer
|
|
42
42
|
!!@called
|
43
43
|
end
|
44
44
|
|
45
|
-
def respond_to?(
|
46
|
-
%w[owner invoked_from called?].include?(
|
45
|
+
def respond_to?(method_name, include_private = false)
|
46
|
+
%w[owner invoked_from called?].include?(method_name.to_s) || super(method_name, include_private)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
@@ -4,23 +4,23 @@ require 'time'
|
|
4
4
|
class DateTime < Date
|
5
5
|
def initialize(*args, &block)
|
6
6
|
@time = Time.new(*args, &block)
|
7
|
-
methods_to_exclude = [:to_date, :to_time, :==, :eql?, :class]
|
7
|
+
methods_to_exclude = [:to_date, :to_time, :==, :eql?, :class] + Object.new.methods
|
8
8
|
methods_to_define = @time.methods - methods_to_exclude
|
9
|
-
methods_to_define.each do |
|
10
|
-
singleton_class.define_method(
|
11
|
-
@time.send(
|
9
|
+
methods_to_define.each do |method_name|
|
10
|
+
singleton_class.define_method(method_name) do |*args, &block|
|
11
|
+
@time.send(method_name, *args, &block)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def to_date
|
17
17
|
@time.to_date
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
def to_time
|
21
21
|
@time
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
def ==(other)
|
25
25
|
return false if other.class != self.class
|
26
26
|
year == other.year and
|
@@ -51,7 +51,7 @@ class Time
|
|
51
51
|
new_original(*args)
|
52
52
|
end
|
53
53
|
end
|
54
|
-
|
54
|
+
|
55
55
|
def to_datetime
|
56
56
|
# TODO support timezone
|
57
57
|
DateTime.new(year, month, day, hour, min, sec)
|