glimmer 0.5.11 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/README.markdown +129 -15
  3. data/lib/glimmer.rb +13 -1
  4. data/lib/glimmer/css/rule_set.rb +27 -0
  5. data/lib/glimmer/css/style_sheet.rb +20 -0
  6. data/lib/glimmer/dsl/css/css_expression.rb +21 -0
  7. data/lib/glimmer/dsl/css/dsl.rb +10 -0
  8. data/lib/glimmer/dsl/css/p_expression.rb +25 -0
  9. data/lib/glimmer/dsl/css/property_expression.rb +22 -0
  10. data/lib/glimmer/dsl/css/rule_set_expression.rb +25 -0
  11. data/lib/glimmer/dsl/css/s_expression.rb +26 -0
  12. data/lib/glimmer/dsl/engine.rb +90 -18
  13. data/lib/glimmer/dsl/expression.rb +9 -4
  14. data/lib/glimmer/dsl/static_expression.rb +13 -13
  15. data/lib/glimmer/dsl/swt/async_exec_expression.rb +14 -0
  16. data/lib/glimmer/dsl/swt/bind_expression.rb +37 -0
  17. data/lib/glimmer/dsl/swt/color_expression.rb +17 -0
  18. data/lib/glimmer/dsl/swt/column_properties_expression.rb +24 -0
  19. data/lib/glimmer/dsl/swt/combo_selection_data_binding_expression.rb +42 -0
  20. data/lib/glimmer/dsl/swt/custom_widget_expression.rb +36 -0
  21. data/lib/glimmer/dsl/swt/data_binding_expression.rb +34 -0
  22. data/lib/glimmer/dsl/swt/display_expression.rb +19 -0
  23. data/lib/glimmer/dsl/swt/dsl.rb +26 -0
  24. data/lib/glimmer/dsl/swt/exec_expression.rb +28 -0
  25. data/lib/glimmer/dsl/swt/layout_data_expression.rb +25 -0
  26. data/lib/glimmer/dsl/swt/layout_expression.rb +27 -0
  27. data/lib/glimmer/dsl/swt/list_selection_data_binding_expression.rb +44 -0
  28. data/lib/glimmer/dsl/swt/menu_bar_expression.rb +33 -0
  29. data/lib/glimmer/dsl/swt/menu_expression.rb +32 -0
  30. data/lib/glimmer/dsl/swt/observe_expression.rb +32 -0
  31. data/lib/glimmer/dsl/swt/property_expression.rb +22 -0
  32. data/lib/glimmer/dsl/swt/rgb_expression.rb +12 -0
  33. data/lib/glimmer/dsl/swt/rgba_expression.rb +12 -0
  34. data/lib/glimmer/dsl/swt/shell_expression.rb +20 -0
  35. data/lib/glimmer/dsl/swt/swt_expression.rb +25 -0
  36. data/lib/glimmer/dsl/swt/sync_exec_expression.rb +15 -0
  37. data/lib/glimmer/dsl/swt/tab_item_expression.rb +33 -0
  38. data/lib/glimmer/dsl/swt/table_items_data_binding_expression.rb +31 -0
  39. data/lib/glimmer/dsl/swt/tree_items_data_binding_expression.rb +31 -0
  40. data/lib/glimmer/dsl/swt/tree_properties_expression.rb +26 -0
  41. data/lib/glimmer/dsl/swt/widget_expression.rb +27 -0
  42. data/lib/glimmer/dsl/swt/widget_listener_expression.rb +32 -0
  43. data/lib/glimmer/dsl/top_level_expression.rb +7 -0
  44. data/lib/glimmer/dsl/xml/dsl.rb +11 -0
  45. data/lib/glimmer/dsl/xml/html_expression.rb +25 -0
  46. data/lib/glimmer/dsl/xml/meta_expression.rb +23 -0
  47. data/lib/glimmer/dsl/xml/name_space_expression.rb +37 -0
  48. data/lib/glimmer/dsl/xml/node_parent_expression.rb +33 -0
  49. data/lib/glimmer/dsl/xml/tag_expression.rb +29 -0
  50. data/lib/glimmer/dsl/xml/text_expression.rb +22 -0
  51. data/lib/glimmer/dsl/xml/xml_expression.rb +21 -0
  52. data/lib/glimmer/rake_task.rb +1 -1
  53. data/lib/glimmer/swt/shell_proxy.rb +1 -2
  54. data/lib/glimmer/swt/widget_proxy.rb +6 -3
  55. data/lib/glimmer/ui/custom_widget.rb +8 -4
  56. data/lib/glimmer/ui/video.rb +31 -28
  57. data/lib/glimmer/xml/depth_first_search_iterator.rb +22 -0
  58. data/lib/glimmer/xml/name_space_visitor.rb +21 -0
  59. data/lib/glimmer/xml/node.rb +75 -0
  60. data/lib/glimmer/xml/node_visitor.rb +13 -0
  61. data/lib/glimmer/xml/xml_visitor.rb +65 -0
  62. data/samples/gladiator.rb +52 -12
  63. metadata +55 -31
  64. data/lib/glimmer/dsl.rb +0 -26
  65. data/lib/glimmer/dsl/async_exec_expression.rb +0 -12
  66. data/lib/glimmer/dsl/bind_expression.rb +0 -35
  67. data/lib/glimmer/dsl/color_expression.rb +0 -22
  68. data/lib/glimmer/dsl/column_properties_expression.rb +0 -22
  69. data/lib/glimmer/dsl/combo_selection_data_binding_expression.rb +0 -40
  70. data/lib/glimmer/dsl/custom_widget_expression.rb +0 -33
  71. data/lib/glimmer/dsl/data_binding_expression.rb +0 -32
  72. data/lib/glimmer/dsl/display_expression.rb +0 -14
  73. data/lib/glimmer/dsl/exec_expression.rb +0 -23
  74. data/lib/glimmer/dsl/layout_data_expression.rb +0 -23
  75. data/lib/glimmer/dsl/layout_expression.rb +0 -25
  76. data/lib/glimmer/dsl/list_selection_data_binding_expression.rb +0 -42
  77. data/lib/glimmer/dsl/menu_bar_expression.rb +0 -31
  78. data/lib/glimmer/dsl/menu_expression.rb +0 -30
  79. data/lib/glimmer/dsl/observe_expression.rb +0 -27
  80. data/lib/glimmer/dsl/property_expression.rb +0 -20
  81. data/lib/glimmer/dsl/shell_expression.rb +0 -16
  82. data/lib/glimmer/dsl/swt_expression.rb +0 -23
  83. data/lib/glimmer/dsl/sync_exec_expression.rb +0 -13
  84. data/lib/glimmer/dsl/tab_item_expression.rb +0 -31
  85. data/lib/glimmer/dsl/table_items_data_binding_expression.rb +0 -29
  86. data/lib/glimmer/dsl/tree_items_data_binding_expression.rb +0 -29
  87. data/lib/glimmer/dsl/tree_properties_expression.rb +0 -24
  88. data/lib/glimmer/dsl/widget_expression.rb +0 -25
  89. data/lib/glimmer/dsl/widget_listener_expression.rb +0 -30
@@ -1,29 +0,0 @@
1
- require 'glimmer/dsl/expression'
2
- require 'glimmer/data_binding/model_binding'
3
- require 'glimmer/data_binding/table_items_binding'
4
-
5
- module Glimmer
6
- module DSL
7
- #Depends on BindCommandHandler and TableColumnPropertiesDataBindingCommandHandler
8
- class TableItemsDataBindingExpression < Expression
9
- include_package 'org.eclipse.swt.widgets'
10
-
11
- def can_interpret?(parent, keyword, *args, &block)
12
- keyword == "items" and
13
- block.nil? and
14
- widget?(parent) and
15
- parent.swt_widget.is_a?(Table) and
16
- args.size == 2 and
17
- args[0].is_a?(DataBinding::ModelBinding) and
18
- args[0].evaluate_property.is_a?(Array) and
19
- args[1].is_a?(Array)
20
- end
21
-
22
- def interpret(parent, keyword, *args, &block)
23
- model_binding = args[0]
24
- column_properties = args[1]
25
- DataBinding::TableItemsBinding.new(parent, model_binding, column_properties)
26
- end
27
- end
28
- end
29
- end
@@ -1,29 +0,0 @@
1
- require 'glimmer/dsl/expression'
2
- require 'glimmer/data_binding/model_binding'
3
- require 'glimmer/data_binding/tree_items_binding'
4
-
5
- module Glimmer
6
- module DSL
7
- class TreeItemsDataBindingExpression < Expression
8
- include_package 'org.eclipse.swt.widgets'
9
-
10
- def can_interpret?(parent, keyword, *args, &block)
11
- initial_condition = ((keyword == "items") and block.nil? and widget?(parent) and parent.swt_widget.is_a?(Tree))
12
- return false unless initial_condition
13
- raise Glimmer::Error, 'Tree items args must be 2' unless args.size == 2
14
- raise Glimmer::Error, 'Tree items first arg must be a bind expression' unless args[0].is_a?(DataBinding::ModelBinding)
15
- raise Glimmer::Error, 'Tree items data-binding initial value must not be an array yet a single item representing tree root' unless !args[0].evaluate_property.is_a?(Array)
16
- raise Glimmer::Error, 'Tree items second arg must be an array' unless args[1].is_a?(Array)
17
- raise Glimmer::Error, 'Tree items second arg must not be empty' unless !args[1].empty?
18
- raise Glimmer::Error, 'Tree items second arg array elements must be of type hash' unless args[1].first.is_a?(Hash)
19
- true
20
- end
21
-
22
- def interpret(parent, keyword, *args, &block)
23
- model_binding = args[0]
24
- tree_properties = args[1]
25
- DataBinding::TreeItemsBinding.new(parent, model_binding, tree_properties)
26
- end
27
- end
28
- end
29
- end
@@ -1,24 +0,0 @@
1
- require 'glimmer/dsl/static_expression'
2
- require 'glimmer/data_binding/model_binding'
3
- require 'glimmer/data_binding/tree_items_binding'
4
-
5
- module Glimmer
6
- module DSL
7
- # Responsible for providing a readable keyword (command symbol) to capture
8
- # and return tree properties for use in TreeItemsDataBindingCommandHandler
9
- class TreePropertiesExpression < StaticExpression
10
- include_package 'org.eclipse.swt.widgets'
11
-
12
- def can_interpret?(parent, keyword, *args, &block)
13
- keyword == "tree_properties" and
14
- block.nil? and
15
- widget?(parent) and
16
- parent.swt_widget.is_a?(Tree)
17
- end
18
-
19
- def interpret(parent, keyword, *args, &block)
20
- args
21
- end
22
- end
23
- end
24
- end
@@ -1,25 +0,0 @@
1
- require 'glimmer'
2
- require 'glimmer/dsl/expression'
3
- require 'glimmer/dsl/parent_expression'
4
-
5
- module Glimmer
6
- module DSL
7
- class WidgetExpression < Expression
8
- include ParentExpression
9
-
10
- EXCLUDED_KEYWORDS = %w[shell display tab_item]
11
-
12
- def can_interpret?(parent, keyword, *args, &block)
13
- !EXCLUDED_KEYWORDS.include?(keyword) and
14
- widget?(parent) and #TODO change to composite?(parent)
15
- SWT::WidgetProxy.widget_exists?(keyword)
16
- end
17
-
18
- def interpret(parent, keyword, *args, &block)
19
- SWT::WidgetProxy.new(keyword, parent, args)
20
- end
21
- end
22
- end
23
- end
24
-
25
- require 'glimmer/swt/widget_proxy'
@@ -1,30 +0,0 @@
1
- require 'glimmer/dsl/expression'
2
- require 'glimmer/swt/display_proxy'
3
-
4
- module Glimmer
5
- module DSL
6
- class WidgetListenerExpression < Expression
7
- include_package 'org.eclipse.swt.widgets'
8
-
9
- def can_interpret?(parent, keyword, *args, &block)
10
- Glimmer.logger&.debug "keyword starts with on_: #{keyword.start_with?('on_')}"
11
- return false unless keyword.start_with?('on_')
12
- widget_or_display_parentage = widget?(parent) || parent.is_a?(SWT::DisplayProxy)
13
- Glimmer.logger&.debug "parent is a widget or display: #{widget_or_display_parentage}"
14
- return false unless widget_or_display_parentage
15
- Glimmer.logger&.debug "block exists?: #{!block.nil?}"
16
- raise Glimmer::Error, "Listener is missing block for keyword: #{keyword}" unless block_given?
17
- Glimmer.logger&.debug "args are empty?: #{args.empty?}"
18
- raise Glimmer::Error, "Invalid listener arguments for keyword: #{keyword}(#{args})" unless args.empty?
19
- result = parent.can_handle_observation_request?(keyword)
20
- Glimmer.logger&.debug "can add listener? #{result}"
21
- raise Glimmer::Error, "Invalid listener keyword: #{keyword}" unless result
22
- true
23
- end
24
-
25
- def interpret(parent, keyword, *args, &block)
26
- parent.handle_observation_request(keyword, &block)
27
- end
28
- end
29
- end
30
- end