glimmer-dsl-opal 0.0.6 → 0.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 +50 -0
- data/README.md +995 -74
- data/VERSION +1 -1
- data/lib/glimmer-dsl-opal.rb +42 -7
- data/lib/glimmer-dsl-opal/ext/exception.rb +5 -0
- data/lib/glimmer-dsl-opal/missing/net/http.rb +17 -0
- data/lib/glimmer-dsl-opal/missing/uri.rb +26 -0
- data/lib/{samples → glimmer-dsl-opal/samples}/elaborate/contact_manager.rb +2 -3
- 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 -1
- data/lib/{samples → glimmer-dsl-opal/samples}/elaborate/tic_tac_toe.rb +5 -5
- 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_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/{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_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/data_binding/element_binding.rb +1 -1
- data/lib/glimmer/data_binding/ext/observable_model.rb +40 -0
- data/lib/glimmer/data_binding/list_selection_binding.rb +1 -1
- data/lib/glimmer/data_binding/table_items_binding.rb +70 -0
- data/lib/glimmer/dsl/opal/async_exec_expression.rb +17 -0
- data/lib/glimmer/dsl/opal/color_expression.rb +38 -0
- data/lib/glimmer/dsl/opal/column_properties_expression.rb +22 -0
- data/lib/glimmer/dsl/opal/combo_selection_data_binding_expression.rb +2 -2
- data/lib/glimmer/dsl/opal/custom_widget_expression.rb +57 -0
- data/lib/glimmer/dsl/opal/dsl.rb +17 -14
- 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/{text_expression.rb → layout_expression.rb} +5 -5
- data/lib/glimmer/dsl/opal/list_selection_data_binding_expression.rb +2 -3
- data/lib/glimmer/dsl/opal/message_box_expression.rb +20 -0
- data/lib/glimmer/dsl/opal/observe_expression.rb +32 -0
- data/lib/glimmer/dsl/opal/property_expression.rb +5 -2
- 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 +2 -2
- data/lib/glimmer/dsl/opal/swt_expression.rb +46 -0
- data/lib/glimmer/dsl/opal/{composite_expression.rb → table_column_expression.rb} +3 -3
- data/lib/glimmer/dsl/opal/{list_expression.rb → table_expression.rb} +3 -3
- data/lib/glimmer/dsl/opal/table_items_data_binding_expression.rb +29 -0
- 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 +40 -0
- data/lib/glimmer/swt/color_proxy.rb +119 -0
- data/lib/glimmer/{opal/select_proxy.rb → swt/combo_proxy.rb} +24 -19
- data/lib/glimmer/swt/composite_proxy.rb +31 -0
- data/lib/glimmer/swt/display_proxy.rb +25 -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 +71 -0
- data/lib/glimmer/swt/label_proxy.rb +34 -0
- data/lib/glimmer/swt/layout_data_proxy.rb +52 -0
- data/lib/glimmer/swt/layout_proxy.rb +62 -0
- data/lib/glimmer/{opal → swt}/list_proxy.rb +31 -23
- 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/row_layout_proxy.rb +105 -0
- data/lib/glimmer/swt/shell_proxy.rb +245 -0
- data/lib/glimmer/swt/style_constantizable.rb +154 -0
- data/lib/glimmer/swt/swt_proxy.rb +53 -0
- data/lib/glimmer/{opal/tab_folder.rb → swt/tab_folder_proxy.rb} +21 -15
- data/lib/glimmer/swt/tab_item_proxy.rb +84 -0
- data/lib/glimmer/swt/table_column_proxy.rb +56 -0
- data/lib/glimmer/swt/table_item_proxy.rb +147 -0
- data/lib/glimmer/swt/table_proxy.rb +159 -0
- data/lib/glimmer/swt/text_proxy.rb +46 -0
- data/lib/glimmer/swt/widget_proxy.rb +490 -0
- data/lib/glimmer/ui/custom_shell.rb +73 -0
- data/lib/glimmer/ui/custom_widget.rb +290 -0
- data/lib/glimmer/util/proc_tracker.rb +39 -0
- metadata +134 -74
- data/lib/glimmer/config.rb +0 -22
- data/lib/glimmer/dsl/engine.rb +0 -193
- data/lib/glimmer/dsl/expression.rb +0 -42
- data/lib/glimmer/dsl/expression_handler.rb +0 -48
- 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/grid_layout_expression.rb +0 -17
- data/lib/glimmer/dsl/opal/label_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/parent_expression.rb +0 -12
- data/lib/glimmer/dsl/static_expression.rb +0 -36
- data/lib/glimmer/dsl/top_level_expression.rb +0 -7
- data/lib/glimmer/error.rb +0 -6
- data/lib/glimmer/invalid_keyword_error.rb +0 -6
- data/lib/glimmer/opal/div_proxy.rb +0 -22
- data/lib/glimmer/opal/document_proxy.rb +0 -128
- data/lib/glimmer/opal/element_proxy.rb +0 -281
- data/lib/glimmer/opal/grid_layout_proxy.rb +0 -53
- data/lib/glimmer/opal/iframe_proxy.rb +0 -23
- data/lib/glimmer/opal/input_proxy.rb +0 -41
- data/lib/glimmer/opal/label_proxy.rb +0 -25
- data/lib/glimmer/opal/layout_data_proxy.rb +0 -31
- 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,17 @@
|
|
1
|
+
require 'glimmer/dsl/static_expression'
|
2
|
+
require 'glimmer/dsl/top_level_expression'
|
3
|
+
require 'glimmer/swt/display_proxy'
|
4
|
+
|
5
|
+
module Glimmer
|
6
|
+
module DSL
|
7
|
+
module Opal
|
8
|
+
class AsyncExecExpression < StaticExpression
|
9
|
+
include TopLevelExpression
|
10
|
+
|
11
|
+
def interpret(parent, keyword, *args, &block)
|
12
|
+
Glimmer::SWT::DisplayProxy.instance.async_exec(&block)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
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
|
+
require 'glimmer/dsl/static_expression'
|
23
|
+
require 'glimmer/dsl/top_level_expression'
|
24
|
+
require 'glimmer/swt/color_proxy'
|
25
|
+
|
26
|
+
module Glimmer
|
27
|
+
module DSL
|
28
|
+
module Opal
|
29
|
+
class ColorExpression < StaticExpression
|
30
|
+
include TopLevelExpression
|
31
|
+
|
32
|
+
def interpret(parent, keyword, *args, &block)
|
33
|
+
Glimmer::SWT::ColorProxy.new(*args)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'glimmer/dsl/static_expression'
|
2
|
+
require 'glimmer/swt/table_proxy'
|
3
|
+
|
4
|
+
module Glimmer
|
5
|
+
module DSL
|
6
|
+
module Opal
|
7
|
+
# Responsible for providing a readable keyword (command symbol) to capture
|
8
|
+
# and return column properties for use in TreeItemsDataBindingCommandHandler
|
9
|
+
class ColumnPropertiesExpression < StaticExpression
|
10
|
+
def can_interpret?(parent, keyword, *args, &block)
|
11
|
+
keyword == 'column_properties' and
|
12
|
+
block.nil? and
|
13
|
+
parent.is_a?(Glimmer::SWT::TableProxy)
|
14
|
+
end
|
15
|
+
|
16
|
+
def interpret(parent, keyword, *args, &block)
|
17
|
+
args
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'glimmer/dsl/expression'
|
2
2
|
require 'glimmer/data_binding/model_binding'
|
3
3
|
require 'glimmer/data_binding/element_binding'
|
4
|
-
require 'glimmer/
|
4
|
+
require 'glimmer/swt/combo_proxy'
|
5
5
|
|
6
6
|
module Glimmer
|
7
7
|
module DSL
|
@@ -10,7 +10,7 @@ module Glimmer
|
|
10
10
|
def can_interpret?(parent, keyword, *args, &block)
|
11
11
|
keyword == 'selection' and
|
12
12
|
block.nil? and
|
13
|
-
parent.is_a?(Glimmer::
|
13
|
+
parent.is_a?(Glimmer::SWT::ComboProxy) and
|
14
14
|
args.size == 1 and
|
15
15
|
args[0].is_a?(DataBinding::ModelBinding) and
|
16
16
|
args[0].evaluate_options_property.is_a?(Array)
|
@@ -0,0 +1,57 @@
|
|
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
|
+
require 'glimmer'
|
23
|
+
require 'glimmer/dsl/expression'
|
24
|
+
require 'glimmer/dsl/parent_expression'
|
25
|
+
require 'glimmer/dsl/top_level_expression'
|
26
|
+
require 'glimmer/ui/custom_widget'
|
27
|
+
require 'glimmer/ui/custom_shell'
|
28
|
+
|
29
|
+
module Glimmer
|
30
|
+
module DSL
|
31
|
+
module Opal
|
32
|
+
class CustomWidgetExpression < Expression
|
33
|
+
# TODO Make custom widgets automatically generate static expressions
|
34
|
+
include ParentExpression
|
35
|
+
include TopLevelExpression
|
36
|
+
|
37
|
+
def can_interpret?(parent, keyword, *args, &block)
|
38
|
+
!!UI::CustomWidget.for(keyword)
|
39
|
+
end
|
40
|
+
|
41
|
+
def interpret(parent, keyword, *args, &block)
|
42
|
+
options = args.last.is_a?(Hash) ? args.pop : {}
|
43
|
+
UI::CustomWidget.for(keyword).new(parent, *args, options, &block)
|
44
|
+
end
|
45
|
+
|
46
|
+
def add_content(parent, &block)
|
47
|
+
# TODO consider avoiding source_location
|
48
|
+
if block.source_location == parent.content&.__getobj__.source_location
|
49
|
+
parent.content.call(parent) unless parent.content.called?
|
50
|
+
else
|
51
|
+
super
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/lib/glimmer/dsl/opal/dsl.rb
CHANGED
@@ -1,26 +1,25 @@
|
|
1
|
-
require 'opal'
|
2
|
-
require 'browser'
|
3
|
-
|
4
1
|
require 'glimmer/dsl/engine'
|
5
2
|
# Dir[File.expand_path('../*_expression.rb', __FILE__)].each {|f| require f}
|
6
3
|
require 'glimmer/dsl/opal/shell_expression'
|
7
|
-
require 'glimmer/dsl/opal/
|
4
|
+
require 'glimmer/dsl/opal/widget_expression'
|
8
5
|
require 'glimmer/dsl/opal/property_expression'
|
9
|
-
require 'glimmer/dsl/opal/combo_expression'
|
10
|
-
require 'glimmer/dsl/opal/composite_expression'
|
11
|
-
require 'glimmer/dsl/opal/button_expression'
|
12
6
|
require 'glimmer/dsl/opal/bind_expression'
|
13
7
|
require 'glimmer/dsl/opal/data_binding_expression'
|
14
8
|
require 'glimmer/dsl/opal/combo_selection_data_binding_expression'
|
15
9
|
require 'glimmer/dsl/opal/widget_listener_expression'
|
16
|
-
require 'glimmer/dsl/opal/
|
17
|
-
require 'glimmer/dsl/opal/
|
18
|
-
require 'glimmer/dsl/opal/
|
19
|
-
require 'glimmer/dsl/opal/
|
20
|
-
require 'glimmer/dsl/opal/tab_folder_expression'
|
21
|
-
require 'glimmer/dsl/opal/tab_item_expression'
|
10
|
+
require 'glimmer/dsl/opal/message_box_expression'
|
11
|
+
require 'glimmer/dsl/opal/async_exec_expression'
|
12
|
+
require 'glimmer/dsl/opal/observe_expression'
|
13
|
+
require 'glimmer/dsl/opal/layout_expression'
|
22
14
|
require 'glimmer/dsl/opal/layout_data_expression'
|
23
15
|
require 'glimmer/dsl/opal/list_selection_data_binding_expression'
|
16
|
+
require 'glimmer/dsl/opal/table_items_data_binding_expression'
|
17
|
+
require 'glimmer/dsl/opal/column_properties_expression'
|
18
|
+
require 'glimmer/dsl/opal/font_expression'
|
19
|
+
require 'glimmer/dsl/opal/color_expression'
|
20
|
+
require 'glimmer/dsl/opal/rgb_expression'
|
21
|
+
require 'glimmer/dsl/opal/rgba_expression'
|
22
|
+
require 'glimmer/dsl/opal/custom_widget_expression'
|
24
23
|
|
25
24
|
module Glimmer
|
26
25
|
module DSL
|
@@ -28,12 +27,16 @@ module Glimmer
|
|
28
27
|
Engine.add_dynamic_expressions(
|
29
28
|
Opal,
|
30
29
|
%w[
|
30
|
+
custom_widget
|
31
31
|
widget_listener
|
32
|
+
table_items_data_binding
|
32
33
|
combo_selection_data_binding
|
33
34
|
list_selection_data_binding
|
34
35
|
data_binding
|
35
|
-
|
36
|
+
font
|
37
|
+
layout
|
36
38
|
property
|
39
|
+
widget
|
37
40
|
]
|
38
41
|
)
|
39
42
|
end
|
@@ -0,0 +1,47 @@
|
|
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
|
+
require 'glimmer/dsl/expression'
|
23
|
+
require 'glimmer/dsl/top_level_expression'
|
24
|
+
require 'glimmer/swt/font_proxy'
|
25
|
+
|
26
|
+
module Glimmer
|
27
|
+
module DSL
|
28
|
+
module Opal
|
29
|
+
# font expression
|
30
|
+
# Note: Cannot be a static expression because it clashes with font property expression
|
31
|
+
class FontExpression < Expression
|
32
|
+
include TopLevelExpression
|
33
|
+
|
34
|
+
def can_interpret?(parent, keyword, *args, &block)
|
35
|
+
keyword.to_s == 'font' and
|
36
|
+
(parent.nil? || !parent.respond_to?('font')) and
|
37
|
+
args.size == 1 and
|
38
|
+
args.first.is_a?(Hash)
|
39
|
+
end
|
40
|
+
|
41
|
+
def interpret(parent, keyword, *args, &block)
|
42
|
+
Glimmer::SWT::FontProxy.new(*args)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'glimmer/dsl/static_expression'
|
2
2
|
require 'glimmer/dsl/parent_expression'
|
3
|
-
require 'glimmer/
|
3
|
+
require 'glimmer/swt/layout_data_proxy'
|
4
4
|
|
5
5
|
module Glimmer
|
6
6
|
module DSL
|
@@ -9,7 +9,7 @@ module Glimmer
|
|
9
9
|
include ParentExpression
|
10
10
|
|
11
11
|
def interpret(parent, keyword, *args, &block)
|
12
|
-
Glimmer::
|
12
|
+
Glimmer::SWT::LayoutDataProxy.new(parent, args)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -1,20 +1,20 @@
|
|
1
1
|
require 'glimmer/dsl/expression'
|
2
2
|
require 'glimmer/dsl/parent_expression'
|
3
|
-
require 'glimmer/
|
3
|
+
require 'glimmer/swt/layout_proxy'
|
4
4
|
|
5
5
|
module Glimmer
|
6
6
|
module DSL
|
7
7
|
module Opal
|
8
|
-
class
|
8
|
+
class LayoutExpression < Expression
|
9
9
|
include ParentExpression
|
10
10
|
|
11
11
|
def can_interpret?(parent, keyword, *args, &block)
|
12
|
-
|
12
|
+
parent.is_a?(Glimmer::SWT::CompositeProxy) &&
|
13
|
+
Glimmer::SWT::LayoutProxy.layout_exists?(keyword)
|
13
14
|
end
|
14
15
|
|
15
16
|
def interpret(parent, keyword, *args, &block)
|
16
|
-
|
17
|
-
Glimmer::Opal::InputProxy.new(parent, args)
|
17
|
+
Glimmer::SWT::LayoutProxy.for(keyword, parent, args)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -2,7 +2,7 @@ require 'glimmer/dsl/expression'
|
|
2
2
|
require 'glimmer/data_binding/model_binding'
|
3
3
|
require 'glimmer/data_binding/element_binding'
|
4
4
|
require 'glimmer/data_binding/list_selection_binding'
|
5
|
-
require 'glimmer/
|
5
|
+
require 'glimmer/swt/list_proxy'
|
6
6
|
|
7
7
|
module Glimmer
|
8
8
|
module DSL
|
@@ -11,7 +11,7 @@ module Glimmer
|
|
11
11
|
def can_interpret?(parent, keyword, *args, &block)
|
12
12
|
keyword == 'selection' and
|
13
13
|
block.nil? and
|
14
|
-
parent.is_a?(Glimmer::
|
14
|
+
parent.is_a?(Glimmer::SWT::ListProxy) and
|
15
15
|
args.size == 1 and
|
16
16
|
args[0].is_a?(DataBinding::ModelBinding) and
|
17
17
|
args[0].evaluate_options_property.is_a?(Array)
|
@@ -31,7 +31,6 @@ module Glimmer
|
|
31
31
|
list_selection_binding.call(model_binding.evaluate_property)
|
32
32
|
#TODO check if nested data binding works for list widget and other widgets that need custom data binding
|
33
33
|
list_selection_binding.observe(model, model_binding.property_name_expression)
|
34
|
-
|
35
34
|
parent.on_widget_selected do
|
36
35
|
model_binding.call(list_selection_binding.evaluate_property)
|
37
36
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'glimmer/dsl/static_expression'
|
2
|
+
require 'glimmer/dsl/top_level_expression'
|
3
|
+
require 'glimmer/dsl/parent_expression'
|
4
|
+
require 'glimmer/swt/message_box_proxy'
|
5
|
+
|
6
|
+
module Glimmer
|
7
|
+
module DSL
|
8
|
+
module Opal
|
9
|
+
class MessageBoxExpression < StaticExpression
|
10
|
+
include TopLevelExpression
|
11
|
+
include ParentExpression
|
12
|
+
|
13
|
+
def interpret(parent, keyword, *args, &block)
|
14
|
+
parent = args.delete_at(0)
|
15
|
+
Glimmer::SWT::MessageBoxProxy.new(parent, args)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'glimmer/dsl/static_expression'
|
2
|
+
require 'glimmer/dsl/top_level_expression'
|
3
|
+
require 'glimmer/data_binding/observer'
|
4
|
+
require 'glimmer/data_binding/model_binding'
|
5
|
+
|
6
|
+
module Glimmer
|
7
|
+
module DSL
|
8
|
+
module Opal
|
9
|
+
class ObserveExpression < StaticExpression
|
10
|
+
include TopLevelExpression
|
11
|
+
|
12
|
+
REGEX_NESTED_OR_INDEXED_PROPERTY = /([^\[]+)(\[[^\]]+\])?/
|
13
|
+
|
14
|
+
def can_interpret?(parent, keyword, *args, &block)
|
15
|
+
keyword == 'observe' and
|
16
|
+
block_given? and
|
17
|
+
(args.size == 2) and
|
18
|
+
textual?(args[1])
|
19
|
+
end
|
20
|
+
|
21
|
+
def interpret(parent, keyword, *args, &block)
|
22
|
+
observer = DataBinding::Observer.proc(&block)
|
23
|
+
if args[1].to_s.match(REGEX_NESTED_OR_INDEXED_PROPERTY)
|
24
|
+
observer.observe(DataBinding::ModelBinding.new(args[0], args[1]))
|
25
|
+
else
|
26
|
+
observer.observe(args[0], args[1])
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -7,12 +7,15 @@ module Glimmer
|
|
7
7
|
include TopLevelExpression
|
8
8
|
|
9
9
|
def can_interpret?(parent, keyword, *args, &block)
|
10
|
-
parent and
|
10
|
+
parent and
|
11
|
+
parent.respond_to?(:set_attribute) and
|
12
|
+
keyword and
|
13
|
+
block.nil?
|
11
14
|
end
|
12
15
|
|
13
16
|
def interpret(parent, keyword, *args, &block)
|
14
17
|
if keyword == 'text' # TODO move into property converters in element proxy
|
15
|
-
args = [args.first.to_s.gsub('&', '')
|
18
|
+
args = [args.first.to_s.gsub('&', '')]
|
16
19
|
end
|
17
20
|
parent.set_attribute(keyword, *args)
|
18
21
|
args.first.to_s
|
@@ -0,0 +1,32 @@
|
|
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
|
+
require 'glimmer/dsl/opal/color_expression'
|
23
|
+
require 'glimmer/swt/color_proxy'
|
24
|
+
|
25
|
+
module Glimmer
|
26
|
+
module DSL
|
27
|
+
module Opal
|
28
|
+
class RgbExpression < ColorExpression
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,32 @@
|
|
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
|
+
require 'glimmer/dsl/opal/color_expression'
|
23
|
+
require 'glimmer/swt/color_proxy'
|
24
|
+
|
25
|
+
module Glimmer
|
26
|
+
module DSL
|
27
|
+
module Opal
|
28
|
+
class RgbaExpression < ColorExpression
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|