jrubyfx-master 1.1.1.brakemanpro1-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +202 -0
  3. data/README.md +121 -0
  4. data/bin/jrubyfx-compile +32 -0
  5. data/bin/jrubyfx-generator +98 -0
  6. data/bin/jrubyfx-jarify +115 -0
  7. data/lib/jrubyfx/application.rb +42 -0
  8. data/lib/jrubyfx/compiler_app.rb +51 -0
  9. data/lib/jrubyfx/controller.rb +375 -0
  10. data/lib/jrubyfx/core_ext/border_pane.rb +30 -0
  11. data/lib/jrubyfx/core_ext/column_constraints.rb +43 -0
  12. data/lib/jrubyfx/core_ext/drag_event.rb +32 -0
  13. data/lib/jrubyfx/core_ext/duration.rb +30 -0
  14. data/lib/jrubyfx/core_ext/effects.rb +32 -0
  15. data/lib/jrubyfx/core_ext/exts.yml +57 -0
  16. data/lib/jrubyfx/core_ext/file_chooser.rb +63 -0
  17. data/lib/jrubyfx/core_ext/geometry.rb +27 -0
  18. data/lib/jrubyfx/core_ext/grid_pane.rb +30 -0
  19. data/lib/jrubyfx/core_ext/image_view.rb +25 -0
  20. data/lib/jrubyfx/core_ext/media_player.rb +25 -0
  21. data/lib/jrubyfx/core_ext/observable_value.rb +158 -0
  22. data/lib/jrubyfx/core_ext/pagination.rb +28 -0
  23. data/lib/jrubyfx/core_ext/path.rb +37 -0
  24. data/lib/jrubyfx/core_ext/precompiled.rb +1883 -0
  25. data/lib/jrubyfx/core_ext/progress_indicator.rb +41 -0
  26. data/lib/jrubyfx/core_ext/radial_gradient.rb +37 -0
  27. data/lib/jrubyfx/core_ext/region.rb +42 -0
  28. data/lib/jrubyfx/core_ext/rotate.rb +39 -0
  29. data/lib/jrubyfx/core_ext/stage.rb +89 -0
  30. data/lib/jrubyfx/core_ext/table_view.rb +31 -0
  31. data/lib/jrubyfx/core_ext/timeline.rb +56 -0
  32. data/lib/jrubyfx/core_ext/transition.rb +26 -0
  33. data/lib/jrubyfx/core_ext/tree_view.rb +40 -0
  34. data/lib/jrubyfx/core_ext/xy_chart.rb +53 -0
  35. data/lib/jrubyfx/dsl.rb +330 -0
  36. data/lib/jrubyfx/dsl_control.rb +28 -0
  37. data/lib/jrubyfx/dsl_map.rb +273 -0
  38. data/lib/jrubyfx/imports.rb +310 -0
  39. data/lib/jrubyfx/java_fx_impl.rb +137 -0
  40. data/lib/jrubyfx/module.rb +178 -0
  41. data/lib/jrubyfx/part_imports.rb +127 -0
  42. data/lib/jrubyfx/utils/__ignore_java_stupid_rdoc.rb +30 -0
  43. data/lib/jrubyfx/utils/common_converters.rb +223 -0
  44. data/lib/jrubyfx/utils/common_utils.rb +72 -0
  45. data/lib/jrubyfx/utils/string_utils.rb +48 -0
  46. data/lib/jrubyfx/utils.rb +76 -0
  47. data/lib/jrubyfx/version.rb +4 -0
  48. data/lib/jrubyfx.rb +41 -0
  49. data/lib/jrubyfx_tasks.rb +183 -0
  50. metadata +145 -0
@@ -0,0 +1,30 @@
1
+ =begin
2
+ JRubyFX - Write JavaFX and FXML in Ruby
3
+ Copyright (C) 2013 The JRubyFX Team
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+ =end
17
+ require 'jrubyfx/dsl'
18
+
19
+ # JRubyFX DSL extensions for JavaFX Grid panes
20
+ class Java::javafx::scene::layout::GridPane
21
+ include JRubyFX::DSL
22
+ # don't kill the add(node, int, int..) methods
23
+ def add(node, *moar)
24
+ if moar.length > 1
25
+ self.java_send :add, [Node, *([Java::int]*moar.length)], node, *moar
26
+ else
27
+ children << node
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,25 @@
1
+ =begin
2
+ JRubyFX - Write JavaFX and FXML in Ruby
3
+ Copyright (C) 2013 The JRubyFX Team
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+ =end
17
+ require 'jrubyfx/dsl'
18
+
19
+ # JRubyFX DSL extensions for JavaFX Image Views
20
+ class Java::javafx::scene::image::ImageView
21
+ extend JRubyFX::Utils::CommonConverters
22
+
23
+ converter_for :viewport, [:rectangle2d]
24
+ # NO: logical_child :image this is not possible as the image is not a node, hnce no id
25
+ end
@@ -0,0 +1,25 @@
1
+ =begin
2
+ JRubyFX - Write JavaFX and FXML in Ruby
3
+ Copyright (C) 2013 The JRubyFX Team
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+ =end
17
+ require 'jrubyfx/dsl'
18
+
19
+ # JRubyFX DSL extensions for JavaFX color stops
20
+ class Java::javafx::scene::media::MediaPlayer
21
+ extend JRubyFX::Utils::CommonConverters
22
+
23
+ converter_for :cycle_count, [map_converter(indefinite: INDEFINITE)]
24
+
25
+ end
@@ -0,0 +1,158 @@
1
+ =begin
2
+ JRubyFX - Write JavaFX and FXML in Ruby
3
+ Copyright (C) 2013 The JRubyFX Team
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+ =end
17
+ require 'jrubyfx'
18
+
19
+ # JRubyFX DSL extensions for JavaFX ObservableValues
20
+ module Java::javafx::beans::value::ObservableValue
21
+ java_import Java::javafx.beans.value.ChangeListener
22
+ java_import Java::javafx.beans.InvalidationListener
23
+
24
+ ##
25
+ # call-seq:
26
+ # add_change_listener { |observable, old_value, new_value| block }
27
+ # add_change_listener { |new_value| block }
28
+ #
29
+ # Add a ruby block to call when the property changes changes
30
+ def add_change_listener(type=nil, &block)
31
+ unless type
32
+ type = :list if self.is_a? Java::javafx::collections::ObservableList
33
+ type = :map if self.is_a? Java::javafx::collections::ObservableMap
34
+ end
35
+ if type == :list || type == :map
36
+ super(&block)
37
+ else
38
+ old_verbose = $VERBOSE
39
+ begin
40
+ $VERBOSE = nil
41
+ addListener(ChangeListener.impl {|name, x, y, z|
42
+ if block.arity == 1
43
+ block.call(z) # just call with new
44
+ else
45
+ block.call(x, y, z)
46
+ end
47
+ })
48
+ ensure
49
+ # always re-set to old value, even if block raises an exception
50
+ $VERBOSE = old_verbose
51
+ end
52
+ end
53
+ end
54
+
55
+
56
+ ##
57
+ # call-seq:
58
+ # add_invalidation_listener { |observable| block }
59
+ #
60
+ # Add a ruby block to call when the property invalidates itself (bad property!)
61
+ def add_invalidation_listener(&block)
62
+ old_verbose = $VERBOSE
63
+ begin
64
+ $VERBOSE = nil
65
+ addListener(InvalidationListener.impl {|name, change| block.call(change) })
66
+ ensure
67
+ # always re-set to old value, even if block raises an exception
68
+ $VERBOSE = old_verbose
69
+ end
70
+ end
71
+
72
+ # FIXME: Not sure how to remove with this API. We are passing in a proc
73
+ # and we would need to examine each proc to determine which listener to
74
+ # remove. Probably a way to do it in each derived real class which actually
75
+ # stores the listeners.
76
+ end
77
+
78
+ # JRubyFX DSL extensions for JavaFX ObservableLists
79
+ module Java::javafx::collections::ObservableList
80
+ java_import Java::javafx.collections.ListChangeListener
81
+
82
+ ##
83
+ # call-seq:
84
+ # add_change_listener { |change| block }
85
+ #
86
+ # Add a ruby block to call when the property changes changes
87
+ def add_change_listener(&block)
88
+ old_verbose = $VERBOSE
89
+ begin
90
+ $VERBOSE = nil
91
+ addListener(ListChangeListener.impl {|name, x|block.call(x)})
92
+ ensure
93
+ # always re-set to old value, even if block raises an exception
94
+ $VERBOSE = old_verbose
95
+ end
96
+ end
97
+
98
+ def index(x)
99
+ indexOf(x)
100
+ end
101
+
102
+ # FIXME: Not sure how to remove with this API. We are passing in a proc
103
+ # and we would need to examine each proc to determine which listener to
104
+ # remove. Probably a way to do it in each derived real class which actually
105
+ # stores the listeners.
106
+ end
107
+
108
+ # JRubyFX DSL extensions for JavaFX ObservableMaps
109
+ module Java::javafx::collections::ObservableMap
110
+ java_import Java::javafx.collections.MapChangeListener
111
+
112
+ ##
113
+ # call-seq:
114
+ # add_change_listener { |change| block }
115
+ #
116
+ # Add a ruby block to call when the property changes changes
117
+ def add_change_listener(&block)
118
+ old_verbose = $VERBOSE
119
+ begin
120
+ $VERBOSE = nil
121
+ addListener(MapChangeListener.impl {|name, x|block.call(x)})
122
+ ensure
123
+ # always re-set to old value, even if block raises an exception
124
+ $VERBOSE = old_verbose
125
+ end
126
+ end
127
+
128
+ # FIXME: Not sure how to remove with this API. We are passing in a proc
129
+ # and we would need to examine each proc to determine which listener to
130
+ # remove. Probably a way to do it in each derived real class which actually
131
+ # stores the listeners.
132
+ end
133
+
134
+ class Class
135
+ def property_writer(*symbol_names)
136
+ symbol_names.each do |symbol_name|
137
+ send(:define_method, symbol_name.id2name + "=") do |val|
138
+ instance_variable_get("@#{symbol_name}").setValue val
139
+ end
140
+ end
141
+ end
142
+ def property_reader(*symbol_names)
143
+ symbol_names.each do |symbol_name|
144
+ send(:define_method, symbol_name.id2name) do
145
+ instance_variable_get("@#{symbol_name}").getValue
146
+ end
147
+ end
148
+ end
149
+ def property_accessor(*symbol_names)
150
+ property_reader *symbol_names
151
+ property_writer *symbol_names
152
+ symbol_names.each do |symbol_name|
153
+ send(:define_method, symbol_name.id2name + "_property") do
154
+ instance_variable_get("@#{symbol_name}")
155
+ end
156
+ end
157
+ end
158
+ end
@@ -0,0 +1,28 @@
1
+ =begin
2
+ JRubyFX - Write JavaFX and FXML in Ruby
3
+ Copyright (C) 2013 The JRubyFX Team
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+ =end
17
+ require 'jrubyfx/dsl'
18
+
19
+ # JRubyFX DSL extensions for JavaFX Pagination
20
+ class Java::javafx::scene::control::Pagination
21
+ extend JRubyFX::Utils::CommonConverters
22
+
23
+ indeterm_map = map_converter(indeterminate: INDETERMINATE)
24
+
25
+ converter_for :page_count, [indeterm_map]
26
+ converter_for :new, [], [indeterm_map], [indeterm_map, :none]
27
+
28
+ end
@@ -0,0 +1,37 @@
1
+ =begin
2
+ JRubyFX - Write JavaFX and FXML in Ruby
3
+ Copyright (C) 2013 The JRubyFX Team
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+ =end
17
+ require 'jrubyfx/dsl'
18
+
19
+ # JRubyFX DSL extensions for JavaFX Paths
20
+ class Java::javafx::scene::shape::Path
21
+ java_import Java::javafx.scene.shape.PathElement
22
+ java_import Java::javafx.scene.transform.Transform
23
+
24
+ ##
25
+ # This will defer to node to construct proper object, but will
26
+ # optionally add paths primary child automatically if it is a
27
+ # PathElement.
28
+ def method_missing(name, *args, &block)
29
+ super.tap do |obj|
30
+ if obj.kind_of? PathElement
31
+ add(obj)
32
+ elsif obj.kind_of? Transform
33
+ transforms << obj
34
+ end
35
+ end
36
+ end
37
+ end