glimmer 0.8.2 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +116 -95
  4. data/VERSION +1 -1
  5. data/lib/glimmer.rb +0 -20
  6. data/lib/glimmer/config.rb +0 -13
  7. data/lib/glimmer/dsl/engine.rb +25 -18
  8. data/lib/glimmer/dsl/expression.rb +0 -7
  9. data/lib/glimmer/dsl/static_expression.rb +2 -2
  10. metadata +47 -177
  11. data/RUBY_VERSION +0 -1
  12. data/bin/girb +0 -10
  13. data/bin/girb_runner.rb +0 -13
  14. data/bin/glimmer +0 -5
  15. data/icons/scaffold_app.icns +0 -0
  16. data/lib/glimmer/css/rule.rb +0 -25
  17. data/lib/glimmer/css/style_sheet.rb +0 -19
  18. data/lib/glimmer/data_binding/list_selection_binding.rb +0 -52
  19. data/lib/glimmer/data_binding/model_binding.rb +0 -248
  20. data/lib/glimmer/data_binding/observable.rb +0 -21
  21. data/lib/glimmer/data_binding/observable_array.rb +0 -107
  22. data/lib/glimmer/data_binding/observable_model.rb +0 -108
  23. data/lib/glimmer/data_binding/observable_widget.rb +0 -17
  24. data/lib/glimmer/data_binding/observer.rb +0 -124
  25. data/lib/glimmer/data_binding/shine.rb +0 -23
  26. data/lib/glimmer/data_binding/table_items_binding.rb +0 -56
  27. data/lib/glimmer/data_binding/tree_items_binding.rb +0 -71
  28. data/lib/glimmer/data_binding/widget_binding.rb +0 -33
  29. data/lib/glimmer/dsl/css/css_expression.rb +0 -21
  30. data/lib/glimmer/dsl/css/dsl.rb +0 -10
  31. data/lib/glimmer/dsl/css/dynamic_property_expression.rb +0 -12
  32. data/lib/glimmer/dsl/css/property_expression.rb +0 -22
  33. data/lib/glimmer/dsl/css/pv_expression.rb +0 -17
  34. data/lib/glimmer/dsl/css/rule_expression.rb +0 -25
  35. data/lib/glimmer/dsl/css/s_expression.rb +0 -26
  36. data/lib/glimmer/dsl/swt/async_exec_expression.rb +0 -14
  37. data/lib/glimmer/dsl/swt/bind_expression.rb +0 -37
  38. data/lib/glimmer/dsl/swt/color_expression.rb +0 -19
  39. data/lib/glimmer/dsl/swt/column_properties_expression.rb +0 -24
  40. data/lib/glimmer/dsl/swt/combo_selection_data_binding_expression.rb +0 -42
  41. data/lib/glimmer/dsl/swt/custom_widget_expression.rb +0 -36
  42. data/lib/glimmer/dsl/swt/data_binding_expression.rb +0 -34
  43. data/lib/glimmer/dsl/swt/dialog_expression.rb +0 -26
  44. data/lib/glimmer/dsl/swt/display_expression.rb +0 -19
  45. data/lib/glimmer/dsl/swt/dsl.rb +0 -28
  46. data/lib/glimmer/dsl/swt/exec_expression.rb +0 -28
  47. data/lib/glimmer/dsl/swt/layout_data_expression.rb +0 -25
  48. data/lib/glimmer/dsl/swt/layout_expression.rb +0 -27
  49. data/lib/glimmer/dsl/swt/list_selection_data_binding_expression.rb +0 -44
  50. data/lib/glimmer/dsl/swt/menu_bar_expression.rb +0 -33
  51. data/lib/glimmer/dsl/swt/menu_expression.rb +0 -32
  52. data/lib/glimmer/dsl/swt/message_box_expression.rb +0 -29
  53. data/lib/glimmer/dsl/swt/observe_expression.rb +0 -32
  54. data/lib/glimmer/dsl/swt/property_expression.rb +0 -22
  55. data/lib/glimmer/dsl/swt/rgb_expression.rb +0 -12
  56. data/lib/glimmer/dsl/swt/rgba_expression.rb +0 -12
  57. data/lib/glimmer/dsl/swt/shell_expression.rb +0 -25
  58. data/lib/glimmer/dsl/swt/swt_expression.rb +0 -25
  59. data/lib/glimmer/dsl/swt/sync_exec_expression.rb +0 -15
  60. data/lib/glimmer/dsl/swt/tab_item_expression.rb +0 -33
  61. data/lib/glimmer/dsl/swt/table_items_data_binding_expression.rb +0 -31
  62. data/lib/glimmer/dsl/swt/tree_items_data_binding_expression.rb +0 -31
  63. data/lib/glimmer/dsl/swt/tree_properties_expression.rb +0 -26
  64. data/lib/glimmer/dsl/swt/widget_expression.rb +0 -35
  65. data/lib/glimmer/dsl/swt/widget_listener_expression.rb +0 -32
  66. data/lib/glimmer/dsl/xml/dsl.rb +0 -11
  67. data/lib/glimmer/dsl/xml/html_expression.rb +0 -25
  68. data/lib/glimmer/dsl/xml/meta_expression.rb +0 -23
  69. data/lib/glimmer/dsl/xml/name_space_expression.rb +0 -37
  70. data/lib/glimmer/dsl/xml/node_parent_expression.rb +0 -33
  71. data/lib/glimmer/dsl/xml/tag_expression.rb +0 -29
  72. data/lib/glimmer/dsl/xml/text_expression.rb +0 -22
  73. data/lib/glimmer/dsl/xml/xml_expression.rb +0 -21
  74. data/lib/glimmer/launcher.rb +0 -199
  75. data/lib/glimmer/package.rb +0 -55
  76. data/lib/glimmer/rake_task.rb +0 -58
  77. data/lib/glimmer/scaffold.rb +0 -582
  78. data/lib/glimmer/swt/color_proxy.rb +0 -53
  79. data/lib/glimmer/swt/display_proxy.rb +0 -88
  80. data/lib/glimmer/swt/font_proxy.rb +0 -72
  81. data/lib/glimmer/swt/layout_data_proxy.rb +0 -84
  82. data/lib/glimmer/swt/layout_proxy.rb +0 -82
  83. data/lib/glimmer/swt/menu_proxy.rb +0 -101
  84. data/lib/glimmer/swt/message_box_proxy.rb +0 -48
  85. data/lib/glimmer/swt/packages.rb +0 -13
  86. data/lib/glimmer/swt/shell_proxy.rb +0 -152
  87. data/lib/glimmer/swt/swt_proxy.rb +0 -106
  88. data/lib/glimmer/swt/tab_item_proxy.rb +0 -65
  89. data/lib/glimmer/swt/table_proxy.rb +0 -150
  90. data/lib/glimmer/swt/tree_proxy.rb +0 -120
  91. data/lib/glimmer/swt/widget_listener_proxy.rb +0 -34
  92. data/lib/glimmer/swt/widget_proxy.rb +0 -489
  93. data/lib/glimmer/ui/custom_shell.rb +0 -45
  94. data/lib/glimmer/ui/custom_widget.rb +0 -244
  95. data/lib/glimmer/util/proc_tracker.rb +0 -16
  96. data/lib/glimmer/xml/depth_first_search_iterator.rb +0 -22
  97. data/lib/glimmer/xml/name_space_visitor.rb +0 -21
  98. data/lib/glimmer/xml/node.rb +0 -75
  99. data/lib/glimmer/xml/node_visitor.rb +0 -13
  100. data/lib/glimmer/xml/xml_visitor.rb +0 -65
  101. data/vendor/swt/linux/swt.jar +0 -0
  102. data/vendor/swt/mac/swt.jar +0 -0
  103. data/vendor/swt/windows/swt.jar +0 -0
@@ -1,33 +0,0 @@
1
- require 'glimmer'
2
- require 'glimmer/dsl/static_expression'
3
- require 'glimmer/dsl/parent_expression'
4
- require 'glimmer/swt/menu_proxy'
5
-
6
- module Glimmer
7
- module DSL
8
- module SWT
9
- class MenuBarExpression < StaticExpression
10
- include ParentExpression
11
-
12
- include_package 'org.eclipse.swt.widgets'
13
-
14
- def can_interpret?(parent, keyword, *args, &block)
15
- initial_condition = (keyword == 'menu_bar')
16
- if initial_condition
17
- if parent.swt_widget.is_a?(Shell)
18
- return true
19
- else
20
- raise Glimmer::Error, "menu_bar may only be nested under a shell!"
21
- end
22
- end
23
- false
24
- end
25
-
26
- def interpret(parent, keyword, *args, &block)
27
- args = args.unshift(:bar)
28
- Glimmer::SWT::MenuProxy.new(parent, args)
29
- end
30
- end
31
- end
32
- end
33
- end
@@ -1,32 +0,0 @@
1
- require 'glimmer'
2
- require 'glimmer/dsl/static_expression'
3
- require 'glimmer/dsl/parent_expression'
4
- require 'glimmer/swt/menu_proxy'
5
-
6
- module Glimmer
7
- module DSL
8
- module SWT
9
- class MenuExpression < StaticExpression
10
- include ParentExpression
11
-
12
- include_package 'org.eclipse.swt.widgets'
13
-
14
- def can_interpret?(parent, keyword, *args, &block)
15
- initial_condition = (keyword == 'menu')
16
- if initial_condition
17
- if widget?(parent)
18
- return true
19
- else
20
- raise Glimmer::Error, "menu may only be nested under a widget (like shell or another menu)!"
21
- end
22
- end
23
- false
24
- end
25
-
26
- def interpret(parent, keyword, *args, &block)
27
- Glimmer::SWT::MenuProxy.new(parent, args)
28
- end
29
- end
30
- end
31
- end
32
- end
@@ -1,29 +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
- require 'glimmer/swt/message_box_proxy'
6
- require 'glimmer/swt/swt_proxy'
7
-
8
- module Glimmer
9
- module DSL
10
- module SWT
11
- class MessageBoxExpression < StaticExpression
12
- include TopLevelExpression
13
- include ParentExpression
14
-
15
- include_package 'org.eclipse.swt.widgets'
16
-
17
- def can_interpret?(parent, keyword, *args, &block)
18
- keyword == 'message_box'
19
- end
20
-
21
- def interpret(parent, keyword, *args, &block)
22
- potential_parent = args.first
23
- parent = args.shift if potential_parent.is_a?(Shell) || (potential_parent.respond_to?(:swt_widget) && potential_parent.swt_widget.is_a?(Shell))
24
- Glimmer::SWT::MessageBoxProxy.new(parent, Glimmer::SWT::SWTProxy[args])
25
- end
26
- end
27
- end
28
- end
29
- end
@@ -1,32 +0,0 @@
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 SWT
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
@@ -1,22 +0,0 @@
1
- require 'glimmer/dsl/expression'
2
-
3
- module Glimmer
4
- module DSL
5
- module SWT
6
- class PropertyExpression < Expression
7
- def can_interpret?(parent, keyword, *args, &block)
8
- block.nil? and
9
- args.size > 0 and
10
- parent.respond_to?(:set_attribute) and
11
- parent.respond_to?(:has_attribute?) and
12
- parent.has_attribute?(keyword, *args)
13
- end
14
-
15
- def interpret(parent, keyword, *args, &block)
16
- parent.set_attribute(keyword, *args)
17
- nil
18
- end
19
- end
20
- end
21
- end
22
- end
@@ -1,12 +0,0 @@
1
- require 'glimmer/dsl/swt/color_expression'
2
- require 'glimmer/swt/color_proxy'
3
- require 'glimmer/swt/display_proxy'
4
-
5
- module Glimmer
6
- module DSL
7
- module SWT
8
- class RgbExpression < ColorExpression
9
- end
10
- end
11
- end
12
- end
@@ -1,12 +0,0 @@
1
- require 'glimmer/dsl/swt/color_expression'
2
- require 'glimmer/swt/color_proxy'
3
- require 'glimmer/swt/display_proxy'
4
-
5
- module Glimmer
6
- module DSL
7
- module SWT
8
- class RgbaExpression < ColorExpression
9
- end
10
- end
11
- end
12
- end
@@ -1,25 +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 ShellExpression < StaticExpression
10
- include TopLevelExpression
11
- include ParentExpression
12
-
13
- def can_interpret?(parent, keyword, *args, &block)
14
- keyword == 'shell' 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
- Glimmer::SWT::ShellProxy.send(:new, *args)
21
- end
22
- end
23
- end
24
- end
25
- end
@@ -1,25 +0,0 @@
1
- require 'glimmer/dsl/static_expression'
2
- require 'glimmer/swt/swt_proxy'
3
-
4
- # TODO consider turning static keywords like bind into methods
5
-
6
- module Glimmer
7
- module DSL
8
- module SWT
9
- # Responsible for returning SWT constant values
10
- #
11
- # Named SwtExpression (not SWTExpression) so that the DSL engine
12
- # discovers quickly by convention
13
- class SwtExpression < StaticExpression
14
- def can_interpret?(parent, keyword, *args, &block)
15
- block.nil? &&
16
- args.size > 0
17
- end
18
-
19
- def interpret(parent, keyword, *args, &block)
20
- Glimmer::SWT::SWTProxy[*args]
21
- end
22
- end
23
- end
24
- end
25
- end
@@ -1,15 +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
- # Synchronously executes code block against the SWT Event Loop
8
- # to manipulate SWT UI objects on the UI thread safely with
9
- # immediate priority when needed.
10
- class SyncExecExpression < StaticExpression
11
- include ExecExpression
12
- end
13
- end
14
- end
15
- end
@@ -1,33 +0,0 @@
1
- require 'glimmer'
2
- require 'glimmer/dsl/static_expression'
3
- require 'glimmer/dsl/parent_expression'
4
- require 'glimmer/swt/widget_proxy'
5
- require 'glimmer/swt/tab_item_proxy'
6
-
7
- module Glimmer
8
- module DSL
9
- module SWT
10
- class TabItemExpression < StaticExpression
11
- include ParentExpression
12
-
13
- include_package 'org.eclipse.swt.widgets'
14
-
15
- def can_interpret?(parent, keyword, *args, &block)
16
- initial_condition = (keyword == 'tab_item') and widget?(parent)
17
- if initial_condition
18
- if parent.swt_widget.is_a?(TabFolder)
19
- return true
20
- else
21
- Glimmer::Config.logger&.error "tab_item widget may only be used directly under a tab_folder widget!"
22
- end
23
- end
24
- false
25
- end
26
-
27
- def interpret(parent, keyword, *args, &block)
28
- Glimmer::SWT::TabItemProxy.new(parent, args)
29
- end
30
- end
31
- end
32
- end
33
- end
@@ -1,31 +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
- module SWT
8
- #Depends on BindCommandHandler and TableColumnPropertiesDataBindingCommandHandler
9
- class TableItemsDataBindingExpression < Expression
10
- include_package 'org.eclipse.swt.widgets'
11
-
12
- def can_interpret?(parent, keyword, *args, &block)
13
- keyword == "items" and
14
- block.nil? and
15
- widget?(parent) and
16
- parent.swt_widget.is_a?(Table) and
17
- args.size == 2 and
18
- args[0].is_a?(DataBinding::ModelBinding) and
19
- args[0].evaluate_property.is_a?(Array) and
20
- args[1].is_a?(Array)
21
- end
22
-
23
- def interpret(parent, keyword, *args, &block)
24
- model_binding = args[0]
25
- column_properties = args[1]
26
- DataBinding::TableItemsBinding.new(parent, model_binding, column_properties)
27
- end
28
- end
29
- end
30
- end
31
- end
@@ -1,31 +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
- module SWT
8
- class TreeItemsDataBindingExpression < Expression
9
- include_package 'org.eclipse.swt.widgets'
10
-
11
- def can_interpret?(parent, keyword, *args, &block)
12
- initial_condition = ((keyword == "items") and block.nil? and widget?(parent) and parent.swt_widget.is_a?(Tree))
13
- return false unless initial_condition
14
- raise Glimmer::Error, 'Tree items args must be 2' unless args.size == 2
15
- raise Glimmer::Error, 'Tree items first arg must be a bind expression' unless args[0].is_a?(DataBinding::ModelBinding)
16
- 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)
17
- raise Glimmer::Error, 'Tree items second arg must be an array' unless args[1].is_a?(Array)
18
- raise Glimmer::Error, 'Tree items second arg must not be empty' unless !args[1].empty?
19
- raise Glimmer::Error, 'Tree items second arg array elements must be of type hash' unless args[1].first.is_a?(Hash)
20
- true
21
- end
22
-
23
- def interpret(parent, keyword, *args, &block)
24
- model_binding = args[0]
25
- tree_properties = args[1]
26
- DataBinding::TreeItemsBinding.new(parent, model_binding, tree_properties)
27
- end
28
- end
29
- end
30
- end
31
- end
@@ -1,26 +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
- module SWT
8
- # Responsible for providing a readable keyword (command symbol) to capture
9
- # and return tree properties for use in TreeItemsDataBindingCommandHandler
10
- class TreePropertiesExpression < StaticExpression
11
- include_package 'org.eclipse.swt.widgets'
12
-
13
- def can_interpret?(parent, keyword, *args, &block)
14
- keyword == "tree_properties" and
15
- block.nil? and
16
- widget?(parent) and
17
- parent.swt_widget.is_a?(Tree)
18
- end
19
-
20
- def interpret(parent, keyword, *args, &block)
21
- args
22
- end
23
- end
24
- end
25
- end
26
- end
@@ -1,35 +0,0 @@
1
- require 'glimmer'
2
- require 'glimmer/dsl/expression'
3
- require 'glimmer/dsl/parent_expression'
4
-
5
- module Glimmer
6
- module DSL
7
- module SWT
8
- class WidgetExpression < Expression
9
- include ParentExpression
10
-
11
- EXCLUDED_KEYWORDS = %w[shell display tab_item]
12
-
13
- def can_interpret?(parent, keyword, *args, &block)
14
- !EXCLUDED_KEYWORDS.include?(keyword) and
15
- widget?(parent) and #TODO change to composite?(parent)
16
- Glimmer::SWT::WidgetProxy.widget_exists?(keyword)
17
- end
18
-
19
- def interpret(parent, keyword, *args, &block)
20
- begin
21
- class_name = "#{keyword.camelcase(:upper)}Proxy".to_sym
22
- widget_class = Glimmer::SWT.const_get(class_name)
23
- rescue
24
- widget_class = Glimmer::SWT::WidgetProxy
25
- end
26
- widget_class.new(keyword, parent, args)
27
- end
28
- end
29
- end
30
- end
31
- end
32
-
33
- require 'glimmer/swt/widget_proxy'
34
- require 'glimmer/swt/tree_proxy'
35
- require 'glimmer/swt/table_proxy'
@@ -1,32 +0,0 @@
1
- require 'glimmer/dsl/expression'
2
- require 'glimmer/swt/display_proxy'
3
-
4
- module Glimmer
5
- module DSL
6
- module SWT
7
- class WidgetListenerExpression < Expression
8
- include_package 'org.eclipse.swt.widgets'
9
-
10
- def can_interpret?(parent, keyword, *args, &block)
11
- Glimmer::Config.logger&.debug "keyword starts with on_: #{keyword.start_with?('on_')}"
12
- return false unless keyword.start_with?('on_')
13
- widget_or_display_parentage = widget?(parent) || parent.is_a?(Glimmer::SWT::DisplayProxy)
14
- Glimmer::Config.logger&.debug "parent is a widget or display: #{widget_or_display_parentage}"
15
- return false unless widget_or_display_parentage
16
- Glimmer::Config.logger&.debug "block exists?: #{!block.nil?}"
17
- raise Glimmer::Error, "Listener is missing block for keyword: #{keyword}" unless block_given?
18
- Glimmer::Config.logger&.debug "args are empty?: #{args.empty?}"
19
- raise Glimmer::Error, "Invalid listener arguments for keyword: #{keyword}(#{args})" unless args.empty?
20
- result = parent.can_handle_observation_request?(keyword)
21
- Glimmer::Config.logger&.debug "can add listener? #{result}"
22
- raise Glimmer::Error, "Invalid listener keyword: #{keyword}" unless result
23
- true
24
- end
25
-
26
- def interpret(parent, keyword, *args, &block)
27
- parent.handle_observation_request(keyword, &block)
28
- end
29
- end
30
- end
31
- end
32
- end