glimmer-dsl-swt 4.18.0.0 → 4.18.2.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 +52 -0
- data/LICENSE.txt +1 -1
- data/README.md +571 -55
- data/RUBY_VERSION +1 -1
- data/VERSION +1 -1
- data/bin/girb +1 -1
- data/bin/girb_runner.rb +1 -1
- data/bin/glimmer +1 -1
- data/glimmer-dsl-swt.gemspec +26 -17
- data/lib/ext/glimmer.rb +1 -1
- data/lib/ext/glimmer/config.rb +7 -7
- data/lib/glimmer-dsl-swt.rb +2 -1
- data/lib/glimmer/Rakefile +1 -1
- data/lib/glimmer/data_binding/list_selection_binding.rb +1 -1
- data/lib/glimmer/data_binding/observable_widget.rb +1 -1
- data/lib/glimmer/data_binding/shine.rb +1 -1
- data/lib/glimmer/data_binding/table_items_binding.rb +1 -1
- data/lib/glimmer/data_binding/tree_items_binding.rb +1 -1
- data/lib/glimmer/data_binding/widget_binding.rb +1 -1
- data/lib/glimmer/dsl/swt/animation_expression.rb +43 -0
- data/lib/glimmer/dsl/swt/async_exec_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/bind_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/block_property_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/checkbox_group_selection_data_binding_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/color_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/column_properties_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/combo_selection_data_binding_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/cursor_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/custom_widget_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/data_binding_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/dialog_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/directory_dialog_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/display_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/dnd_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/dsl.rb +5 -4
- data/lib/glimmer/dsl/swt/exec_expression.rb +5 -5
- data/lib/glimmer/dsl/swt/expand_item_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/file_dialog_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/font_expression.rb +8 -6
- data/lib/glimmer/dsl/swt/image_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/layout_data_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/layout_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/list_selection_data_binding_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/menu_bar_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/menu_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/message_box_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/observe_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/property_expression.rb +4 -4
- data/lib/glimmer/dsl/swt/radio_group_selection_data_binding_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/rgb_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/rgba_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/shape_expression.rb +56 -0
- data/lib/glimmer/dsl/swt/shell_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/swt_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/sync_exec_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/tab_item_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/table_items_data_binding_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/tree_items_data_binding_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/tree_properties_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/widget_expression.rb +7 -3
- data/lib/glimmer/dsl/swt/widget_listener_expression.rb +1 -1
- data/lib/glimmer/launcher.rb +1 -1
- data/lib/glimmer/rake_task.rb +1 -1
- data/lib/glimmer/rake_task/list.rb +6 -6
- data/lib/glimmer/rake_task/package.rb +1 -1
- data/lib/glimmer/rake_task/scaffold.rb +33 -34
- data/lib/glimmer/swt/color_proxy.rb +1 -1
- data/lib/glimmer/swt/cursor_proxy.rb +1 -1
- data/lib/glimmer/swt/custom/animation.rb +243 -0
- data/lib/glimmer/swt/custom/checkbox_group.rb +1 -1
- data/lib/glimmer/swt/custom/code_text.rb +2 -1
- data/lib/glimmer/swt/custom/drawable.rb +43 -0
- data/lib/glimmer/swt/custom/radio_group.rb +1 -1
- data/lib/glimmer/swt/custom/shape.rb +193 -0
- data/lib/glimmer/swt/date_time_proxy.rb +1 -1
- data/lib/glimmer/swt/directory_dialog_proxy.rb +1 -1
- data/lib/glimmer/swt/display_proxy.rb +17 -1
- data/lib/glimmer/swt/dnd_proxy.rb +1 -1
- data/lib/glimmer/swt/expand_item_proxy.rb +1 -1
- data/lib/glimmer/swt/file_dialog_proxy.rb +1 -1
- data/lib/glimmer/swt/font_proxy.rb +4 -4
- data/lib/glimmer/swt/image_proxy.rb +1 -1
- data/lib/glimmer/swt/layout_data_proxy.rb +1 -1
- data/lib/glimmer/swt/layout_proxy.rb +1 -1
- data/lib/glimmer/swt/menu_proxy.rb +1 -1
- data/lib/glimmer/swt/message_box_proxy.rb +1 -1
- data/lib/glimmer/swt/packages.rb +1 -1
- data/lib/glimmer/swt/properties.rb +49 -0
- data/lib/glimmer/swt/sash_form_proxy.rb +1 -1
- data/lib/glimmer/swt/scrolled_composite_proxy.rb +1 -1
- data/lib/glimmer/swt/shell_proxy.rb +3 -2
- data/lib/glimmer/swt/style_constantizable.rb +1 -1
- data/lib/glimmer/swt/styled_text_proxy.rb +1 -1
- data/lib/glimmer/swt/swt_proxy.rb +1 -1
- data/lib/glimmer/swt/tab_item_proxy.rb +1 -1
- data/lib/glimmer/swt/table_column_proxy.rb +1 -1
- data/lib/glimmer/swt/table_proxy.rb +1 -1
- data/lib/glimmer/swt/tree_proxy.rb +26 -22
- data/lib/glimmer/swt/widget_listener_proxy.rb +1 -1
- data/lib/glimmer/swt/widget_proxy.rb +5 -23
- data/lib/glimmer/ui/custom_shell.rb +1 -1
- data/lib/glimmer/ui/custom_widget.rb +1 -1
- data/lib/glimmer/util/proc_tracker.rb +1 -1
- data/samples/elaborate/contact_manager.rb +1 -1
- data/samples/elaborate/contact_manager/contact.rb +1 -1
- data/samples/elaborate/contact_manager/contact_manager_presenter.rb +1 -1
- data/samples/elaborate/contact_manager/contact_repository.rb +1 -1
- data/samples/elaborate/login.rb +1 -1
- data/samples/elaborate/meta_sample.rb +3 -1
- data/samples/elaborate/tic_tac_toe.rb +2 -2
- data/samples/elaborate/tic_tac_toe/board.rb +1 -1
- data/samples/elaborate/tic_tac_toe/cell.rb +1 -1
- data/samples/elaborate/user_profile.rb +1 -1
- data/samples/hello/hello_browser.rb +1 -1
- data/samples/hello/hello_button.rb +1 -1
- data/samples/hello/hello_canvas.rb +63 -0
- data/samples/hello/hello_canvas_animation.rb +66 -0
- data/samples/hello/hello_checkbox.rb +1 -1
- data/samples/hello/hello_checkbox_group.rb +1 -1
- data/samples/hello/hello_combo.rb +1 -1
- data/samples/hello/hello_computed.rb +1 -1
- data/samples/hello/hello_computed/contact.rb +1 -1
- data/samples/hello/hello_custom_shell.rb +1 -1
- data/samples/hello/hello_custom_widget.rb +1 -1
- data/samples/hello/hello_date_time.rb +1 -1
- data/samples/hello/hello_dialog.rb +78 -0
- data/samples/hello/hello_directory_dialog.rb +1 -1
- data/samples/hello/hello_drag_and_drop.rb +1 -1
- data/samples/hello/hello_expand_bar.rb +1 -1
- data/samples/hello/hello_file_dialog.rb +1 -1
- data/samples/hello/hello_group.rb +1 -1
- data/samples/hello/hello_link.rb +1 -1
- data/samples/hello/hello_list_multi_selection.rb +1 -1
- data/samples/hello/hello_list_single_selection.rb +1 -1
- data/samples/hello/hello_menu_bar.rb +1 -1
- data/samples/hello/hello_message_box.rb +1 -1
- data/samples/hello/hello_pop_up_context_menu.rb +1 -1
- data/samples/hello/hello_radio.rb +1 -1
- data/samples/hello/hello_radio_group.rb +1 -1
- data/samples/hello/hello_sash_form.rb +1 -1
- data/samples/hello/hello_spinner.rb +1 -1
- data/samples/hello/hello_styled_text.rb +1 -1
- data/samples/hello/hello_tab.rb +1 -1
- data/samples/hello/hello_table.rb +1 -1
- data/samples/hello/hello_world.rb +1 -1
- metadata +37 -13
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2007-
|
1
|
+
# Copyright (c) 2007-2021 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
|
@@ -20,6 +20,7 @@
|
|
20
20
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
21
|
|
22
22
|
require 'glimmer/swt/widget_listener_proxy'
|
23
|
+
require 'glimmer/swt/custom/drawable'
|
23
24
|
|
24
25
|
module Glimmer
|
25
26
|
module SWT
|
@@ -36,6 +37,8 @@ module Glimmer
|
|
36
37
|
# Follows the Proxy Design Pattern
|
37
38
|
class DisplayProxy
|
38
39
|
include_package 'org.eclipse.swt.widgets'
|
40
|
+
|
41
|
+
include Custom::Drawable
|
39
42
|
|
40
43
|
OBSERVED_MENU_ITEMS = ['about', 'preferences']
|
41
44
|
|
@@ -53,6 +56,7 @@ module Glimmer
|
|
53
56
|
attr_reader :swt_display
|
54
57
|
|
55
58
|
def initialize(*args)
|
59
|
+
Display.app_name ||= 'Glimmer'
|
56
60
|
@swt_display = Display.new(*args)
|
57
61
|
@swt_display.set_data('proxy', self)
|
58
62
|
end
|
@@ -60,6 +64,18 @@ module Glimmer
|
|
60
64
|
def content(&block)
|
61
65
|
Glimmer::DSL::Engine.add_content(self, Glimmer::DSL::SWT::DisplayExpression.new, &block)
|
62
66
|
end
|
67
|
+
|
68
|
+
def async_exec(&block)
|
69
|
+
@swt_display.async_exec(&block)
|
70
|
+
end
|
71
|
+
|
72
|
+
def sync_exec(&block)
|
73
|
+
@swt_display.sync_exec(&block)
|
74
|
+
end
|
75
|
+
|
76
|
+
def timer_exec(&block)
|
77
|
+
@swt_display.timer_exec(&block)
|
78
|
+
end
|
63
79
|
|
64
80
|
def method_missing(method, *args, &block)
|
65
81
|
if can_handle_observation_request?(method)
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (c) 2007-
|
2
|
-
#
|
1
|
+
# Copyright (c) 2007-2021 Andy Maleh
|
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
|
data/lib/glimmer/swt/packages.rb
CHANGED
@@ -0,0 +1,49 @@
|
|
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
|
+
module Glimmer
|
23
|
+
module SWT
|
24
|
+
module Properties
|
25
|
+
def ruby_attribute_setter(attribute_name)
|
26
|
+
"#{normalized_attribute(attribute_name)}="
|
27
|
+
end
|
28
|
+
|
29
|
+
def attribute_setter(attribute_name)
|
30
|
+
"set#{normalized_attribute(attribute_name).camelcase(:upper)}"
|
31
|
+
end
|
32
|
+
|
33
|
+
def attribute_getter(attribute_name)
|
34
|
+
"get#{normalized_attribute(attribute_name).camelcase(:upper)}"
|
35
|
+
end
|
36
|
+
|
37
|
+
def normalized_attribute(attribute_name)
|
38
|
+
attribute_name = attribute_name.to_s if attribute_name.is_a?(Symbol)
|
39
|
+
attribute_name = attribute_name.underscore unless attribute_name.downcase?
|
40
|
+
attribute_name = attribute_name.sub(/^get_/, '') if attribute_name.start_with?('get_')
|
41
|
+
attribute_name = attribute_name.sub(/^set_/, '') if attribute_name.start_with?('set_')
|
42
|
+
attribute_name = attribute_name.sub(/=$/, '') if attribute_name.end_with?('=')
|
43
|
+
attribute_name
|
44
|
+
end
|
45
|
+
alias ruby_attribute_getter normalized_attribute
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2007-
|
1
|
+
# Copyright (c) 2007-2021 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
|
@@ -64,10 +64,11 @@ module Glimmer
|
|
64
64
|
@swt_widget.setLayout(FillLayout.new)
|
65
65
|
@swt_widget.setMinimumSize(WIDTH_MIN, HEIGHT_MIN)
|
66
66
|
# TODO make this an option not the default
|
67
|
+
shell_swt_display = Glimmer::SWT::DisplayProxy.instance.swt_display
|
67
68
|
on_swt_show do
|
68
69
|
Thread.new do
|
69
70
|
sleep(0.25)
|
70
|
-
async_exec do
|
71
|
+
shell_swt_display.async_exec do
|
71
72
|
@swt_widget.setActive unless @swt_widget.isDisposed
|
72
73
|
end
|
73
74
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (c) 2007-
|
2
|
-
#
|
1
|
+
# Copyright (c) 2007-2021 Andy Maleh
|
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
|
@@ -59,7 +59,7 @@ module Glimmer
|
|
59
59
|
observer.call(@swt_widget.getSelection)
|
60
60
|
}
|
61
61
|
end
|
62
|
-
},
|
62
|
+
},
|
63
63
|
})
|
64
64
|
end
|
65
65
|
|
@@ -85,24 +85,28 @@ module Glimmer
|
|
85
85
|
@edit_in_progress = false
|
86
86
|
}
|
87
87
|
action = lambda { |event|
|
88
|
-
|
89
|
-
action_taken
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
88
|
+
begin
|
89
|
+
if !action_taken && !@edit_in_progress
|
90
|
+
action_taken = true
|
91
|
+
@edit_in_progress = true
|
92
|
+
new_text = @tree_editor_text_proxy.swt_widget.getText
|
93
|
+
if new_text == tree_item.getText
|
94
|
+
cancel.call
|
95
|
+
else
|
96
|
+
before_write&.call
|
97
|
+
tree_item.setText(new_text)
|
98
|
+
model = tree_item.getData
|
99
|
+
model.send("#{tree_properties[:text]}=", new_text) # makes tree update itself, so must search for selected tree item again
|
100
|
+
edited_tree_item = depth_first_search { |ti| ti.getData == model }.first
|
101
|
+
swt_widget.showItem(edited_tree_item)
|
102
|
+
@tree_editor_text_proxy.swt_widget.dispose
|
103
|
+
@tree_editor_text_proxy = nil
|
104
|
+
after_write&.call(edited_tree_item)
|
105
|
+
@edit_in_progress = false
|
106
|
+
end
|
105
107
|
end
|
108
|
+
rescue => e
|
109
|
+
Glimmer::Config.logger.error {"Error encountered while editing tree item!\n#{e.full_message}"}
|
106
110
|
end
|
107
111
|
}
|
108
112
|
on_focus_lost(&action)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2007-
|
1
|
+
# Copyright (c) 2007-2021 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
|
@@ -26,6 +26,8 @@ require 'glimmer/swt/swt_proxy'
|
|
26
26
|
require 'glimmer/swt/display_proxy'
|
27
27
|
require 'glimmer/swt/dnd_proxy'
|
28
28
|
require 'glimmer/swt/image_proxy'
|
29
|
+
require 'glimmer/swt/properties'
|
30
|
+
require 'glimmer/swt/custom/drawable'
|
29
31
|
|
30
32
|
# TODO refactor to make file smaller and extract sub-widget-proxies out of this
|
31
33
|
|
@@ -42,6 +44,8 @@ module Glimmer
|
|
42
44
|
# Follows the Proxy Design Pattern
|
43
45
|
class WidgetProxy
|
44
46
|
include Packages
|
47
|
+
include Properties
|
48
|
+
include Custom::Drawable
|
45
49
|
|
46
50
|
DEFAULT_STYLES = {
|
47
51
|
'arrow' => [:arrow],
|
@@ -667,28 +671,6 @@ module Glimmer
|
|
667
671
|
DEFAULT_STYLES[underscored_widget_name] || [:none]
|
668
672
|
end
|
669
673
|
|
670
|
-
def ruby_attribute_setter(attribute_name)
|
671
|
-
"#{normalized_attribute(attribute_name)}="
|
672
|
-
end
|
673
|
-
|
674
|
-
def attribute_setter(attribute_name)
|
675
|
-
"set#{normalized_attribute(attribute_name).camelcase(:upper)}"
|
676
|
-
end
|
677
|
-
|
678
|
-
def attribute_getter(attribute_name)
|
679
|
-
"get#{normalized_attribute(attribute_name).camelcase(:upper)}"
|
680
|
-
end
|
681
|
-
|
682
|
-
def normalized_attribute(attribute_name)
|
683
|
-
attribute_name = attribute_name.to_s if attribute_name.is_a?(Symbol)
|
684
|
-
attribute_name = attribute_name.underscore unless attribute_name.downcase?
|
685
|
-
attribute_name = attribute_name.sub(/^get_/, '') if attribute_name.start_with?('get_')
|
686
|
-
attribute_name = attribute_name.sub(/^set_/, '') if attribute_name.start_with?('set_')
|
687
|
-
attribute_name = attribute_name.sub(/=$/, '') if attribute_name.end_with?('=')
|
688
|
-
attribute_name
|
689
|
-
end
|
690
|
-
alias ruby_attribute_getter normalized_attribute
|
691
|
-
|
692
674
|
# TODO refactor following methods to eliminate duplication
|
693
675
|
# perhaps consider relying on raising an exception to avoid checking first
|
694
676
|
# unless that gives obscure SWT errors
|