glimmer 0.8.1 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +327 -127
  4. data/VERSION +1 -1
  5. data/lib/glimmer.rb +35 -21
  6. data/lib/glimmer/config.rb +7 -12
  7. data/lib/glimmer/data_binding/observable_array.rb +32 -53
  8. data/lib/glimmer/data_binding/observable_model.rb +10 -14
  9. data/lib/glimmer/data_binding/observer.rb +3 -0
  10. data/lib/glimmer/dsl/engine.rb +58 -27
  11. data/lib/glimmer/dsl/expression.rb +0 -7
  12. data/lib/glimmer/dsl/static_expression.rb +2 -2
  13. data/lib/glimmer/excluded_keyword_error.rb +5 -0
  14. metadata +60 -136
  15. data/RUBY_VERSION +0 -1
  16. data/bin/girb +0 -10
  17. data/bin/girb_runner.rb +0 -13
  18. data/bin/glimmer +0 -5
  19. data/icons/scaffold_app.icns +0 -0
  20. data/lib/glimmer/css/rule.rb +0 -25
  21. data/lib/glimmer/css/style_sheet.rb +0 -19
  22. data/lib/glimmer/data_binding/list_selection_binding.rb +0 -52
  23. data/lib/glimmer/data_binding/observable_widget.rb +0 -17
  24. data/lib/glimmer/data_binding/shine.rb +0 -23
  25. data/lib/glimmer/data_binding/table_items_binding.rb +0 -47
  26. data/lib/glimmer/data_binding/tree_items_binding.rb +0 -71
  27. data/lib/glimmer/data_binding/widget_binding.rb +0 -33
  28. data/lib/glimmer/dsl/css/css_expression.rb +0 -21
  29. data/lib/glimmer/dsl/css/dsl.rb +0 -10
  30. data/lib/glimmer/dsl/css/dynamic_property_expression.rb +0 -12
  31. data/lib/glimmer/dsl/css/property_expression.rb +0 -22
  32. data/lib/glimmer/dsl/css/pv_expression.rb +0 -17
  33. data/lib/glimmer/dsl/css/rule_expression.rb +0 -25
  34. data/lib/glimmer/dsl/css/s_expression.rb +0 -26
  35. data/lib/glimmer/dsl/swt/async_exec_expression.rb +0 -14
  36. data/lib/glimmer/dsl/swt/bind_expression.rb +0 -37
  37. data/lib/glimmer/dsl/swt/color_expression.rb +0 -19
  38. data/lib/glimmer/dsl/swt/column_properties_expression.rb +0 -24
  39. data/lib/glimmer/dsl/swt/combo_selection_data_binding_expression.rb +0 -42
  40. data/lib/glimmer/dsl/swt/custom_widget_expression.rb +0 -36
  41. data/lib/glimmer/dsl/swt/data_binding_expression.rb +0 -34
  42. data/lib/glimmer/dsl/swt/dialog_expression.rb +0 -26
  43. data/lib/glimmer/dsl/swt/display_expression.rb +0 -19
  44. data/lib/glimmer/dsl/swt/dsl.rb +0 -28
  45. data/lib/glimmer/dsl/swt/exec_expression.rb +0 -28
  46. data/lib/glimmer/dsl/swt/layout_data_expression.rb +0 -25
  47. data/lib/glimmer/dsl/swt/layout_expression.rb +0 -27
  48. data/lib/glimmer/dsl/swt/list_selection_data_binding_expression.rb +0 -44
  49. data/lib/glimmer/dsl/swt/menu_bar_expression.rb +0 -33
  50. data/lib/glimmer/dsl/swt/menu_expression.rb +0 -32
  51. data/lib/glimmer/dsl/swt/observe_expression.rb +0 -32
  52. data/lib/glimmer/dsl/swt/property_expression.rb +0 -22
  53. data/lib/glimmer/dsl/swt/rgb_expression.rb +0 -12
  54. data/lib/glimmer/dsl/swt/rgba_expression.rb +0 -12
  55. data/lib/glimmer/dsl/swt/shell_expression.rb +0 -25
  56. data/lib/glimmer/dsl/swt/swt_expression.rb +0 -25
  57. data/lib/glimmer/dsl/swt/sync_exec_expression.rb +0 -15
  58. data/lib/glimmer/dsl/swt/tab_item_expression.rb +0 -33
  59. data/lib/glimmer/dsl/swt/table_items_data_binding_expression.rb +0 -31
  60. data/lib/glimmer/dsl/swt/tree_items_data_binding_expression.rb +0 -31
  61. data/lib/glimmer/dsl/swt/tree_properties_expression.rb +0 -26
  62. data/lib/glimmer/dsl/swt/widget_expression.rb +0 -34
  63. data/lib/glimmer/dsl/swt/widget_listener_expression.rb +0 -32
  64. data/lib/glimmer/dsl/xml/dsl.rb +0 -11
  65. data/lib/glimmer/dsl/xml/html_expression.rb +0 -25
  66. data/lib/glimmer/dsl/xml/meta_expression.rb +0 -23
  67. data/lib/glimmer/dsl/xml/name_space_expression.rb +0 -37
  68. data/lib/glimmer/dsl/xml/node_parent_expression.rb +0 -33
  69. data/lib/glimmer/dsl/xml/tag_expression.rb +0 -29
  70. data/lib/glimmer/dsl/xml/text_expression.rb +0 -22
  71. data/lib/glimmer/dsl/xml/xml_expression.rb +0 -21
  72. data/lib/glimmer/launcher.rb +0 -199
  73. data/lib/glimmer/package.rb +0 -7
  74. data/lib/glimmer/rake_task.rb +0 -89
  75. data/lib/glimmer/scaffold.rb +0 -582
  76. data/lib/glimmer/swt/color_proxy.rb +0 -53
  77. data/lib/glimmer/swt/display_proxy.rb +0 -88
  78. data/lib/glimmer/swt/font_proxy.rb +0 -72
  79. data/lib/glimmer/swt/layout_data_proxy.rb +0 -84
  80. data/lib/glimmer/swt/layout_proxy.rb +0 -82
  81. data/lib/glimmer/swt/menu_proxy.rb +0 -101
  82. data/lib/glimmer/swt/packages.rb +0 -13
  83. data/lib/glimmer/swt/shell_proxy.rb +0 -157
  84. data/lib/glimmer/swt/swt_proxy.rb +0 -106
  85. data/lib/glimmer/swt/tab_item_proxy.rb +0 -65
  86. data/lib/glimmer/swt/tree_proxy.rb +0 -120
  87. data/lib/glimmer/swt/widget_listener_proxy.rb +0 -34
  88. data/lib/glimmer/swt/widget_proxy.rb +0 -489
  89. data/lib/glimmer/ui/custom_shell.rb +0 -45
  90. data/lib/glimmer/ui/custom_widget.rb +0 -244
  91. data/lib/glimmer/util/proc_tracker.rb +0 -16
  92. data/lib/glimmer/xml/depth_first_search_iterator.rb +0 -22
  93. data/lib/glimmer/xml/name_space_visitor.rb +0 -21
  94. data/lib/glimmer/xml/node.rb +0 -75
  95. data/lib/glimmer/xml/node_visitor.rb +0 -13
  96. data/lib/glimmer/xml/xml_visitor.rb +0 -65
  97. data/vendor/swt/linux/swt.jar +0 -0
  98. data/vendor/swt/mac/swt.jar +0 -0
  99. data/vendor/swt/windows/swt.jar +0 -0
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.1
1
+ 0.9.3
@@ -2,14 +2,12 @@
2
2
  # interfaces using the robust platform-independent Eclipse SWT library. Glimmer
3
3
  # comes with built-in data-binding support to greatly facilitate synchronizing
4
4
  # UI with domain models.
5
- require 'facets'
6
- require 'super_module'
7
5
  require 'logger'
8
- require 'java'
9
6
  require 'set'
10
- require 'nested_inherited_jruby_include_package'
11
- require 'fileutils'
12
- require 'os'
7
+
8
+ $LOAD_PATH.unshift(File.expand_path('..', __FILE__))
9
+
10
+ require 'glimmer/config'
13
11
 
14
12
  # Glimmer provides a JRuby Desktop UI DSL + Data-Binding functionality
15
13
  #
@@ -20,24 +18,45 @@ require 'os'
20
18
  module Glimmer
21
19
  #TODO make it configurable to include or not include perhaps reverting to using included
22
20
  REGEX_METHODS_EXCLUDED = /^(to_|\[)/
23
-
21
+
22
+ # TODO add loop detection support to avoid infinite loops (perhaps breaks after 3 repetitions and provides an option to allow it if intentional)
24
23
  class << self
25
- def included(klass)
26
- if Config.import_swt_packages
27
- klass.include(SWT::Packages)
28
- klass.extend(SWT::Packages)
29
- klass.extend(Glimmer)
30
- end
24
+ attr_accessor :loop_last_data
25
+
26
+ def loop_reset!(including_loop_last_data = false)
27
+ @loop_last_data = nil if including_loop_last_data
28
+ @loop = 1
29
+ end
30
+
31
+ def loop
32
+ @loop ||= loop_reset!
33
+ end
34
+
35
+ def loop_increment!
36
+ @loop = loop + 1
31
37
  end
32
38
  end
33
39
 
34
40
  def method_missing(method_symbol, *args, &block)
41
+ new_loop_data = [method_symbol, args, block]
42
+ if new_loop_data == Glimmer.loop_last_data
43
+ Glimmer.loop_increment!
44
+ if Glimmer.loop == Config.loop_max_count
45
+ raise "Glimmer looped #{Config.loop_max_count} times with keyword '#{new_loop_data[0]}'! Check code for errors."
46
+ end
47
+ else
48
+ Glimmer.loop_reset!
49
+ end
50
+ Glimmer.loop_last_data = new_loop_data
35
51
  # This if statement speeds up Glimmer in girb or whenever directly including on main object
36
52
  if method_symbol.to_s.match(REGEX_METHODS_EXCLUDED)
37
- raise InvalidKeywordError, "Glimmer excluded keyword: #{method_symbol}"
53
+ raise ExcludedKeywordError, "Glimmer excluded keyword: #{method_symbol}"
38
54
  end
39
55
  Glimmer::Config.logger&.debug "Interpreting keyword: #{method_symbol}"
40
56
  Glimmer::DSL::Engine.interpret(method_symbol, *args, &block)
57
+ rescue ExcludedKeywordError => e
58
+ # TODO add a feature to show excluded keywords optionally for debugging purposes
59
+ super(method_symbol, *args, &block)
41
60
  rescue InvalidKeywordError => e
42
61
  if !method_symbol.to_s.match(REGEX_METHODS_EXCLUDED)
43
62
  Glimmer::Config.logger&.error e.message
@@ -47,12 +66,7 @@ module Glimmer
47
66
  end
48
67
  end
49
68
 
50
- $LOAD_PATH.unshift(File.expand_path('..', __FILE__))
51
-
52
- require 'glimmer/config'
53
- require 'glimmer/swt/packages'
54
- require 'glimmer/dsl/swt/dsl'
55
- require 'glimmer/dsl/xml/dsl'
56
- require 'glimmer/dsl/css/dsl'
57
69
  require 'glimmer/error'
70
+ require 'glimmer/excluded_keyword_error'
58
71
  require 'glimmer/invalid_keyword_error'
72
+ require 'glimmer/dsl/engine'
@@ -1,19 +1,14 @@
1
1
  module Glimmer
2
2
  module Config
3
3
  class << self
4
- # Tells Glimmer to import SWT packages into including class (default: true)
5
- def import_swt_packages=(value)
6
- @@import_swt_packages = !!value
4
+ LOOP_MAX_COUNT_DEFAULT = 100
5
+
6
+ attr_writer :loop_max_count
7
+
8
+ def loop_max_count
9
+ @loop_max_count ||= LOOP_MAX_COUNT_DEFAULT
7
10
  end
8
-
9
- # Returns whether Glimmer will import SWT packages into including class
10
- def import_swt_packages
11
- unless defined? @@import_swt_packages
12
- @@import_swt_packages = true
13
- end
14
- @@import_swt_packages
15
- end
16
-
11
+
17
12
  # Returns Glimmer logger (standard Ruby logger)
18
13
  def logger
19
14
  # unless defined? @@logger
@@ -1,6 +1,6 @@
1
1
  require 'set'
2
2
 
3
- require_relative 'observable'
3
+ require 'glimmer/data_binding/observable'
4
4
 
5
5
  module Glimmer
6
6
  module DataBinding
@@ -40,61 +40,40 @@ module Glimmer
40
40
  def notify_observers
41
41
  property_observer_list.each {|observer| observer.call}
42
42
  end
43
-
44
- def self.extend_object(array)
45
- # TODO consider alias_method, and define_method instead
46
-
47
- array.instance_eval("alias __original_add <<")
48
- array.instance_eval <<-end_eval, __FILE__, __LINE__
49
- def <<(value)
50
- self.__original_add(value)
51
- notify_observers
52
- end
53
- end_eval
54
-
55
- array.instance_eval("alias __original_set_value []=")
56
- array.instance_eval <<-end_eval, __FILE__, __LINE__
57
- def []=(index, value)
58
- old_value = self[index]
59
- unregister_dependent_observers(old_value)
60
- self.__original_set_value(index, value)
61
- notify_observers
62
- end
63
- end_eval
64
-
65
- array.instance_eval("alias __original_delete delete")
66
- array.instance_eval <<-end_eval, __FILE__, __LINE__
67
- def delete(value)
68
- unregister_dependent_observers(value)
69
- self.__original_delete(value)
70
- notify_observers
71
- end
72
- end_eval
73
-
74
- array.instance_eval("alias __original_delete_at delete_at")
75
- array.instance_eval <<-end_eval, __FILE__, __LINE__
76
- def delete_at(index)
77
- old_value = self[index]
43
+
44
+ def <<(element)
45
+ super(element)
46
+ notify_observers
47
+ end
48
+
49
+ def []=(index, value)
50
+ old_value = self[index]
51
+ unregister_dependent_observers(old_value)
52
+ super(index, value)
53
+ notify_observers
54
+ end
55
+
56
+ def delete(element)
57
+ unregister_dependent_observers(element)
58
+ super(element)
59
+ notify_observers
60
+ end
61
+
62
+ def delete_at(index)
63
+ old_value = self[index]
64
+ unregister_dependent_observers(old_value)
65
+ super(index)
66
+ notify_observers
67
+ end
68
+
69
+ def clear
70
+ each do |old_value|
78
71
  unregister_dependent_observers(old_value)
79
- self.__original_delete_at(index)
80
- notify_observers
81
72
  end
82
- end_eval
83
-
84
- array.instance_eval("alias __original_clear clear")
85
- array.instance_eval <<-end_eval, __FILE__, __LINE__
86
- def clear
87
- each do |old_value|
88
- unregister_dependent_observers(old_value)
89
- end
90
- self.__original_clear
91
- notify_observers
92
- end
93
- end_eval
94
-
95
- super
73
+ super()
74
+ notify_observers
96
75
  end
97
-
76
+
98
77
  def unregister_dependent_observers(old_value)
99
78
  # TODO look into optimizing this
100
79
  return unless old_value.is_a?(ObservableModel) || old_value.is_a?(ObservableArray)
@@ -1,7 +1,5 @@
1
- require 'glimmer'
2
-
3
- require_relative 'observable'
4
- require_relative 'observer'
1
+ require 'glimmer/data_binding/observable'
2
+ require 'glimmer/data_binding/observer'
5
3
 
6
4
  module Glimmer
7
5
  module DataBinding
@@ -60,17 +58,15 @@ module Glimmer
60
58
  begin
61
59
  method("__original_#{property_writer_name}")
62
60
  rescue
63
- # TODO consider alias_method or define_method instead
64
- instance_eval "alias __original_#{property_writer_name} #{property_writer_name}"
65
- instance_eval <<-end_eval, __FILE__, __LINE__
66
- def #{property_writer_name}(value)
67
- old_value = self.#{property_name}
68
- unregister_dependent_observers('#{property_name}', old_value)
69
- self.__original_#{property_writer_name}(value)
70
- notify_observers('#{property_name}')
71
- ensure_array_object_observer('#{property_name}', value, old_value)
61
+ old_method = self.class.instance_method(property_writer_name)
62
+ define_singleton_method("__original_#{property_writer_name}", old_method)
63
+ define_singleton_method(property_writer_name) do |value|
64
+ old_value = self.send(property_name)
65
+ unregister_dependent_observers(property_name, old_value)
66
+ self.send("__original_#{property_writer_name}", value)
67
+ notify_observers(property_name)
68
+ ensure_array_object_observer(property_name, value, old_value)
72
69
  end
73
- end_eval
74
70
  end
75
71
  rescue => e
76
72
  # ignore writing if no property writer exists
@@ -122,3 +122,6 @@ module Glimmer
122
122
  end
123
123
  end
124
124
  end
125
+
126
+ require 'glimmer/data_binding/observable_model'
127
+ require 'glimmer/data_binding/observable_array'
@@ -1,4 +1,5 @@
1
- require 'glimmer'
1
+ require 'facets/string/camelcase'
2
+
2
3
  require 'glimmer/dsl/expression_handler'
3
4
 
4
5
  module Glimmer
@@ -10,6 +11,8 @@ module Glimmer
10
11
  # When DSL engine interprets an expression, it attempts to handle
11
12
  # with ordered expression array specified via `.expressions=` method.
12
13
  class Engine
14
+ MESSAGE_NO_DSLS = "Glimmer has no DSLs configured. Add glimmer-dsl-swt gem or visit https://github.com/AndyObtiva/glimmer#multi-dsl-support for more details.\n"
15
+
13
16
  class << self
14
17
  def dsl=(dsl_name)
15
18
  dsl_name = dsl_name&.to_sym
@@ -55,6 +58,10 @@ module Glimmer
55
58
  dsl_stack.clear
56
59
  disabled_dsls.clear
57
60
  end
61
+
62
+ def no_dsls?
63
+ static_expressions.empty? && dynamic_expression_chains_of_responsibility.empty?
64
+ end
58
65
 
59
66
  # Dynamic expression chains of responsibility indexed by dsl
60
67
  def dynamic_expression_chains_of_responsibility
@@ -64,6 +71,16 @@ module Glimmer
64
71
  # Static expressions indexed by keyword and dsl
65
72
  def static_expressions
66
73
  @static_expressions ||= {}
74
+ end
75
+
76
+ # Sets dynamic expression chains of responsibility. Useful for internal testing
77
+ def dynamic_expression_chains_of_responsibility=(chains)
78
+ @dynamic_expression_chains_of_responsibility = chains
79
+ end
80
+
81
+ # Sets static expressions. Useful for internal testing
82
+ def static_expressions=(expressions)
83
+ @static_expressions = expressions
67
84
  end
68
85
 
69
86
  # Sets an ordered array of DSL expressions to support
@@ -73,8 +90,9 @@ module Glimmer
73
90
  #
74
91
  # They are used in order following the Chain of Responsibility Design
75
92
  # Pattern when interpretting a DSL expression
76
- def add_dynamic_expressions(dsl_namespace, expression_names)
77
- dsl = dsl_namespace.name.split("::").last.downcase.to_sym
93
+ def add_dynamic_expressions(dsl_namespace, *expression_names)
94
+ expression_names = expression_names.flatten
95
+ dsl = dsl_namespace.name.split("::").last.downcase.to_sym
78
96
  dynamic_expression_chains_of_responsibility[dsl] = expression_names.reverse.map do |expression_name|
79
97
  expression_class(dsl_namespace, expression_name).new
80
98
  end.reduce(nil) do |last_expresion_handler, expression|
@@ -82,7 +100,7 @@ module Glimmer
82
100
  expression_handler = ExpressionHandler.new(expression)
83
101
  expression_handler.next = last_expresion_handler if last_expresion_handler
84
102
  expression_handler
85
- end
103
+ end
86
104
  end
87
105
 
88
106
  def add_static_expression(static_expression)
@@ -91,31 +109,40 @@ module Glimmer
91
109
  static_expression_dsl = static_expression.class.dsl
92
110
  static_expressions[keyword] ||= {}
93
111
  static_expressions[keyword][static_expression_dsl] = static_expression
94
- Glimmer.define_method(keyword) do |*args, &block|
112
+ Glimmer.send(:define_method, keyword) do |*args, &block|
95
113
  begin
96
- retrieved_static_expression = Glimmer::DSL::Engine.static_expressions[keyword][Glimmer::DSL::Engine.dsl]
97
- static_expression_dsl = (Glimmer::DSL::Engine.static_expressions[keyword].keys - Glimmer::DSL::Engine.disabled_dsls).first if retrieved_static_expression.nil?
98
- if retrieved_static_expression.nil? && Glimmer::DSL::Engine.dsl && (static_expression_dsl.nil? || !Glimmer::DSL::Engine.static_expressions[keyword][static_expression_dsl].is_a?(TopLevelExpression))
99
- begin
100
- return Glimmer::DSL::Engine.interpret(keyword, *args, &block)
101
- rescue => e
102
- Glimmer::DSL::Engine.reset
103
- raise e if static_expression_dsl.nil? || !Glimmer::DSL::Engine.static_expressions[keyword][static_expression_dsl].is_a?(TopLevelExpression)
104
- end
105
- end
106
- raise Glimmer::Error, "Unsupported keyword: #{keyword}" unless static_expression_dsl || retrieved_static_expression
107
- Glimmer::DSL::Engine.dsl_stack.push(static_expression_dsl || Glimmer::DSL::Engine.dsl)
108
- static_expression = Glimmer::DSL::Engine.static_expressions[keyword][Glimmer::DSL::Engine.dsl]
109
- if !static_expression.can_interpret?(Glimmer::DSL::Engine.parent, keyword, *args, &block)
110
- raise Error, "Invalid use of Glimmer keyword #{keyword} with args #{args} under parent #{Glimmer::DSL::Engine.parent}"
114
+ if Glimmer::DSL::Engine.no_dsls?
115
+ puts Glimmer::DSL::Engine::MESSAGE_NO_DSLS
111
116
  else
112
- Glimmer::Config.logger&.debug "#{static_expression.class.name} will handle expression keyword #{keyword}"
113
- return static_expression.interpret(Glimmer::DSL::Engine.parent, keyword, *args, &block).tap do |ui_object|
114
- Glimmer::DSL::Engine.add_content(ui_object, static_expression, &block) unless block.nil?
115
- Glimmer::DSL::Engine.dsl_stack.pop
117
+ retrieved_static_expression = Glimmer::DSL::Engine.static_expressions[keyword][Glimmer::DSL::Engine.dsl]
118
+ static_expression_dsl = (Glimmer::DSL::Engine.static_expressions[keyword].keys - Glimmer::DSL::Engine.disabled_dsls).first if retrieved_static_expression.nil?
119
+ interpretation = nil
120
+ if retrieved_static_expression.nil? && Glimmer::DSL::Engine.dsl && (static_expression_dsl.nil? || !Glimmer::DSL::Engine.static_expressions[keyword][static_expression_dsl].is_a?(TopLevelExpression))
121
+ begin
122
+ interpretation = Glimmer::DSL::Engine.interpret(keyword, *args, &block)
123
+ rescue => e
124
+ Glimmer::DSL::Engine.reset
125
+ raise e if static_expression_dsl.nil? || !Glimmer::DSL::Engine.static_expressions[keyword][static_expression_dsl].is_a?(TopLevelExpression)
126
+ end
116
127
  end
117
- end
118
- rescue => e
128
+ if interpretation
129
+ interpretation
130
+ else
131
+ raise Glimmer::Error, "Unsupported keyword: #{keyword}" unless static_expression_dsl || retrieved_static_expression
132
+ Glimmer::DSL::Engine.dsl_stack.push(static_expression_dsl || Glimmer::DSL::Engine.dsl)
133
+ static_expression = Glimmer::DSL::Engine.static_expressions[keyword][Glimmer::DSL::Engine.dsl]
134
+ if !static_expression.can_interpret?(Glimmer::DSL::Engine.parent, keyword, *args, &block)
135
+ raise Error, "Invalid use of Glimmer keyword #{keyword} with args #{args} under parent #{Glimmer::DSL::Engine.parent}"
136
+ else
137
+ Glimmer::Config.logger&.debug "#{static_expression.class.name} will handle expression keyword #{keyword}"
138
+ static_expression.interpret(Glimmer::DSL::Engine.parent, keyword, *args, &block).tap do |ui_object|
139
+ Glimmer::DSL::Engine.add_content(ui_object, static_expression, &block) unless block.nil?
140
+ Glimmer::DSL::Engine.dsl_stack.pop
141
+ end
142
+ end
143
+ end
144
+ end
145
+ rescue StandardError => e
119
146
  # Glimmer::DSL::Engine.dsl_stack.pop
120
147
  Glimmer::DSL::Engine.reset
121
148
  raise e
@@ -133,6 +160,10 @@ module Glimmer
133
160
 
134
161
  # Interprets Glimmer dynamic DSL expression consisting of keyword, args, and block (e.g. shell(:no_resize) { ... })
135
162
  def interpret(keyword, *args, &block)
163
+ if no_dsls?
164
+ puts MESSAGE_NO_DSLS
165
+ return
166
+ end
136
167
  keyword = keyword.to_s
137
168
  dynamic_expression_dsl = (dynamic_expression_chains_of_responsibility.keys - disabled_dsls).first if dsl.nil?
138
169
  dsl_stack.push(dynamic_expression_dsl || dsl)
@@ -141,7 +172,7 @@ module Glimmer
141
172
  add_content(ui_object, expression, &block)
142
173
  dsl_stack.pop
143
174
  end
144
- rescue => e
175
+ rescue StandardError => e
145
176
  # dsl_stack.pop
146
177
  reset
147
178
  raise e
@@ -1,6 +1,4 @@
1
1
  require 'glimmer/error'
2
- require 'glimmer/swt/widget_proxy'
3
- require 'glimmer/ui/custom_widget'
4
2
 
5
3
  module Glimmer
6
4
  module DSL
@@ -35,11 +33,6 @@ module Glimmer
35
33
  # No Op by default
36
34
  end
37
35
 
38
- # Checks if parent object is a widget
39
- def widget?(parent)
40
- parent.is_a?(Glimmer::SWT::WidgetProxy) or parent.is_a?(Glimmer::UI::CustomWidget)
41
- end
42
-
43
36
  # Checks if object is a Symbol or a String
44
37
  def textual?(object)
45
38
  object.is_a?(Symbol) or object.is_a?(String)
@@ -1,8 +1,8 @@
1
+ require 'facets/string/underscore'
2
+
1
3
  require 'glimmer/error'
2
4
  require 'glimmer/dsl/engine'
3
5
  require 'glimmer/dsl/expression'
4
- require 'glimmer/swt/widget_proxy'
5
- require 'glimmer/ui/custom_widget'
6
6
 
7
7
  module Glimmer
8
8
  module DSL
@@ -0,0 +1,5 @@
1
+ module Glimmer
2
+ # Represents Glimmer errors that occur due to excluded keywords passing through method_missing
3
+ class ExcludedKeywordError < RuntimeError
4
+ end
5
+ end
metadata CHANGED
@@ -1,174 +1,182 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - AndyMaleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-03 00:00:00.000000000 Z
11
+ date: 2020-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
- - - "~>"
16
+ - - ">="
17
17
  - !ruby/object:Gem::Version
18
18
  version: 3.1.0
19
+ - - "<"
20
+ - !ruby/object:Gem::Version
21
+ version: 4.0.0
19
22
  name: facets
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: 3.1.0
27
- - !ruby/object:Gem::Dependency
28
- requirement: !ruby/object:Gem::Requirement
29
- requirements:
30
- - - "~>"
31
- - !ruby/object:Gem::Version
32
- version: 1.0.0
33
- name: os
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
30
+ - - "<"
39
31
  - !ruby/object:Gem::Version
40
- version: 1.0.0
32
+ version: 4.0.0
41
33
  - !ruby/object:Gem::Dependency
42
34
  requirement: !ruby/object:Gem::Requirement
43
35
  requirements:
44
36
  - - "~>"
45
37
  - !ruby/object:Gem::Version
46
- version: 1.4.1
47
- name: super_module
48
- type: :runtime
38
+ version: 3.5.0
39
+ name: rspec-mocks
40
+ type: :development
49
41
  prerelease: false
50
42
  version_requirements: !ruby/object:Gem::Requirement
51
43
  requirements:
52
44
  - - "~>"
53
45
  - !ruby/object:Gem::Version
54
- version: 1.4.1
46
+ version: 3.5.0
55
47
  - !ruby/object:Gem::Dependency
56
48
  requirement: !ruby/object:Gem::Requirement
57
49
  requirements:
58
50
  - - "~>"
59
51
  - !ruby/object:Gem::Version
60
- version: 0.3.0
61
- name: nested_inherited_jruby_include_package
62
- type: :runtime
52
+ version: 3.5.0
53
+ name: rspec
54
+ type: :development
63
55
  prerelease: false
64
56
  version_requirements: !ruby/object:Gem::Requirement
65
57
  requirements:
66
58
  - - "~>"
67
59
  - !ruby/object:Gem::Version
68
- version: 0.3.0
60
+ version: 3.5.0
69
61
  - !ruby/object:Gem::Dependency
70
62
  requirement: !ruby/object:Gem::Requirement
71
63
  requirements:
72
64
  - - "~>"
73
65
  - !ruby/object:Gem::Version
74
- version: 2.0.5
75
- name: warbler
76
- type: :runtime
66
+ version: 0.8.1
67
+ name: puts_debuggerer
68
+ type: :development
77
69
  prerelease: false
78
70
  version_requirements: !ruby/object:Gem::Requirement
79
71
  requirements:
80
72
  - - "~>"
81
73
  - !ruby/object:Gem::Version
82
- version: 2.0.5
74
+ version: 0.8.1
83
75
  - !ruby/object:Gem::Dependency
84
76
  requirement: !ruby/object:Gem::Requirement
85
77
  requirements:
86
78
  - - ">="
87
79
  - !ruby/object:Gem::Version
88
80
  version: 10.1.0
81
+ - - "<"
82
+ - !ruby/object:Gem::Version
83
+ version: 14.0.0
89
84
  name: rake
90
- type: :runtime
85
+ type: :development
91
86
  prerelease: false
92
87
  version_requirements: !ruby/object:Gem::Requirement
93
88
  requirements:
94
89
  - - ">="
95
90
  - !ruby/object:Gem::Version
96
91
  version: 10.1.0
92
+ - - "<"
93
+ - !ruby/object:Gem::Version
94
+ version: 14.0.0
97
95
  - !ruby/object:Gem::Dependency
98
96
  requirement: !ruby/object:Gem::Requirement
99
97
  requirements:
100
- - - '='
98
+ - - ">="
101
99
  - !ruby/object:Gem::Version
102
100
  version: 2.3.9
101
+ - - "<"
102
+ - !ruby/object:Gem::Version
103
+ version: 3.0.0
103
104
  name: jeweler
104
- type: :runtime
105
+ type: :development
105
106
  prerelease: false
106
107
  version_requirements: !ruby/object:Gem::Requirement
107
108
  requirements:
108
- - - '='
109
+ - - ">="
109
110
  - !ruby/object:Gem::Version
110
111
  version: 2.3.9
112
+ - - "<"
113
+ - !ruby/object:Gem::Version
114
+ version: 3.0.0
111
115
  - !ruby/object:Gem::Dependency
112
116
  requirement: !ruby/object:Gem::Requirement
113
117
  requirements:
114
- - - '='
118
+ - - ">="
115
119
  - !ruby/object:Gem::Version
116
120
  version: 6.2.1
121
+ - - "<"
122
+ - !ruby/object:Gem::Version
123
+ version: 7.0.0
117
124
  name: rdoc
118
- type: :runtime
125
+ type: :development
119
126
  prerelease: false
120
127
  version_requirements: !ruby/object:Gem::Requirement
121
128
  requirements:
122
- - - '='
129
+ - - ">="
123
130
  - !ruby/object:Gem::Version
124
131
  version: 6.2.1
132
+ - - "<"
133
+ - !ruby/object:Gem::Version
134
+ version: 7.0.0
125
135
  - !ruby/object:Gem::Dependency
126
136
  requirement: !ruby/object:Gem::Requirement
127
137
  requirements:
128
- - - "~>"
138
+ - - '='
129
139
  - !ruby/object:Gem::Version
130
- version: 3.5.0
131
- name: rspec-mocks
140
+ version: 0.8.23
141
+ name: coveralls
132
142
  type: :development
133
143
  prerelease: false
134
144
  version_requirements: !ruby/object:Gem::Requirement
135
145
  requirements:
136
- - - "~>"
146
+ - - '='
137
147
  - !ruby/object:Gem::Version
138
- version: 3.5.0
148
+ version: 0.8.23
139
149
  - !ruby/object:Gem::Dependency
140
150
  requirement: !ruby/object:Gem::Requirement
141
151
  requirements:
142
152
  - - "~>"
143
153
  - !ruby/object:Gem::Version
144
- version: 3.5.0
145
- name: rspec
154
+ version: 0.16.1
155
+ name: simplecov
146
156
  type: :development
147
157
  prerelease: false
148
158
  version_requirements: !ruby/object:Gem::Requirement
149
159
  requirements:
150
160
  - - "~>"
151
161
  - !ruby/object:Gem::Version
152
- version: 3.5.0
162
+ version: 0.16.1
153
163
  - !ruby/object:Gem::Dependency
154
164
  requirement: !ruby/object:Gem::Requirement
155
165
  requirements:
156
166
  - - "~>"
157
167
  - !ruby/object:Gem::Version
158
- version: 0.8.1
159
- name: puts_debuggerer
168
+ version: 0.7.0
169
+ name: simplecov-lcov
160
170
  type: :development
161
171
  prerelease: false
162
172
  version_requirements: !ruby/object:Gem::Requirement
163
173
  requirements:
164
174
  - - "~>"
165
175
  - !ruby/object:Gem::Version
166
- version: 0.8.1
167
- description: Ruby Desktop Development GUI Library
176
+ version: 0.7.0
177
+ description: Ruby Desktop Development GUI Library (JRuby on SWT)
168
178
  email: andy.am@gmail.com
169
- executables:
170
- - glimmer
171
- - girb
179
+ executables: []
172
180
  extensions: []
173
181
  extra_rdoc_files:
174
182
  - LICENSE.txt
@@ -176,107 +184,23 @@ extra_rdoc_files:
176
184
  files:
177
185
  - LICENSE.txt
178
186
  - README.md
179
- - RUBY_VERSION
180
187
  - VERSION
181
- - bin/girb
182
- - bin/girb_runner.rb
183
- - bin/glimmer
184
- - icons/scaffold_app.icns
185
188
  - lib/glimmer.rb
186
189
  - lib/glimmer/config.rb
187
- - lib/glimmer/css/rule.rb
188
- - lib/glimmer/css/style_sheet.rb
189
- - lib/glimmer/data_binding/list_selection_binding.rb
190
190
  - lib/glimmer/data_binding/model_binding.rb
191
191
  - lib/glimmer/data_binding/observable.rb
192
192
  - lib/glimmer/data_binding/observable_array.rb
193
193
  - lib/glimmer/data_binding/observable_model.rb
194
- - lib/glimmer/data_binding/observable_widget.rb
195
194
  - lib/glimmer/data_binding/observer.rb
196
- - lib/glimmer/data_binding/shine.rb
197
- - lib/glimmer/data_binding/table_items_binding.rb
198
- - lib/glimmer/data_binding/tree_items_binding.rb
199
- - lib/glimmer/data_binding/widget_binding.rb
200
- - lib/glimmer/dsl/css/css_expression.rb
201
- - lib/glimmer/dsl/css/dsl.rb
202
- - lib/glimmer/dsl/css/dynamic_property_expression.rb
203
- - lib/glimmer/dsl/css/property_expression.rb
204
- - lib/glimmer/dsl/css/pv_expression.rb
205
- - lib/glimmer/dsl/css/rule_expression.rb
206
- - lib/glimmer/dsl/css/s_expression.rb
207
195
  - lib/glimmer/dsl/engine.rb
208
196
  - lib/glimmer/dsl/expression.rb
209
197
  - lib/glimmer/dsl/expression_handler.rb
210
198
  - lib/glimmer/dsl/parent_expression.rb
211
199
  - lib/glimmer/dsl/static_expression.rb
212
- - lib/glimmer/dsl/swt/async_exec_expression.rb
213
- - lib/glimmer/dsl/swt/bind_expression.rb
214
- - lib/glimmer/dsl/swt/color_expression.rb
215
- - lib/glimmer/dsl/swt/column_properties_expression.rb
216
- - lib/glimmer/dsl/swt/combo_selection_data_binding_expression.rb
217
- - lib/glimmer/dsl/swt/custom_widget_expression.rb
218
- - lib/glimmer/dsl/swt/data_binding_expression.rb
219
- - lib/glimmer/dsl/swt/dialog_expression.rb
220
- - lib/glimmer/dsl/swt/display_expression.rb
221
- - lib/glimmer/dsl/swt/dsl.rb
222
- - lib/glimmer/dsl/swt/exec_expression.rb
223
- - lib/glimmer/dsl/swt/layout_data_expression.rb
224
- - lib/glimmer/dsl/swt/layout_expression.rb
225
- - lib/glimmer/dsl/swt/list_selection_data_binding_expression.rb
226
- - lib/glimmer/dsl/swt/menu_bar_expression.rb
227
- - lib/glimmer/dsl/swt/menu_expression.rb
228
- - lib/glimmer/dsl/swt/observe_expression.rb
229
- - lib/glimmer/dsl/swt/property_expression.rb
230
- - lib/glimmer/dsl/swt/rgb_expression.rb
231
- - lib/glimmer/dsl/swt/rgba_expression.rb
232
- - lib/glimmer/dsl/swt/shell_expression.rb
233
- - lib/glimmer/dsl/swt/swt_expression.rb
234
- - lib/glimmer/dsl/swt/sync_exec_expression.rb
235
- - lib/glimmer/dsl/swt/tab_item_expression.rb
236
- - lib/glimmer/dsl/swt/table_items_data_binding_expression.rb
237
- - lib/glimmer/dsl/swt/tree_items_data_binding_expression.rb
238
- - lib/glimmer/dsl/swt/tree_properties_expression.rb
239
- - lib/glimmer/dsl/swt/widget_expression.rb
240
- - lib/glimmer/dsl/swt/widget_listener_expression.rb
241
200
  - lib/glimmer/dsl/top_level_expression.rb
242
- - lib/glimmer/dsl/xml/dsl.rb
243
- - lib/glimmer/dsl/xml/html_expression.rb
244
- - lib/glimmer/dsl/xml/meta_expression.rb
245
- - lib/glimmer/dsl/xml/name_space_expression.rb
246
- - lib/glimmer/dsl/xml/node_parent_expression.rb
247
- - lib/glimmer/dsl/xml/tag_expression.rb
248
- - lib/glimmer/dsl/xml/text_expression.rb
249
- - lib/glimmer/dsl/xml/xml_expression.rb
250
201
  - lib/glimmer/error.rb
202
+ - lib/glimmer/excluded_keyword_error.rb
251
203
  - lib/glimmer/invalid_keyword_error.rb
252
- - lib/glimmer/launcher.rb
253
- - lib/glimmer/package.rb
254
- - lib/glimmer/rake_task.rb
255
- - lib/glimmer/scaffold.rb
256
- - lib/glimmer/swt/color_proxy.rb
257
- - lib/glimmer/swt/display_proxy.rb
258
- - lib/glimmer/swt/font_proxy.rb
259
- - lib/glimmer/swt/layout_data_proxy.rb
260
- - lib/glimmer/swt/layout_proxy.rb
261
- - lib/glimmer/swt/menu_proxy.rb
262
- - lib/glimmer/swt/packages.rb
263
- - lib/glimmer/swt/shell_proxy.rb
264
- - lib/glimmer/swt/swt_proxy.rb
265
- - lib/glimmer/swt/tab_item_proxy.rb
266
- - lib/glimmer/swt/tree_proxy.rb
267
- - lib/glimmer/swt/widget_listener_proxy.rb
268
- - lib/glimmer/swt/widget_proxy.rb
269
- - lib/glimmer/ui/custom_shell.rb
270
- - lib/glimmer/ui/custom_widget.rb
271
- - lib/glimmer/util/proc_tracker.rb
272
- - lib/glimmer/xml/depth_first_search_iterator.rb
273
- - lib/glimmer/xml/name_space_visitor.rb
274
- - lib/glimmer/xml/node.rb
275
- - lib/glimmer/xml/node_visitor.rb
276
- - lib/glimmer/xml/xml_visitor.rb
277
- - vendor/swt/linux/swt.jar
278
- - vendor/swt/mac/swt.jar
279
- - vendor/swt/windows/swt.jar
280
204
  homepage: http://github.com/AndyObtiva/glimmer
281
205
  licenses:
282
206
  - MIT