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,41 @@
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 Progress *
20
+ class Java::javafx::scene::control::ProgressIndicator
21
+ extend JRubyFX::Utils::CommonConverters
22
+
23
+ progress_conv = map_converter(indeterminate_progress: INDETERMINATE_PROGRESS,
24
+ indeterminate: INDETERMINATE_PROGRESS)
25
+
26
+ converter_for :progress, [progress_conv]
27
+ converter_for :new, [], [progress_conv]
28
+
29
+ end
30
+
31
+ # JRubyFX DSL extensions for JavaFX Progress *
32
+ class Java::javafx::scene::control::ProgressBar
33
+ extend JRubyFX::Utils::CommonConverters
34
+
35
+ progress_conv = map_converter(indeterminate_progress: INDETERMINATE_PROGRESS,
36
+ indeterminate: INDETERMINATE_PROGRESS)
37
+
38
+ converter_for :progress, [progress_conv]
39
+ converter_for :new, [], [progress_conv]
40
+
41
+ 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/utils/common_converters'
18
+
19
+ # JRubyFX DSL extensions for JavaFX Radial Gradients
20
+ class Java::javafx::scene::paint::RadialGradient
21
+ class << self
22
+ java_import Java::javafx.scene.paint.CycleMethod
23
+ extend JRubyFX::Utils::CommonConverters
24
+
25
+ converter_for :new, [:none, :none, :none, :none, :none, :none, enum_converter(CycleMethod), :none]
26
+ end
27
+ end
28
+
29
+ # JRubyFX DSL extensions for JavaFX Linear Gradients
30
+ class Java::javafx::scene::paint::LinearGradient
31
+ class << self
32
+ java_import Java::javafx.scene.paint.CycleMethod
33
+ extend JRubyFX::Utils::CommonConverters
34
+
35
+ converter_for :new, [:none, :none, :none, :none, :none, enum_converter(CycleMethod), :none]
36
+ end
37
+ end
@@ -0,0 +1,42 @@
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::layout::Region
21
+ extend JRubyFX::Utils::CommonConverters
22
+
23
+ use_sizes = map_converter(use_pref_size: USE_PREF_SIZE,
24
+ use_computed_size: USE_COMPUTED_SIZE,
25
+ pref_size: USE_PREF_SIZE,
26
+ computed_size: USE_COMPUTED_SIZE,
27
+ preferred_size: USE_PREF_SIZE,
28
+ compute_size: USE_COMPUTED_SIZE,
29
+ pref: USE_PREF_SIZE,
30
+ computed: USE_COMPUTED_SIZE,
31
+ preferred: USE_PREF_SIZE,
32
+ compute: USE_COMPUTED_SIZE)
33
+
34
+ converter_for :min_width, [use_sizes]
35
+ converter_for :min_height, [use_sizes]
36
+ converter_for :pref_width, [use_sizes]
37
+ converter_for :pref_height, [use_sizes]
38
+ converter_for :max_width, [use_sizes]
39
+ converter_for :max_height, [use_sizes]
40
+
41
+ converter_for :padding, [:insets]
42
+ end
@@ -0,0 +1,39 @@
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::transform::Rotate
21
+ extend JRubyFX::Utils::CommonConverters
22
+
23
+ @@axis_conversions = map_converter(x_axis: X_AXIS,
24
+ y_axis: Y_AXIS,
25
+ z_axis: Z_AXIS,
26
+ x: X_AXIS,
27
+ y: Y_AXIS,
28
+ z: Z_AXIS)
29
+
30
+ converter_for :axis, [@@axis_conversions]
31
+
32
+ class << self
33
+ extend JRubyFX::Utils::CommonConverters
34
+
35
+ converter_for :new, [], [:none], [:none, @axis_conversions], [:none, :none, :none],
36
+ [:none, :none, :none, :none], [:none, :none, :none, :none, @axis_conversions]
37
+ end
38
+
39
+ end
@@ -0,0 +1,89 @@
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 the JavaFX Stage
20
+ class Java::javafx::stage::Stage
21
+ include JRubyFX::DSL
22
+
23
+ ##
24
+ # call-seq:
25
+ # [name] => node or nil
26
+ #
27
+ # Returns the item in the scene with the given CSS selector, or nil if not found.
28
+ # === Example
29
+ # stage['#my_button'] #=> Button
30
+ # stage['#doesNotExist'] #=> nil
31
+ #
32
+ def [](name)
33
+ get_scene.lookup(name)
34
+ end
35
+
36
+ ##
37
+ # call-seq:
38
+ # layout_scene() { block } => scene
39
+ # layout_scene(fill) { block } => scene
40
+ # layout_scene(width, height) { block } => scene
41
+ # layout_scene(width, height, fill) { block } => scene
42
+ # layout_scene(width, height, depth_buffer) { block } => scene
43
+ # layout_scene(hash) { block } => scene
44
+ # layout_scene(fill, hash) { block } => scene
45
+ # layout_scene(width, height, hash) { block } => scene
46
+ # layout_scene(width, height, fill, hash) { block } => scene
47
+ # layout_scene(width, height, depth_buffer, hash) { block } => scene
48
+ # layout_scene(fill, hash) => scene
49
+ # layout_scene(width, height, hash) => scene
50
+ # layout_scene(width, height, fill, hash) => scene
51
+ # layout_scene(width, height, depth_buffer, hash) => scene
52
+ # layout_scene(fill) => scene
53
+ # layout_scene(width, height) => scene
54
+ # layout_scene(width, height, fill) => scene
55
+ # layout_scene(width, height, depth_buffer) => scene
56
+ #
57
+ # Creates a new scene with given constructor arguments (fill, width, height),
58
+ # sets all the properties in the hash, and calls the block on the scene.
59
+ # === Examples
60
+ # layout_scene(fill: "white") do
61
+ # label("Hello World!")
62
+ # end
63
+ #
64
+ # layout_scene(:white) do
65
+ # label("Hello World!")
66
+ # end
67
+ #
68
+ # layout_scene do
69
+ # fill = Color::WHITE
70
+ # label("Hello World!")
71
+ # end
72
+ #
73
+ def layout_scene(*args, &code)
74
+ root = code.arity == 1 ? code[node] : instance_eval(&code)
75
+ build(Scene, root, *args).tap { |scene| set_scene scene }
76
+ end
77
+
78
+ def fxml(source, options={})
79
+ if source.is_a? String
80
+ JRubyFX::Controller.load_fxml_only(source, self, options)
81
+ else
82
+ source.load_into self, options
83
+ end
84
+ end
85
+
86
+ def fxml=(source)
87
+ fxml(source)
88
+ end
89
+ end
@@ -0,0 +1,31 @@
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 TableViews
20
+ class Java::javafx::scene::control::TableView
21
+ java_import Java::javafx.scene.control.TableColumn
22
+
23
+ extend JRubyFX::Utils::CommonConverters
24
+
25
+ resize_policy = map_converter(unconstrained_resize_policy: UNCONSTRAINED_RESIZE_POLICY,
26
+ constrained_resize_policy: CONSTRAINED_RESIZE_POLICY,
27
+ unconstrained: UNCONSTRAINED_RESIZE_POLICY,
28
+ constrained: CONSTRAINED_RESIZE_POLICY)
29
+
30
+ converter_for :column_resize_policy, [resize_policy]
31
+ end
@@ -0,0 +1,56 @@
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 animation Timelines
20
+ class Java::javafx::animation::Timeline
21
+ java_import Java::javafx.animation.KeyFrame
22
+
23
+ extend JRubyFX::Utils::CommonConverters
24
+
25
+ # call-seq:
26
+ # animate myProperty, from_duration => to_duration, start_value => next_value
27
+ # animate myProperty, from_duration => [with_duration, ..., to_duration], start_value => [next_value, ...]
28
+ #
29
+ # Animates a given JavaFX property over the given duration, using the given values
30
+ # as keyFrames
31
+ #
32
+ # === Examples
33
+ # animate translateXProperty, 0.sec => [100.ms, 1.sec], 0 => [500, 200]
34
+ # animate translateYProperty, 0.sec => 1.sec, 0 => 200
35
+ #
36
+ def animate(prop, args)
37
+ time = []
38
+ values = []
39
+ # detect our time
40
+ args.each do |key, value|
41
+ if key.is_a? Duration
42
+ time << [key, value]
43
+ time.flatten!
44
+ else #assume values
45
+ values << [key, value]
46
+ values.flatten!
47
+ end
48
+ end
49
+ # add the keyframes
50
+ [time.length, values.length].min.times do |i|
51
+ key_frame(time[i], key_value(prop, values[i]))
52
+ end
53
+ end
54
+
55
+ converter_for :cycle_count, [map_converter(indefinite: Java::javafx::animation::Timeline::INDEFINITE)]
56
+ end
@@ -0,0 +1,26 @@
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
+
18
+ #:nodoc:
19
+ {:Rotate => :angle, :Scale => [:x, :y, :z], :Translate => [:x, :y, :z],
20
+ :Fade => :value, :Fill => :value, :Stroke => :value}.each do |clas, anim_props|
21
+ JavaUtilities.get_proxy_class("javafx.animation.#{clas}Transition").class_eval do
22
+ extend JRubyFX::Utils::CommonConverters
23
+
24
+ animation_converter_for *anim_props
25
+ end
26
+ end
@@ -0,0 +1,40 @@
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 Tree views
20
+ class Java::javafx::scene::control::TreeView
21
+ include JRubyFX::DSL
22
+
23
+ ##
24
+ # get_tree_item interferes with idiomatic construction of a root
25
+ # tree_item. We override and users should use get_tree_item(i)
26
+ # if they want the original method.
27
+ def tree_item(*args, &block)
28
+ method_missing(:tree_item, *args, &block)
29
+ end
30
+
31
+ ##
32
+ # Add any child tree items as the root node. Note, that there
33
+ # is only one root and successive tree_items in a tree_view will
34
+ # keep replacing the root.
35
+ def method_missing(name, *args, &block)
36
+ super.tap do |obj|
37
+ set_root(obj) if obj.kind_of? TreeItem
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,53 @@
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 XYCharts
20
+ class Java::javafx::scene::chart::XYChart
21
+ include JRubyFX::DSL
22
+
23
+ ##
24
+ # This will defer to node to construct proper object, but will
25
+ # optionally add paths primary child automatically if it is a
26
+ # PathElement.
27
+ def method_missing(name, *args, &block)
28
+ super.tap do |obj|
29
+ data.add(obj) if obj.kind_of? XYChart::Series
30
+ end
31
+ end
32
+ end
33
+
34
+ # JRubyFX DSL extensions for JavaFX XYChart Series
35
+ class Java::javafx::scene::chart::XYChart::Series
36
+ include JRubyFX::DSL
37
+
38
+ ##
39
+ # This will defer to node to construct proper object, but will
40
+ # optionally add paths primary child automatically if it is a
41
+ # PathElement.
42
+ def method_missing(name, *args, &block)
43
+ super.tap do |obj|
44
+ data.add(obj) if obj.kind_of? XYChart::Data
45
+ end
46
+ end
47
+
48
+ end
49
+
50
+ # JRubyFX DSL extensions for JavaFX XYChart Data
51
+ class Java::javafx::scene::chart::XYChart::Data
52
+ include JRubyFX::DSL
53
+ end