glimmer 0.8.2 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +116 -95
- data/VERSION +1 -1
- data/lib/glimmer.rb +0 -20
- data/lib/glimmer/config.rb +0 -13
- data/lib/glimmer/dsl/engine.rb +25 -18
- data/lib/glimmer/dsl/expression.rb +0 -7
- data/lib/glimmer/dsl/static_expression.rb +2 -2
- metadata +47 -177
- data/RUBY_VERSION +0 -1
- data/bin/girb +0 -10
- data/bin/girb_runner.rb +0 -13
- data/bin/glimmer +0 -5
- data/icons/scaffold_app.icns +0 -0
- data/lib/glimmer/css/rule.rb +0 -25
- data/lib/glimmer/css/style_sheet.rb +0 -19
- data/lib/glimmer/data_binding/list_selection_binding.rb +0 -52
- data/lib/glimmer/data_binding/model_binding.rb +0 -248
- data/lib/glimmer/data_binding/observable.rb +0 -21
- data/lib/glimmer/data_binding/observable_array.rb +0 -107
- data/lib/glimmer/data_binding/observable_model.rb +0 -108
- data/lib/glimmer/data_binding/observable_widget.rb +0 -17
- data/lib/glimmer/data_binding/observer.rb +0 -124
- data/lib/glimmer/data_binding/shine.rb +0 -23
- data/lib/glimmer/data_binding/table_items_binding.rb +0 -56
- data/lib/glimmer/data_binding/tree_items_binding.rb +0 -71
- data/lib/glimmer/data_binding/widget_binding.rb +0 -33
- data/lib/glimmer/dsl/css/css_expression.rb +0 -21
- data/lib/glimmer/dsl/css/dsl.rb +0 -10
- data/lib/glimmer/dsl/css/dynamic_property_expression.rb +0 -12
- data/lib/glimmer/dsl/css/property_expression.rb +0 -22
- data/lib/glimmer/dsl/css/pv_expression.rb +0 -17
- data/lib/glimmer/dsl/css/rule_expression.rb +0 -25
- data/lib/glimmer/dsl/css/s_expression.rb +0 -26
- data/lib/glimmer/dsl/swt/async_exec_expression.rb +0 -14
- data/lib/glimmer/dsl/swt/bind_expression.rb +0 -37
- data/lib/glimmer/dsl/swt/color_expression.rb +0 -19
- data/lib/glimmer/dsl/swt/column_properties_expression.rb +0 -24
- data/lib/glimmer/dsl/swt/combo_selection_data_binding_expression.rb +0 -42
- data/lib/glimmer/dsl/swt/custom_widget_expression.rb +0 -36
- data/lib/glimmer/dsl/swt/data_binding_expression.rb +0 -34
- data/lib/glimmer/dsl/swt/dialog_expression.rb +0 -26
- data/lib/glimmer/dsl/swt/display_expression.rb +0 -19
- data/lib/glimmer/dsl/swt/dsl.rb +0 -28
- data/lib/glimmer/dsl/swt/exec_expression.rb +0 -28
- data/lib/glimmer/dsl/swt/layout_data_expression.rb +0 -25
- data/lib/glimmer/dsl/swt/layout_expression.rb +0 -27
- data/lib/glimmer/dsl/swt/list_selection_data_binding_expression.rb +0 -44
- data/lib/glimmer/dsl/swt/menu_bar_expression.rb +0 -33
- data/lib/glimmer/dsl/swt/menu_expression.rb +0 -32
- data/lib/glimmer/dsl/swt/message_box_expression.rb +0 -29
- data/lib/glimmer/dsl/swt/observe_expression.rb +0 -32
- data/lib/glimmer/dsl/swt/property_expression.rb +0 -22
- data/lib/glimmer/dsl/swt/rgb_expression.rb +0 -12
- data/lib/glimmer/dsl/swt/rgba_expression.rb +0 -12
- data/lib/glimmer/dsl/swt/shell_expression.rb +0 -25
- data/lib/glimmer/dsl/swt/swt_expression.rb +0 -25
- data/lib/glimmer/dsl/swt/sync_exec_expression.rb +0 -15
- data/lib/glimmer/dsl/swt/tab_item_expression.rb +0 -33
- data/lib/glimmer/dsl/swt/table_items_data_binding_expression.rb +0 -31
- data/lib/glimmer/dsl/swt/tree_items_data_binding_expression.rb +0 -31
- data/lib/glimmer/dsl/swt/tree_properties_expression.rb +0 -26
- data/lib/glimmer/dsl/swt/widget_expression.rb +0 -35
- data/lib/glimmer/dsl/swt/widget_listener_expression.rb +0 -32
- data/lib/glimmer/dsl/xml/dsl.rb +0 -11
- data/lib/glimmer/dsl/xml/html_expression.rb +0 -25
- data/lib/glimmer/dsl/xml/meta_expression.rb +0 -23
- data/lib/glimmer/dsl/xml/name_space_expression.rb +0 -37
- data/lib/glimmer/dsl/xml/node_parent_expression.rb +0 -33
- data/lib/glimmer/dsl/xml/tag_expression.rb +0 -29
- data/lib/glimmer/dsl/xml/text_expression.rb +0 -22
- data/lib/glimmer/dsl/xml/xml_expression.rb +0 -21
- data/lib/glimmer/launcher.rb +0 -199
- data/lib/glimmer/package.rb +0 -55
- data/lib/glimmer/rake_task.rb +0 -58
- data/lib/glimmer/scaffold.rb +0 -582
- data/lib/glimmer/swt/color_proxy.rb +0 -53
- data/lib/glimmer/swt/display_proxy.rb +0 -88
- data/lib/glimmer/swt/font_proxy.rb +0 -72
- data/lib/glimmer/swt/layout_data_proxy.rb +0 -84
- data/lib/glimmer/swt/layout_proxy.rb +0 -82
- data/lib/glimmer/swt/menu_proxy.rb +0 -101
- data/lib/glimmer/swt/message_box_proxy.rb +0 -48
- data/lib/glimmer/swt/packages.rb +0 -13
- data/lib/glimmer/swt/shell_proxy.rb +0 -152
- data/lib/glimmer/swt/swt_proxy.rb +0 -106
- data/lib/glimmer/swt/tab_item_proxy.rb +0 -65
- data/lib/glimmer/swt/table_proxy.rb +0 -150
- data/lib/glimmer/swt/tree_proxy.rb +0 -120
- data/lib/glimmer/swt/widget_listener_proxy.rb +0 -34
- data/lib/glimmer/swt/widget_proxy.rb +0 -489
- data/lib/glimmer/ui/custom_shell.rb +0 -45
- data/lib/glimmer/ui/custom_widget.rb +0 -244
- data/lib/glimmer/util/proc_tracker.rb +0 -16
- data/lib/glimmer/xml/depth_first_search_iterator.rb +0 -22
- data/lib/glimmer/xml/name_space_visitor.rb +0 -21
- data/lib/glimmer/xml/node.rb +0 -75
- data/lib/glimmer/xml/node_visitor.rb +0 -13
- data/lib/glimmer/xml/xml_visitor.rb +0 -65
- data/vendor/swt/linux/swt.jar +0 -0
- data/vendor/swt/mac/swt.jar +0 -0
- data/vendor/swt/windows/swt.jar +0 -0
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'glimmer/dsl/static_expression'
|
2
|
-
require 'glimmer/css/style_sheet'
|
3
|
-
require 'glimmer/css/rule'
|
4
|
-
|
5
|
-
module Glimmer
|
6
|
-
module DSL
|
7
|
-
module CSS
|
8
|
-
class SExpression < StaticExpression
|
9
|
-
include ParentExpression
|
10
|
-
|
11
|
-
def can_interpret?(parent, keyword, *args, &block)
|
12
|
-
keyword == 's' and
|
13
|
-
parent.is_a?(Glimmer::CSS::StyleSheet) and
|
14
|
-
block_given? and
|
15
|
-
!args.empty?
|
16
|
-
end
|
17
|
-
|
18
|
-
def interpret(parent, keyword, *args, &block)
|
19
|
-
Glimmer::CSS::Rule.new(args.first.to_s).tap do |rule|
|
20
|
-
parent.rules << rule
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'glimmer/dsl/static_expression'
|
2
|
-
require 'glimmer/dsl/swt/exec_expression'
|
3
|
-
|
4
|
-
module Glimmer
|
5
|
-
module DSL
|
6
|
-
module SWT
|
7
|
-
# Asynchronously executes code block against the SWT Event Loop
|
8
|
-
# to manipulate SWT UI objects on the UI thread safely
|
9
|
-
class AsyncExecExpression < StaticExpression
|
10
|
-
include ExecExpression
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
require 'glimmer/dsl/static_expression'
|
2
|
-
require 'glimmer/data_binding/model_binding'
|
3
|
-
|
4
|
-
module Glimmer
|
5
|
-
module DSL
|
6
|
-
module SWT
|
7
|
-
# Responsible for setting up the return value of the bind keyword (command symbol)
|
8
|
-
# as a ModelBinding. It is then used by another command handler like
|
9
|
-
# DataBindingCommandHandler for text and selection properties on Text and Spinner
|
10
|
-
# or TableItemsDataBindingCommandHandler for items in a Table
|
11
|
-
class BindExpression < StaticExpression
|
12
|
-
def can_interpret?(parent, keyword, *args, &block)
|
13
|
-
(
|
14
|
-
keyword == 'bind' and
|
15
|
-
(
|
16
|
-
(
|
17
|
-
(args.size == 2) and
|
18
|
-
textual?(args[1])
|
19
|
-
) ||
|
20
|
-
(
|
21
|
-
(args.size == 3) and
|
22
|
-
textual?(args[1]) and
|
23
|
-
(args[2].is_a?(Hash))
|
24
|
-
)
|
25
|
-
)
|
26
|
-
)
|
27
|
-
end
|
28
|
-
|
29
|
-
def interpret(parent, keyword, *args, &block)
|
30
|
-
binding_options = args[2] || {}
|
31
|
-
binding_options[:on_read] = binding_options.delete(:on_read) || binding_options.delete('on_read') || block
|
32
|
-
DataBinding::ModelBinding.new(args[0], args[1].to_s, binding_options)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'glimmer/dsl/static_expression'
|
2
|
-
require 'glimmer/dsl/top_level_expression'
|
3
|
-
require 'glimmer/swt/color_proxy'
|
4
|
-
require 'glimmer/swt/display_proxy'
|
5
|
-
|
6
|
-
module Glimmer
|
7
|
-
module DSL
|
8
|
-
module SWT
|
9
|
-
class ColorExpression < StaticExpression
|
10
|
-
include TopLevelExpression
|
11
|
-
include_package 'org.eclipse.swt.widgets'
|
12
|
-
|
13
|
-
def interpret(parent, keyword, *args, &block)
|
14
|
-
Glimmer::SWT::ColorProxy.new(*args)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'glimmer/dsl/static_expression'
|
2
|
-
|
3
|
-
module Glimmer
|
4
|
-
module DSL
|
5
|
-
module SWT
|
6
|
-
# Responsible for providing a readable keyword (command symbol) to capture
|
7
|
-
# and return column properties for use in TreeItemsDataBindingCommandHandler
|
8
|
-
class ColumnPropertiesExpression < StaticExpression
|
9
|
-
include_package 'org.eclipse.swt.widgets'
|
10
|
-
|
11
|
-
def can_interpret?(parent, keyword, *args, &block)
|
12
|
-
keyword == 'column_properties' and
|
13
|
-
block.nil? and
|
14
|
-
widget?(parent) and
|
15
|
-
parent.swt_widget.is_a?(Table)
|
16
|
-
end
|
17
|
-
|
18
|
-
def interpret(parent, keyword, *args, &block)
|
19
|
-
args
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
require 'glimmer/dsl/expression'
|
2
|
-
require 'glimmer/data_binding/model_binding'
|
3
|
-
require 'glimmer/data_binding/widget_binding'
|
4
|
-
|
5
|
-
module Glimmer
|
6
|
-
module DSL
|
7
|
-
module SWT
|
8
|
-
class ComboSelectionDataBindingExpression < Expression
|
9
|
-
include_package 'org.eclipse.swt.widgets'
|
10
|
-
|
11
|
-
def can_interpret?(parent, keyword, *args, &block)
|
12
|
-
keyword == 'selection' and
|
13
|
-
block.nil? and
|
14
|
-
widget?(parent) and
|
15
|
-
parent.swt_widget.is_a?(Combo) and
|
16
|
-
args.size == 1 and
|
17
|
-
args[0].is_a?(DataBinding::ModelBinding) and
|
18
|
-
args[0].evaluate_options_property.is_a?(Array)
|
19
|
-
end
|
20
|
-
|
21
|
-
def interpret(parent, keyword, *args, &block)
|
22
|
-
model_binding = args[0]
|
23
|
-
|
24
|
-
#TODO make this options observer dependent and all similar observers in widget specific data binding handlers
|
25
|
-
# TODO consider delegating some of this work
|
26
|
-
widget_binding = DataBinding::WidgetBinding.new(parent, 'items')
|
27
|
-
widget_binding.call(model_binding.evaluate_options_property)
|
28
|
-
model = model_binding.base_model
|
29
|
-
widget_binding.observe(model, model_binding.options_property_name)
|
30
|
-
|
31
|
-
widget_binding = DataBinding::WidgetBinding.new(parent, 'text')
|
32
|
-
widget_binding.call(model_binding.evaluate_property)
|
33
|
-
widget_binding.observe(model, model_binding.property_name_expression)
|
34
|
-
|
35
|
-
parent.on_widget_selected do
|
36
|
-
model_binding.call(widget_binding.evaluate_property)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'glimmer'
|
2
|
-
require 'glimmer/dsl/expression'
|
3
|
-
require 'glimmer/dsl/parent_expression'
|
4
|
-
require 'glimmer/ui/custom_widget'
|
5
|
-
require 'glimmer/ui/custom_shell'
|
6
|
-
|
7
|
-
module Glimmer
|
8
|
-
module DSL
|
9
|
-
module SWT
|
10
|
-
class CustomWidgetExpression < Expression
|
11
|
-
include ParentExpression
|
12
|
-
|
13
|
-
def can_interpret?(parent, keyword, *args, &block)
|
14
|
-
custom_widget_class = UI::CustomWidget.for(keyword)
|
15
|
-
custom_widget_class and
|
16
|
-
(widget?(parent) or
|
17
|
-
custom_widget_class.ancestors.include?(UI::CustomShell))
|
18
|
-
end
|
19
|
-
|
20
|
-
def interpret(parent, keyword, *args, &block)
|
21
|
-
options = args.last.is_a?(Hash) ? args.pop : {}
|
22
|
-
UI::CustomWidget.for(keyword).new(parent, *args, options, &block)
|
23
|
-
end
|
24
|
-
|
25
|
-
def add_content(parent, &block)
|
26
|
-
# TODO consider avoiding source_location
|
27
|
-
if block.source_location == parent.content&.__getobj__.source_location
|
28
|
-
parent.content.call(parent) unless parent.content.called?
|
29
|
-
else
|
30
|
-
super
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'glimmer/dsl/expression'
|
2
|
-
require 'glimmer/data_binding/model_binding'
|
3
|
-
require 'glimmer/data_binding/widget_binding'
|
4
|
-
|
5
|
-
module Glimmer
|
6
|
-
module DSL
|
7
|
-
module SWT
|
8
|
-
# Responsible for wiring two-way data-binding for text and selection properties
|
9
|
-
# on Text, Button, and Spinner widgets.
|
10
|
-
# Does so by using the output of the bind(model, property) command in the form
|
11
|
-
# of a ModelBinding, which is then connected to an anonymous widget observer
|
12
|
-
# (aka widget_data_binder as per widget_data_binders array)
|
13
|
-
#
|
14
|
-
# Depends on BindCommandHandler
|
15
|
-
class DataBindingExpression < Expression
|
16
|
-
def can_interpret?(parent, keyword, *args, &block)
|
17
|
-
args.size == 1 and
|
18
|
-
args[0].is_a?(DataBinding::ModelBinding)
|
19
|
-
end
|
20
|
-
|
21
|
-
def interpret(parent, keyword, *args, &block)
|
22
|
-
model_binding = args[0]
|
23
|
-
widget_binding_parameters = [parent, keyword]
|
24
|
-
widget_binding = DataBinding::WidgetBinding.new(*widget_binding_parameters)
|
25
|
-
widget_binding.call(model_binding.evaluate_property)
|
26
|
-
#TODO make this options observer dependent and all similar observers in widget specific data binding handlers
|
27
|
-
widget_binding.observe(model_binding)
|
28
|
-
# TODO simplify this logic and put it where it belongs
|
29
|
-
parent.add_observer(model_binding, keyword) if parent.respond_to?(:add_observer, [model_binding, keyword])
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'glimmer/dsl/static_expression'
|
2
|
-
require 'glimmer/dsl/parent_expression'
|
3
|
-
require 'glimmer/dsl/top_level_expression'
|
4
|
-
require 'glimmer/swt/shell_proxy'
|
5
|
-
|
6
|
-
module Glimmer
|
7
|
-
module DSL
|
8
|
-
module SWT
|
9
|
-
class DialogExpression < StaticExpression
|
10
|
-
include TopLevelExpression
|
11
|
-
include ParentExpression
|
12
|
-
|
13
|
-
def can_interpret?(parent, keyword, *args, &block)
|
14
|
-
keyword == 'dialog' and
|
15
|
-
(parent.nil? or parent.is_a?(Glimmer::SWT::ShellProxy))
|
16
|
-
end
|
17
|
-
|
18
|
-
def interpret(parent, keyword, *args, &block)
|
19
|
-
args = [parent] + args unless parent.nil?
|
20
|
-
args += [:dialog_trim, :application_modal]
|
21
|
-
Glimmer::SWT::ShellProxy.send(:new, *args)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'glimmer/dsl/static_expression'
|
2
|
-
require 'glimmer/dsl/parent_expression'
|
3
|
-
require 'glimmer/dsl/top_level_expression'
|
4
|
-
require 'glimmer/swt/display_proxy'
|
5
|
-
|
6
|
-
module Glimmer
|
7
|
-
module DSL
|
8
|
-
module SWT
|
9
|
-
class DisplayExpression < StaticExpression
|
10
|
-
include TopLevelExpression
|
11
|
-
include ParentExpression
|
12
|
-
|
13
|
-
def interpret(parent, keyword, *args, &block)
|
14
|
-
Glimmer::SWT::DisplayProxy.instance(*args)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
data/lib/glimmer/dsl/swt/dsl.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'glimmer/launcher'
|
2
|
-
require Glimmer::Launcher.swt_jar_file
|
3
|
-
require 'glimmer/dsl/engine'
|
4
|
-
Dir[File.expand_path('../*_expression.rb', __FILE__)].each {|f| require f}
|
5
|
-
|
6
|
-
# Glimmer DSL expression configuration module
|
7
|
-
#
|
8
|
-
# When DSL engine interprets an expression, it attempts to handle
|
9
|
-
# with expressions listed here in the order specified.
|
10
|
-
|
11
|
-
# Every expression has a corresponding Expression subclass
|
12
|
-
# in glimmer/dsl
|
13
|
-
|
14
|
-
Glimmer::DSL::Engine.add_dynamic_expressions(
|
15
|
-
Glimmer::DSL::SWT,
|
16
|
-
%w[
|
17
|
-
layout
|
18
|
-
widget_listener
|
19
|
-
combo_selection_data_binding
|
20
|
-
list_selection_data_binding
|
21
|
-
tree_items_data_binding
|
22
|
-
table_items_data_binding
|
23
|
-
data_binding
|
24
|
-
property
|
25
|
-
widget
|
26
|
-
custom_widget
|
27
|
-
]
|
28
|
-
)
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'glimmer/dsl/top_level_expression'
|
2
|
-
require 'glimmer/swt/display_proxy'
|
3
|
-
|
4
|
-
module Glimmer
|
5
|
-
module DSL
|
6
|
-
module SWT
|
7
|
-
# Mixin for common code in async_exec and sync_exec expressions
|
8
|
-
# Uses name in subclass to auto-derive exec_operation
|
9
|
-
module ExecExpression
|
10
|
-
include TopLevelExpression
|
11
|
-
|
12
|
-
def exec_operation
|
13
|
-
@exec_operation ||= self.class.name.split(/::/).last.sub(/Expression$/, '').underscore
|
14
|
-
end
|
15
|
-
|
16
|
-
def can_interpret?(parent, keyword, *args, &block)
|
17
|
-
keyword == exec_operation and
|
18
|
-
block_given? and
|
19
|
-
args.empty?
|
20
|
-
end
|
21
|
-
|
22
|
-
def interpret(parent, keyword, *args, &block)
|
23
|
-
Glimmer::SWT::DisplayProxy.instance.send(exec_operation, &block)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'glimmer'
|
2
|
-
require 'glimmer/dsl/static_expression'
|
3
|
-
require 'glimmer/dsl/parent_expression'
|
4
|
-
require 'glimmer/swt/layout_data_proxy'
|
5
|
-
|
6
|
-
# TODO consider turning static keywords like layout_data into methods
|
7
|
-
|
8
|
-
module Glimmer
|
9
|
-
module DSL
|
10
|
-
module SWT
|
11
|
-
class LayoutDataExpression < StaticExpression
|
12
|
-
include ParentExpression
|
13
|
-
|
14
|
-
def can_interpret?(parent, keyword, *args, &block)
|
15
|
-
keyword == 'layout_data' and
|
16
|
-
widget?(parent)
|
17
|
-
end
|
18
|
-
|
19
|
-
def interpret(parent, keyword, *args, &block)
|
20
|
-
Glimmer::SWT::LayoutDataProxy.new(parent, args)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'glimmer'
|
2
|
-
require 'glimmer/dsl/expression'
|
3
|
-
require 'glimmer/dsl/parent_expression'
|
4
|
-
require 'glimmer/swt/layout_proxy'
|
5
|
-
|
6
|
-
module Glimmer
|
7
|
-
module DSL
|
8
|
-
module SWT
|
9
|
-
class LayoutExpression < Expression
|
10
|
-
include ParentExpression
|
11
|
-
|
12
|
-
include_package 'org.eclipse.swt.widgets'
|
13
|
-
|
14
|
-
def can_interpret?(parent, keyword, *args, &block)
|
15
|
-
keyword.to_s.end_with?('_layout') and
|
16
|
-
widget?(parent) and
|
17
|
-
parent.swt_widget.is_a?(Composite) and
|
18
|
-
Glimmer::SWT::LayoutProxy.layout_exists?(keyword.to_s)
|
19
|
-
end
|
20
|
-
|
21
|
-
def interpret(parent, keyword, *args, &block)
|
22
|
-
Glimmer::SWT::LayoutProxy.new(keyword, parent, args)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'glimmer/dsl/expression'
|
2
|
-
require 'glimmer/data_binding/model_binding'
|
3
|
-
require 'glimmer/data_binding/widget_binding'
|
4
|
-
require 'glimmer/data_binding/list_selection_binding'
|
5
|
-
|
6
|
-
module Glimmer
|
7
|
-
module DSL
|
8
|
-
module SWT
|
9
|
-
class ListSelectionDataBindingExpression < Expression
|
10
|
-
include_package 'org.eclipse.swt.widgets'
|
11
|
-
|
12
|
-
def can_interpret?(parent, keyword, *args, &block)
|
13
|
-
keyword == 'selection' and
|
14
|
-
block.nil? and
|
15
|
-
widget?(parent) and
|
16
|
-
parent.swt_widget.is_a?(List) and
|
17
|
-
args.size == 1 and
|
18
|
-
args[0].is_a?(DataBinding::ModelBinding) and
|
19
|
-
args[0].evaluate_options_property.is_a?(Array)
|
20
|
-
end
|
21
|
-
|
22
|
-
def interpret(parent, keyword, *args, &block)
|
23
|
-
model_binding = args[0]
|
24
|
-
widget_binding = DataBinding::WidgetBinding.new(parent, 'items')
|
25
|
-
widget_binding.call(model_binding.evaluate_options_property)
|
26
|
-
model = model_binding.base_model
|
27
|
-
#TODO make this options observer dependent and all similar observers in widget specific data binding interpretrs
|
28
|
-
widget_binding.observe(model, model_binding.options_property_name)
|
29
|
-
|
30
|
-
property_type = :string
|
31
|
-
property_type = :array if parent.has_style?(:multi)
|
32
|
-
list_selection_binding = DataBinding::ListSelectionBinding.new(parent, property_type)
|
33
|
-
list_selection_binding.call(model_binding.evaluate_property)
|
34
|
-
#TODO check if nested data binding works for list widget and other widgets that need custom data binding
|
35
|
-
list_selection_binding.observe(model, model_binding.property_name_expression)
|
36
|
-
|
37
|
-
parent.on_widget_selected do
|
38
|
-
model_binding.call(list_selection_binding.evaluate_property)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|