glimmer-dsl-swt 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/RUBY_VERSION +1 -1
- data/VERSION +1 -1
- data/lib/ext/glimmer.rb +8 -1
- data/lib/ext/glimmer/config.rb +12 -4
- data/lib/glimmer/data_binding/table_items_binding.rb +3 -2
- data/lib/glimmer/dsl/swt/block_property_expression.rb +20 -0
- data/lib/glimmer/dsl/swt/combo_selection_data_binding_expression.rb +4 -0
- data/lib/glimmer/dsl/swt/dsl.rb +1 -0
- data/lib/glimmer/dsl/swt/widget_expression.rb +2 -0
- data/lib/glimmer/package.rb +7 -1
- data/lib/glimmer/rake_task.rb +5 -0
- data/lib/glimmer/scaffold.rb +7 -7
- data/lib/glimmer/swt/packages.rb +9 -7
- data/lib/glimmer/swt/scrolled_composite_proxy.rb +21 -0
- data/lib/glimmer/swt/swt_proxy.rb +2 -1
- data/lib/glimmer/swt/table_column_proxy.rb +24 -0
- data/lib/glimmer/swt/table_proxy.rb +87 -3
- data/lib/glimmer/swt/widget_proxy.rb +38 -6
- data/lib/glimmer/ui/custom_widget.rb +5 -0
- metadata +8 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b818d6b949f1a1c4388ecad2f9d6f425afbdf0c772a99031c2ea1cf1276dc1c
|
4
|
+
data.tar.gz: 7f9f78326e9a083b170f9606bfb7337963bda57c4648e7f585c435747f77e94a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e56deeff2d43d47a8e875ed1e32ba54f6cca9398053afdd5351257a2b0da3326384412635cf0c41529e8d961abab5de32d69cc5b6e23e67f1ebec23bb372b174
|
7
|
+
data.tar.gz: 49dc96a0dc0921bac9b0cd048d9e33d1436dffa09b4bcb48704f162a30209c52209b3ca03318c89e7277835e682821ec89fb4f32f9c26218fb8ed1812a340dcb
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# <img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 /> Glimmer DSL for SWT 0.
|
1
|
+
# <img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 /> Glimmer DSL for SWT 0.3.0 (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)
|
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
You may find full setup/usage instructions at the main [Glimmer project page](https://github.com/AndyObtiva/glimmer).
|
12
12
|
|
13
|
-
Other Glimmer DSL gems:
|
13
|
+
Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
|
14
14
|
- [glimmer-dsl-opal](https://github.com/AndyObtiva/glimmer-dsl-opal): Glimmer DSL for Opal (Web GUI Adapter for Desktop Apps)
|
15
15
|
- [glimmer-dsl-xml](https://github.com/AndyObtiva/glimmer-dsl-xml): Glimmer DSL for XML (& HTML)
|
16
16
|
- [glimmer-dsl-css](https://github.com/AndyObtiva/glimmer-dsl-css): Glimmer DSL for CSS (Cascading Style Sheets)
|
data/RUBY_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
jruby-9.2.
|
1
|
+
jruby-9.2.12.0
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/lib/ext/glimmer.rb
CHANGED
@@ -3,11 +3,18 @@ require 'glimmer/swt/packages'
|
|
3
3
|
module Glimmer
|
4
4
|
class << self
|
5
5
|
def included(klass)
|
6
|
+
if Object.const_defined?(:ActiveSupport) && ActiveSupport.const_defined?(:Dependencies)
|
7
|
+
begin
|
8
|
+
ActiveSupport::Dependencies.unhook!
|
9
|
+
rescue => e
|
10
|
+
# noop TODO support logging unimportant details below debug level
|
11
|
+
end
|
12
|
+
end
|
6
13
|
if Config.import_swt_packages
|
7
14
|
klass.include(SWT::Packages)
|
8
15
|
klass.extend(SWT::Packages)
|
9
|
-
klass.extend(Glimmer)
|
10
16
|
end
|
17
|
+
klass.extend(Glimmer)
|
11
18
|
end
|
12
19
|
end
|
13
20
|
end
|
data/lib/ext/glimmer/config.rb
CHANGED
@@ -1,16 +1,24 @@
|
|
1
1
|
module Glimmer
|
2
2
|
module Config
|
3
|
+
DEFAULT_IMPORT_SWT_PACKAGES = [
|
4
|
+
'org.eclipse.swt',
|
5
|
+
'org.eclipse.swt.widgets',
|
6
|
+
'org.eclipse.swt.layout',
|
7
|
+
'org.eclipse.swt.graphics',
|
8
|
+
'org.eclipse.swt.browser',
|
9
|
+
'org.eclipse.swt.custom',
|
10
|
+
'org.eclipse.swt.dnd',
|
11
|
+
]
|
12
|
+
|
3
13
|
class << self
|
4
14
|
# Tells Glimmer to import SWT packages into including class (default: true)
|
5
15
|
def import_swt_packages=(value)
|
6
|
-
@@import_swt_packages =
|
16
|
+
@@import_swt_packages = value
|
7
17
|
end
|
8
18
|
|
9
19
|
# Returns whether Glimmer will import SWT packages into including class
|
10
20
|
def import_swt_packages
|
11
|
-
|
12
|
-
@@import_swt_packages = true
|
13
|
-
end
|
21
|
+
@@import_swt_packages = DEFAULT_IMPORT_SWT_PACKAGES if !defined?(@@import_swt_packages) || (defined?(@@import_swt_packages) && @@import_swt_packages == true)
|
14
22
|
@@import_swt_packages
|
15
23
|
end
|
16
24
|
end
|
@@ -15,6 +15,7 @@ module Glimmer
|
|
15
15
|
def initialize(parent, model_binding, column_properties)
|
16
16
|
@table = parent
|
17
17
|
@model_binding = model_binding
|
18
|
+
@table.swt_widget.data = @model_binding
|
18
19
|
@column_properties = column_properties
|
19
20
|
if @table.respond_to?(:column_properties=)
|
20
21
|
@table.column_properties = @column_properties
|
@@ -22,14 +23,14 @@ module Glimmer
|
|
22
23
|
@table.body_root.column_properties = @column_properties
|
23
24
|
end
|
24
25
|
call(@model_binding.evaluate_property)
|
25
|
-
|
26
|
-
observe(model, model_binding.property_name_expression)
|
26
|
+
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
34
|
if new_model_collection and new_model_collection.is_a?(Array)
|
34
35
|
observe(new_model_collection, @column_properties)
|
35
36
|
@model_collection = new_model_collection
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'glimmer/dsl/expression'
|
2
|
+
|
3
|
+
module Glimmer
|
4
|
+
module DSL
|
5
|
+
module SWT
|
6
|
+
class BlockPropertyExpression < Expression
|
7
|
+
def can_interpret?(parent, keyword, *args, &block)
|
8
|
+
block_given? and
|
9
|
+
args.size == 0 and
|
10
|
+
parent.respond_to?("#{keyword}_block=")
|
11
|
+
end
|
12
|
+
|
13
|
+
def interpret(parent, keyword, *args, &block)
|
14
|
+
parent.send("#{keyword}_block=", block)
|
15
|
+
nil
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/glimmer/dsl/swt/dsl.rb
CHANGED
data/lib/glimmer/package.rb
CHANGED
@@ -7,6 +7,12 @@ module Glimmer
|
|
7
7
|
class << self
|
8
8
|
attr_accessor :javapackager_extra_args
|
9
9
|
|
10
|
+
def clean
|
11
|
+
require 'fileutils'
|
12
|
+
FileUtils.rm_rf('dist')
|
13
|
+
FileUtils.rm_rf('packages')
|
14
|
+
end
|
15
|
+
|
10
16
|
def config
|
11
17
|
project_name = File.basename(File.expand_path('.'))
|
12
18
|
if !File.exists?('config/warble.rb')
|
@@ -15,7 +21,7 @@ module Glimmer
|
|
15
21
|
system('warble config')
|
16
22
|
new_config = File.read('config/warble.rb').split("\n").inject('') do |output, line|
|
17
23
|
if line.include?('config.dirs =')
|
18
|
-
line = line.sub('# ', '').sub(/=[^=\n]+$/, '= %w(app config db lib script bin docs fonts icons images sounds videos)')
|
24
|
+
line = line.sub('# ', '').sub(/=[^=\n]+$/, '= %w(app config db lib script bin docs fonts icons images sounds videos vendor)')
|
19
25
|
end
|
20
26
|
if line.include?('config.includes =')
|
21
27
|
line = line.sub('# ', '').sub(/=[^=\n]+$/, "= FileList['LICENSE.txt', 'VERSION']")
|
data/lib/glimmer/rake_task.rb
CHANGED
@@ -4,6 +4,11 @@ require_relative 'package'
|
|
4
4
|
|
5
5
|
namespace :glimmer do
|
6
6
|
namespace :package do
|
7
|
+
desc 'Clean by removing "dist" and "packages" directories'
|
8
|
+
task :clean do
|
9
|
+
Glimmer::Package.clean
|
10
|
+
end
|
11
|
+
|
7
12
|
desc 'Generate JAR config file'
|
8
13
|
task :config do
|
9
14
|
Glimmer::Package.config
|
data/lib/glimmer/scaffold.rb
CHANGED
@@ -58,7 +58,7 @@ class Scaffold
|
|
58
58
|
|
59
59
|
# for a library or gem, you might want to ignore these files since the code is
|
60
60
|
# intended to run in multiple environments; otherwise, check them in:
|
61
|
-
Gemfile.lock
|
61
|
+
# Gemfile.lock
|
62
62
|
# .ruby-version
|
63
63
|
# .ruby-gemset
|
64
64
|
|
@@ -179,6 +179,7 @@ class Scaffold
|
|
179
179
|
end
|
180
180
|
|
181
181
|
def custom_shell_gem(custom_shell_name, namespace)
|
182
|
+
return puts('Namespace is required! Usage: glimmer scaffold:custom_shell_gem[custom_shell_name,namespace]') unless `git config --get github.user`.to_s.strip == 'AndyObtiva'
|
182
183
|
gem_name = "glimmer-cs-#{compact_name(custom_shell_name)}"
|
183
184
|
gem_summary = "#{human_name(custom_shell_name)} - Glimmer Custom Shell"
|
184
185
|
if namespace
|
@@ -218,6 +219,7 @@ class Scaffold
|
|
218
219
|
end
|
219
220
|
|
220
221
|
def custom_widget_gem(custom_widget_name, namespace)
|
222
|
+
return puts('Namespace is required! Usage: glimmer scaffold:custom_widget_gem[custom_widget_name,namespace]') unless `git config --get github.user`.to_s.strip == 'AndyObtiva'
|
221
223
|
gem_name = "glimmer-cw-#{compact_name(custom_widget_name)}"
|
222
224
|
gem_summary = "#{human_name(custom_widget_name)} - Glimmer Custom Widget"
|
223
225
|
if namespace
|
@@ -483,12 +485,10 @@ class Scaffold
|
|
483
485
|
custom_shell_file_content += <<-MULTI_LINE_STRING
|
484
486
|
|
485
487
|
def display_about_dialog
|
486
|
-
message_box
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
message_box.setMessage(message)
|
491
|
-
message_box.open
|
488
|
+
message_box(body_root) {
|
489
|
+
text 'About'
|
490
|
+
message "#{human_name(namespace)} - #{human_name(custom_shell_name)} \#{VERSION}\\n\\n\#{LICENSE}"
|
491
|
+
}.open
|
492
492
|
end
|
493
493
|
|
494
494
|
def display_preferences_dialog
|
data/lib/glimmer/swt/packages.rb
CHANGED
@@ -1,14 +1,16 @@
|
|
1
|
+
require 'ext/glimmer/config'
|
2
|
+
|
1
3
|
module Glimmer
|
2
4
|
module SWT
|
3
5
|
# This contains Java imports of SWT Java packages
|
4
6
|
module Packages
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
class << self
|
8
|
+
def included(klass)
|
9
|
+
Glimmer::Config.import_swt_packages.to_a.each do |package|
|
10
|
+
include_package(package) if package.is_a?(String)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
12
14
|
end
|
13
15
|
end
|
14
16
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'glimmer/swt/widget_proxy'
|
2
|
+
|
3
|
+
module Glimmer
|
4
|
+
module SWT
|
5
|
+
class ScrolledCompositeProxy < Glimmer::SWT::WidgetProxy
|
6
|
+
def initialize(underscored_widget_name, parent, args)
|
7
|
+
unless args.first.is_a?(Numeric)
|
8
|
+
args.unshift(:h_scroll)
|
9
|
+
args.unshift(:v_scroll)
|
10
|
+
end
|
11
|
+
super
|
12
|
+
swt_widget.expand_horizontal = true
|
13
|
+
swt_widget.expand_vertical = true
|
14
|
+
end
|
15
|
+
|
16
|
+
def post_initialize_child(child)
|
17
|
+
swt_widget.content = child.swt_widget
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'glimmer/swt/widget_proxy'
|
2
|
+
|
3
|
+
module Glimmer
|
4
|
+
module SWT
|
5
|
+
class TableColumnProxy < Glimmer::SWT::WidgetProxy
|
6
|
+
attr_reader :no_sort, :sort_property
|
7
|
+
alias no_sort? no_sort
|
8
|
+
attr_accessor :sort_block, :sort_by_block
|
9
|
+
|
10
|
+
def initialize(underscored_widget_name, parent, args)
|
11
|
+
@no_sort = args.delete(:no_sort)
|
12
|
+
super
|
13
|
+
on_widget_selected do |event|
|
14
|
+
parent.sort_by_column(self)
|
15
|
+
end unless no_sort?
|
16
|
+
end
|
17
|
+
|
18
|
+
def sort_property=(args)
|
19
|
+
@sort_property = args unless args.empty?
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'glimmer/swt/widget_proxy'
|
1
|
+
require 'glimmer/swt/widget_proxy'
|
2
2
|
|
3
3
|
module Glimmer
|
4
4
|
module SWT
|
@@ -33,7 +33,7 @@ module Glimmer
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
attr_reader :table_editor, :table_editor_text_proxy
|
36
|
+
attr_reader :table_editor, :table_editor_text_proxy, :sort_property, :sort_direction, :sort_block, :sort_type, :sort_by_block, :additional_sort_properties
|
37
37
|
attr_accessor :column_properties
|
38
38
|
|
39
39
|
def initialize(underscored_widget_name, parent, args)
|
@@ -43,7 +43,91 @@ module Glimmer
|
|
43
43
|
@table_editor.grabHorizontal = true
|
44
44
|
@table_editor.minimumHeight = 20
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
|
+
def model_binding
|
48
|
+
swt_widget.data
|
49
|
+
end
|
50
|
+
|
51
|
+
def sort_by_column(table_column_proxy)
|
52
|
+
index = swt_widget.columns.to_a.index(table_column_proxy.swt_widget)
|
53
|
+
new_sort_property = table_column_proxy.sort_property || [column_properties[index]]
|
54
|
+
if new_sort_property.size == 1 && !additional_sort_properties.to_a.empty?
|
55
|
+
selected_additional_sort_properties = additional_sort_properties.clone
|
56
|
+
if selected_additional_sort_properties.include?(new_sort_property.first)
|
57
|
+
selected_additional_sort_properties.delete(new_sort_property.first)
|
58
|
+
new_sort_property += selected_additional_sort_properties
|
59
|
+
else
|
60
|
+
new_sort_property += additional_sort_properties
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
@sort_direction = @sort_direction.nil? || @sort_property != new_sort_property || @sort_direction == :descending ? :ascending : :descending
|
65
|
+
swt_widget.sort_direction = @sort_direction == :ascending ? SWTProxy[:up] : SWTProxy[:down]
|
66
|
+
|
67
|
+
@sort_property = new_sort_property
|
68
|
+
swt_widget.sort_column = table_column_proxy.swt_widget
|
69
|
+
|
70
|
+
@sort_by_block = nil
|
71
|
+
@sort_block = nil
|
72
|
+
@sort_type = nil
|
73
|
+
if table_column_proxy.sort_by_block
|
74
|
+
@sort_by_block = table_column_proxy.sort_by_block
|
75
|
+
elsif table_column_proxy.sort_block
|
76
|
+
@sort_block = table_column_proxy.sort_block
|
77
|
+
else
|
78
|
+
detect_sort_type
|
79
|
+
end
|
80
|
+
sort
|
81
|
+
end
|
82
|
+
|
83
|
+
def detect_sort_type
|
84
|
+
@sort_type = sort_property.size.times.map { String }
|
85
|
+
array = model_binding.evaluate_property
|
86
|
+
sort_property.each_with_index do |a_sort_property, i|
|
87
|
+
values = array.map { |object| object.send(a_sort_property) }
|
88
|
+
value_classes = values.map(&:class).uniq
|
89
|
+
if value_classes.size == 1
|
90
|
+
@sort_type[i] = value_classes.first
|
91
|
+
elsif value_classes.include?(Integer)
|
92
|
+
@sort_type[i] = Integer
|
93
|
+
elsif value_classes.include?(Float)
|
94
|
+
@sort_type[i] = Float
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def additional_sort_properties=(args)
|
100
|
+
@additional_sort_properties = args unless args.empty?
|
101
|
+
end
|
102
|
+
|
103
|
+
def sort
|
104
|
+
return unless sort_property && (sort_type || sort_block || sort_by_block)
|
105
|
+
array = model_binding.evaluate_property
|
106
|
+
# Converting value to_s first to handle nil cases. Should work with numeric, boolean, and date fields
|
107
|
+
if sort_block
|
108
|
+
sorted_array = array.sort(&sort_block)
|
109
|
+
elsif sort_by_block
|
110
|
+
sorted_array = array.sort_by(&sort_by_block)
|
111
|
+
else
|
112
|
+
sorted_array = array.sort_by do |object|
|
113
|
+
sort_property.each_with_index.map do |a_sort_property, i|
|
114
|
+
value = object.send(a_sort_property)
|
115
|
+
# handle nil and difficult to compare types gracefully
|
116
|
+
if sort_type[i] == Integer
|
117
|
+
value = value.to_i
|
118
|
+
elsif sort_type[i] == Float
|
119
|
+
value = value.to_f
|
120
|
+
elsif sort_type[i] == String
|
121
|
+
value = value.to_s
|
122
|
+
end
|
123
|
+
value
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
sorted_array = sorted_array.reverse if sort_direction == :descending
|
128
|
+
model_binding.call(sorted_array)
|
129
|
+
end
|
130
|
+
|
47
131
|
# Performs a search for table items matching block condition
|
48
132
|
# If no condition block is passed, returns all table items
|
49
133
|
# Returns a Java TableItem array to easily set as selection on org.eclipse.swt.Table if needed
|
@@ -61,6 +61,12 @@ module Glimmer
|
|
61
61
|
swt_widget_class = self.class.swt_widget_class_for(underscored_widget_name)
|
62
62
|
@swt_widget = swt_widget_class.new(parent.swt_widget, style(underscored_widget_name, styles), *extra_options)
|
63
63
|
DEFAULT_INITIALIZERS[underscored_widget_name]&.call(@swt_widget)
|
64
|
+
parent.post_initialize_child(self)
|
65
|
+
end
|
66
|
+
|
67
|
+
# Subclasses may override to perform post initialization work on an added child
|
68
|
+
def post_initialize_child(child)
|
69
|
+
# No Op by default
|
64
70
|
end
|
65
71
|
|
66
72
|
def extract_args(underscored_widget_name, args)
|
@@ -75,7 +81,18 @@ module Glimmer
|
|
75
81
|
if @arg_extractor_mapping[underscored_widget_name]
|
76
82
|
@arg_extractor_mapping[underscored_widget_name].call(args)
|
77
83
|
else
|
78
|
-
|
84
|
+
extra_options = []
|
85
|
+
style_args = args.select {|arg| arg.is_a?(Symbol) || arg.is_a?(String)}
|
86
|
+
if style_args.any?
|
87
|
+
style_arg_start_index = args.index(style_args.first)
|
88
|
+
style_arg_last_index = args.index(style_args.last)
|
89
|
+
extra_options = args[style_arg_last_index+1..-1]
|
90
|
+
args = args[style_arg_start_index..style_arg_last_index]
|
91
|
+
elsif args.first.is_a?(Integer)
|
92
|
+
extra_options = args[1..-1]
|
93
|
+
args = args[0..0]
|
94
|
+
end
|
95
|
+
[args, extra_options]
|
79
96
|
end
|
80
97
|
end
|
81
98
|
|
@@ -134,6 +151,23 @@ module Glimmer
|
|
134
151
|
observer.call(false)
|
135
152
|
}
|
136
153
|
end,
|
154
|
+
:selection => lambda do |observer|
|
155
|
+
on_widget_selected { |selection_event|
|
156
|
+
observer.call(@swt_widget.getSelection)
|
157
|
+
} if can_handle_observation_request?(:on_widget_selected)
|
158
|
+
end,
|
159
|
+
:text => lambda do |observer|
|
160
|
+
on_modify_text { |modify_event|
|
161
|
+
observer.call(@swt_widget.getText)
|
162
|
+
} if can_handle_observation_request?(:on_modify_text)
|
163
|
+
end,
|
164
|
+
},
|
165
|
+
Java::OrgEclipseSwtWidgets::Combo => {
|
166
|
+
:text => lambda do |observer|
|
167
|
+
on_modify_text { |modify_event|
|
168
|
+
observer.call(@swt_widget.getText)
|
169
|
+
}
|
170
|
+
end,
|
137
171
|
},
|
138
172
|
Java::OrgEclipseSwtWidgets::Text => {
|
139
173
|
:text => lambda do |observer|
|
@@ -238,11 +272,11 @@ module Glimmer
|
|
238
272
|
end
|
239
273
|
swt_widget_class
|
240
274
|
rescue NameError => e
|
241
|
-
Glimmer::Config.logger&.debug e.
|
275
|
+
Glimmer::Config.logger&.debug e.full_message
|
242
276
|
# Glimmer::Config.logger&.debug("#{e.message}\n#{e.backtrace.join("\n")}")
|
243
277
|
nil
|
244
278
|
rescue => e
|
245
|
-
Glimmer::Config.logger&.debug e.
|
279
|
+
Glimmer::Config.logger&.debug e.full_message
|
246
280
|
# Glimmer::Config.logger&.debug("#{e.message}\n#{e.backtrace.join("\n")}")
|
247
281
|
nil
|
248
282
|
end
|
@@ -278,9 +312,7 @@ module Glimmer
|
|
278
312
|
def add_observer(observer, property_name)
|
279
313
|
property_listener_installers = @swt_widget.class.ancestors.map {|ancestor| widget_property_listener_installers[ancestor]}.compact
|
280
314
|
widget_listener_installers = property_listener_installers.map{|installer| installer[property_name.to_s.to_sym]}.compact if !property_listener_installers.empty?
|
281
|
-
widget_listener_installers.to_a.
|
282
|
-
widget_listener_installer.call(observer)
|
283
|
-
end
|
315
|
+
widget_listener_installers.to_a.first&.call(observer)
|
284
316
|
end
|
285
317
|
|
286
318
|
def remove_observer(observer, property_name)
|
@@ -137,6 +137,11 @@ module Glimmer
|
|
137
137
|
execute_hooks('after_body')
|
138
138
|
@swt_widget = @body_root.swt_widget
|
139
139
|
end
|
140
|
+
|
141
|
+
# Subclasses may override to perform post initialization work on an added child
|
142
|
+
def post_initialize_child(child)
|
143
|
+
body_root.post_initialize_child(child)
|
144
|
+
end
|
140
145
|
|
141
146
|
def can_handle_observation_request?(observation_request)
|
142
147
|
result = false
|
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.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AndyMaleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-17 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.
|
18
|
+
version: 0.9.4
|
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.
|
26
|
+
version: 0.9.4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
@@ -256,7 +256,7 @@ dependencies:
|
|
256
256
|
- - "~>"
|
257
257
|
- !ruby/object:Gem::Version
|
258
258
|
version: 0.7.0
|
259
|
-
description: Glimmer DSL for SWT (Desktop GUI)
|
259
|
+
description: Glimmer DSL for SWT (Desktop GUI) - JRuby on SWT
|
260
260
|
email: andy.am@gmail.com
|
261
261
|
executables:
|
262
262
|
- glimmer
|
@@ -285,6 +285,7 @@ files:
|
|
285
285
|
- lib/glimmer/data_binding/widget_binding.rb
|
286
286
|
- lib/glimmer/dsl/swt/async_exec_expression.rb
|
287
287
|
- lib/glimmer/dsl/swt/bind_expression.rb
|
288
|
+
- lib/glimmer/dsl/swt/block_property_expression.rb
|
288
289
|
- lib/glimmer/dsl/swt/color_expression.rb
|
289
290
|
- lib/glimmer/dsl/swt/column_properties_expression.rb
|
290
291
|
- lib/glimmer/dsl/swt/combo_selection_data_binding_expression.rb
|
@@ -328,10 +329,12 @@ files:
|
|
328
329
|
- lib/glimmer/swt/menu_proxy.rb
|
329
330
|
- lib/glimmer/swt/message_box_proxy.rb
|
330
331
|
- lib/glimmer/swt/packages.rb
|
332
|
+
- lib/glimmer/swt/scrolled_composite_proxy.rb
|
331
333
|
- lib/glimmer/swt/shell_proxy.rb
|
332
334
|
- lib/glimmer/swt/style_constantizable.rb
|
333
335
|
- lib/glimmer/swt/swt_proxy.rb
|
334
336
|
- lib/glimmer/swt/tab_item_proxy.rb
|
337
|
+
- lib/glimmer/swt/table_column_proxy.rb
|
335
338
|
- lib/glimmer/swt/table_proxy.rb
|
336
339
|
- lib/glimmer/swt/tree_proxy.rb
|
337
340
|
- lib/glimmer/swt/widget_listener_proxy.rb
|