glimmer-dsl-swt 0.3.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce119763646f3e3ccc0211534317572ed02c5d21b9820387dec34d83b714e50f
4
- data.tar.gz: 1c4486c574ab3e8d30957133b9aab200dcfbdea10ea1c4aa0279a4991f80a0dd
3
+ metadata.gz: 3d85c2647eb91ad5e3890357021cca11cfa1e3978490079e7de7d44ae8bacb63
4
+ data.tar.gz: f5c74f67484cf9fd54c6be65c41b95f787632715d048b4186980d4b40abfe78f
5
5
  SHA512:
6
- metadata.gz: cea6c2e7ac8920d4ae87e447f08c7a622fc8851827b76160dc07b36d8c725911bf94a772aa5f47e43465a24961f7dc38b1d974a164ec3704d159dee61deb7712
7
- data.tar.gz: 8efbb95213218c052cbcc8165dc2305c41f26a42f1a374ba05fd9b5912c3a79bfbb99522a524c8cc0fa88b128c471ab22e03fb75a750b7dd31708617b4c6b4cf
6
+ metadata.gz: 7357435f443a4bc764bfcc9d4a216272f3ff3f007e69488b0da74a6decc1b4f5252bbd31982134d7358e76b4c86547429a1952a2c1c2fb15a59127a22bdb1970
7
+ data.tar.gz: 365b10848e8851b92373783666c701fff642742990218fc0652cd5d5f42ddaaad2e672062b25699500f275f83cac49bf4fb1301511b8f3b6b14cc26d8c87a921
data/README.md CHANGED
@@ -1,7 +1,8 @@
1
- # <img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 /> Glimmer DSL for SWT 0.3.1 (Desktop GUI)
1
+ # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 0.5.2 (Desktop GUI)
2
2
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-swt.svg)](http://badge.fury.io/rb/glimmer-dsl-swt)
3
3
  [![Travis CI](https://travis-ci.com/AndyObtiva/glimmer-dsl-swt.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer-dsl-swt)
4
4
  [![Coverage Status](https://coveralls.io/repos/github/AndyObtiva/glimmer-dsl-swt/badge.svg?branch=master)](https://coveralls.io/github/AndyObtiva/glimmer-dsl-swt?branch=master)
5
+ [![Maintainability](https://api.codeclimate.com/v1/badges/aaf1cba142dd351f84bd/maintainability)](https://codeclimate.com/github/AndyObtiva/glimmer-dsl-swt/maintainability)
5
6
  [![Join the chat at https://gitter.im/AndyObtiva/glimmer](https://badges.gitter.im/AndyObtiva/glimmer.svg)](https://gitter.im/AndyObtiva/glimmer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
6
7
 
7
8
  [Glimmer](https://github.com/AndyObtiva/glimmer) DSL for [SWT](https://www.eclipse.org/swt/) enables desktop development with [Glimmer](https://github.com/AndyObtiva/glimmer).
@@ -66,5 +67,11 @@ These features have been suggested. You might see them in a future version of Gl
66
67
 
67
68
  ## License
68
69
 
69
- Copyright (c) 2020 Andy Maleh.
70
- See LICENSE.txt for further details.
70
+ [MIT](https://opensource.org/licenses/MIT)
71
+
72
+ Copyright (c) 2020 - Andy Maleh.
73
+ See [LICENSE.txt](LICENSE.txt) for further details.
74
+
75
+ --
76
+
77
+ [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=40 />](https://github.com/AndyObtiva/glimmer) Built for [Glimmer](https://github.com/AndyObtiva/glimmer) (Ruby Desktop Development GUI Library).
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.5.2
@@ -21,6 +21,94 @@ module Glimmer
21
21
  @@import_swt_packages = DEFAULT_IMPORT_SWT_PACKAGES if !defined?(@@import_swt_packages) || (defined?(@@import_swt_packages) && @@import_swt_packages == true)
22
22
  @@import_swt_packages
23
23
  end
24
+
25
+ # Returns Logging Devices. Default is [:stdout, :syslog]
26
+ def logging_devices
27
+ unless defined? @@logging_devices
28
+ @@logging_devices = [:stdout, :syslog]
29
+ end
30
+ @@logging_devices
31
+ end
32
+
33
+ # Logging Devices is an array of these possible values: :stdout (default), :stderr, :file, :syslog (default), :stringio
34
+ def logging_devices=(devices)
35
+ @@logging_devices = devices
36
+ reset_logger!
37
+ end
38
+
39
+ def logging_device_file_options
40
+ @@logging_device_file_options = {size: 1_000_000, age: 'daily', roll_by: 'number'} unless defined? @@logging_device_file_options
41
+ @@logging_device_file_options
42
+ end
43
+
44
+ def logging_device_file_options=(custom_options)
45
+ @@logging_device_file_options = custom_options
46
+ reset_logger!
47
+ end
48
+
49
+ def logging_appender_options
50
+ @@logging_appender_options = {async: true, auto_flushing: 500, write_size: 500, flush_period: 60, immediate_at: [:error, :fatal], layout: logging_layout} unless defined? @@logging_appender_options
51
+ @@logging_appender_options
52
+ end
53
+
54
+ def logging_appender_options=(custom_options)
55
+ @@logging_appender_options = custom_options
56
+ reset_logger!
57
+ end
58
+
59
+ def logging_layout
60
+ unless defined? @@logging_layout
61
+ @@logging_layout = Logging.layouts.pattern(
62
+ pattern: '[%d] %-5l %c: %m\n',
63
+ date_pattern: '%Y-%m-%d %H:%M:%S'
64
+ )
65
+ end
66
+ @@logging_layout
67
+ end
68
+
69
+ def logging_layout=(custom_layout)
70
+ @@logging_layout = custom_layout
71
+ reset_logger!
72
+ end
73
+
74
+ def reset_logger!
75
+ @first_time = !defined?(@@logger)
76
+ old_level = logger.level unless @first_time
77
+ self.logger = Logging.logger['glimmer'].tap do |logger|
78
+ logger.level = old_level || :error
79
+ appenders = []
80
+ appenders << Logging.appenders.stdout(logging_appender_options) if logging_devices.include?(:stdout)
81
+ appenders << Logging.appenders.stderr(logging_appender_options) if logging_devices.include?(:stderr)
82
+ if logging_devices.include?(:file)
83
+ require 'fileutils'
84
+ FileUtils.mkdir_p('log')
85
+ appenders << Logging.appenders.rolling_file('log/glimmer.log', logging_appender_options.merge(logging_device_file_options)) if logging_devices.include?(:file)
86
+ end
87
+ if Object.const_defined?(:Syslog) && logging_devices.include?(:syslog)
88
+ Syslog.close if Syslog.opened?
89
+ appenders << Logging.appenders.syslog('glimmer', logging_appender_options)
90
+ end
91
+ logger.appenders = appenders
92
+ end
93
+ end
24
94
  end
25
95
  end
26
96
  end
97
+
98
+ Glimmer::Config.reset_logger!
99
+ if ENV['GLIMMER_LOGGER_LEVEL']
100
+ # if glimmer log level is being overridden for debugging purposes, then disable async logging making logging immediate
101
+ Glimmer::Config.logging_appender_options = Glimmer::Config.logging_appender_options.merge(async: false, auto_flushing: 1)
102
+ Glimmer::Config.logging_devices = [:stdout]
103
+ Glimmer::Config.logger.level = ENV['GLIMMER_LOGGER_LEVEL']
104
+ end
105
+ Glimmer::Config.excluded_keyword_checkers << lambda do |method_symbol, *args|
106
+ method = method_symbol.to_s
107
+ result = false
108
+ result ||= method.start_with?('on_swt_') && is_a?(Glimmer::UI::CustomWidget) && respond_to?(method)
109
+ result ||= method == 'dispose' && is_a?(Glimmer::UI::CustomWidget) && respond_to?(method)
110
+ result ||= ['drag_source_proxy', 'drop_target_proxy'].include?(method) && is_a?(Glimmer::UI::CustomWidget)
111
+ result ||= method == 'post_initialize_child'
112
+ result ||= method.end_with?('=')
113
+ result ||= ['finish_edit!', 'search', 'all_tree_items', 'depth_first_search'].include?(method) && is_a?(Glimmer::UI::CustomWidget) && body_root.respond_to?(method)
114
+ end
@@ -6,9 +6,10 @@ if ENV['BUNDLER_REQUIRE'].to_s.downcase == 'true'
6
6
  require 'bundler'
7
7
  Bundler.require
8
8
  else
9
+ require 'glimmer'
10
+ require 'logging'
9
11
  require 'nested_inherited_jruby_include_package'
10
12
  require 'super_module'
11
- require 'glimmer'
12
13
  end
13
14
 
14
15
  # Internal requires
@@ -23,16 +23,18 @@ module Glimmer
23
23
  @table.body_root.column_properties = @column_properties
24
24
  end
25
25
  call(@model_binding.evaluate_property)
26
- observe(model_binding)
26
+ @table_observer_registration = observe(model_binding)
27
27
  @table.on_widget_disposed do |dispose_event|
28
28
  unregister_all_observables
29
29
  end
30
30
  end
31
31
 
32
32
  def call(new_model_collection=nil)
33
- new_model_collection = @model_binding.evaluate_property # this ensures applying converters (e.g. :on_read)
33
+ new_model_collection = @model_binding.evaluate_property # this ensures applying converters (e.g. :on_read)
34
34
  if new_model_collection and new_model_collection.is_a?(Array)
35
- observe(new_model_collection, @column_properties)
35
+ @table_items_observer_registration&.unobserve
36
+ @table_items_observer_registration = observe(new_model_collection, @column_properties)
37
+ add_dependent(@table_observer_registration => @table_items_observer_registration)
36
38
  @model_collection = new_model_collection
37
39
  end
38
40
  populate_table(@model_collection, @table, @column_properties)
@@ -41,6 +43,7 @@ module Glimmer
41
43
  def populate_table(model_collection, parent, column_properties)
42
44
  selected_table_item_models = parent.swt_widget.getSelection.map(&:getData)
43
45
  parent.finish_edit!
46
+ parent.swt_widget.items.each(&:dispose)
44
47
  parent.swt_widget.removeAll
45
48
  model_collection.each do |model|
46
49
  table_item = TableItem.new(parent.swt_widget, SWT::SWTProxy[:none])
@@ -52,6 +55,7 @@ module Glimmer
52
55
  selected_table_items = parent.search {|item| selected_table_item_models.include?(item.getData) }
53
56
  selected_table_items = [parent.swt_widget.getItems.first].to_java(TableItem) if selected_table_items.empty? && !parent.swt_widget.getItems.empty?
54
57
  parent.swt_widget.setSelection(selected_table_items) unless selected_table_items.empty?
58
+ parent.sort
55
59
  end
56
60
  end
57
61
  end
@@ -41,10 +41,9 @@ module Glimmer
41
41
  old_tree_items = parent.all_tree_items
42
42
  old_tree_item_expansion_by_data = old_tree_items.reduce({}) {|hash, ti| hash.merge(ti.getData => ti.getExpanded)}
43
43
  old_tree_items.each do |tree_item|
44
- tree_item.getData('observer_registrations').each do |key, observer_registration|
45
- observer_registration.unregister
46
- end
44
+ tree_item.getData('observer_registrations').each(&:unregister)
47
45
  end
46
+ parent.swt_widget.items.each(&:dispose)
48
47
  parent.swt_widget.removeAll
49
48
  populate_tree_node(model_tree_root_node, parent.swt_widget, tree_properties)
50
49
  parent.all_tree_items.each { |ti| ti.setExpanded(!!old_tree_item_expansion_by_data[ti.getData]) }
@@ -54,10 +53,9 @@ module Glimmer
54
53
 
55
54
  def populate_tree_node(model_tree_node, parent, tree_properties)
56
55
  return if model_tree_node.nil?
57
- # TODO anticipate default tree properties if none were passed (like literal values text and children)
58
56
  tree_item = TreeItem.new(parent, SWT::SWTProxy[:none])
59
- observer_registrations = @tree_properties.reduce({}) do |hash, key_value_pair|
60
- hash.merge(key_value_pair.first => observe(model_tree_node, key_value_pair.last))
57
+ observer_registrations = @tree_properties.reduce([]) do |array, key_value_pair|
58
+ array + [observe(model_tree_node, key_value_pair.last)]
61
59
  end
62
60
  tree_item.setData('observer_registrations', observer_registrations)
63
61
  tree_item.setData(model_tree_node)
@@ -1,3 +1,4 @@
1
+
1
2
  require 'glimmer'
2
3
  require 'glimmer/dsl/expression'
3
4
  require 'glimmer/dsl/parent_expression'
@@ -20,7 +20,7 @@ module Glimmer
20
20
  end
21
21
 
22
22
  def interpret(parent, keyword, *args, &block)
23
- Glimmer::SWT::DisplayProxy.instance.send(exec_operation, &block)
23
+ Glimmer::SWT::DisplayProxy.instance.swt_display.send(exec_operation, &block)
24
24
  end
25
25
  end
26
26
  end
@@ -18,7 +18,7 @@ module Glimmer
18
18
  if parent.swt_widget.is_a?(TabFolder)
19
19
  return true
20
20
  else
21
- Glimmer::Config.logger&.error "tab_item widget may only be used directly under a tab_folder widget!"
21
+ Glimmer::Config.logger.error {"tab_item widget may only be used directly under a tab_folder widget!"}
22
22
  end
23
23
  end
24
24
  false
@@ -8,17 +8,17 @@ module Glimmer
8
8
  include_package 'org.eclipse.swt.widgets'
9
9
 
10
10
  def can_interpret?(parent, keyword, *args, &block)
11
- Glimmer::Config.logger&.debug "keyword starts with on_: #{keyword.start_with?('on_')}"
11
+ Glimmer::Config.logger.debug {"keyword starts with on_: #{keyword.start_with?('on_')}"}
12
12
  return false unless keyword.start_with?('on_')
13
13
  widget_or_display_parentage = parent.respond_to?(:swt_widget) || parent.is_a?(Glimmer::SWT::DisplayProxy)
14
- Glimmer::Config.logger&.debug "parent is a widget or display: #{widget_or_display_parentage}"
14
+ Glimmer::Config.logger.debug {"parent #{parent} is a widget or display: #{widget_or_display_parentage}"}
15
15
  return false unless widget_or_display_parentage
16
- Glimmer::Config.logger&.debug "block exists?: #{!block.nil?}"
16
+ Glimmer::Config.logger.debug {"block exists?: #{!block.nil?}"}
17
17
  raise Glimmer::Error, "Listener is missing block for keyword: #{keyword}" unless block_given?
18
- Glimmer::Config.logger&.debug "args are empty?: #{args.empty?}"
18
+ Glimmer::Config.logger.debug {"args are empty?: #{args.empty?}"}
19
19
  raise Glimmer::Error, "Invalid listener arguments for keyword: #{keyword}(#{args})" unless args.empty?
20
20
  result = parent.can_handle_observation_request?(keyword)
21
- Glimmer::Config.logger&.debug "can add listener? #{result}"
21
+ Glimmer::Config.logger.debug {"can add listener? #{result}"}
22
22
  raise Glimmer::Error, "Invalid listener keyword: #{keyword}" unless result
23
23
  true
24
24
  end
@@ -17,7 +17,7 @@ module Glimmer
17
17
  project_name = File.basename(File.expand_path('.'))
18
18
  if !File.exists?('config/warble.rb')
19
19
  puts 'Generating JAR configuration (config/warble.rb) to use with Warbler...'
20
- system('mkdir -p config')
20
+ FileUtils.mkdir_p('config')
21
21
  system('warble config')
22
22
  new_config = File.read('config/warble.rb').split("\n").inject('') do |output, line|
23
23
  if line.include?('config.dirs =')
@@ -36,7 +36,7 @@ module Glimmer
36
36
  end
37
37
 
38
38
  def jar
39
- system('mkdir -p dist')
39
+ FileUtils.mkdir_p('dist')
40
40
  puts "Generating JAR with Warbler..."
41
41
  system('warble')
42
42
  end
@@ -49,11 +49,13 @@ module Glimmer
49
49
  version = (File.read(version_file).strip if File.exists?(version_file) && File.file?(version_file)) rescue nil
50
50
  license_file = File.expand_path('./LICENSE.txt')
51
51
  license = (File.read(license_file).strip if File.exists?(license_file) && File.file?(license_file)) rescue nil
52
+ copyright = license.split("\n").first
52
53
  human_name = project_name.underscore.titlecase
53
- command = "javapackager -deploy -native -outdir packages -outfile \"#{project_name}\" -srcfiles \"dist/#{project_name}.jar\" -appclass JarMain -name \"#{human_name}\" -title \"#{human_name}\" -Bmac.CFBundleName=\"#{human_name}\" -Bmac.CFBundleIdentifier=\"org.#{project_name}.application.#{project_name}\" -Bmac.category=\"public.app-category.business\" "
54
+ command = "javapackager -deploy -native -outdir packages -outfile \"#{project_name}\" -srcfiles \"dist/#{project_name}.jar\" -appclass JarMain -name \"#{human_name}\" -title \"#{human_name}\" -Bmac.CFBundleName=\"#{human_name}\" -Bmac.CFBundleIdentifier=\"org.#{project_name}.application.#{project_name}\" -Bmac.category=\"public.app-category.business\" -BinstalldirChooser=true -Bvendor=\"#{human_name}\" -Bwin.menuGroup=\"#{human_name}\" -BsystemWide=#{OS.mac?} "
54
55
  command += " -BjvmOptions=-XstartOnFirstThread " if OS.mac?
55
56
  command += " -BappVersion=#{version} -Bmac.CFBundleVersion=#{version} " if version
56
57
  command += " -srcfiles LICENSE.txt -BlicenseFile=LICENSE.txt " if license
58
+ command += " -Bcopyright=\"#{copyright}\" " if copyright
57
59
  command += " #{javapackager_extra_args} " if javapackager_extra_args
58
60
  command += " #{ENV['JAVAPACKAGER_EXTRA_ARGS']} " if ENV['JAVAPACKAGER_EXTRA_ARGS']
59
61
  puts "Generating DMG/PKG/APP/JNLP with javapackager..."
@@ -33,57 +33,97 @@ namespace :glimmer do
33
33
  end
34
34
 
35
35
 
36
- desc 'Scaffold a Glimmer application directory structure to begin building a new app'
36
+ desc 'Scaffold Glimmer application directory structure to build a new app'
37
37
  task :scaffold, [:app_name] do |t, args|
38
38
  require_relative 'scaffold'
39
39
  Scaffold.app(args[:app_name])
40
40
  end
41
41
 
42
42
  namespace :scaffold do
43
- desc 'Scaffold a Glimmer::UI::CustomShell subclass (represents a full window view) under app/views (namespace is optional)'
44
- task :custom_shell, [:custom_shell_name, :namespace] do |t, args|
43
+ desc 'Scaffold Glimmer::UI::CustomShell subclass (full window view) under app/views (namespace is optional) [alt: scaffold:cs]'
44
+ task :customshell, [:name, :namespace] do |t, args|
45
45
  require_relative 'scaffold'
46
- Scaffold.custom_shell(args[:custom_shell_name], args[:namespace])
46
+ Scaffold.custom_shell(args[:name], args[:namespace])
47
47
  end
48
48
 
49
- desc 'Scaffold a Glimmer::UI::CustomWidget subclass (represents a part of a view) under app/views (namespace is optional)'
50
- task :custom_widget, [:custom_widget_name, :namespace] do |t, args|
51
- require_relative 'scaffold'
52
- Scaffold.custom_widget(args[:custom_widget_name], args[:namespace])
53
- end
49
+ task :cs, [:name, :namespace] => :customshell
50
+ task :custom_shell, [:name, :namespace] => :customshell
51
+ task :"custom-shell", [:name, :namespace] => :customshell
54
52
 
55
- desc 'Scaffold a Glimmer::UI::CustomShell subclass (represents a full window view) under its own Ruby gem + app project (namespace is required)'
56
- task :custom_shell_gem, [:custom_shell_name, :namespace] do |t, args|
53
+ desc 'Scaffold Glimmer::UI::CustomWidget subclass (part of a view) under app/views (namespace is optional) [alt: scaffold:cw]'
54
+ task :customwidget, [:name, :namespace] do |t, args|
57
55
  require_relative 'scaffold'
58
- Scaffold.custom_shell_gem(args[:custom_shell_name], args[:namespace])
56
+ Scaffold.custom_widget(args[:name], args[:namespace])
59
57
  end
60
58
 
61
- desc 'Scaffold a Glimmer::UI::CustomWidget subclass (represents a part of a view) under its own Ruby gem project (namespace is required)'
62
- task :custom_widget_gem, [:custom_widget_name, :namespace] do |t, args|
63
- require_relative 'scaffold'
64
- Scaffold.custom_widget_gem(args[:custom_widget_name], args[:namespace])
59
+ task :cw, [:name, :namespace] => :customwidget
60
+ task :custom_widget, [:name, :namespace] => :customwidget
61
+ task :"custom-widget", [:name, :namespace] => :customwidget
62
+
63
+ namespace :gem do
64
+ desc 'Scaffold Glimmer::UI::CustomShell subclass (full window view) under its own Ruby gem + app project (namespace is required) [alt: scaffold:gem:cs]'
65
+ task :customshell, [:name, :namespace] do |t, args|
66
+ require_relative 'scaffold'
67
+ Scaffold.custom_shell_gem(args[:name], args[:namespace])
68
+ end
69
+
70
+ task :cs, [:name, :namespace] => :customshell
71
+ task :custom_shell, [:name, :namespace] => :customshell
72
+ task :"custom-shell", [:name, :namespace] => :customshell
73
+
74
+ desc 'Scaffold Glimmer::UI::CustomWidget subclass (part of a view) under its own Ruby gem project (namespace is required) [alt: scaffold:gem:cw]'
75
+ task :customwidget, [:name, :namespace] do |t, args|
76
+ require_relative 'scaffold'
77
+ Scaffold.custom_widget_gem(args[:name], args[:namespace])
78
+ end
79
+
80
+ task :cw, [:name, :namespace] => :customwidget
81
+ task :custom_widget, [:name, :namespace] => :customwidget
82
+ task :"custom-widget", [:name, :namespace] => :customwidget
65
83
  end
84
+
85
+ # legacy support
86
+
87
+ task :custom_shell_gem, [:name, :namespace] => 'gem:customshell'
88
+ task :custom_widget_gem, [:name, :namespace] => 'gem:customwidget'
89
+
66
90
  end
67
91
 
68
92
  namespace :list do
69
93
  task :list_require do
70
94
  require_relative 'rake_task/list'
71
95
  end
72
-
73
- desc 'List Glimmer custom widget gems available at rubygems.org (query is optional)'
74
- task :custom_widget_gems, [:query] => :list_require do |t, args|
75
- Glimmer::RakeTask::List.custom_widget_gems(args[:query])
76
- end
77
96
 
78
- desc 'List Glimmer custom shell gems available at rubygems.org (query is optional)'
79
- task :custom_shell_gems, [:query] => :list_require do |t, args|
80
- Glimmer::RakeTask::List.custom_shell_gems(args[:query])
81
- end
97
+ namespace :gems do
98
+ desc 'List Glimmer custom widget gems available at rubygems.org (query is optional) [alt: list:gems:cw]'
99
+ task :customwidget, [:query] => :list_require do |t, args|
100
+ Glimmer::RakeTask::List.custom_widget_gems(args[:query])
101
+ end
102
+
103
+ task :cw, [:query] => :customwidget
104
+ task :custom_widget, [:query] => :customwidget
105
+ task :"custom-widget", [:query] => :customwidget
106
+
107
+ desc 'List Glimmer custom shell gems available at rubygems.org (query is optional) [alt: list:gems:cs]'
108
+ task :customshell, [:query] => :list_require do |t, args|
109
+ Glimmer::RakeTask::List.custom_shell_gems(args[:query])
110
+ end
111
+
112
+ task :cs, [:query] => :customshell
113
+ task :custom_shell, [:query] => :customshell
114
+ task :"custom-shell", [:query] => :customshell
115
+
116
+ desc 'List Glimmer DSL gems available at rubygems.org (query is optional)'
117
+ task :dsl, [:query] => :list_require do |t, args|
118
+ Glimmer::RakeTask::List.dsl_gems(args[:query])
119
+ end
82
120
 
83
- desc 'List Glimmer DSL gems available at rubygems.org (query is optional)'
84
- task :dsl_gems, [:query] => :list_require do |t, args|
85
- Glimmer::RakeTask::List.dsl_gems(args[:query])
86
121
  end
87
122
 
123
+ # legacy support
124
+
125
+ task :custom_shell_gems, [:name, :namespace] => 'gems:customshell'
126
+ task :custom_widget_gems, [:name, :namespace] => 'gems:customwidget'
127
+
88
128
  end
89
129
  end
@@ -48,6 +48,17 @@ module Glimmer
48
48
  end
49
49
  @swt_color
50
50
  end
51
+
52
+ def method_missing(method, *args, &block)
53
+ swt_color.send(method, *args, &block)
54
+ rescue => e
55
+ Glimmer::Config.logger.debug {"Neither ColorProxy nor #{swt_color.class.name} can handle the method ##{method}"}
56
+ super
57
+ end
58
+
59
+ def respond_to?(method, *args, &block)
60
+ super || swt_color.respond_to?(method, *args, &block)
61
+ end
51
62
  end
52
63
  end
53
64
  end
@@ -33,26 +33,24 @@ module Glimmer
33
33
 
34
34
  def initialize(*args)
35
35
  @swt_display = Display.new(*args)
36
+ @swt_display.set_data('proxy', self)
36
37
  end
37
38
 
38
- def dispose
39
- @swt_display.dispose
39
+ def method_missing(method, *args, &block)
40
+ swt_display.send(method, *args, &block)
41
+ rescue => e
42
+ Glimmer::Config.logger.debug {"Neither DisplayProxy nor #{swt_display.class.name} can handle the method ##{method}"}
43
+ super
40
44
  end
41
-
42
- # Executes code block asynchronously with respect to SWT UI thread
43
- def async_exec(&block)
44
- @swt_display.asyncExec(&block)
45
- end
46
-
47
- # Executes code block synchronously with respect to SWT UI thread
48
- def sync_exec(&block)
49
- @swt_display.syncExec(&block)
45
+
46
+ def respond_to?(method, *args, &block)
47
+ super || swt_display.respond_to?(method, *args, &block)
50
48
  end
51
49
 
52
50
  def can_handle_observation_request?(observation_request)
53
51
  observation_request = observation_request.to_s
54
- if observation_request.start_with?('on_event_')
55
- constant_name = observation_request.sub(/^on_event_/, '')
52
+ if observation_request.start_with?('on_swt_')
53
+ constant_name = observation_request.sub(/^on_swt_/, '')
56
54
  SWTProxy.has_constant?(constant_name)
57
55
  elsif observation_request.start_with?('on_')
58
56
  event_name = observation_request.sub(/^on_/, '')
@@ -63,8 +61,8 @@ module Glimmer
63
61
  end
64
62
 
65
63
  def handle_observation_request(observation_request, &block)
66
- if observation_request.start_with?('on_event_')
67
- constant_name = observation_request.sub(/^on_event_/, '')
64
+ if observation_request.start_with?('on_swt_')
65
+ constant_name = observation_request.sub(/^on_swt_/, '')
68
66
  add_swt_event_listener(constant_name, &block)
69
67
  elsif observation_request.start_with?('on_')
70
68
  event_name = observation_request.sub(/^on_/, '')
@@ -31,7 +31,7 @@ module Glimmer
31
31
  begin
32
32
  @swt_layout_data = swt_layout_data_class.new(*args)
33
33
  rescue => e
34
- Glimmer::Config.logger&.debug "#{e.message}\n#{e.backtrace.join("\n")}"
34
+ Glimmer::Config.logger.debug {"#{e.message}\n#{e.backtrace.join("\n")}"}
35
35
  @swt_layout_data = args.first if args.count == 1
36
36
  end
37
37
  @widget_proxy.swt_widget.setLayoutData(@swt_layout_data)
@@ -34,8 +34,8 @@ module Glimmer
34
34
  end
35
35
  swt_layout_class
36
36
  rescue => e
37
- Glimmer::Config.logger&.debug e.message
38
- # Glimmer::Config.logger&.debug "#{e.message}\n#{e.backtrace.join("\n")}"
37
+ Glimmer::Config.logger.debug {e.message}
38
+ # Glimmer::Config.logger.debug {"#{e.message}\n#{e.backtrace.join("\n")}"}
39
39
  raise e
40
40
  end
41
41
  end
@@ -15,11 +15,13 @@ module Glimmer
15
15
 
16
16
  def initialize(parent, style)
17
17
  parent = parent.swt_widget if parent.respond_to?(:swt_widget) && parent.swt_widget.is_a?(Shell)
18
+ @temporary_parent = parent = Glimmer::SWT::ShellProxy.new.swt_widget if parent.nil?
18
19
  @swt_widget = MessageBox.new(parent, style)
19
20
  end
20
21
 
21
22
  def open
22
23
  @swt_widget.open
24
+ @temporary_parent&.dispose
23
25
  end
24
26
 
25
27
  # TODO refactor the following methods to put in a JavaBean mixin or somethin (perhaps contribute to OSS project too)
@@ -40,9 +40,10 @@ module Glimmer
40
40
  end
41
41
  args = args.compact
42
42
  @swt_widget = Shell.new(*args)
43
+ @swt_widget.set_data('proxy', self)
43
44
  @swt_widget.setLayout(FillLayout.new)
44
45
  @swt_widget.setMinimumSize(WIDTH_MIN, HEIGHT_MIN)
45
- on_event_show do
46
+ on_swt_show do
46
47
  Thread.new do
47
48
  sleep(0.25)
48
49
  async_exec do
@@ -83,10 +84,6 @@ module Glimmer
83
84
  @swt_widget.setVisible(false)
84
85
  end
85
86
 
86
- def close
87
- @swt_widget.close
88
- end
89
-
90
87
  def visible?
91
88
  @swt_widget.isDisposed ? false : @swt_widget.isVisible
92
89
  end
@@ -133,7 +130,7 @@ module Glimmer
133
130
  begin
134
131
  @display.sleep unless @display.readAndDispatch
135
132
  rescue => e
136
- Glimmer::Config.logger&.debug e.full_message
133
+ Glimmer::Config.logger.debug {e.full_message}
137
134
  end
138
135
  end
139
136
  end
@@ -144,9 +141,9 @@ module Glimmer
144
141
  visibility_notifier = proc do
145
142
  observer.call(visible?)
146
143
  end
147
- on_event_show(&visibility_notifier)
148
- on_event_hide(&visibility_notifier)
149
- on_event_close(&visibility_notifier)
144
+ on_swt_show(&visibility_notifier)
145
+ on_swt_hide(&visibility_notifier)
146
+ on_swt_close(&visibility_notifier)
150
147
  else
151
148
  super
152
149
  end
@@ -61,12 +61,12 @@ module Glimmer
61
61
  negative ? ~bit_value : bit_value
62
62
  rescue => e
63
63
  begin
64
- # Glimmer::Config.logger&.debug(e.full_message)
64
+ # Glimmer::Config.logger.debug {e.full_message}
65
65
  alternative_swt_constant_symbol = constant_source_class.constants.find {|c| c.to_s.upcase == swt_constant_symbol.to_s.upcase}
66
66
  bit_value = constant_source_class.const_get(alternative_swt_constant_symbol)
67
67
  negative ? ~bit_value : bit_value
68
68
  rescue => e
69
- # Glimmer::Config.logger&.debug(e.full_message)
69
+ # Glimmer::Config.logger.debug {e.full_message}
70
70
  bit_value = extra_styles[swt_constant_symbol]
71
71
  if bit_value
72
72
  negative ? ~bit_value : bit_value
@@ -61,6 +61,7 @@ module Glimmer
61
61
  combo: {
62
62
  widget_value_property: :text,
63
63
  editor_gui: lambda do |args, model, property, table_proxy|
64
+ first_time = true
64
65
  table_proxy.table_editor.minimumHeight = 25
65
66
  table_editor_widget_proxy = combo(*args) {
66
67
  items model.send("#{property}_options")
@@ -77,7 +78,9 @@ module Glimmer
77
78
  end
78
79
  }
79
80
  on_widget_selected {
80
- table_proxy.finish_edit!
81
+ if !OS.windows? || !first_time || first_time && model.send(property) != table_editor_widget_proxy.swt_widget.text
82
+ table_proxy.finish_edit!
83
+ end
81
84
  }
82
85
  }
83
86
  table_editor_widget_proxy
@@ -87,7 +90,7 @@ module Glimmer
87
90
  end
88
91
  end
89
92
 
90
- attr_reader :table_editor, :table_editor_text_proxy, :table_editor_widget_proxy, :sort_property, :sort_direction, :sort_block, :sort_type, :sort_by_block, :additional_sort_properties, :editor
93
+ attr_reader :table_editor, :table_editor_widget_proxy, :sort_property, :sort_direction, :sort_block, :sort_type, :sort_by_block, :additional_sort_properties, :editor
91
94
  attr_accessor :column_properties
92
95
 
93
96
  def initialize(underscored_widget_name, parent, args)
@@ -293,11 +296,11 @@ module Glimmer
293
296
  end
294
297
 
295
298
  content {
296
- @table_editor_widget_proxy = @table_editor_text_proxy = TableProxy::editors[editor_widget][:editor_gui].call(editor_widget_args, model, model_editing_property, self)
299
+ @table_editor_widget_proxy = TableProxy::editors[editor_widget][:editor_gui].call(editor_widget_args, model, model_editing_property, self)
297
300
  }
298
301
  @table_editor.setEditor(@table_editor_widget_proxy.swt_widget, table_item, column_index)
299
302
  rescue => e
300
- Glimmer::Config.logger&.error e.full_message
303
+ Glimmer::Config.logger.error {e.full_message}
301
304
  raise e
302
305
  end
303
306
 
@@ -3,7 +3,6 @@ require 'glimmer/swt/color_proxy'
3
3
  require 'glimmer/swt/font_proxy'
4
4
  require 'glimmer/swt/swt_proxy'
5
5
  require 'glimmer/swt/dnd_proxy'
6
- require 'glimmer/data_binding/observable_widget'
7
6
 
8
7
  # TODO refactor to make file smaller and extract sub-widget-proxies out of this
9
8
 
@@ -20,11 +19,10 @@ module Glimmer
20
19
  # Follows the Proxy Design Pattern
21
20
  class WidgetProxy
22
21
  include Packages
23
- include DataBinding::ObservableWidget
24
22
 
25
23
  DEFAULT_STYLES = {
26
24
  "text" => [:border],
27
- "table" => [:border],
25
+ "table" => [:virtual, :border, :full_selection],
28
26
  "tree" => [:virtual, :border, :h_scroll, :v_scroll],
29
27
  "spinner" => [:border],
30
28
  "styled_text" => [:border],
@@ -60,6 +58,7 @@ module Glimmer
60
58
  styles, extra_options = extract_args(underscored_widget_name, args)
61
59
  swt_widget_class = self.class.swt_widget_class_for(underscored_widget_name)
62
60
  @swt_widget = swt_widget_class.new(parent.swt_widget, style(underscored_widget_name, styles), *extra_options)
61
+ @swt_widget.set_data('proxy', self)
63
62
  DEFAULT_INITIALIZERS[underscored_widget_name]&.call(@swt_widget)
64
63
  parent.post_initialize_child(self)
65
64
  end
@@ -176,44 +175,44 @@ module Glimmer
176
175
  }
177
176
  end,
178
177
  :caret_position => lambda do |observer|
179
- on_event_keydown { |event|
178
+ on_swt_keydown { |event|
180
179
  observer.call(@swt_widget.getCaretPosition)
181
180
  }
182
- on_event_keyup { |event|
181
+ on_swt_keyup { |event|
183
182
  observer.call(@swt_widget.getCaretPosition)
184
183
  }
185
- on_event_mousedown { |event|
184
+ on_swt_mousedown { |event|
186
185
  observer.call(@swt_widget.getCaretPosition)
187
186
  }
188
- on_event_mouseup { |event|
187
+ on_swt_mouseup { |event|
189
188
  observer.call(@swt_widget.getCaretPosition)
190
189
  }
191
190
  end,
192
191
  :selection => lambda do |observer|
193
- on_event_keydown { |event|
192
+ on_swt_keydown { |event|
194
193
  observer.call(@swt_widget.getSelection)
195
194
  }
196
- on_event_keyup { |event|
195
+ on_swt_keyup { |event|
197
196
  observer.call(@swt_widget.getSelection)
198
197
  }
199
- on_event_mousedown { |event|
198
+ on_swt_mousedown { |event|
200
199
  observer.call(@swt_widget.getSelection)
201
200
  }
202
- on_event_mouseup { |event|
201
+ on_swt_mouseup { |event|
203
202
  observer.call(@swt_widget.getSelection)
204
203
  }
205
204
  end,
206
205
  :selection_count => lambda do |observer|
207
- on_event_keydown { |event|
206
+ on_swt_keydown { |event|
208
207
  observer.call(@swt_widget.getSelectionCount)
209
208
  }
210
- on_event_keyup { |event|
209
+ on_swt_keyup { |event|
211
210
  observer.call(@swt_widget.getSelectionCount)
212
211
  }
213
- on_event_mousedown { |event|
212
+ on_swt_mousedown { |event|
214
213
  observer.call(@swt_widget.getSelectionCount)
215
214
  }
216
- on_event_mouseup { |event|
215
+ on_swt_mouseup { |event|
217
216
  observer.call(@swt_widget.getSelectionCount)
218
217
  }
219
218
  end,
@@ -267,17 +266,17 @@ module Glimmer
267
266
  swt_widget_name = underscored_widget_name.camelcase(:upper)
268
267
  swt_widget_class = eval(swt_widget_name)
269
268
  unless swt_widget_class.ancestors.include?(org.eclipse.swt.widgets.Widget)
270
- Glimmer::Config.logger&.debug("Class #{swt_widget_class} matching #{underscored_widget_name} is not a subclass of org.eclipse.swt.widgets.Widget")
269
+ Glimmer::Config.logger.debug {"Class #{swt_widget_class} matching #{underscored_widget_name} is not a subclass of org.eclipse.swt.widgets.Widget"}
271
270
  return nil
272
271
  end
273
272
  swt_widget_class
274
273
  rescue SyntaxError, NameError => e
275
- Glimmer::Config.logger&.debug e.full_message
276
- # Glimmer::Config.logger&.debug("#{e.message}\n#{e.backtrace.join("\n")}")
274
+ Glimmer::Config.logger.debug {e.full_message}
275
+ # Glimmer::Config.logger.debug {"#{e.message}\n#{e.backtrace.join("\n")}"}
277
276
  nil
278
277
  rescue => e
279
- Glimmer::Config.logger&.debug e.full_message
280
- # Glimmer::Config.logger&.debug("#{e.message}\n#{e.backtrace.join("\n")}")
278
+ Glimmer::Config.logger.debug {e.full_message}
279
+ # Glimmer::Config.logger.debug {"#{e.message}\n#{e.backtrace.join("\n")}"}
281
280
  nil
282
281
  end
283
282
 
@@ -336,10 +335,10 @@ module Glimmer
336
335
 
337
336
  # TODO eliminate duplication in the following methods perhaps by relying on exceptions
338
337
 
339
- def can_handle_observation_request?(observation_request)
338
+ def can_handle_observation_request?(observation_request)
340
339
  observation_request = observation_request.to_s
341
- if observation_request.start_with?('on_event_')
342
- constant_name = observation_request.sub(/^on_event_/, '')
340
+ if observation_request.start_with?('on_swt_')
341
+ constant_name = observation_request.sub(/^on_swt_/, '')
343
342
  SWTProxy.has_constant?(constant_name)
344
343
  elsif observation_request.start_with?('on_')
345
344
  event = observation_request.sub(/^on_/, '')
@@ -357,6 +356,9 @@ module Glimmer
357
356
  @drag_source_proxy = nil
358
357
  end
359
358
  end
359
+ rescue => e
360
+ Glimmer::Config.logger.debug {e.full_message}
361
+ false
360
362
  end
361
363
 
362
364
  def can_handle_drop_observation_request?(observation_request)
@@ -372,8 +374,9 @@ module Glimmer
372
374
  end
373
375
 
374
376
  def handle_observation_request(observation_request, &block)
375
- if observation_request.start_with?('on_event_')
376
- constant_name = observation_request.sub(/^on_event_/, '')
377
+ observation_request = observation_request.to_s
378
+ if observation_request.start_with?('on_swt_')
379
+ constant_name = observation_request.sub(/^on_swt_/, '')
377
380
  add_swt_event_listener(constant_name, &block)
378
381
  elsif observation_request.start_with?('on_')
379
382
  event = observation_request.sub(/^on_/, '')
@@ -392,6 +395,23 @@ module Glimmer
392
395
  Glimmer::DSL::Engine.add_content(self, Glimmer::DSL::SWT::WidgetExpression.new, &block)
393
396
  end
394
397
 
398
+ def method_missing(method, *args, &block)
399
+ if can_handle_observation_request?(method)
400
+ handle_observation_request(method, &block)
401
+ else
402
+ swt_widget.send(method, *args, &block)
403
+ end
404
+ rescue => e
405
+ Glimmer::Config.logger.debug {"Neither WidgetProxy nor #{swt_widget.class.name} can handle the method ##{method}"}
406
+ super
407
+ end
408
+
409
+ def respond_to?(method, *args, &block)
410
+ super ||
411
+ can_handle_observation_request?(method) ||
412
+ swt_widget.respond_to?(method, *args, &block)
413
+ end
414
+
395
415
  private
396
416
 
397
417
  def style(underscored_widget_name, styles)
@@ -437,7 +457,7 @@ module Glimmer
437
457
  def add_listener(underscored_listener_name, &block)
438
458
  widget_add_listener_method, listener_class, listener_method = self.class.find_listener(@swt_widget.getClass, underscored_listener_name)
439
459
  widget_listener_proxy = nil
440
- safe_block = lambda { |event| block.call(event) unless @swt_widget.isDisposed }
460
+ safe_block = lambda { |*args| block.call(*args) unless @swt_widget.isDisposed }
441
461
  listener = listener_class.new(listener_method => safe_block)
442
462
  @swt_widget.send(widget_add_listener_method, listener)
443
463
  widget_listener_proxy = WidgetListenerProxy.new(swt_widget: @swt_widget, swt_listener: listener, widget_add_listener_method: widget_add_listener_method, swt_listener_class: listener_class, swt_listener_method: listener_method)
@@ -479,9 +499,9 @@ module Glimmer
479
499
  listener_class.define_method('initialize') do |event_method_block_mapping|
480
500
  @event_method_block_mapping = event_method_block_mapping
481
501
  end
482
- listener_type.getMethods.each do |event_method|
483
- listener_class.define_method(event_method.getName) do |event|
484
- @event_method_block_mapping[event_method.getName]&.call(event)
502
+ listener_type.getMethods.each do |event_method|
503
+ listener_class.define_method(event_method.getName) do |*args|
504
+ @event_method_block_mapping[event_method.getName]&.call(*args)
485
505
  end
486
506
  end
487
507
  end
@@ -492,7 +512,7 @@ module Glimmer
492
512
  def add_swt_event_listener(swt_constant, &block)
493
513
  event_type = SWTProxy[swt_constant]
494
514
  widget_listener_proxy = nil
495
- safe_block = lambda { |event| block.call(event) unless @swt_widget.isDisposed }
515
+ safe_block = lambda { |*args| block.call(*args) unless @swt_widget.isDisposed }
496
516
  @swt_widget.addListener(event_type, &safe_block)
497
517
  widget_listener_proxy = WidgetListenerProxy.new(swt_widget: @swt_widget, swt_listener: @swt_widget.getListeners(event_type).last, event_type: event_type, swt_constant: swt_constant)
498
518
  end
@@ -579,7 +599,7 @@ module Glimmer
579
599
  end
580
600
  image_data = ImageData.new(value)
581
601
  # TODO in the future, look into unregistering this listener when no longer needed
582
- on_event_Resize do |resize_event|
602
+ on_swt_Resize do |resize_event|
583
603
  new_image_data = image_data.scaledTo(@swt_widget.getSize.x, @swt_widget.getSize.y)
584
604
  @swt_widget.getBackgroundImage&.dispose
585
605
  @swt_widget.setBackgroundImage(Image.new(@swt_widget.getDisplay, new_image_data))
@@ -5,9 +5,10 @@ module Glimmer
5
5
  module CustomShell
6
6
  include SuperModule
7
7
  include Glimmer::UI::CustomWidget
8
-
8
+
9
9
  def initialize(parent, *swt_constants, options, &content)
10
10
  super
11
+ @swt_widget.set_data('custom_shell', self)
11
12
  raise Error, 'Invalid custom shell body root! Must be a shell or another custom shell.' unless body_root.swt_widget.is_a?(org.eclipse.swt.widgets.Shell)
12
13
  end
13
14
 
@@ -5,7 +5,6 @@ require 'glimmer/swt/display_proxy'
5
5
  require 'glimmer/util/proc_tracker'
6
6
  require 'glimmer/data_binding/observer'
7
7
  require 'glimmer/data_binding/observable_model'
8
- require 'glimmer/data_binding/observable_widget'
9
8
 
10
9
  module Glimmer
11
10
  module UI
@@ -15,7 +14,6 @@ module Glimmer
15
14
 
16
15
  super_module_included do |klass|
17
16
  klass.include(Glimmer) unless klass.name.include?('Glimmer::UI::CustomShell')
18
- klass.prepend DataBinding::ObservableWidget
19
17
  Glimmer::UI::CustomWidget.add_custom_widget_namespaces_for(klass) unless klass.name.include?('Glimmer::UI::CustomShell')
20
18
  end
21
19
 
@@ -36,15 +34,15 @@ module Glimmer
36
34
  return constant if constant.ancestors.include?(Glimmer::UI::CustomWidget)
37
35
  constant
38
36
  rescue => e
39
- # Glimmer::Config.logger&.debug "#{e.message}\n#{e.backtrace.join("\n")}"
37
+ # Glimmer::Config.logger.debug {"#{e.message}\n#{e.backtrace.join("\n")}"}
40
38
  result
41
39
  end
42
40
  end
43
41
  end
44
42
  raise "#{underscored_custom_widget_name} has no custom widget class!"
45
43
  rescue => e
46
- Glimmer::Config.logger&.debug e.message
47
- Glimmer::Config.logger&.debug "#{e.message}\n#{e.backtrace.join("\n")}"
44
+ Glimmer::Config.logger.debug {e.message}
45
+ Glimmer::Config.logger.debug {"#{e.message}\n#{e.backtrace.join("\n")}"}
48
46
  nil
49
47
  end
50
48
 
@@ -134,10 +132,16 @@ module Glimmer
134
132
  body_block = self.class.instance_variable_get("@body_block")
135
133
  raise Glimmer::Error, 'Invalid custom widget for having no body! Please define body block!' if body_block.nil?
136
134
  @body_root = instance_exec(&body_block)
137
- execute_hooks('after_body')
138
135
  @swt_widget = @body_root.swt_widget
136
+ @swt_widget.set_data('custom_widget', self)
137
+ execute_hooks('after_body')
139
138
  end
140
139
 
140
+ # Subclasses may override to perform post initialization work on an added child
141
+ def post_initialize_child(child)
142
+ # No Op by default
143
+ end
144
+
141
145
  def can_handle_observation_request?(observation_request)
142
146
  observation_request = observation_request.to_s
143
147
  result = false
@@ -159,7 +163,7 @@ module Glimmer
159
163
  end
160
164
 
161
165
  def can_add_observer?(attribute_name)
162
- has_instance_method?(attribute_name) || respond_to?("#{attribute_name}?") || @body_root.can_add_observer?(attribute_name)
166
+ has_instance_method?(attribute_name) || has_instance_method?("#{attribute_name}?") || @body_root.can_add_observer?(attribute_name)
163
167
  end
164
168
 
165
169
  def add_observer(observer, attribute_name)
@@ -171,12 +175,12 @@ module Glimmer
171
175
  end
172
176
 
173
177
  def has_attribute?(attribute_name, *args)
174
- respond_to?(attribute_setter(attribute_name), args) ||
178
+ has_instance_method?(attribute_setter(attribute_name)) ||
175
179
  @body_root.has_attribute?(attribute_name, *args)
176
180
  end
177
181
 
178
182
  def set_attribute(attribute_name, *args)
179
- if respond_to?(attribute_setter(attribute_name), args)
183
+ if has_instance_method?(attribute_setter(attribute_name))
180
184
  send(attribute_setter(attribute_name), *args)
181
185
  else
182
186
  @body_root.set_attribute(attribute_name, *args)
@@ -186,6 +190,7 @@ module Glimmer
186
190
  # This method ensures it has an instance method not coming from Glimmer DSL
187
191
  def has_instance_method?(method_name)
188
192
  respond_to?(method_name) &&
193
+ !swt_widget.respond_to?(method_name) &&
189
194
  !method(method_name)&.source_location&.first&.include?('glimmer/dsl/engine.rb') &&
190
195
  !method(method_name)&.source_location&.first&.include?('glimmer/swt/widget_proxy.rb')
191
196
  end
@@ -202,7 +207,6 @@ module Glimmer
202
207
  "#{attribute_name}="
203
208
  end
204
209
 
205
-
206
210
  def has_style?(style)
207
211
  (swt_style & SWT::SWTProxy[style]) == SWT::SWTProxy[style]
208
212
  end
@@ -229,11 +233,17 @@ module Glimmer
229
233
  end
230
234
 
231
235
  def method_missing(method, *args, &block)
232
- body_root.send(method, *args, &block)
236
+ if can_handle_observation_request?(method)
237
+ handle_observation_request(method, &block)
238
+ else
239
+ body_root.send(method, *args, &block)
240
+ end
233
241
  end
234
-
242
+
243
+ alias local_respond_to? respond_to?
235
244
  def respond_to?(method, *args, &block)
236
245
  super or
246
+ can_handle_observation_request?(method) or
237
247
  body_root.respond_to?(method, *args, &block)
238
248
  end
239
249
 
metadata CHANGED
@@ -1,21 +1,21 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-swt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - AndyMaleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-18 00:00:00.000000000 Z
11
+ date: 2020-07-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
- version: 0.9.5
18
+ version: 0.10.1
19
19
  name: glimmer
20
20
  type: :runtime
21
21
  prerelease: false
@@ -23,7 +23,7 @@ dependencies:
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.9.5
26
+ version: 0.10.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
@@ -57,7 +57,7 @@ dependencies:
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: 0.8.2
60
+ version: 0.9.0
61
61
  name: puts_debuggerer
62
62
  type: :runtime
63
63
  prerelease: false
@@ -65,67 +65,67 @@ dependencies:
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.8.2
68
+ version: 0.9.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  requirement: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - ">="
73
73
  - !ruby/object:Gem::Version
74
- version: 1.2.4
74
+ version: 2.3.9
75
75
  - - "<"
76
76
  - !ruby/object:Gem::Version
77
- version: 2.0.0
78
- name: text-table
77
+ version: 3.0.0
78
+ name: jeweler
79
79
  type: :runtime
80
80
  prerelease: false
81
81
  version_requirements: !ruby/object:Gem::Requirement
82
82
  requirements:
83
83
  - - ">="
84
84
  - !ruby/object:Gem::Version
85
- version: 1.2.4
85
+ version: 2.3.9
86
86
  - - "<"
87
87
  - !ruby/object:Gem::Version
88
- version: 2.0.0
88
+ version: 3.0.0
89
89
  - !ruby/object:Gem::Dependency
90
90
  requirement: !ruby/object:Gem::Requirement
91
91
  requirements:
92
92
  - - ">="
93
93
  - !ruby/object:Gem::Version
94
- version: 1.0.0
94
+ version: 2.3.0
95
95
  - - "<"
96
96
  - !ruby/object:Gem::Version
97
- version: 2.0.0
98
- name: os
97
+ version: 3.0.0
98
+ name: logging
99
99
  type: :runtime
100
100
  prerelease: false
101
101
  version_requirements: !ruby/object:Gem::Requirement
102
102
  requirements:
103
103
  - - ">="
104
104
  - !ruby/object:Gem::Version
105
- version: 1.0.0
105
+ version: 2.3.0
106
106
  - - "<"
107
107
  - !ruby/object:Gem::Version
108
- version: 2.0.0
108
+ version: 3.0.0
109
109
  - !ruby/object:Gem::Dependency
110
110
  requirement: !ruby/object:Gem::Requirement
111
111
  requirements:
112
112
  - - ">="
113
113
  - !ruby/object:Gem::Version
114
- version: 2.0.5
114
+ version: 1.0.0
115
115
  - - "<"
116
116
  - !ruby/object:Gem::Version
117
- version: 3.0.0
118
- name: warbler
117
+ version: 2.0.0
118
+ name: os
119
119
  type: :runtime
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
123
  - - ">="
124
124
  - !ruby/object:Gem::Version
125
- version: 2.0.5
125
+ version: 1.0.0
126
126
  - - "<"
127
127
  - !ruby/object:Gem::Version
128
- version: 3.0.0
128
+ version: 2.0.0
129
129
  - !ruby/object:Gem::Dependency
130
130
  requirement: !ruby/object:Gem::Requirement
131
131
  requirements:
@@ -151,41 +151,61 @@ dependencies:
151
151
  requirements:
152
152
  - - ">="
153
153
  - !ruby/object:Gem::Version
154
- version: 2.3.9
154
+ version: 6.2.1
155
155
  - - "<"
156
156
  - !ruby/object:Gem::Version
157
- version: 3.0.0
158
- name: jeweler
157
+ version: 7.0.0
158
+ name: rdoc
159
159
  type: :runtime
160
160
  prerelease: false
161
161
  version_requirements: !ruby/object:Gem::Requirement
162
162
  requirements:
163
163
  - - ">="
164
164
  - !ruby/object:Gem::Version
165
- version: 2.3.9
165
+ version: 6.2.1
166
166
  - - "<"
167
167
  - !ruby/object:Gem::Version
168
- version: 3.0.0
168
+ version: 7.0.0
169
169
  - !ruby/object:Gem::Dependency
170
170
  requirement: !ruby/object:Gem::Requirement
171
171
  requirements:
172
172
  - - ">="
173
173
  - !ruby/object:Gem::Version
174
- version: 6.2.1
174
+ version: 1.2.4
175
175
  - - "<"
176
176
  - !ruby/object:Gem::Version
177
- version: 7.0.0
178
- name: rdoc
177
+ version: 2.0.0
178
+ name: text-table
179
179
  type: :runtime
180
180
  prerelease: false
181
181
  version_requirements: !ruby/object:Gem::Requirement
182
182
  requirements:
183
183
  - - ">="
184
184
  - !ruby/object:Gem::Version
185
- version: 6.2.1
185
+ version: 1.2.4
186
186
  - - "<"
187
187
  - !ruby/object:Gem::Version
188
- version: 7.0.0
188
+ version: 2.0.0
189
+ - !ruby/object:Gem::Dependency
190
+ requirement: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: 2.0.5
195
+ - - "<"
196
+ - !ruby/object:Gem::Version
197
+ version: 3.0.0
198
+ name: warbler
199
+ type: :runtime
200
+ prerelease: false
201
+ version_requirements: !ruby/object:Gem::Requirement
202
+ requirements:
203
+ - - ">="
204
+ - !ruby/object:Gem::Version
205
+ version: 2.0.5
206
+ - - "<"
207
+ - !ruby/object:Gem::Version
208
+ version: 3.0.0
189
209
  - !ruby/object:Gem::Dependency
190
210
  requirement: !ruby/object:Gem::Requirement
191
211
  requirements: