glimmer-dsl-opal 0.0.9 → 0.5.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 +50 -0
- data/README.md +999 -177
- data/VERSION +1 -1
- data/lib/glimmer-dsl-opal.rb +49 -10
- 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 +1 -1
- 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 +19 -19
- 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 +0 -0
- 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/glimmer-dsl-opal/vendor/jquery.js +2 -0
- data/lib/glimmer-dsl-swt.rb +37 -0
- data/lib/glimmer/data_binding/element_binding.rb +1 -0
- data/lib/glimmer/data_binding/ext/observable_model.rb +5 -5
- data/lib/glimmer/data_binding/list_selection_binding.rb +1 -1
- data/lib/glimmer/data_binding/table_items_binding.rb +3 -3
- 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/column_properties_expression.rb +2 -2
- data/lib/glimmer/dsl/opal/combo_selection_data_binding_expression.rb +2 -2
- 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 +18 -16
- 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_data_expression.rb +2 -2
- data/lib/glimmer/dsl/opal/layout_expression.rb +22 -0
- data/lib/glimmer/dsl/opal/list_selection_data_binding_expression.rb +2 -3
- data/lib/glimmer/dsl/opal/message_box_expression.rb +2 -2
- 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 +20 -3
- 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/table_expression.rb +2 -2
- data/lib/glimmer/dsl/opal/table_items_data_binding_expression.rb +2 -2
- data/lib/glimmer/dsl/opal/widget_expression.rb +24 -0
- 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 +27 -0
- data/lib/glimmer/swt/button_proxy.rb +54 -0
- data/lib/glimmer/swt/checkbox_proxy.rb +80 -0
- data/lib/glimmer/swt/color_proxy.rb +119 -0
- data/lib/glimmer/{opal/select_proxy.rb → swt/combo_proxy.rb} +23 -18
- data/lib/glimmer/swt/composite_proxy.rb +31 -0
- 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/{opal → swt}/event_listener_proxy.rb +1 -1
- 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 +82 -0
- data/lib/glimmer/swt/group_proxy.rb +38 -0
- data/lib/glimmer/swt/label_proxy.rb +54 -0
- data/lib/glimmer/swt/layout_data_proxy.rb +105 -0
- data/lib/glimmer/swt/layout_proxy.rb +63 -0
- data/lib/glimmer/{opal → swt}/list_proxy.rb +30 -22
- data/lib/glimmer/swt/make_shift_shell_proxy.rb +38 -0
- data/lib/glimmer/swt/message_box_proxy.rb +143 -0
- data/lib/glimmer/{opal → swt}/point.rb +1 -1
- data/lib/glimmer/{opal → swt}/property_owner.rb +1 -1
- 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 +260 -0
- 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/{opal/tab_folder.rb → swt/tab_folder_proxy.rb} +20 -21
- data/lib/glimmer/swt/tab_item_proxy.rb +84 -0
- data/lib/glimmer/{opal/table_column.rb → swt/table_column_proxy.rb} +13 -7
- data/lib/glimmer/{opal/table_item.rb → swt/table_item_proxy.rb} +59 -48
- data/lib/glimmer/{opal → swt}/table_proxy.rb +66 -56
- data/lib/glimmer/swt/text_proxy.rb +46 -0
- data/lib/glimmer/swt/widget_proxy.rb +511 -0
- 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 +142 -67
- data/lib/glimmer/dsl/opal/browser_expression.rb +0 -17
- data/lib/glimmer/dsl/opal/button_expression.rb +0 -18
- data/lib/glimmer/dsl/opal/combo_expression.rb +0 -17
- data/lib/glimmer/dsl/opal/composite_expression.rb +0 -17
- data/lib/glimmer/dsl/opal/grid_layout_expression.rb +0 -17
- data/lib/glimmer/dsl/opal/label_expression.rb +0 -17
- data/lib/glimmer/dsl/opal/list_expression.rb +0 -17
- data/lib/glimmer/dsl/opal/tab_folder_expression.rb +0 -17
- data/lib/glimmer/dsl/opal/tab_item_expression.rb +0 -17
- data/lib/glimmer/dsl/opal/text_expression.rb +0 -22
- data/lib/glimmer/opal/display_proxy.rb +0 -23
- data/lib/glimmer/opal/div_proxy.rb +0 -29
- data/lib/glimmer/opal/document_proxy.rb +0 -187
- data/lib/glimmer/opal/element_proxy.rb +0 -304
- data/lib/glimmer/opal/grid_layout_proxy.rb +0 -54
- data/lib/glimmer/opal/iframe_proxy.rb +0 -23
- data/lib/glimmer/opal/input_proxy.rb +0 -45
- data/lib/glimmer/opal/label_proxy.rb +0 -25
- data/lib/glimmer/opal/layout_data_proxy.rb +0 -52
- data/lib/glimmer/opal/modal.rb +0 -94
- data/lib/glimmer/opal/tab_item.rb +0 -98
- 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,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
|
@@ -0,0 +1,128 @@
|
|
1
|
+
require 'glimmer/swt/layout_proxy'
|
2
|
+
|
3
|
+
module Glimmer
|
4
|
+
module SWT
|
5
|
+
class RowLayoutProxy < LayoutProxy
|
6
|
+
include Glimmer
|
7
|
+
|
8
|
+
STYLE = <<~CSS
|
9
|
+
.row-layout {
|
10
|
+
display: flex;
|
11
|
+
align-items: flex-start;
|
12
|
+
}
|
13
|
+
|
14
|
+
.row-layout-pack-false {
|
15
|
+
display: initial;
|
16
|
+
}
|
17
|
+
|
18
|
+
.row-layout-horizontal {
|
19
|
+
flex-direction: row;
|
20
|
+
}
|
21
|
+
|
22
|
+
.row-layout-horizontal.row-layout-pack-false {
|
23
|
+
flex-direction: unset;
|
24
|
+
}
|
25
|
+
|
26
|
+
.row-layout-vertical {
|
27
|
+
flex-direction: column;
|
28
|
+
}
|
29
|
+
|
30
|
+
.row-layout-vertical.row-layout-pack {
|
31
|
+
flex-direction: none;
|
32
|
+
}
|
33
|
+
CSS
|
34
|
+
|
35
|
+
attr_reader :type, :margin_width, :margin_height, :margin_top, :margin_right, :margin_bottom, :margin_left, :spacing, :pack
|
36
|
+
|
37
|
+
def initialize(parent, args)
|
38
|
+
super(parent, args)
|
39
|
+
@type = @args.first || :horizontal
|
40
|
+
@marign_width = 15
|
41
|
+
@margin_height = 15
|
42
|
+
self.pack = true
|
43
|
+
@parent.dom_element.add_class('row-layout')
|
44
|
+
@parent.dom_element.add_class(horizontal? ? 'row-layout-horizontal' : 'row-layout-vertical')
|
45
|
+
end
|
46
|
+
|
47
|
+
def horizontal?
|
48
|
+
@type == :horizontal
|
49
|
+
end
|
50
|
+
|
51
|
+
def vertical?
|
52
|
+
@type == :vertical
|
53
|
+
end
|
54
|
+
|
55
|
+
def dom(widget_dom)
|
56
|
+
dom_result = widget_dom
|
57
|
+
dom_result += '<br />' if vertical? && @pack
|
58
|
+
dom_result
|
59
|
+
end
|
60
|
+
|
61
|
+
def pack=(value)
|
62
|
+
@pack = value
|
63
|
+
if @pack
|
64
|
+
@parent.dom_element.remove_class('row-layout-pack-false')
|
65
|
+
else
|
66
|
+
@parent.dom_element.add_class('row-layout-pack-false')
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def margin_width=(pixels)
|
71
|
+
@margin_width = pixels
|
72
|
+
# Using padding for width since margin-right isn't getting respected with width 100%
|
73
|
+
@parent.dom_element.css('padding-left', @margin_width)
|
74
|
+
@parent.dom_element.css('padding-right', @margin_width)
|
75
|
+
end
|
76
|
+
|
77
|
+
def margin_height=(pixels)
|
78
|
+
@margin_height = pixels
|
79
|
+
@parent.dom_element.css('padding-top', @margin_height)
|
80
|
+
@parent.dom_element.css('padding-bottom', @margin_height)
|
81
|
+
end
|
82
|
+
|
83
|
+
def margin_top=(pixels)
|
84
|
+
@margin_top = pixels
|
85
|
+
# Using padding for width since margin-right isn't getting respected with width 100%
|
86
|
+
@parent.dom_element.css('padding-top', @margin_top)
|
87
|
+
end
|
88
|
+
|
89
|
+
def margin_right=(pixels)
|
90
|
+
@margin_right = pixels
|
91
|
+
@parent.dom_element.css('padding-right', @margin_right)
|
92
|
+
end
|
93
|
+
|
94
|
+
def margin_bottom=(pixels)
|
95
|
+
@margin_bottom = pixels
|
96
|
+
# Using padding for width since margin-right isn't getting respected with width 100%
|
97
|
+
@parent.dom_element.css('padding-bottom', @margin_bottom)
|
98
|
+
end
|
99
|
+
|
100
|
+
def margin_left=(pixels)
|
101
|
+
@margin_left = pixels
|
102
|
+
@parent.dom_element.css('padding-left', @margin_left)
|
103
|
+
end
|
104
|
+
|
105
|
+
def spacing=(spacing)
|
106
|
+
@spacing = spacing.to_i
|
107
|
+
# TODO implement changes to accomodate layout_data in the future
|
108
|
+
@parent.style_element.html css {
|
109
|
+
s("##{@parent.id} > *") {
|
110
|
+
if horizontal?
|
111
|
+
margin_right "#{@spacing}px"
|
112
|
+
elsif vertical?
|
113
|
+
margin_bottom "#{@spacing}px"
|
114
|
+
end
|
115
|
+
}
|
116
|
+
s("##{@parent.id} > :last-child") {
|
117
|
+
if horizontal?
|
118
|
+
margin_right 0
|
119
|
+
elsif vertical?
|
120
|
+
margin_bottom 0
|
121
|
+
end
|
122
|
+
}
|
123
|
+
}.to_s
|
124
|
+
end
|
125
|
+
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'glimmer/swt/grid_layout_proxy'
|
2
|
+
require 'glimmer/swt/widget_proxy'
|
3
|
+
|
4
|
+
module Glimmer
|
5
|
+
module SWT
|
6
|
+
class ScrolledCompositeProxy < CompositeProxy
|
7
|
+
STYLE = <<~CSS
|
8
|
+
.scrolled-composite {
|
9
|
+
}
|
10
|
+
CSS
|
11
|
+
|
12
|
+
# TODO set overflow-y and overflow-x based on :v_scroll and :h_scroll styles.... though consider also that it might not be needed in web browsers where scrollbars are always present
|
13
|
+
# height: 100px;
|
14
|
+
# overflow-y: auto;
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,260 @@
|
|
1
|
+
require 'glimmer/swt/widget_proxy'
|
2
|
+
require 'glimmer/swt/display_proxy'
|
3
|
+
require 'glimmer/swt/point'
|
4
|
+
|
5
|
+
module Glimmer
|
6
|
+
module SWT
|
7
|
+
class ShellProxy < CompositeProxy
|
8
|
+
# TODO consider renaming to ShellProxy to match SWT API
|
9
|
+
attr_reader :minimum_size
|
10
|
+
|
11
|
+
WIDTH_MIN = 130
|
12
|
+
HEIGHT_MIN = 0
|
13
|
+
|
14
|
+
def initialize(args)
|
15
|
+
@args = args
|
16
|
+
@children = []
|
17
|
+
# Document.ready? do end # TODO consider embedding this jQuery call in so outside consumers don't have to use it
|
18
|
+
Document.find('body').empty unless ENV['RUBY_ENV'] == 'test'
|
19
|
+
render
|
20
|
+
@layout = FillLayoutProxy.new(self, [])
|
21
|
+
@layout.margin_width = 0
|
22
|
+
@layout.margin_height = 0
|
23
|
+
self.minimum_size = Point.new(WIDTH_MIN, HEIGHT_MIN)
|
24
|
+
end
|
25
|
+
|
26
|
+
def element
|
27
|
+
'div'
|
28
|
+
end
|
29
|
+
|
30
|
+
def parent_path
|
31
|
+
'body'
|
32
|
+
end
|
33
|
+
|
34
|
+
def text
|
35
|
+
$document.title
|
36
|
+
end
|
37
|
+
|
38
|
+
def text=(value)
|
39
|
+
Document.title = value
|
40
|
+
end
|
41
|
+
|
42
|
+
def minimum_size=(width_or_minimum_size, height = nil)
|
43
|
+
@minimum_size = height.nil? ? width_or_minimum_size : Point.new(width_or_minimum_size, height)
|
44
|
+
return if @minimum_size.nil?
|
45
|
+
dom_element.css('min-width', "#{@minimum_size.x}px")
|
46
|
+
dom_element.css('min-height', "#{@minimum_size.y}px")
|
47
|
+
end
|
48
|
+
|
49
|
+
def style_dom_css
|
50
|
+
<<~CSS
|
51
|
+
.hide {
|
52
|
+
display: none !important;
|
53
|
+
}
|
54
|
+
.selected, .tabs .tab.selected {
|
55
|
+
background: rgb(80, 116, 211);
|
56
|
+
color: white;
|
57
|
+
}
|
58
|
+
CSS
|
59
|
+
end
|
60
|
+
|
61
|
+
def style_dom_shell_css
|
62
|
+
<<~CSS
|
63
|
+
html {
|
64
|
+
width: 100%;
|
65
|
+
height: 100%;
|
66
|
+
}
|
67
|
+
body {
|
68
|
+
width: 100%;
|
69
|
+
height: 100%;
|
70
|
+
margin: 0;
|
71
|
+
}
|
72
|
+
.shell {
|
73
|
+
height: 100%;
|
74
|
+
margin: 0;
|
75
|
+
}
|
76
|
+
.shell iframe {
|
77
|
+
width: 100%;
|
78
|
+
height: 100%;
|
79
|
+
}
|
80
|
+
CSS
|
81
|
+
end
|
82
|
+
|
83
|
+
def style_dom_list_css
|
84
|
+
<<~CSS
|
85
|
+
ul {
|
86
|
+
list-style: none;
|
87
|
+
padding: 0;
|
88
|
+
}
|
89
|
+
li {
|
90
|
+
cursor: default;
|
91
|
+
padding-left: 10px;
|
92
|
+
padding-right: 10px;
|
93
|
+
}
|
94
|
+
li.empty-list-item {
|
95
|
+
color: transparent;
|
96
|
+
}
|
97
|
+
CSS
|
98
|
+
end
|
99
|
+
|
100
|
+
def style_dom_tab_css
|
101
|
+
<<~CSS
|
102
|
+
.tabs .tab {
|
103
|
+
background-color: inherit;
|
104
|
+
float: left;
|
105
|
+
border: none;
|
106
|
+
outline: none;
|
107
|
+
cursor: pointer;
|
108
|
+
padding: 14px 16px;
|
109
|
+
transition: 0.3s;
|
110
|
+
font-size: 17px;
|
111
|
+
}
|
112
|
+
.tabs {
|
113
|
+
overflow: hidden;
|
114
|
+
border: 1px solid #ccc;
|
115
|
+
background-color: #f1f1f1;
|
116
|
+
}
|
117
|
+
CSS
|
118
|
+
end
|
119
|
+
|
120
|
+
def style_dom_tab_item_css
|
121
|
+
<<~CSS
|
122
|
+
/* Create an selected/current tablink class */
|
123
|
+
.tabs .tab.selected {
|
124
|
+
background-color: #ccc;
|
125
|
+
}
|
126
|
+
/* Change background color of buttons on hover */
|
127
|
+
.tabs .tab:hover {
|
128
|
+
background-color: #ddd;
|
129
|
+
}
|
130
|
+
/* Style the tab content */
|
131
|
+
.tab-item {
|
132
|
+
padding: 6px 12px;
|
133
|
+
border: 1px solid #ccc;
|
134
|
+
border-top: none;
|
135
|
+
}
|
136
|
+
CSS
|
137
|
+
end
|
138
|
+
|
139
|
+
def style_dom_modal_css
|
140
|
+
<<~CSS
|
141
|
+
/* The Modal (background) */
|
142
|
+
.modal {
|
143
|
+
position: fixed; /* Stay in place */
|
144
|
+
z-index: 1; /* Sit on top */
|
145
|
+
padding-top: 100px; /* Location of the box */
|
146
|
+
left: 0;
|
147
|
+
top: 0;
|
148
|
+
width: 100%; /* Full width */
|
149
|
+
height: 100%; /* Full height */
|
150
|
+
overflow: auto; /* Enable scroll if needed */
|
151
|
+
background-color: rgb(0,0,0); /* Fallback color */
|
152
|
+
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
|
153
|
+
text-align: center;
|
154
|
+
}
|
155
|
+
|
156
|
+
/* Modal Content */
|
157
|
+
.modal-content {
|
158
|
+
background-color: #fefefe;
|
159
|
+
margin: auto;
|
160
|
+
border: 1px solid #888;
|
161
|
+
display: inline-block;
|
162
|
+
min-width: 200px;
|
163
|
+
}
|
164
|
+
|
165
|
+
.modal-content .text {
|
166
|
+
background: rgb(80, 116, 211);
|
167
|
+
color: white;
|
168
|
+
padding: 5px;
|
169
|
+
}
|
170
|
+
|
171
|
+
.modal-content .message {
|
172
|
+
padding: 20px;
|
173
|
+
}
|
174
|
+
|
175
|
+
/* The Close Button */
|
176
|
+
.close {
|
177
|
+
color: #aaaaaa;
|
178
|
+
float: right;
|
179
|
+
font-weight: bold;
|
180
|
+
margin: 5px;
|
181
|
+
}
|
182
|
+
|
183
|
+
.close:hover,
|
184
|
+
.close:focus {
|
185
|
+
color: #000;
|
186
|
+
text-decoration: none;
|
187
|
+
cursor: pointer;
|
188
|
+
}
|
189
|
+
CSS
|
190
|
+
end
|
191
|
+
|
192
|
+
def style_dom_table_css
|
193
|
+
<<~CSS
|
194
|
+
table {
|
195
|
+
border-spacing: 0;
|
196
|
+
}
|
197
|
+
|
198
|
+
table tr th,td {
|
199
|
+
cursor: default;
|
200
|
+
}
|
201
|
+
CSS
|
202
|
+
end
|
203
|
+
|
204
|
+
def dom
|
205
|
+
i = 0
|
206
|
+
body_id = id
|
207
|
+
body_class = ([name] + css_classes.to_a).join(' ')
|
208
|
+
@dom ||= html {
|
209
|
+
div(id: body_id, class: body_class) {
|
210
|
+
style(class: 'common-style') {
|
211
|
+
style_dom_css
|
212
|
+
}
|
213
|
+
style(class: 'shell-style') {
|
214
|
+
style_dom_shell_css
|
215
|
+
}
|
216
|
+
style(class: 'list-style') {
|
217
|
+
style_dom_list_css
|
218
|
+
}
|
219
|
+
style(class: 'tab-style') {
|
220
|
+
style_dom_tab_css
|
221
|
+
}
|
222
|
+
# style(class: 'tab-item-style') {
|
223
|
+
# style_dom_tab_item_css
|
224
|
+
# }
|
225
|
+
# style(class: 'modal-style') {
|
226
|
+
# style_dom_modal_css
|
227
|
+
# }
|
228
|
+
style(class: 'table-style') {
|
229
|
+
style_dom_table_css
|
230
|
+
}
|
231
|
+
style(class: 'fill-layout-style') {
|
232
|
+
Glimmer::SWT::FillLayoutProxy::STYLE
|
233
|
+
}
|
234
|
+
style(class: 'row-layout-style') {
|
235
|
+
Glimmer::SWT::RowLayoutProxy::STYLE
|
236
|
+
}
|
237
|
+
style(class: 'grid-layout-style') {
|
238
|
+
Glimmer::SWT::GridLayoutProxy::STYLE
|
239
|
+
}
|
240
|
+
style(class: 'checkbox-style') {
|
241
|
+
Glimmer::SWT::CheckboxProxy::STYLE
|
242
|
+
}
|
243
|
+
style(class: 'radio-style') {
|
244
|
+
Glimmer::SWT::RadioProxy::STYLE
|
245
|
+
}
|
246
|
+
style(class: 'scrolled-composite-style') {
|
247
|
+
Glimmer::SWT::ScrolledCompositeProxy::STYLE
|
248
|
+
}
|
249
|
+
}
|
250
|
+
}.to_s
|
251
|
+
end
|
252
|
+
|
253
|
+
def open
|
254
|
+
# TODO consider the idea of delaying rendering till the open method
|
255
|
+
# TODO make it start as hidden and show shell upon open
|
256
|
+
Glimmer::SWT::DisplayProxy.instance.shells << self
|
257
|
+
end
|
258
|
+
end
|
259
|
+
end
|
260
|
+
end
|