glimmer-dsl-swt 0.1.2 → 0.1.3

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: 4b54809644b379821d606ce742901ec5ce91197bfccb33ee15893d9b809ef766
4
- data.tar.gz: f322c7d1c9f2a7aa9b97709739978317c727a0988dec41c397db205c544c3c7b
3
+ metadata.gz: 3b097c051f15a0fd1a52677fd65d542a67532a2e1a51fc928fc22acd8e729953
4
+ data.tar.gz: 203b4cd8bad18d912e83067fce0175e5667f7db503cfa67bf9beac6e72752508
5
5
  SHA512:
6
- metadata.gz: 54539c2fa3414d637fa6e29578e88c592f09d292c7027308ced2a8ddd84f11ed6d36ec769ec9e8c06113c3fed16c08cba4774f92b5d167e8f16867788fd7106d
7
- data.tar.gz: 8f3f36715b553078f72f0fd66f635437344ba0151a1ba2665852cee9fb81658afb265d66493d0b61d42083f1ebb3c963368fc43c6f74133e4b9bf73d79fb8395
6
+ metadata.gz: edb0568d6bcf252b89332050f2de545917bb6ce2bd687dae961e1aa1afb66d9a051420ea00745db028a93d3869ab5ca9229192d806daa3e0db652a5fffdc1df5
7
+ data.tar.gz: 745dae7d8a1999c0267b4d4e7a66a37209bb59c29e4c0f9c7ccf31dc87b2bcd0903eef7c2a0bc6cb46a498200468ce9bcb28d1b5752b54a5a0340be350793e0e
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
- # <img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=105 /> Glimmer DSL for SWT 0.1.2 (Desktop GUI)
1
+ # <img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 /> Glimmer DSL for SWT 0.1.3 (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
+ [![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)
4
5
  [![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)
5
6
 
6
7
  [Glimmer](https://github.com/AndyObtiva/glimmer) DSL for SWT enables desktop development with Glimmer.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
Binary file
@@ -1,4 +1,3 @@
1
- require 'glimmer'
2
1
  require 'glimmer/data_binding/observable'
3
2
  require 'glimmer/data_binding/observer'
4
3
 
@@ -34,11 +34,12 @@ module Glimmer
34
34
  observe(new_model_collection, @column_properties)
35
35
  @model_collection = new_model_collection
36
36
  end
37
- populate_table(@model_collection, @table, @column_properties)
37
+ populate_table(@model_collection, @table, @column_properties)
38
38
  end
39
-
39
+
40
40
  def populate_table(model_collection, parent, column_properties)
41
41
  selected_table_item_models = parent.swt_widget.getSelection.map(&:getData)
42
+ parent.finish_edit!
42
43
  parent.swt_widget.removeAll
43
44
  model_collection.each do |model|
44
45
  table_item = TableItem.new(parent.swt_widget, SWT::SWTProxy[:none])
@@ -1,5 +1,7 @@
1
1
  require 'os'
2
2
 
3
+ # TODO refactor to nest under RakeTask namespace
4
+
3
5
  module Glimmer
4
6
  module Package
5
7
  class << self
@@ -59,4 +59,26 @@ namespace :glimmer do
59
59
  Scaffold.custom_widget_gem(args[:custom_widget_name], args[:namespace])
60
60
  end
61
61
  end
62
+
63
+ namespace :list do
64
+ task :list_require do
65
+ require_relative 'rake_task/list'
66
+ end
67
+
68
+ desc 'List Glimmer custom widget gems available at rubygems.org (query is optional)'
69
+ task :custom_widget_gems, [:query] => :list_require do |t, args|
70
+ Glimmer::RakeTask::List.custom_widget_gems(args[:query])
71
+ end
72
+
73
+ desc 'List Glimmer custom shell gems available at rubygems.org (query is optional)'
74
+ task :custom_shell_gems, [:query] => :list_require do |t, args|
75
+ Glimmer::RakeTask::List.custom_shell_gems(args[:query])
76
+ end
77
+
78
+ desc 'List Glimmer DSL gems available at rubygems.org (query is optional)'
79
+ task :dsl_gems, [:query] => :list_require do |t, args|
80
+ Glimmer::RakeTask::List.dsl_gems(args[:query])
81
+ end
82
+
83
+ end
62
84
  end
@@ -0,0 +1,73 @@
1
+ require 'facets'
2
+ require 'text-table'
3
+
4
+ module Glimmer
5
+ module RakeTask
6
+ # Lists Glimmer related gems to use in rake_task.rb
7
+ class List
8
+ class << self
9
+ REGEX_GEM_LINE = /^([^\(]+) \(([^\)]+)\)$/
10
+
11
+ def custom_widget_gems(query=nil)
12
+ list_gems('glimmer-cw-', query) do |result|
13
+ puts
14
+ puts " Glimmer Custom Widget Gems#{" matching [#{query}]" if query} at rubygems.org:"
15
+ puts result
16
+ end
17
+ end
18
+
19
+ def custom_shell_gems(query=nil)
20
+ list_gems('glimmer-cs-', query) do |result|
21
+ puts
22
+ puts " Glimmer Custom Shell Gems#{" matching [#{query}]" if query} at rubygems.org:"
23
+ puts result
24
+ end
25
+ end
26
+
27
+ def dsl_gems(query=nil)
28
+ list_gems('glimmer-dsl-', query) do |result|
29
+ puts
30
+ puts " Glimmer DSL Gems#{" matching [#{query}]" if query} at rubygems.org:"
31
+ puts result
32
+ end
33
+ end
34
+
35
+ def list_gems(gem_prefix, query=nil, &printer)
36
+ lines = `gem search -d #{gem_prefix}`.split("\n")
37
+ gems = lines.slice_before {|l| l.match(REGEX_GEM_LINE) }.to_a
38
+ gems = gems.map do |gem|
39
+ {
40
+ name: gem[0].match(REGEX_GEM_LINE)[1],
41
+ version: gem[0].match(REGEX_GEM_LINE)[2],
42
+ author: gem[1].strip,
43
+ description: gem[4..-1].map(&:strip).join(' ')
44
+ }
45
+ end.select do |gem|
46
+ query.nil? || "#{gem[:name]} #{gem[:author]} #{gem[:description]}".downcase.include?(query.to_s.downcase)
47
+ end
48
+ printer.call(tablify(gem_prefix, gems))
49
+ end
50
+
51
+ def tablify(gem_prefix, gems)
52
+ array_of_arrays = gems.map do |gem|
53
+ [
54
+ gem[:name].sub(gem_prefix, '').underscore.titlecase,
55
+ gem[:name],
56
+ gem[:version],
57
+ gem[:author].sub('Author: ', ''),
58
+ gem[:description],
59
+ ]
60
+ end
61
+ Text::Table.new(
62
+ :head => %w[Name Gem Version Author Description],
63
+ :rows => array_of_arrays,
64
+ :horizontal_padding => 1,
65
+ :vertical_boundary => ' ',
66
+ :horizontal_boundary => ' ',
67
+ :boundary_intersection => ' '
68
+ )
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
@@ -2,6 +2,8 @@ require 'fileutils'
2
2
  require 'os'
3
3
  require 'facets'
4
4
 
5
+ # TODO refactor to nest under RakeTask namespace
6
+
5
7
  class Scaffold
6
8
  class << self
7
9
  include FileUtils
@@ -0,0 +1,34 @@
1
+ require 'glimmer/swt/style_constantizable'
2
+
3
+ module Glimmer
4
+ module SWT
5
+ # Proxy for org.eclipse.swt.dnd.DND
6
+ #
7
+ # Follows the Proxy Design Pattern
8
+ class DNDProxy
9
+ include StyleConstantizable
10
+
11
+ class << self
12
+ JAVA_IMPORT = 'org.eclipse.swt.dnd.DND'
13
+
14
+ java_import JAVA_IMPORT
15
+
16
+ def constant_java_import
17
+ JAVA_IMPORT
18
+ end
19
+
20
+ def constant_source_class
21
+ DND
22
+ end
23
+
24
+ def constant_value_none
25
+ DND::DROP_NONE
26
+ end
27
+
28
+ def extra_styles
29
+ {}
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -8,6 +8,7 @@ module Glimmer
8
8
  include_package 'org.eclipse.swt.graphics'
9
9
  include_package 'org.eclipse.swt.browser'
10
10
  include_package 'org.eclipse.swt.custom'
11
+ include_package 'org.eclipse.swt.dnd'
11
12
  end
12
13
  end
13
14
  end
@@ -0,0 +1,120 @@
1
+ require 'glimmer/error'
2
+
3
+ module Glimmer
4
+ module SWT
5
+ # Mixin for all proxy classes that manage style constants (e.g. SWT, DND, etc...)
6
+ module StyleConstantizable
7
+ include SuperModule
8
+
9
+ class << self
10
+ REGEX_SYMBOL_NEGATIVITY = /^([^!]+)(!)?$/
11
+
12
+ def constant_java_import
13
+ raise 'Not implemented! Mixer must implement!'
14
+ end
15
+
16
+ def constant_source_class
17
+ raise 'Not implemented! Mixer must implement!'
18
+ end
19
+
20
+ def constant_value_none
21
+ raise 'Not implemented! Mixer must implement!'
22
+ end
23
+
24
+ # hash of extra styles (i.e. new style combinations)
25
+ def extra_styles
26
+ raise 'Not implemented! Mixer must implement!'
27
+ end
28
+
29
+ def error_message_invalid_style
30
+ " is an invalid #{constant_source_class.name.split(':').last} style! Please choose a style from #{constant_java_import} class constants." # TODO parameterize
31
+ end
32
+
33
+ # Gets constants (e.g. SWT::CONSTANT) where constant is
34
+ # passed in as a lower case symbol
35
+ def [](*symbols)
36
+ symbols = symbols.first if symbols.size == 1 && symbols.first.is_a?(Array)
37
+ result = symbols.compact.map do |symbol|
38
+ constant(symbol).tap do |constant_value|
39
+ raise Glimmer::Error, symbol.to_s + error_message_invalid_style unless constant_value.is_a?(Integer)
40
+ end
41
+ end.reduce do |output, constant_value|
42
+ if constant_value < 0
43
+ output & constant_value
44
+ else
45
+ output | constant_value
46
+ end
47
+ end
48
+ result.nil? ? constant_value_none : result
49
+ end
50
+
51
+ # Returns style integer value for passed in symbol or allows
52
+ # passed in object to pass through (e.g. Integer). This makes is convenient
53
+ # to use symbols or actual style integers in Glimmer
54
+ # Does not raise error for invalid values. Just lets them pass as is.
55
+ # (look into [] operator if you want an error raised on invalid values)
56
+ def constant(symbol)
57
+ return symbol unless symbol.is_a?(Symbol) || symbol.is_a?(String)
58
+ symbol_string, negative = extract_symbol_string_negativity(symbol)
59
+ swt_constant_symbol = symbol_string.downcase == symbol_string ? symbol_string.upcase.to_sym : symbol_string.to_sym
60
+ bit_value = constant_source_class.const_get(swt_constant_symbol)
61
+ negative ? ~bit_value : bit_value
62
+ rescue => e
63
+ begin
64
+ # Glimmer::Config.logger&.debug(e.full_message)
65
+ alternative_swt_constant_symbol = constant_source_class.constants.find {|c| c.to_s.upcase == swt_constant_symbol.to_s.upcase}
66
+ bit_value = constant_source_class.const_get(alternative_swt_constant_symbol)
67
+ negative ? ~bit_value : bit_value
68
+ rescue => e
69
+ # Glimmer::Config.logger&.debug(e.full_message)
70
+ bit_value = extra_styles[swt_constant_symbol]
71
+ if bit_value
72
+ negative ? ~bit_value : bit_value
73
+ else
74
+ symbol
75
+ end
76
+ end
77
+ end
78
+
79
+ def extract_symbol_string_negativity(symbol)
80
+ if symbol.is_a?(Symbol) || symbol.is_a?(String)
81
+ symbol_negativity_match = symbol.to_s.match(REGEX_SYMBOL_NEGATIVITY)
82
+ symbol = symbol_negativity_match[1]
83
+ negative = !!symbol_negativity_match[2]
84
+ [symbol, negative]
85
+ else
86
+ negative = symbol < 0
87
+ [symbol, negative]
88
+ end
89
+ end
90
+
91
+ def negative?(symbol)
92
+ extract_symbol_string_negativity(symbol)[1]
93
+ end
94
+
95
+ def has_constant?(symbol)
96
+ return false unless symbol.is_a?(Symbol) || symbol.is_a?(String)
97
+ constant(symbol).is_a?(Integer)
98
+ end
99
+
100
+ def constantify_args(args)
101
+ args.map {|arg| constant(arg)}
102
+ end
103
+
104
+ # Deconstructs a style integer into symbols
105
+ # Useful for debugging
106
+ def deconstruct(integer)
107
+ constant_source_class.constants.reduce([]) do |found, c|
108
+ constant_value = constant_source_class.const_get(c) rescue -1
109
+ is_found = constant_value.is_a?(Integer) && (constant_value & integer) == constant_value
110
+ is_found ? found += [c] : found
111
+ end
112
+ end
113
+
114
+ def include?(swt_constant, *symbols)
115
+ swt_constant & self[symbols] == self[symbols]
116
+ end
117
+ end
118
+ end
119
+ end
120
+ end
@@ -1,106 +1,38 @@
1
- require 'glimmer/error'
1
+ require 'glimmer/swt/style_constantizable'
2
2
 
3
3
  module Glimmer
4
- module SWT # TODO Consider making this the class below to ease calling it
4
+ module SWT
5
5
  # Proxy for org.eclipse.swt.SWT
6
6
  #
7
7
  # Follows the Proxy Design Pattern
8
- class SWTProxy
9
- class << self
10
- java_import 'org.eclipse.swt.SWT'
11
-
12
- ERROR_INVALID_STYLE = " is an invalid SWT style! Please choose a style from org.eclipse.swt.SWT class constants."
13
- REGEX_SYMBOL_NEGATIVITY = /^([^!]+)(!)?$/
14
-
15
- # Gets SWT constants as if calling SWT::CONSTANT where constant is
16
- # passed in as a lower case symbol
17
- def [](*symbols)
18
- symbols = symbols.first if symbols.size == 1 && symbols.first.is_a?(Array)
19
- result = symbols.compact.map do |symbol|
20
- constant(symbol).tap do |constant_value|
21
- raise Error, symbol.to_s + ERROR_INVALID_STYLE unless constant_value.is_a?(Integer)
22
- end
23
- end.reduce do |output, constant_value|
24
- if constant_value < 0
25
- output & constant_value
26
- else
27
- output | constant_value
28
- end
29
- end
30
- result.nil? ? SWT::NONE : result
31
- end
32
-
33
- # Returns SWT style integer value for passed in symbol or allows
34
- # passed in object to pass through (e.g. Integer). This makes is convenient
35
- # to use symbols or actual SWT style integers in Glimmer
36
- # Does not raise error for invalid values. Just lets them pass as is.
37
- # (look into [] operator if you want an error raised on invalid values)
38
- def constant(symbol)
39
- return symbol unless symbol.is_a?(Symbol) || symbol.is_a?(String)
40
- symbol_string, negative = extract_symbol_string_negativity(symbol)
41
- swt_constant_symbol = symbol_string.downcase == symbol_string ? symbol_string.upcase.to_sym : symbol_string.to_sym
42
- bit_value = SWT.const_get(swt_constant_symbol)
43
- negative ? ~bit_value : bit_value
44
- rescue => e
45
- begin
46
- # Glimmer::Config.logger&.debug(e.full_message)
47
- alternative_swt_constant_symbol = SWT.constants.find {|c| c.to_s.upcase == swt_constant_symbol.to_s.upcase}
48
- bit_value = SWT.const_get(alternative_swt_constant_symbol)
49
- negative ? ~bit_value : bit_value
50
- rescue => e
51
- # Glimmer::Config.logger&.debug(e.full_message)
52
- bit_value = Glimmer::SWT::SWTProxy::EXTRA_STYLES[swt_constant_symbol]
53
- if bit_value
54
- negative ? ~bit_value : bit_value
55
- else
56
- symbol
57
- end
58
- end
59
- end
8
+ class SWTProxy
9
+ include StyleConstantizable
60
10
 
61
- def extract_symbol_string_negativity(symbol)
62
- if symbol.is_a?(Symbol) || symbol.is_a?(String)
63
- symbol_negativity_match = symbol.to_s.match(REGEX_SYMBOL_NEGATIVITY)
64
- symbol = symbol_negativity_match[1]
65
- negative = !!symbol_negativity_match[2]
66
- [symbol, negative]
67
- else
68
- negative = symbol < 0
69
- [symbol, negative]
70
- end
71
- end
72
-
73
- def negative?(symbol)
74
- extract_symbol_string_negativity(symbol)[1]
75
- end
76
-
77
- def has_constant?(symbol)
78
- return false unless symbol.is_a?(Symbol) || symbol.is_a?(String)
79
- constant(symbol).is_a?(Integer)
11
+ class << self
12
+ JAVA_IMPORT = 'org.eclipse.swt.SWT'
13
+
14
+ java_import JAVA_IMPORT
15
+
16
+ def constant_java_import
17
+ JAVA_IMPORT
80
18
  end
81
19
 
82
- def constantify_args(args)
83
- args.map {|arg| constant(arg)}
20
+ def constant_source_class
21
+ SWT
84
22
  end
85
23
 
86
- # Deconstructs a style integer into symbols
87
- # Useful for debugging
88
- def deconstruct(integer)
89
- SWT.constants.reduce([]) do |found, c|
90
- constant_value = SWT.const_get(c) rescue -1
91
- is_found = constant_value.is_a?(Integer) && (constant_value & integer) == constant_value
92
- is_found ? found += [c] : found
93
- end
24
+ def constant_value_none
25
+ SWT::NONE
94
26
  end
95
-
96
- def include?(swt_constant, *symbols)
97
- swt_constant & self[symbols] == self[symbols]
27
+
28
+ def extra_styles
29
+ EXTRA_STYLES
98
30
  end
99
31
  end
100
-
32
+
101
33
  EXTRA_STYLES = {
102
34
  NO_RESIZE: self[:shell_trim, :resize!, :max!]
103
- }
35
+ }
104
36
  end
105
37
  end
106
38
  end
@@ -68,6 +68,21 @@ module Glimmer
68
68
  })
69
69
  end
70
70
 
71
+ # Indicates if table is in edit mode, thus displaying a text widget for a table item cell
72
+ def edit_mode?
73
+ !!@edit_mode
74
+ end
75
+
76
+ def cancel_edit!
77
+ @cancel_edit&.call if @edit_mode
78
+ end
79
+
80
+ def finish_edit!
81
+ @finish_edit&.call if @edit_mode
82
+ end
83
+
84
+ # Indicates if table is editing a table item because the user hit ENTER or focused out after making a change in edit mode to a table item cell.
85
+ # It is set to false once change is saved to model
71
86
  def edit_in_progress?
72
87
  !!@edit_in_progress
73
88
  end
@@ -78,24 +93,32 @@ module Glimmer
78
93
 
79
94
  def edit_table_item(table_item, column_index, before_write: nil, after_write: nil, after_cancel: nil)
80
95
  return if table_item.nil?
96
+ @cancel_edit&.call if @edit_mode
97
+ @edit_mode = true
81
98
  content {
82
99
  @table_editor_text_proxy = text {
83
100
  focus true
84
101
  text table_item.getText(column_index)
85
102
  action_taken = false
86
- cancel = lambda {
87
- @table_editor_text_proxy.swt_widget.dispose
103
+ @cancel_edit = lambda do
104
+ @cancel_in_progress = true
105
+ @table_editor_text_proxy&.swt_widget&.dispose
88
106
  @table_editor_text_proxy = nil
89
107
  after_cancel&.call
90
108
  @edit_in_progress = false
91
- }
92
- action = lambda { |event|
93
- if !action_taken && !@edit_in_progress
109
+ @cancel_in_progress = false
110
+ @cancel_edit = nil
111
+ @edit_mode = false
112
+ end
113
+ @finish_edit = lambda do |event=nil|
114
+ if table_item.isDisposed
115
+ @cancel_edit.call
116
+ elsif !action_taken && !@edit_in_progress && !@cancel_in_progress
94
117
  action_taken = true
95
118
  @edit_in_progress = true
96
119
  new_text = @table_editor_text_proxy.swt_widget.getText
97
120
  if new_text == table_item.getText(column_index)
98
- cancel.call
121
+ @cancel_edit.call
99
122
  else
100
123
  before_write&.call
101
124
  table_item.setText(column_index, new_text)
@@ -103,19 +126,19 @@ module Glimmer
103
126
  model.send("#{column_properties[column_index]}=", new_text) # makes table update itself, so must search for selected table item again
104
127
  edited_table_item = search { |ti| ti.getData == model }.first
105
128
  swt_widget.showItem(edited_table_item)
106
- @table_editor_text_proxy.swt_widget.dispose
129
+ @table_editor_text_proxy&.swt_widget&.dispose
107
130
  @table_editor_text_proxy = nil
108
131
  after_write&.call(edited_table_item)
109
132
  @edit_in_progress = false
110
133
  end
111
134
  end
112
- }
113
- on_focus_lost(&action)
135
+ end
136
+ on_focus_lost(&@finish_edit)
114
137
  on_key_pressed { |key_event|
115
138
  if key_event.keyCode == swt(:cr)
116
- action.call(key_event)
139
+ @finish_edit.call(key_event)
117
140
  elsif key_event.keyCode == swt(:esc)
118
- cancel.call
141
+ @cancel_edit.call
119
142
  end
120
143
  }
121
144
  }
@@ -2,6 +2,7 @@ require 'glimmer/swt/widget_listener_proxy'
2
2
  require 'glimmer/swt/color_proxy'
3
3
  require 'glimmer/swt/font_proxy'
4
4
  require 'glimmer/swt/swt_proxy'
5
+ require 'glimmer/swt/dnd_proxy'
5
6
  require 'glimmer/data_binding/observable_widget'
6
7
 
7
8
  # TODO refactor to make file smaller and extract sub-widget-proxies out of this
@@ -30,6 +31,8 @@ module Glimmer
30
31
  "list" => [:border, :v_scroll],
31
32
  "button" => [:push],
32
33
  "menu_item" => [:push],
34
+ "drag_source" => DND::DROP_COPY,
35
+ "drop_target" => DND::DROP_COPY,
33
36
  }
34
37
 
35
38
  DEFAULT_INITIALIZERS = {
@@ -251,7 +254,12 @@ module Glimmer
251
254
  end
252
255
 
253
256
  def has_style?(style)
254
- (@swt_widget.style & SWTProxy[style]) == SWTProxy[style]
257
+ begin
258
+ comparison = SWTProxy[style]
259
+ rescue
260
+ comparison = DNDProxy[style]
261
+ end
262
+ (@swt_widget.style & comparison) == comparison
255
263
  end
256
264
 
257
265
  def dispose
@@ -310,7 +318,15 @@ module Glimmer
310
318
 
311
319
  def style(underscored_widget_name, styles)
312
320
  styles = [styles].flatten.compact
313
- styles.empty? ? default_style(underscored_widget_name) : SWTProxy[*styles]
321
+ if styles.empty?
322
+ default_style(underscored_widget_name)
323
+ else
324
+ begin
325
+ SWTProxy[*styles]
326
+ rescue
327
+ DNDProxy[*styles]
328
+ end
329
+ end
314
330
  end
315
331
 
316
332
  def default_style(underscored_widget_name)
@@ -478,6 +494,24 @@ module Glimmer
478
494
  value.to_s
479
495
  end
480
496
  end,
497
+ :transfer => lambda do |value|
498
+ transfer_object_extrapolator = lambda do |transfer_name|
499
+ transfer_type = "#{transfer_name.to_s.camelcase(:upper)}Transfer".to_sym
500
+ transfer_type_alternative = "#{transfer_name.to_s.upcase}Transfer".to_sym
501
+ transfer_class = org.eclipse.swt.dnd.const_get(transfer_type) rescue org.eclipse.swt.dnd.const_get(transfer_type_alternative)
502
+ transfer_class.getInstance
503
+ end
504
+ result = value
505
+ if value.is_a?(Symbol) || value.is_a?(String)
506
+ result = [transfer_object_extrapolator.call(value)]
507
+ elsif value.is_a?(Array)
508
+ result = value.map do |transfer_name|
509
+ transfer_object_extrapolator.call(transfer_name)
510
+ end
511
+ end
512
+ result = result.to_java(Transfer) unless result.is_a?(ArrayJavaProxy)
513
+ result
514
+ end,
481
515
  :visible => lambda do |value|
482
516
  !!value
483
517
  end,
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.1.2
4
+ version: 0.1.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-17 00:00:00.000000000 Z
11
+ date: 2020-06-28 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.2
18
+ version: 0.9.3
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.2
26
+ version: 0.9.3
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.1
60
+ version: 0.8.2
61
61
  name: puts_debuggerer
62
62
  type: :runtime
63
63
  prerelease: false
@@ -65,7 +65,27 @@ dependencies:
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.8.1
68
+ version: 0.8.2
69
+ - !ruby/object:Gem::Dependency
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 1.2.4
75
+ - - "<"
76
+ - !ruby/object:Gem::Version
77
+ version: 2.0.0
78
+ name: text-table
79
+ type: :runtime
80
+ prerelease: false
81
+ version_requirements: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: 1.2.4
86
+ - - "<"
87
+ - !ruby/object:Gem::Version
88
+ version: 2.0.0
69
89
  - !ruby/object:Gem::Dependency
70
90
  requirement: !ruby/object:Gem::Requirement
71
91
  requirements:
@@ -194,6 +214,48 @@ dependencies:
194
214
  - - "~>"
195
215
  - !ruby/object:Gem::Version
196
216
  version: 3.5.0
217
+ - !ruby/object:Gem::Dependency
218
+ requirement: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - '='
221
+ - !ruby/object:Gem::Version
222
+ version: 0.8.23
223
+ name: coveralls
224
+ type: :development
225
+ prerelease: false
226
+ version_requirements: !ruby/object:Gem::Requirement
227
+ requirements:
228
+ - - '='
229
+ - !ruby/object:Gem::Version
230
+ version: 0.8.23
231
+ - !ruby/object:Gem::Dependency
232
+ requirement: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - "~>"
235
+ - !ruby/object:Gem::Version
236
+ version: 0.16.1
237
+ name: simplecov
238
+ type: :development
239
+ prerelease: false
240
+ version_requirements: !ruby/object:Gem::Requirement
241
+ requirements:
242
+ - - "~>"
243
+ - !ruby/object:Gem::Version
244
+ version: 0.16.1
245
+ - !ruby/object:Gem::Dependency
246
+ requirement: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - "~>"
249
+ - !ruby/object:Gem::Version
250
+ version: 0.7.0
251
+ name: simplecov-lcov
252
+ type: :development
253
+ prerelease: false
254
+ version_requirements: !ruby/object:Gem::Requirement
255
+ requirements:
256
+ - - "~>"
257
+ - !ruby/object:Gem::Version
258
+ version: 0.7.0
197
259
  description: Glimmer DSL for SWT (Desktop GUI)
198
260
  email: andy.am@gmail.com
199
261
  executables:
@@ -254,9 +316,11 @@ files:
254
316
  - lib/glimmer/launcher.rb
255
317
  - lib/glimmer/package.rb
256
318
  - lib/glimmer/rake_task.rb
319
+ - lib/glimmer/rake_task/list.rb
257
320
  - lib/glimmer/scaffold.rb
258
321
  - lib/glimmer/swt/color_proxy.rb
259
322
  - lib/glimmer/swt/display_proxy.rb
323
+ - lib/glimmer/swt/dnd_proxy.rb
260
324
  - lib/glimmer/swt/font_proxy.rb
261
325
  - lib/glimmer/swt/layout_data_proxy.rb
262
326
  - lib/glimmer/swt/layout_proxy.rb
@@ -264,6 +328,7 @@ files:
264
328
  - lib/glimmer/swt/message_box_proxy.rb
265
329
  - lib/glimmer/swt/packages.rb
266
330
  - lib/glimmer/swt/shell_proxy.rb
331
+ - lib/glimmer/swt/style_constantizable.rb
267
332
  - lib/glimmer/swt/swt_proxy.rb
268
333
  - lib/glimmer/swt/tab_item_proxy.rb
269
334
  - lib/glimmer/swt/table_proxy.rb