glimmer-dsl-opal 0.1.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +48 -0
- data/README.md +948 -169
- data/VERSION +1 -1
- data/lib/glimmer-dsl-opal.rb +31 -7
- data/lib/glimmer-dsl-opal/ext/date.rb +13 -0
- data/lib/glimmer-dsl-opal/ext/exception.rb +5 -0
- data/lib/{samples → glimmer-dsl-opal/samples}/elaborate/contact_manager.rb +0 -0
- data/lib/{samples → glimmer-dsl-opal/samples}/elaborate/contact_manager/contact.rb +0 -0
- data/lib/{samples → glimmer-dsl-opal/samples}/elaborate/contact_manager/contact_manager_presenter.rb +0 -0
- data/lib/{samples → glimmer-dsl-opal/samples}/elaborate/contact_manager/contact_repository.rb +24 -99
- data/lib/{samples → glimmer-dsl-opal/samples}/elaborate/login.rb +0 -0
- data/lib/{samples → glimmer-dsl-opal/samples}/elaborate/tic_tac_toe.rb +0 -0
- data/lib/{samples → glimmer-dsl-opal/samples}/elaborate/tic_tac_toe/board.rb +0 -0
- data/lib/{samples → glimmer-dsl-opal/samples}/elaborate/tic_tac_toe/cell.rb +0 -0
- data/lib/{samples → glimmer-dsl-opal/samples}/hello/hello_browser.rb +0 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_checkbox.rb +85 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_checkbox_group.rb +68 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_combo.rb +63 -0
- data/lib/{samples → glimmer-dsl-opal/samples}/hello/hello_computed.rb +0 -0
- data/lib/{samples → glimmer-dsl-opal/samples}/hello/hello_computed/contact.rb +0 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_custom_shell.rb +155 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_custom_widget.rb +86 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_group.rb +104 -0
- data/lib/{samples → glimmer-dsl-opal/samples}/hello/hello_list_multi_selection.rb +0 -0
- data/lib/{samples → glimmer-dsl-opal/samples}/hello/hello_list_single_selection.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_radio.rb +108 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_radio_group.rb +84 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_tab.rb +50 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_world.rb +29 -0
- data/lib/{jquery.js → glimmer-dsl-opal/vendor/jquery.js} +0 -0
- data/lib/glimmer-dsl-swt.rb +37 -0
- data/lib/glimmer/data_binding/element_binding.rb +2 -1
- data/lib/glimmer/data_binding/ext/observable_model.rb +1 -1
- data/lib/glimmer/dsl/opal/async_exec_expression.rb +23 -7
- data/lib/glimmer/dsl/opal/checkbox_group_selection_data_binding_expression.rb +61 -0
- data/lib/glimmer/dsl/opal/color_expression.rb +38 -0
- data/lib/glimmer/dsl/opal/custom_widget_expression.rb +94 -0
- data/lib/glimmer/dsl/opal/display_expression.rb +40 -0
- data/lib/glimmer/dsl/opal/dsl.rb +14 -0
- data/lib/glimmer/dsl/opal/exec_expression.rb +55 -0
- data/lib/glimmer/dsl/opal/font_expression.rb +47 -0
- data/lib/glimmer/dsl/opal/layout_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/property_expression.rb +6 -2
- data/lib/glimmer/dsl/opal/radio_group_selection_data_binding_expression.rb +61 -0
- data/lib/glimmer/dsl/opal/rgb_expression.rb +32 -0
- data/lib/glimmer/dsl/opal/rgba_expression.rb +32 -0
- data/lib/glimmer/dsl/opal/shell_expression.rb +19 -2
- data/lib/glimmer/dsl/opal/swt_expression.rb +46 -0
- data/lib/glimmer/dsl/opal/sync_exec_expression.rb +33 -0
- data/lib/glimmer/dsl/opal/widget_expression.rb +2 -1
- data/lib/glimmer/dsl/opal/widget_listener_expression.rb +16 -3
- data/lib/glimmer/swt.rb +499 -0
- data/lib/glimmer/swt/browser_proxy.rb +1 -1
- data/lib/glimmer/swt/button_proxy.rb +17 -3
- data/lib/glimmer/swt/checkbox_proxy.rb +80 -0
- data/lib/glimmer/swt/color_proxy.rb +119 -0
- data/lib/glimmer/swt/combo_proxy.rb +13 -12
- data/lib/glimmer/swt/composite_proxy.rb +8 -8
- data/lib/glimmer/swt/custom/checkbox_group.rb +142 -0
- data/lib/glimmer/swt/custom/radio_group.rb +143 -0
- data/lib/glimmer/swt/display_proxy.rb +79 -0
- data/lib/glimmer/swt/fill_layout_proxy.rb +84 -0
- data/lib/glimmer/swt/font_proxy.rb +79 -0
- data/lib/glimmer/swt/grid_layout_proxy.rb +45 -4
- data/lib/glimmer/swt/group_proxy.rb +38 -0
- data/lib/glimmer/swt/label_proxy.rb +28 -4
- data/lib/glimmer/swt/layout_data_proxy.rb +59 -6
- data/lib/glimmer/swt/layout_proxy.rb +17 -14
- data/lib/glimmer/swt/list_proxy.rb +19 -14
- data/lib/glimmer/swt/make_shift_shell_proxy.rb +38 -0
- data/lib/glimmer/swt/message_box_proxy.rb +5 -8
- data/lib/glimmer/swt/radio_proxy.rb +81 -0
- data/lib/glimmer/swt/row_layout_proxy.rb +128 -0
- data/lib/glimmer/swt/scrolled_composite_proxy.rb +20 -0
- data/lib/glimmer/swt/shell_proxy.rb +51 -26
- data/lib/glimmer/swt/style_constantizable.rb +154 -0
- data/lib/glimmer/swt/styled_text_proxy.rb +44 -0
- data/lib/glimmer/swt/swt_proxy.rb +53 -0
- data/lib/glimmer/swt/tab_folder_proxy.rb +8 -8
- data/lib/glimmer/swt/tab_item_proxy.rb +15 -32
- data/lib/glimmer/swt/table_proxy.rb +0 -18
- data/lib/glimmer/swt/widget_proxy.rb +173 -54
- data/lib/glimmer/ui/custom_shell.rb +92 -0
- data/lib/glimmer/ui/custom_widget.rb +292 -0
- data/lib/glimmer/util/proc_tracker.rb +39 -0
- data/lib/net/http.rb +17 -0
- data/lib/uri.rb +64 -0
- metadata +108 -57
- data/lib/glimmer/opal/display_proxy.rb +0 -23
- data/lib/glimmer/opal/element_proxy.rb +0 -312
- data/lib/samples/elaborate/launch +0 -6
- data/lib/samples/hello/hello_combo.rb +0 -34
- data/lib/samples/hello/hello_tab.rb +0 -24
- data/lib/samples/hello/hello_world.rb +0 -8
- data/lib/samples/hello/launch +0 -10
- data/lib/samples/launch +0 -4
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'glimmer/swt/widget_proxy'
|
2
|
+
|
3
|
+
module Glimmer
|
4
|
+
module SWT
|
5
|
+
# Adapter for org.eclipse.swt.widgets.Group
|
6
|
+
#
|
7
|
+
# Follows Adapter Pattern
|
8
|
+
class GroupProxy < CompositeProxy
|
9
|
+
attr_reader :text
|
10
|
+
|
11
|
+
def text=(value)
|
12
|
+
@text = value
|
13
|
+
if @text.nil?
|
14
|
+
legend_dom_element.add_class('hide')
|
15
|
+
else
|
16
|
+
legend_dom_element.remove_class('hide')
|
17
|
+
end
|
18
|
+
legend_dom_element.html(@text)
|
19
|
+
end
|
20
|
+
|
21
|
+
def element
|
22
|
+
'fieldset'
|
23
|
+
end
|
24
|
+
|
25
|
+
def legend_dom_element
|
26
|
+
dom_element.find('legend')
|
27
|
+
end
|
28
|
+
|
29
|
+
def dom
|
30
|
+
@dom ||= html {
|
31
|
+
fieldset(id: id, class: name) {
|
32
|
+
legend(class: 'hide') { text }
|
33
|
+
}
|
34
|
+
}.to_s
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -1,26 +1,50 @@
|
|
1
1
|
require 'glimmer/swt/widget_proxy'
|
2
|
+
# require 'glimmer/swt/image_proxy'
|
2
3
|
|
3
4
|
module Glimmer
|
4
5
|
module SWT
|
5
6
|
class LabelProxy < WidgetProxy
|
6
|
-
attr_reader :text
|
7
|
+
attr_reader :text, :background_image, :image, :alignment
|
8
|
+
|
9
|
+
def initialize(parent, args)
|
10
|
+
super(parent, args)
|
11
|
+
self.alignment = [:left, :center, :right].detect {|align| args.detect { |arg| SWTProxy[align] == arg } }
|
12
|
+
end
|
7
13
|
|
8
14
|
def text=(value)
|
9
15
|
@text = value
|
10
|
-
|
16
|
+
dom_element.html(value)
|
17
|
+
end
|
18
|
+
|
19
|
+
def background_image=(*image_options)
|
20
|
+
# TODO consider if there is a difference between background_image and image in label and to have one reuse the other
|
21
|
+
# TODO finish implementation
|
22
|
+
# @background_image = Glimmer::SWT::ImageProxy.create(*image_options)
|
23
|
+
# dom_element.css('background-image', @background_image.image_data.dom_element.src)
|
24
|
+
end
|
25
|
+
|
26
|
+
def image=(*image_options)
|
27
|
+
# TODO finish implementation
|
28
|
+
# @image = Glimmer::SWT::ImageProxy.create(*image_options)
|
29
|
+
# dom_element.css('background-image', @image.image_data.dom_element.src)
|
11
30
|
end
|
12
31
|
|
13
32
|
def element
|
14
33
|
'label'
|
15
34
|
end
|
35
|
+
|
36
|
+
def alignment=(value)
|
37
|
+
# TODO consider storing swt value in the future instead
|
38
|
+
@alignment = value
|
39
|
+
dom_element.css('text-align', @alignment.to_s)
|
40
|
+
end
|
16
41
|
|
17
42
|
def dom
|
18
43
|
label_text = @text
|
19
44
|
label_id = id
|
20
|
-
label_style = css
|
21
45
|
label_class = name
|
22
46
|
@dom ||= html {
|
23
|
-
label(id: label_id,
|
47
|
+
label(id: label_id, class: label_class) {
|
24
48
|
label_text
|
25
49
|
}
|
26
50
|
}.to_s
|
@@ -8,39 +8,92 @@ module Glimmer
|
|
8
8
|
:args,
|
9
9
|
:horizontal_alignment,
|
10
10
|
:vertical_alignment,
|
11
|
+
:horizontal_span,
|
12
|
+
:vertical_span,
|
13
|
+
:horizontal_indent,
|
14
|
+
:vertical_indent,
|
11
15
|
:grab_excess_horizontal_space,
|
12
16
|
:grab_excess_vertical_space,
|
17
|
+
:width_hint,
|
13
18
|
:height_hint
|
14
19
|
|
15
20
|
def initialize(parent, args)
|
16
21
|
@parent = parent
|
17
22
|
@args = args
|
18
|
-
|
23
|
+
self.horizontal_alignment = @args[0] if @args[0]
|
24
|
+
self.vertical_alignment = @args[1] if @args[1]
|
25
|
+
self.grab_excess_horizontal_space = @args[2] if @args[2]
|
26
|
+
self.grab_excess_vertical_space = @args[3] if @args[3]
|
27
|
+
# TODO spread args correctly as per SWT LayoutData API
|
28
|
+
# TODO avoid using reapply
|
29
|
+
# reapply
|
30
|
+
end
|
31
|
+
|
32
|
+
def width_hint=(width_hint)
|
33
|
+
@width_hint = width_hint
|
34
|
+
@parent.dom_element.css('width', "#{@width_hint}px")
|
35
|
+
# reapply
|
19
36
|
end
|
20
37
|
|
21
38
|
def height_hint=(height_hint)
|
22
39
|
@height_hint = height_hint
|
23
|
-
|
40
|
+
@parent.dom_element.css('height', "#{@height_hint}px")
|
41
|
+
# reapply
|
24
42
|
end
|
25
43
|
|
26
44
|
def horizontal_alignment=(horizontal_alignment)
|
27
45
|
@horizontal_alignment = horizontal_alignment
|
28
|
-
|
46
|
+
return if @horizontal_alignment.nil?
|
47
|
+
if @horizontal_alignment == 'fill'
|
48
|
+
@parent.dom_element.css('width', '100%') if width_hint.nil?
|
49
|
+
else
|
50
|
+
@parent.dom_element.css('text-align', @horizontal_alignment)
|
51
|
+
end
|
52
|
+
# TODO
|
53
|
+
# reapply
|
29
54
|
end
|
30
55
|
|
31
56
|
def vertical_alignment=(vertical_alignment)
|
32
57
|
@vertical_alignment = vertical_alignment
|
33
|
-
|
58
|
+
# TODO
|
59
|
+
# reapply
|
60
|
+
end
|
61
|
+
|
62
|
+
def horizontal_span=(value)
|
63
|
+
@horizontal_span = value
|
64
|
+
@parent.dom_element.css('grid-column-start', "span #{@horizontal_span}")
|
65
|
+
# reapply
|
66
|
+
end
|
67
|
+
|
68
|
+
def vertical_span=(value)
|
69
|
+
@vertical_span = value
|
70
|
+
@parent.dom_element.css('grid-row-start', "span #{@vertical_span}")
|
71
|
+
# reapply
|
72
|
+
end
|
73
|
+
|
74
|
+
def horizontal_indent=(value)
|
75
|
+
@horizontal_indent = value
|
76
|
+
@parent.dom_element.css('padding-left', @horizontal_indent)
|
77
|
+
# reapply
|
78
|
+
end
|
79
|
+
|
80
|
+
def vertical_indent=(value)
|
81
|
+
@vertical_indent = value
|
82
|
+
@parent.dom_element.css('padding-top', @vertical_indent)
|
83
|
+
# reapply
|
34
84
|
end
|
35
85
|
|
36
86
|
def grab_excess_horizontal_space=(grab_excess_horizontal_space)
|
37
87
|
@grab_excess_horizontal_space = grab_excess_horizontal_space
|
38
|
-
|
88
|
+
@parent.dom_element.css('width', "100%") if @grab_excess_horizontal_space && width_hint.nil?
|
89
|
+
# reapply
|
39
90
|
end
|
40
91
|
|
41
92
|
def grab_excess_vertical_space=(grab_excess_vertical_space)
|
42
93
|
@grab_excess_vertical_space = grab_excess_vertical_space
|
43
|
-
|
94
|
+
@parent.dom_element.css('height', "100%") if @grab_excess_vertical_space && height_hint.nil?
|
95
|
+
# TODO
|
96
|
+
# reapply
|
44
97
|
end
|
45
98
|
|
46
99
|
def reapply
|
@@ -29,10 +29,17 @@ module Glimmer
|
|
29
29
|
|
30
30
|
attr_reader :parent, :args
|
31
31
|
|
32
|
-
def initialize(parent, args)
|
32
|
+
def initialize(parent, args)
|
33
33
|
@parent = parent
|
34
|
-
@
|
34
|
+
@parent = parent.body_root if @parent.is_a?(Glimmer::UI::CustomWidget)
|
35
|
+
@parent.css_classes.each do |css_class|
|
36
|
+
@parent.remove_css_class(css_class) if css_class.include?('layout')
|
37
|
+
end
|
38
|
+
@args = args
|
35
39
|
@parent.add_css_class(css_class)
|
40
|
+
@parent.layout = self
|
41
|
+
self.margin_width = 15 if respond_to?(:margin_width=)
|
42
|
+
self.margin_height = 15 if respond_to?(:margin_height=)
|
36
43
|
end
|
37
44
|
|
38
45
|
def css_class
|
@@ -40,21 +47,17 @@ module Glimmer
|
|
40
47
|
end
|
41
48
|
|
42
49
|
def reapply
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
CSS
|
50
|
-
layout_css.split(";").map(&:strip).map {|l| l.split(':').map(&:strip)}.each do |key, value|
|
51
|
-
unless key.nil?
|
52
|
-
@parent.dom_element.css(key, value)
|
53
|
-
end
|
54
|
-
end
|
50
|
+
# subclasses can override this
|
51
|
+
end
|
52
|
+
|
53
|
+
# Decorates widget dom. Subclasses may override. Returns widget dom by default.
|
54
|
+
def dom(widget_dom)
|
55
|
+
widget_dom
|
55
56
|
end
|
56
57
|
end
|
57
58
|
end
|
58
59
|
end
|
59
60
|
|
60
61
|
require 'glimmer/swt/grid_layout_proxy'
|
62
|
+
require 'glimmer/swt/fill_layout_proxy'
|
63
|
+
require 'glimmer/swt/row_layout_proxy'
|
@@ -6,14 +6,25 @@ module Glimmer
|
|
6
6
|
ITEM_EMPTY = '_____'
|
7
7
|
attr_reader :items, :selection
|
8
8
|
|
9
|
-
def initialize(parent, args)
|
9
|
+
def initialize(parent, args)
|
10
10
|
super(parent, args)
|
11
11
|
@selection = []
|
12
12
|
end
|
13
13
|
|
14
14
|
def items=(items)
|
15
15
|
@items = items.map {|item| item.strip == '' ? ITEM_EMPTY : item}
|
16
|
-
|
16
|
+
list_selection = selection
|
17
|
+
items_dom = @items.to_a.each_with_index.map do |item, index|
|
18
|
+
li_class = ''
|
19
|
+
li_class += ' selected' if list_selection.include?(item)
|
20
|
+
li_class += ' empty-list-item' if item == ITEM_EMPTY
|
21
|
+
html {
|
22
|
+
li(class: li_class) {
|
23
|
+
item
|
24
|
+
}
|
25
|
+
}.to_s
|
26
|
+
end
|
27
|
+
dom_element.html(items_dom)
|
17
28
|
end
|
18
29
|
|
19
30
|
def index_of(item)
|
@@ -23,7 +34,11 @@ module Glimmer
|
|
23
34
|
# used for multi-selection taking an array
|
24
35
|
def selection=(selection)
|
25
36
|
@selection = selection
|
26
|
-
|
37
|
+
dom_element.find('li').remove_class('selected')
|
38
|
+
@selection.each do |item|
|
39
|
+
index = @items.index(item)
|
40
|
+
dom_element.find("li:nth-child(#{index + 1})").add_class('selected')
|
41
|
+
end
|
27
42
|
end
|
28
43
|
|
29
44
|
# used for single selection taking an index
|
@@ -47,7 +62,7 @@ module Glimmer
|
|
47
62
|
if event.target.prop('nodeName') == 'LI'
|
48
63
|
selected_item = event.target.text
|
49
64
|
select(index_of(selected_item), event.meta_key)
|
50
|
-
event_listener.call(event)
|
65
|
+
event_listener.call(event)
|
51
66
|
end
|
52
67
|
}
|
53
68
|
}
|
@@ -60,21 +75,11 @@ module Glimmer
|
|
60
75
|
end
|
61
76
|
|
62
77
|
def dom
|
63
|
-
list_items = @items
|
64
78
|
list_id = id
|
65
79
|
list_style = css
|
66
80
|
list_selection = selection
|
67
81
|
@dom ||= html {
|
68
82
|
ul(id: list_id, class: name, style: list_style) {
|
69
|
-
list_items.to_a.each_with_index do |item, index|
|
70
|
-
li_class = ''
|
71
|
-
li_class += ' selected' if list_selection.include?(item)
|
72
|
-
li_class += ' empty-list-item' if item == ITEM_EMPTY
|
73
|
-
li(class: li_class) {
|
74
|
-
item
|
75
|
-
}
|
76
|
-
end
|
77
|
-
nil #TODO look into glimmer-dsl-xml and why it doesn't ignore collections like each_with_index
|
78
83
|
}
|
79
84
|
}.to_s
|
80
85
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Copyright (c) 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
|
+
module Glimmer
|
23
|
+
module SWT
|
24
|
+
class MakeShiftShellProxy < Glimmer::SWT::ShellProxy
|
25
|
+
def initialize(*args, &block)
|
26
|
+
# No Op
|
27
|
+
end
|
28
|
+
|
29
|
+
def add_child(child)
|
30
|
+
# No Op
|
31
|
+
end
|
32
|
+
|
33
|
+
def open
|
34
|
+
# No Op
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -10,8 +10,6 @@ module Glimmer
|
|
10
10
|
@parent = parent
|
11
11
|
@args = args
|
12
12
|
@children = Set.new
|
13
|
-
@css_classes = Set.new(['modal', name])
|
14
|
-
@css = ''
|
15
13
|
@enabled = true
|
16
14
|
content do
|
17
15
|
on_widget_selected {
|
@@ -22,12 +20,12 @@ module Glimmer
|
|
22
20
|
|
23
21
|
def text=(txt)
|
24
22
|
@text = txt
|
25
|
-
|
23
|
+
dom_element.find('.modal-content .text').html(@text)
|
26
24
|
end
|
27
25
|
|
28
26
|
def message=(msg)
|
29
27
|
@message = msg
|
30
|
-
|
28
|
+
dom_element.find('.modal-content .message').html(@text)
|
31
29
|
end
|
32
30
|
|
33
31
|
def document
|
@@ -95,7 +93,7 @@ module Glimmer
|
|
95
93
|
}
|
96
94
|
.modal-content {
|
97
95
|
background-color: #fefefe;
|
98
|
-
|
96
|
+
padding-bottom: 15px;
|
99
97
|
border: 1px solid #888;
|
100
98
|
display: inline-block;
|
101
99
|
min-width: 200px;
|
@@ -120,8 +118,7 @@ module Glimmer
|
|
120
118
|
modal_style = css
|
121
119
|
modal_text = text
|
122
120
|
modal_message = message
|
123
|
-
|
124
|
-
modal_class = modal_css_classes.to_a.join(' ')
|
121
|
+
modal_class = ['modal', name].join(' ')
|
125
122
|
@dom ||= html {
|
126
123
|
div(id: modal_id, style: modal_style, class: modal_class) {
|
127
124
|
style(class: 'modal-style') {
|
@@ -131,7 +128,7 @@ module Glimmer
|
|
131
128
|
header(class: 'text') {
|
132
129
|
modal_text
|
133
130
|
}
|
134
|
-
tag(_name: 'p', id: 'message') {
|
131
|
+
tag(_name: 'p', id: 'message', class: 'message') {
|
135
132
|
modal_message
|
136
133
|
}
|
137
134
|
input(type: 'button', class: 'close', autofocus: 'autofocus', value: 'OK')
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'glimmer/swt/widget_proxy'
|
2
|
+
|
3
|
+
module Glimmer
|
4
|
+
module SWT
|
5
|
+
class RadioProxy < WidgetProxy
|
6
|
+
STYLE=<<~CSS
|
7
|
+
.radio {
|
8
|
+
display: inline;
|
9
|
+
}
|
10
|
+
.radio-label {
|
11
|
+
display: inline;
|
12
|
+
}
|
13
|
+
.radio-container {
|
14
|
+
}
|
15
|
+
CSS
|
16
|
+
|
17
|
+
def text
|
18
|
+
label_dom_element.html
|
19
|
+
end
|
20
|
+
|
21
|
+
def text=(value)
|
22
|
+
label_dom_element.html(value)
|
23
|
+
end
|
24
|
+
|
25
|
+
def selection
|
26
|
+
dom_element.prop('checked')
|
27
|
+
end
|
28
|
+
|
29
|
+
def selection=(value)
|
30
|
+
dom_element.prop('checked', value)
|
31
|
+
end
|
32
|
+
|
33
|
+
def element
|
34
|
+
'input'
|
35
|
+
end
|
36
|
+
|
37
|
+
def label_id
|
38
|
+
"#{id}-label"
|
39
|
+
end
|
40
|
+
|
41
|
+
def label_name
|
42
|
+
"#{name}-label"
|
43
|
+
end
|
44
|
+
|
45
|
+
def label_path
|
46
|
+
"#{parent_path} ##{label_id}"
|
47
|
+
end
|
48
|
+
|
49
|
+
def label_dom_element
|
50
|
+
Document.find(label_path)
|
51
|
+
end
|
52
|
+
|
53
|
+
def container_id
|
54
|
+
"#{id}-container"
|
55
|
+
end
|
56
|
+
|
57
|
+
def container_name
|
58
|
+
"#{name}-container"
|
59
|
+
end
|
60
|
+
|
61
|
+
def observation_request_to_event_mapping
|
62
|
+
{
|
63
|
+
'on_widget_selected' => {
|
64
|
+
event: 'change'
|
65
|
+
},
|
66
|
+
}
|
67
|
+
end
|
68
|
+
|
69
|
+
def dom
|
70
|
+
@dom ||= html {
|
71
|
+
span(id: container_id, class: container_name) {
|
72
|
+
input(type: 'radio', id: id, class: name, name: parent&.id)
|
73
|
+
label(id: label_id, class: label_name, for: id) {
|
74
|
+
text
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}.to_s
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|