glimmer-dsl-swt 4.17.2.3 → 4.17.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +47 -0
- data/README.md +358 -516
- data/VERSION +1 -1
- data/glimmer-dsl-swt.gemspec +10 -6
- data/lib/glimmer-dsl-swt.rb +1 -0
- data/lib/glimmer/dsl/swt/custom_widget_expression.rb +1 -0
- data/lib/glimmer/dsl/swt/widget_expression.rb +2 -0
- data/lib/glimmer/rake_task.rb +32 -20
- data/lib/glimmer/rake_task/package.rb +10 -3
- data/lib/glimmer/rake_task/scaffold.rb +146 -42
- data/lib/glimmer/swt/custom/code_text.rb +95 -0
- data/lib/glimmer/swt/image_proxy.rb +18 -3
- data/lib/glimmer/swt/message_box_proxy.rb +1 -1
- data/lib/glimmer/swt/sash_form_proxy.rb +53 -0
- data/lib/glimmer/swt/style_constantizable.rb +2 -1
- data/lib/glimmer/swt/styled_text_proxy.rb +43 -0
- data/lib/glimmer/swt/widget_proxy.rb +93 -63
- data/samples/elaborate/meta_sample.rb +166 -0
- data/samples/hello/hello_sash_form.rb +137 -0
- metadata +12 -8
- data/lib/glimmer/rake_task/sample.rb +0 -115
@@ -0,0 +1,95 @@
|
|
1
|
+
require 'glimmer/ui/custom_widget'
|
2
|
+
|
3
|
+
module Glimmer
|
4
|
+
module SWT
|
5
|
+
module Custom
|
6
|
+
# CodeText is a customization of StyledText with support for Ruby Syntax Highlighting
|
7
|
+
class CodeText
|
8
|
+
include Glimmer::UI::CustomWidget
|
9
|
+
|
10
|
+
SYNTAX_COLOR_MAP = {
|
11
|
+
Builtin: [215,58,73],
|
12
|
+
Class: [3,47,98],
|
13
|
+
Constant: [0,92,197],
|
14
|
+
Double: [0,92,197],
|
15
|
+
Escape: [:red],
|
16
|
+
Function: [:blue],
|
17
|
+
Instance: [227,98,9],
|
18
|
+
Integer: [:blue],
|
19
|
+
Interpol: [:blue],
|
20
|
+
Keyword: [:blue],
|
21
|
+
Name: [111,66,193], #purple
|
22
|
+
Operator: [:red],
|
23
|
+
Pseudo: [:dark_red],
|
24
|
+
Punctuation: [:blue],
|
25
|
+
Single: [106,115,125], # Also, Comments
|
26
|
+
Symbol: [:dark_green],
|
27
|
+
Text: [75, 75, 75],
|
28
|
+
}
|
29
|
+
|
30
|
+
# TODO support `option :language`
|
31
|
+
# TODO support auto language detection
|
32
|
+
|
33
|
+
def text=(value)
|
34
|
+
swt_widget&.text = value
|
35
|
+
end
|
36
|
+
|
37
|
+
def text
|
38
|
+
swt_widget&.text
|
39
|
+
end
|
40
|
+
|
41
|
+
def syntax_highlighting
|
42
|
+
return [] if text.to_s.strip.empty?
|
43
|
+
code = text
|
44
|
+
return @syntax_highlighting if @last_code == code
|
45
|
+
@last_code = code
|
46
|
+
lexer = Rouge::Lexer.find_fancy('ruby', code)
|
47
|
+
lex = lexer.lex(code).to_a
|
48
|
+
code_size = 0
|
49
|
+
lex_hashes = lex.map do |pair|
|
50
|
+
{token_type: pair.first, token_text: pair.last}
|
51
|
+
end.each do |hash|
|
52
|
+
hash[:token_index] = code_size
|
53
|
+
code_size += hash[:token_text].size
|
54
|
+
end
|
55
|
+
code_lines = code.split("\n")
|
56
|
+
line_index = 0
|
57
|
+
@syntax_highlighting = code_lines_map = code_lines.reduce({}) do |hash, line|
|
58
|
+
line_hashes = []
|
59
|
+
line_hashes << lex_hashes.shift while lex_hashes.any? && lex_hashes.first[:token_index].between?(line_index, line_index + line.size)
|
60
|
+
hash.merge(line_index => line_hashes).tap do
|
61
|
+
line_index += line.size + 1
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
before_body {
|
67
|
+
@swt_style = swt_style == 0 ? [:border, :multi, :v_scroll, :h_scroll] : swt_style
|
68
|
+
}
|
69
|
+
|
70
|
+
body {
|
71
|
+
styled_text(swt_style) {
|
72
|
+
font name: 'Consolas', height: 15
|
73
|
+
foreground rgb(75, 75, 75)
|
74
|
+
left_margin 5
|
75
|
+
top_margin 5
|
76
|
+
right_margin 5
|
77
|
+
bottom_margin 5
|
78
|
+
|
79
|
+
on_line_get_style { |line_style_event|
|
80
|
+
styles = []
|
81
|
+
syntax_highlighting[line_style_event.lineOffset].to_a.each do |token_hash|
|
82
|
+
start_index = token_hash[:token_index]
|
83
|
+
size = token_hash[:token_text].size
|
84
|
+
token_color = SYNTAX_COLOR_MAP[token_hash[:token_type].name] || [:black]
|
85
|
+
token_color = color(*token_color).swt_color
|
86
|
+
styles << StyleRange.new(start_index, size, token_color, nil)
|
87
|
+
end
|
88
|
+
line_style_event.styles = styles.to_java(StyleRange) unless styles.empty?
|
89
|
+
}
|
90
|
+
}
|
91
|
+
}
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
@@ -27,10 +27,20 @@ module Glimmer
|
|
27
27
|
#
|
28
28
|
# Follows the Proxy Design Pattern
|
29
29
|
class ImageProxy
|
30
|
+
class << self
|
31
|
+
def create(*args)
|
32
|
+
if args.size == 1 && args.first.is_a?(ImageProxy)
|
33
|
+
args.first
|
34
|
+
else
|
35
|
+
new(*args)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
30
40
|
include_package 'org.eclipse.swt.graphics'
|
31
41
|
|
32
42
|
attr_reader :file_path, :jar_file_path, :image_data, :swt_image
|
33
|
-
|
43
|
+
|
34
44
|
# Initializes a proxy for an SWT Image object
|
35
45
|
#
|
36
46
|
# Takes the same args as the SWT Image class
|
@@ -38,14 +48,19 @@ module Glimmer
|
|
38
48
|
# and returns an image object.
|
39
49
|
def initialize(*args)
|
40
50
|
@args = args
|
41
|
-
|
42
|
-
options = @args.
|
51
|
+
options = @args.last.is_a?(Hash) ? @args.delete_at(-1) : {}
|
52
|
+
options[:swt_image] = @args.first if @args.size == 1 && @args.first.is_a?(Image)
|
53
|
+
@file_path = @args.first if @args.size == 1 && @args.first.is_a?(String)
|
54
|
+
@args = @args.first if @args.size == 1 && @args.first.is_a?(Array)
|
43
55
|
if options&.keys&.include?(:swt_image)
|
44
56
|
@swt_image = options[:swt_image]
|
45
57
|
@image_data = @swt_image.image_data
|
46
58
|
elsif @file_path
|
47
59
|
@image_data = ImageData.new(input_stream || @file_path)
|
48
60
|
@swt_image = Image.new(DisplayProxy.instance.swt_display, @image_data)
|
61
|
+
width = options[:width]
|
62
|
+
height = options[:height]
|
63
|
+
scale_to(width, height) unless width.nil? || height.nil?
|
49
64
|
else
|
50
65
|
@swt_image = Image.new(*@args)
|
51
66
|
@image_data = @swt_image.image_data
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# Copyright (c) 2007-2020 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/swt/widget_proxy'
|
23
|
+
|
24
|
+
module Glimmer
|
25
|
+
module SWT
|
26
|
+
# Proxy for org.eclipse.swt.custom.SashForm
|
27
|
+
#
|
28
|
+
# Follows the Proxy Design Pattern
|
29
|
+
class SashFormProxy < WidgetProxy
|
30
|
+
def post_add_content
|
31
|
+
swt_widget.setWeights(@weights) unless @weights.nil?
|
32
|
+
end
|
33
|
+
|
34
|
+
def set_attribute(attribute_name, *args)
|
35
|
+
if attribute_name.to_s == 'weights'
|
36
|
+
@weights = args
|
37
|
+
@weights = @weights.first if @weights.first.is_a?(Array)
|
38
|
+
else
|
39
|
+
super(attribute_name, *args)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def get_attribute(attribute_name)
|
44
|
+
if attribute_name.to_s == "weights"
|
45
|
+
swt_widget.getWeights.to_a
|
46
|
+
else
|
47
|
+
super(attribute_name)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -128,7 +128,7 @@ module Glimmer
|
|
128
128
|
def deconstruct(integer)
|
129
129
|
constant_source_class.constants.reduce([]) do |found, c|
|
130
130
|
constant_value = constant_source_class.const_get(c) rescue -1
|
131
|
-
is_found = constant_value.is_a?(Integer) && (integer & constant_value) ==
|
131
|
+
is_found = constant_value.is_a?(Integer) && (integer & constant_value) == constant_value
|
132
132
|
is_found ? found += [c] : found
|
133
133
|
end
|
134
134
|
end
|
@@ -136,6 +136,7 @@ module Glimmer
|
|
136
136
|
# Reverse engineer a style integer into a symbol
|
137
137
|
# Useful for debugging
|
138
138
|
def reverse_lookup(integer)
|
139
|
+
# TODO support looking up compound style mixes
|
139
140
|
constant_source_class.constants.reduce([]) do |found, c|
|
140
141
|
constant_value = constant_source_class.const_get(c) rescue -1
|
141
142
|
is_found = constant_value.is_a?(Integer) && integer == constant_value
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# Copyright (c) 2007-2020 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/swt/widget_proxy'
|
23
|
+
|
24
|
+
module Glimmer
|
25
|
+
module SWT
|
26
|
+
# Proxy for org.eclipse.swt.custom.StyledText
|
27
|
+
#
|
28
|
+
# Follows the Proxy Design Pattern
|
29
|
+
class StyledTextProxy < WidgetProxy
|
30
|
+
def set_attribute(attribute_name, *args)
|
31
|
+
if attribute_name.to_s == 'selection'
|
32
|
+
if args.first
|
33
|
+
async_exec { @swt_widget.setCaretOffset(args.first.x) }
|
34
|
+
async_exec { @swt_widget.setSelection(args.first) }
|
35
|
+
end
|
36
|
+
else
|
37
|
+
super(attribute_name, *args)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -44,26 +44,28 @@ module Glimmer
|
|
44
44
|
include Packages
|
45
45
|
|
46
46
|
DEFAULT_STYLES = {
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
47
|
+
'arrow' => [:arrow],
|
48
|
+
'button' => [:push],
|
49
|
+
'checkbox' => [:check],
|
50
|
+
'check' => [:check],
|
51
|
+
'drag_source' => [:drop_copy],
|
52
|
+
'drop_target' => [:drop_copy],
|
53
|
+
'list' => [:border, :v_scroll],
|
54
|
+
'menu_item' => [:push],
|
55
|
+
'radio' => [:radio],
|
56
|
+
'scrolled_composite' => [:border, :h_scroll, :v_scroll],
|
57
|
+
'spinner' => [:border],
|
58
|
+
'styled_text' => [:border, :multi, :v_scroll, :h_scroll],
|
59
|
+
'table' => [:virtual, :border, :full_selection],
|
60
|
+
'text' => [:border],
|
61
|
+
'toggle' => [:toggle],
|
62
|
+
'tool_bar' => [:push],
|
63
|
+
'tool_item' => [:push],
|
64
|
+
'tree' => [:virtual, :border, :h_scroll, :v_scroll],
|
63
65
|
}
|
64
66
|
|
65
67
|
DEFAULT_INITIALIZERS = {
|
66
|
-
|
68
|
+
'composite' => lambda do |composite|
|
67
69
|
if composite.get_layout.nil?
|
68
70
|
layout = GridLayout.new
|
69
71
|
layout.marginWidth = 15
|
@@ -71,18 +73,18 @@ module Glimmer
|
|
71
73
|
composite.layout = layout
|
72
74
|
end
|
73
75
|
end,
|
74
|
-
|
76
|
+
'scrolled_composite' => lambda do |scrolled_composite|
|
75
77
|
scrolled_composite.expand_horizontal = true
|
76
78
|
scrolled_composite.expand_vertical = true
|
77
79
|
end,
|
78
|
-
|
80
|
+
'table' => lambda do |table|
|
79
81
|
table.setHeaderVisible(true)
|
80
82
|
table.setLinesVisible(true)
|
81
83
|
end,
|
82
|
-
|
84
|
+
'table_column' => lambda do |table_column|
|
83
85
|
table_column.setWidth(80)
|
84
86
|
end,
|
85
|
-
|
87
|
+
'group' => lambda do |group|
|
86
88
|
group.layout = GridLayout.new if group.get_layout.nil?
|
87
89
|
end,
|
88
90
|
}
|
@@ -216,7 +218,11 @@ module Glimmer
|
|
216
218
|
def get_attribute(attribute_name)
|
217
219
|
widget_custom_attribute = widget_custom_attribute_mapping[attribute_name.to_s]
|
218
220
|
if widget_custom_attribute
|
219
|
-
|
221
|
+
if widget_custom_attribute[:getter][:invoker]
|
222
|
+
widget_custom_attribute[:getter][:invoker].call(@swt_widget, [])
|
223
|
+
else
|
224
|
+
@swt_widget.send(widget_custom_attribute[:getter][:name])
|
225
|
+
end
|
220
226
|
else
|
221
227
|
@swt_widget.send(attribute_getter(attribute_name))
|
222
228
|
end
|
@@ -329,6 +335,56 @@ module Glimmer
|
|
329
335
|
observer.call(@swt_widget.getText)
|
330
336
|
}
|
331
337
|
end,
|
338
|
+
:caret_position => lambda do |observer|
|
339
|
+
on_swt_keyup { |event|
|
340
|
+
observer.call(@swt_widget.getCaretOffset)
|
341
|
+
}
|
342
|
+
on_swt_mouseup { |event|
|
343
|
+
observer.call(@swt_widget.getCaretOffset)
|
344
|
+
}
|
345
|
+
end,
|
346
|
+
:caret_offset => lambda do |observer|
|
347
|
+
on_swt_keyup { |event|
|
348
|
+
observer.call(@swt_widget.getCaretOffset)
|
349
|
+
}
|
350
|
+
on_swt_mouseup { |event|
|
351
|
+
observer.call(@swt_widget.getCaretOffset)
|
352
|
+
}
|
353
|
+
end,
|
354
|
+
:selection => lambda do |observer|
|
355
|
+
on_swt_keyup { |event|
|
356
|
+
observer.call(@swt_widget.getSelection) unless @swt_widget.getSelection.x == 0 && @swt_widget.getSelection.y == 0
|
357
|
+
}
|
358
|
+
on_swt_mouseup { |event|
|
359
|
+
observer.call(@swt_widget.getSelection) unless @swt_widget.getSelection.x == 0 && @swt_widget.getSelection.y == 0
|
360
|
+
}
|
361
|
+
end,
|
362
|
+
:selection_count => lambda do |observer|
|
363
|
+
on_swt_keyup { |event|
|
364
|
+
observer.call(@swt_widget.getSelectionCount)
|
365
|
+
}
|
366
|
+
on_swt_mouseup { |event|
|
367
|
+
observer.call(@swt_widget.getSelectionCount)
|
368
|
+
}
|
369
|
+
end,
|
370
|
+
:top_index => lambda do |observer|
|
371
|
+
@last_top_index = @swt_widget.getTopIndex
|
372
|
+
on_paint_control { |event|
|
373
|
+
if @swt_widget.getTopIndex != @last_top_index
|
374
|
+
@last_top_index = @swt_widget.getTopIndex
|
375
|
+
observer.call(@last_top_index)
|
376
|
+
end
|
377
|
+
}
|
378
|
+
end,
|
379
|
+
:top_pixel => lambda do |observer|
|
380
|
+
@last_top_pixel = @swt_widget.getTopPixel
|
381
|
+
on_paint_control { |event|
|
382
|
+
if @swt_widget.getTopPixel != @last_top_pixel
|
383
|
+
@last_top_pixel = @swt_widget.getTopPixel
|
384
|
+
observer.call(@last_top_pixel)
|
385
|
+
end
|
386
|
+
}
|
387
|
+
end,
|
332
388
|
},
|
333
389
|
Java::OrgEclipseSwtWidgets::Button => {
|
334
390
|
:selection => lambda do |observer|
|
@@ -609,18 +665,22 @@ module Glimmer
|
|
609
665
|
end
|
610
666
|
|
611
667
|
def widget_custom_attribute_mapping
|
668
|
+
# TODO scope per widget class type just like other mappings
|
612
669
|
@swt_widget_custom_attribute_mapping ||= {
|
613
670
|
'focus' => {
|
614
671
|
getter: {name: 'isFocusControl'},
|
615
672
|
setter: {name: 'setFocus', invoker: lambda { |widget, args| @swt_widget.setFocus if args.first }},
|
616
673
|
},
|
617
674
|
'caret_position' => {
|
618
|
-
getter: {name: 'getCaretPosition'},
|
675
|
+
getter: {name: 'getCaretPosition', invoker: lambda { |widget, args| @swt_widget.respond_to?(:getCaretPosition) ? @swt_widget.getCaretPosition : @swt_widget.getCaretOffset}},
|
619
676
|
setter: {name: 'setSelection', invoker: lambda { |widget, args| @swt_widget.setSelection(args.first) if args.first }},
|
620
677
|
},
|
621
678
|
'selection_count' => {
|
622
679
|
getter: {name: 'getSelectionCount'},
|
623
|
-
setter: {name: 'setSelection', invoker: lambda { |widget, args|
|
680
|
+
setter: {name: 'setSelection', invoker: lambda { |widget, args|
|
681
|
+
caret_position = @swt_widget.respond_to?(:getCaretPosition) ? @swt_widget.getCaretPosition : @swt_widget.getCaretOffset
|
682
|
+
@swt_widget.setSelection(caret_position, caret_position + args.first) if args.first
|
683
|
+
}},
|
624
684
|
},
|
625
685
|
}
|
626
686
|
end
|
@@ -658,11 +718,9 @@ module Glimmer
|
|
658
718
|
end
|
659
719
|
|
660
720
|
def apply_property_type_converters(attribute_name, args)
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
args[0] = converter.call(value) if converter
|
665
|
-
end
|
721
|
+
value = args
|
722
|
+
converter = property_type_converters[attribute_name.to_sym]
|
723
|
+
args[0..-1] = [converter.call(*value)] if converter
|
666
724
|
if args.count == 1 && args.first.is_a?(ColorProxy)
|
667
725
|
g_color = args.first
|
668
726
|
args[0] = g_color.swt_color
|
@@ -683,17 +741,8 @@ module Glimmer
|
|
683
741
|
SWTProxy[*value]
|
684
742
|
},
|
685
743
|
:background => color_converter,
|
686
|
-
:background_image => lambda do
|
687
|
-
|
688
|
-
image_proxy = if value.is_a?(String)
|
689
|
-
ImageProxy.new(value)
|
690
|
-
elsif value.is_a?(Array)
|
691
|
-
ImageProxy.new(*value)
|
692
|
-
elsif value.is_a?(Image)
|
693
|
-
ImageProxy.new(swt_image: value)
|
694
|
-
else
|
695
|
-
value
|
696
|
-
end
|
744
|
+
:background_image => lambda do |*value|
|
745
|
+
image_proxy = ImageProxy.create(*value)
|
697
746
|
|
698
747
|
if image_proxy&.file_path&.end_with?('.gif')
|
699
748
|
image = image_proxy.swt_image
|
@@ -751,38 +800,19 @@ module Glimmer
|
|
751
800
|
value
|
752
801
|
end
|
753
802
|
end,
|
754
|
-
:image => lambda do
|
755
|
-
|
756
|
-
ImageProxy.new(value).swt_image
|
757
|
-
elsif value.is_a?(Array)
|
758
|
-
ImageProxy.new(*value).swt_image
|
759
|
-
elsif value.is_a?(Image)
|
760
|
-
ImageProxy.new(swt_image: value)
|
761
|
-
else
|
762
|
-
value
|
763
|
-
end
|
764
|
-
image_proxy.swt_image
|
803
|
+
:image => lambda do |*value|
|
804
|
+
ImageProxy.create(*value).swt_image
|
765
805
|
end,
|
766
806
|
:images => lambda do |array|
|
767
807
|
array.to_a.map do |value|
|
768
|
-
|
769
|
-
ImageProxy.new(value).swt_image
|
770
|
-
elsif value.is_a?(Array)
|
771
|
-
ImageProxy.new(*value).swt_image
|
772
|
-
else
|
773
|
-
value
|
774
|
-
end
|
808
|
+
ImageProxy.create(value).swt_image
|
775
809
|
end.to_java(Image)
|
776
810
|
end,
|
777
811
|
:items => lambda do |value|
|
778
812
|
value.to_java :string
|
779
813
|
end,
|
780
814
|
:text => lambda do |value|
|
781
|
-
|
782
|
-
value.to_s
|
783
|
-
else
|
784
|
-
value.to_s
|
785
|
-
end
|
815
|
+
value.to_s
|
786
816
|
end,
|
787
817
|
:transfer => lambda do |value|
|
788
818
|
value = value.first if value.is_a?(Array) && value.size == 1 && value.first.is_a?(Array)
|