jrubyfx 0.9.1-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. data/LICENSE +202 -0
  2. data/README.md +97 -0
  3. data/bin/jrubyfx-jarify +90 -0
  4. data/bin/rubyfx-generator +81 -0
  5. data/lib/jrubyfx.rb +27 -0
  6. data/lib/jrubyfx/core_ext/border_pane.rb +29 -0
  7. data/lib/jrubyfx/core_ext/circle.rb +26 -0
  8. data/lib/jrubyfx/core_ext/column_constraints.rb +41 -0
  9. data/lib/jrubyfx/core_ext/duration.rb +28 -0
  10. data/lib/jrubyfx/core_ext/effects.rb +30 -0
  11. data/lib/jrubyfx/core_ext/file_chooser.rb +60 -0
  12. data/lib/jrubyfx/core_ext/labeled.rb +24 -0
  13. data/lib/jrubyfx/core_ext/media_player.rb +23 -0
  14. data/lib/jrubyfx/core_ext/node.rb +24 -0
  15. data/lib/jrubyfx/core_ext/observable_value.rb +36 -0
  16. data/lib/jrubyfx/core_ext/pagination.rb +26 -0
  17. data/lib/jrubyfx/core_ext/parallel_transition.rb +28 -0
  18. data/lib/jrubyfx/core_ext/parent.rb +28 -0
  19. data/lib/jrubyfx/core_ext/path.rb +41 -0
  20. data/lib/jrubyfx/core_ext/progress_indicator.rb +38 -0
  21. data/lib/jrubyfx/core_ext/radial_gradient.rb +37 -0
  22. data/lib/jrubyfx/core_ext/region.rb +39 -0
  23. data/lib/jrubyfx/core_ext/rotate.rb +37 -0
  24. data/lib/jrubyfx/core_ext/scene.rb +29 -0
  25. data/lib/jrubyfx/core_ext/shape.rb +27 -0
  26. data/lib/jrubyfx/core_ext/stage.rb +77 -0
  27. data/lib/jrubyfx/core_ext/stop.rb +29 -0
  28. data/lib/jrubyfx/core_ext/table_view.rb +35 -0
  29. data/lib/jrubyfx/core_ext/timeline.rb +47 -0
  30. data/lib/jrubyfx/core_ext/transition.rb +25 -0
  31. data/lib/jrubyfx/core_ext/xy_chart.rb +53 -0
  32. data/lib/jrubyfx/dsl.rb +217 -0
  33. data/lib/jrubyfx/fxml_application.rb +44 -0
  34. data/lib/jrubyfx/fxml_controller.rb +270 -0
  35. data/lib/jrubyfx/fxml_module.rb +98 -0
  36. data/lib/jrubyfx/java_fx_impl.rb +139 -0
  37. data/lib/jrubyfx/jfx_imports.rb +107 -0
  38. data/lib/jrubyfx/utils.rb +56 -0
  39. data/lib/jrubyfx/utils/__ignore_java_stupid_rdoc.rb +24 -0
  40. data/lib/jrubyfx/utils/common_converters.rb +140 -0
  41. data/lib/jrubyfx/utils/common_utils.rb +72 -0
  42. data/lib/jrubyfx/version.rb +4 -0
  43. data/lib/jrubyfx_tasks.rb +110 -0
  44. metadata +116 -0
@@ -0,0 +1,27 @@
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 'java' # for java_import
18
+ require 'jruby/core_ext' # for the become_java!
19
+
20
+ # JRubyFX includes
21
+ require_relative 'jrubyfx/jfx_imports'
22
+ require_relative 'jrubyfx/fxml_module'
23
+ require_relative 'jrubyfx/dsl'
24
+ JRubyFX::DSL.load_dsl # load it after we require the dsl package to not loop around
25
+ require_relative 'jrubyfx/fxml_application'
26
+ require_relative 'jrubyfx/fxml_controller'
27
+ require_relative 'jrubyfx/java_fx_impl'
@@ -0,0 +1,29 @@
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
+ # JRubyFX DSL extensions for BorderPanes
18
+ class Java::javafx::scene::layout::BorderPane
19
+ include JRubyFX::DSL
20
+
21
+ # We don't want to add automatically for this type of pane
22
+ alias :method_missing :node_method_missing
23
+
24
+ alias :left :setLeft
25
+ alias :right :setRight
26
+ alias :top :setTop
27
+ alias :bottom :setBottom
28
+ alias :center :setCenter
29
+ 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
+ require 'jrubyfx/utils/common_converters'
18
+
19
+ # JRubyFX DSL extensions for JavaFX Circles
20
+ class Java::javafx::scene::shape::Circle
21
+ class << self
22
+ extend JRubyFX::Utils::CommonConverters
23
+
24
+ converter_for :new, [], [:none], [:none, :color], [:none, :none, :none], [:none, :none, :none, :color]
25
+ end
26
+ end
@@ -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
+ # JRubyFX DSL extensions for JavaFX Column Constraints
18
+ class Java::javafx::scene::layout::ColumnConstraints
19
+ extend JRubyFX::Utils::CommonConverters
20
+
21
+ constrain = map_converter(constrain_to_pref: CONSTRAIN_TO_PREF,
22
+ constrain: CONSTRAIN_TO_PREF,
23
+ pref: CONSTRAIN_TO_PREF,
24
+ preferred: CONSTRAIN_TO_PREF)
25
+
26
+ converter_for :new, [], [:none], [:none, :none, constrain], [:none, :none, constrain, :none, :none, :none]
27
+
28
+ end
29
+
30
+ # JRubyFX DSL extensions for JavaFX Row Constraints
31
+ class Java::javafx::scene::layout::RowConstraints
32
+ extend JRubyFX::Utils::CommonConverters
33
+
34
+ constrain = map_converter(constrain_to_pref: CONSTRAIN_TO_PREF,
35
+ constrain: CONSTRAIN_TO_PREF,
36
+ pref: CONSTRAIN_TO_PREF,
37
+ preferred: CONSTRAIN_TO_PREF)
38
+
39
+ converter_for :new, [], [:none], [:none, :none, constrain], [:none, :none, constrain, :none, :none, :none]
40
+
41
+ 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
+ # JRubyFX DSL extensions for JavaFX Duration
18
+ class Fixnum
19
+ # defines #ms, #sec, etc to create a JavaFX duration object of respective type
20
+ {:ms => :millis, :sec => :seconds, :min => :minutes,
21
+ :hrs => :hours, :hr => :hours}.each do |rname, jname|
22
+ self.instance_eval do
23
+ define_method rname do
24
+ Java.javafx.util.Duration.method(jname).call(self)
25
+ end
26
+ end
27
+ end
28
+ end
@@ -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
+ # JRubyFX DSL extensions for JavaFX drop shadows
18
+ class Java::javafx::scene::effect::DropShadow
19
+ extend JRubyFX::Utils::CommonConverters
20
+
21
+ converter_for :color, [:color]
22
+
23
+ class << self
24
+ extend JRubyFX::Utils::CommonConverters
25
+
26
+ converter_for :new, [], [:none, :color], [:none, :none, :none, :color],
27
+ [enum_converter(Java::javafx::scene::effect::BlurType), :color, :none, :none, :none, :none]
28
+ end
29
+
30
+ end
@@ -0,0 +1,60 @@
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
+ # JRubyFX DSL extensions for JavaFX FileChooser
18
+ class Java::javafx::stage::FileChooser
19
+
20
+ # call-seq:
21
+ # add_extension_filter(description)
22
+ # add_extension_filter(description, filter)
23
+ # add_extension_filter(description, [filter, ...])
24
+ #
25
+ # Takes ether a straight descriptions with embedded (*.whatnot) filter, or
26
+ # separately, where filter can be an array or a string. Note that without a
27
+ # filter, the description MUST contain a list of extensions in parens.
28
+ # === Examples
29
+ # add_extension_filter("Ruby Files (*.rb)")
30
+ # add_extension_filter("Ruby Files (*.rb)", "*.rb")
31
+ # add_extension_filter("Ruby Files (*.rb)", ["*.rb", "*.rbw"])
32
+ #
33
+ def add_extension_filter(desc, filter=nil)
34
+ if filter == nil
35
+ # Attempt to parse out list of stuff in parens
36
+ filter = desc.match(/\(([\*\.\w;:, ]+)\)$/)[1] # grab everthing inside last parens
37
+ filter = filter.split(/[:; ,]/).delete_if(&:empty?)
38
+ end
39
+ filter = [filter] unless filter.is_a? Array
40
+ extension_filters.add(ExtensionFilter.new(desc.to_s, filter))
41
+ end
42
+
43
+ # call-seq:
44
+ # add_extension_filters([description, ...])
45
+ # add_extension_filters({description => filter, ...})
46
+ # add_extension_filters({description => [filter, ...], ...})
47
+ #
48
+ # Takes a straight list of descriptions with embedded (*.whatnot) filters, or
49
+ # a hash of "description" => "*.whatnot" or a hash of "description => ["*.whatnot", "*.etc"]
50
+ # === Examples
51
+ # add_extension_filters(["Ruby Files (*.rb)", "Python Files (*.py)"])
52
+ # add_extension_filters({"Ruby Files (*.rb)" => "*.rb", "Python Files (*.py)" => ["*.py", "*.pyc"]})
53
+ #
54
+ def add_extension_filters(filters)
55
+ #works with both arrays and hashes
56
+ filters.each do |filters|
57
+ add_extension_filter(*filters)
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,24 @@
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 Labeled
20
+ class Java::javafx::scene::control::Labeled
21
+ extend JRubyFX::Utils::CommonConverters
22
+
23
+ converter_for :text_fill, [:color]
24
+ end
@@ -0,0 +1,23 @@
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
+ # JRubyFX DSL extensions for JavaFX color stops
18
+ class Java::javafx::scene::media::MediaPlayer
19
+ extend JRubyFX::Utils::CommonConverters
20
+
21
+ converter_for :cycle_count, [map_converter(indefinite: INDEFINITE)]
22
+
23
+ end
@@ -0,0 +1,24 @@
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 Nodes
20
+ class Java::javafx::scene::Node
21
+ include JRubyFX::DSL
22
+
23
+ include_rotate
24
+ end
@@ -0,0 +1,36 @@
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
+
23
+ ##
24
+ # call-seq:
25
+ # add_change_listener { |observable, old_value, new_value| block }
26
+ #
27
+ # Add a ruby block to call when the property changes changes
28
+ def add_change_listener(&block)
29
+ java_send :addListener, [ChangeListener.java_class], block
30
+ end
31
+
32
+ # FIXME: Not sure how to remove with this API. We are passing in a proc
33
+ # and we would need to examine each proc to determine which listener to
34
+ # remove. Probably a way to do it in each derived real class which actually
35
+ # stores the listeners.
36
+ 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
+ # JRubyFX DSL extensions for JavaFX Progress *
18
+ class Java::javafx::scene::control::Pagination
19
+ extend JRubyFX::Utils::CommonConverters
20
+
21
+ indeterm_map = map_converter(indeterminate: INDETERMINATE)
22
+
23
+ converter_for :page_count, [indeterm_map]
24
+ converter_for :new, [], [indeterm_map], [indeterm_map, :none]
25
+
26
+ 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 ParallelTransition
20
+ class Java::javafx::animation::ParallelTransition
21
+ java_import Java::javafx.animation.Animation
22
+
23
+ include JRubyFX::DSL
24
+
25
+ include_add
26
+ include_method_missing Animation
27
+
28
+ 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 all JavaFX Parents
20
+ class Java::javafx::scene::Parent
21
+ java_import Java::javafx.scene.Node
22
+
23
+ include JRubyFX::DSL
24
+
25
+ include_add
26
+ include_method_missing Node
27
+
28
+ end