jrubyfx 1.0.0-java → 1.1.0-java
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +10 -4
- data/bin/jrubyfx-compile +32 -0
- data/bin/jrubyfx-jarify +1 -1
- data/lib/jrubyfx.rb +9 -0
- data/lib/jrubyfx/application.rb +1 -1
- data/lib/jrubyfx/compiler_app.rb +49 -0
- data/lib/jrubyfx/controller.rb +50 -8
- data/lib/jrubyfx/core_ext/exts.yml +4 -0
- data/lib/jrubyfx/core_ext/file_chooser.rb +5 -5
- data/lib/jrubyfx/core_ext/geometry.rb +27 -0
- data/lib/jrubyfx/core_ext/grid_pane.rb +30 -0
- data/lib/jrubyfx/core_ext/observable_value.rb +58 -3
- data/lib/jrubyfx/core_ext/path.rb +1 -1
- data/lib/jrubyfx/core_ext/precompiled.rb +1475 -206
- data/lib/jrubyfx/dsl.rb +57 -8
- data/lib/jrubyfx/dsl_map.rb +241 -236
- data/lib/jrubyfx/imports.rb +249 -2
- data/lib/jrubyfx/java_fx_impl.rb +38 -33
- data/lib/jrubyfx/module.rb +11 -8
- data/lib/jrubyfx/part_imports.rb +15 -3
- data/lib/jrubyfx/utils/common_converters.rb +5 -5
- data/lib/jrubyfx/version.rb +1 -1
- data/lib/jrubyfx_tasks.rb +27 -8
- metadata +36 -25
data/lib/jrubyfx/imports.rb
CHANGED
@@ -57,8 +57,255 @@ module JRubyFX
|
|
57
57
|
|
58
58
|
# The below lines are generated by `rake reflect`. Do not edit.
|
59
59
|
|
60
|
-
|
61
|
-
|
60
|
+
def const_missing(c)
|
61
|
+
if LOCAL_NAME_MAP.has_key? c
|
62
|
+
java_import(LOCAL_NAME_MAP[c])[0]
|
63
|
+
else
|
64
|
+
super
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
LOCAL_NAME_MAP = {
|
69
|
+
:Animation => "javafx.animation.Animation",
|
70
|
+
:AnimationTimer => "javafx.animation.AnimationTimer",
|
71
|
+
:FadeTransition => "javafx.animation.FadeTransition",
|
72
|
+
:FillTransition => "javafx.animation.FillTransition",
|
73
|
+
:Interpolator => "javafx.animation.Interpolator",
|
74
|
+
:KeyFrame => "javafx.animation.KeyFrame",
|
75
|
+
:KeyValue => "javafx.animation.KeyValue",
|
76
|
+
:ParallelTransition => "javafx.animation.ParallelTransition",
|
77
|
+
:PathTransition => "javafx.animation.PathTransition",
|
78
|
+
:PauseTransition => "javafx.animation.PauseTransition",
|
79
|
+
:RotateTransition => "javafx.animation.RotateTransition",
|
80
|
+
:ScaleTransition => "javafx.animation.ScaleTransition",
|
81
|
+
:SequentialTransition => "javafx.animation.SequentialTransition",
|
82
|
+
:StrokeTransition => "javafx.animation.StrokeTransition",
|
83
|
+
:Timeline => "javafx.animation.Timeline",
|
84
|
+
:Transition => "javafx.animation.Transition",
|
85
|
+
:TranslateTransition => "javafx.animation.TranslateTransition",
|
86
|
+
:Platform => "javafx.application.Platform",
|
87
|
+
:SimpleBooleanProperty => "javafx.beans.property.SimpleBooleanProperty",
|
88
|
+
:SimpleDoubleProperty => "javafx.beans.property.SimpleDoubleProperty",
|
89
|
+
:SimpleFloatProperty => "javafx.beans.property.SimpleFloatProperty",
|
90
|
+
:SimpleIntegerProperty => "javafx.beans.property.SimpleIntegerProperty",
|
91
|
+
:SimpleListProperty => "javafx.beans.property.SimpleListProperty",
|
92
|
+
:SimpleLongProperty => "javafx.beans.property.SimpleLongProperty",
|
93
|
+
:SimpleMapProperty => "javafx.beans.property.SimpleMapProperty",
|
94
|
+
:SimpleObjectProperty => "javafx.beans.property.SimpleObjectProperty",
|
95
|
+
:SimpleSetProperty => "javafx.beans.property.SimpleSetProperty",
|
96
|
+
:SimpleStringProperty => "javafx.beans.property.SimpleStringProperty",
|
97
|
+
:ChangeListener => "javafx.beans.value.ChangeListener",
|
98
|
+
:FXCollections => "javafx.collections.FXCollections",
|
99
|
+
:Worker => "javafx.concurrent.Worker",
|
100
|
+
:Task => "javafx.concurrent.Task",
|
101
|
+
:Service => "javafx.concurrent.Service",
|
102
|
+
:Event => "javafx.event.Event",
|
103
|
+
:ActionEvent => "javafx.event.ActionEvent",
|
104
|
+
:EventHandler => "javafx.event.EventHandler",
|
105
|
+
:Initializable => "javafx.fxml.Initializable",
|
106
|
+
:LoadException => "javafx.fxml.LoadException",
|
107
|
+
:HorizontalDirection => "javafx.geometry.HorizontalDirection",
|
108
|
+
:HPos => "javafx.geometry.HPos",
|
109
|
+
:Insets => "javafx.geometry.Insets",
|
110
|
+
:Orientation => "javafx.geometry.Orientation",
|
111
|
+
:Pos => "javafx.geometry.Pos",
|
112
|
+
:Rectangle2D => "javafx.geometry.Rectangle2D",
|
113
|
+
:Side => "javafx.geometry.Side",
|
114
|
+
:VerticalDirection => "javafx.geometry.VerticalDirection",
|
115
|
+
:VPos => "javafx.geometry.VPos",
|
116
|
+
:Group => "javafx.scene.Group",
|
117
|
+
:Node => "javafx.scene.Node",
|
118
|
+
:Parent => "javafx.scene.Parent",
|
119
|
+
:Scene => "javafx.scene.Scene",
|
120
|
+
:Canvas => "javafx.scene.canvas.Canvas",
|
121
|
+
:AreaChart => "javafx.scene.chart.AreaChart",
|
122
|
+
:Axis => "javafx.scene.chart.Axis",
|
123
|
+
:BarChart => "javafx.scene.chart.BarChart",
|
124
|
+
:BubbleChart => "javafx.scene.chart.BubbleChart",
|
125
|
+
:CategoryAxis => "javafx.scene.chart.CategoryAxis",
|
126
|
+
:Chart => "javafx.scene.chart.Chart",
|
127
|
+
:LineChart => "javafx.scene.chart.LineChart",
|
128
|
+
:NumberAxis => "javafx.scene.chart.NumberAxis",
|
129
|
+
:PieChart => "javafx.scene.chart.PieChart",
|
130
|
+
:ScatterChart => "javafx.scene.chart.ScatterChart",
|
131
|
+
:StackedAreaChart => "javafx.scene.chart.StackedAreaChart",
|
132
|
+
:StackedBarChart => "javafx.scene.chart.StackedBarChart",
|
133
|
+
:ValueAxis => "javafx.scene.chart.ValueAxis",
|
134
|
+
:XYChart => "javafx.scene.chart.XYChart",
|
135
|
+
:Accordion => "javafx.scene.control.Accordion",
|
136
|
+
:Button => "javafx.scene.control.Button",
|
137
|
+
:Cell => "javafx.scene.control.Cell",
|
138
|
+
:CheckBox => "javafx.scene.control.CheckBox",
|
139
|
+
:CheckBoxTreeItem => "javafx.scene.control.CheckBoxTreeItem",
|
140
|
+
:CheckMenuItem => "javafx.scene.control.CheckMenuItem",
|
141
|
+
:ChoiceBox => "javafx.scene.control.ChoiceBox",
|
142
|
+
:ColorPicker => "javafx.scene.control.ColorPicker",
|
143
|
+
:ComboBox => "javafx.scene.control.ComboBox",
|
144
|
+
:ContextMenu => "javafx.scene.control.ContextMenu",
|
145
|
+
:Hyperlink => "javafx.scene.control.Hyperlink",
|
146
|
+
:Label => "javafx.scene.control.Label",
|
147
|
+
:ListCell => "javafx.scene.control.ListCell",
|
148
|
+
:ListView => "javafx.scene.control.ListView",
|
149
|
+
:Menu => "javafx.scene.control.Menu",
|
150
|
+
:MenuBar => "javafx.scene.control.MenuBar",
|
151
|
+
:MenuButton => "javafx.scene.control.MenuButton",
|
152
|
+
:MenuItem => "javafx.scene.control.MenuItem",
|
153
|
+
:Pagination => "javafx.scene.control.Pagination",
|
154
|
+
:PasswordField => "javafx.scene.control.PasswordField",
|
155
|
+
:PopupControl => "javafx.scene.control.PopupControl",
|
156
|
+
:ProgressBar => "javafx.scene.control.ProgressBar",
|
157
|
+
:ProgressIndicator => "javafx.scene.control.ProgressIndicator",
|
158
|
+
:RadioButton => "javafx.scene.control.RadioButton",
|
159
|
+
:RadioMenuItem => "javafx.scene.control.RadioMenuItem",
|
160
|
+
:ScrollBar => "javafx.scene.control.ScrollBar",
|
161
|
+
:ScrollPane => "javafx.scene.control.ScrollPane",
|
162
|
+
:Separator => "javafx.scene.control.Separator",
|
163
|
+
:SeparatorMenuItem => "javafx.scene.control.SeparatorMenuItem",
|
164
|
+
:Slider => "javafx.scene.control.Slider",
|
165
|
+
:SplitMenuButton => "javafx.scene.control.SplitMenuButton",
|
166
|
+
:SplitPane => "javafx.scene.control.SplitPane",
|
167
|
+
:Tab => "javafx.scene.control.Tab",
|
168
|
+
:TableView => "javafx.scene.control.TableView",
|
169
|
+
:TableCell => "javafx.scene.control.TableCell",
|
170
|
+
:TableColumn => "javafx.scene.control.TableColumn",
|
171
|
+
:TabPane => "javafx.scene.control.TabPane",
|
172
|
+
:TextArea => "javafx.scene.control.TextArea",
|
173
|
+
:TextField => "javafx.scene.control.TextField",
|
174
|
+
:TitledPane => "javafx.scene.control.TitledPane",
|
175
|
+
:ToggleButton => "javafx.scene.control.ToggleButton",
|
176
|
+
:ToggleGroup => "javafx.scene.control.ToggleGroup",
|
177
|
+
:ToolBar => "javafx.scene.control.ToolBar",
|
178
|
+
:Tooltip => "javafx.scene.control.Tooltip",
|
179
|
+
:TreeCell => "javafx.scene.control.TreeCell",
|
180
|
+
:TreeItem => "javafx.scene.control.TreeItem",
|
181
|
+
:TreeView => "javafx.scene.control.TreeView",
|
182
|
+
:ContentDisplay => "javafx.scene.control.ContentDisplay",
|
183
|
+
:OverrunStyle => "javafx.scene.control.OverrunStyle",
|
184
|
+
:SelectionMode => "javafx.scene.control.SelectionMode",
|
185
|
+
:Blend => "javafx.scene.effect.Blend",
|
186
|
+
:BlendMode => "javafx.scene.effect.BlendMode",
|
187
|
+
:Bloom => "javafx.scene.effect.Bloom",
|
188
|
+
:BlurType => "javafx.scene.effect.BlurType",
|
189
|
+
:BoxBlur => "javafx.scene.effect.BoxBlur",
|
190
|
+
:ColorAdjust => "javafx.scene.effect.ColorAdjust",
|
191
|
+
:ColorInput => "javafx.scene.effect.ColorInput",
|
192
|
+
:DisplacementMap => "javafx.scene.effect.DisplacementMap",
|
193
|
+
:DropShadow => "javafx.scene.effect.DropShadow",
|
194
|
+
:GaussianBlur => "javafx.scene.effect.GaussianBlur",
|
195
|
+
:Glow => "javafx.scene.effect.Glow",
|
196
|
+
:ImageInput => "javafx.scene.effect.ImageInput",
|
197
|
+
:InnerShadow => "javafx.scene.effect.InnerShadow",
|
198
|
+
:Lighting => "javafx.scene.effect.Lighting",
|
199
|
+
:MotionBlur => "javafx.scene.effect.MotionBlur",
|
200
|
+
:PerspectiveTransform => "javafx.scene.effect.PerspectiveTransform",
|
201
|
+
:Reflection => "javafx.scene.effect.Reflection",
|
202
|
+
:SepiaTone => "javafx.scene.effect.SepiaTone",
|
203
|
+
:Shadow => "javafx.scene.effect.Shadow",
|
204
|
+
:Image => "javafx.scene.image.Image",
|
205
|
+
:ImageView => "javafx.scene.image.ImageView",
|
206
|
+
:PixelReader => "javafx.scene.image.PixelReader",
|
207
|
+
:PixelWriter => "javafx.scene.image.PixelWriter",
|
208
|
+
:Clipboard => "javafx.scene.input.Clipboard",
|
209
|
+
:ClipboardContent => "javafx.scene.input.ClipboardContent",
|
210
|
+
:ContextMenuEvent => "javafx.scene.input.ContextMenuEvent",
|
211
|
+
:DragEvent => "javafx.scene.input.DragEvent",
|
212
|
+
:GestureEvent => "javafx.scene.input.GestureEvent",
|
213
|
+
:InputEvent => "javafx.scene.input.InputEvent",
|
214
|
+
:InputMethodEvent => "javafx.scene.input.InputMethodEvent",
|
215
|
+
:KeyCode => "javafx.scene.input.KeyCode",
|
216
|
+
:KeyEvent => "javafx.scene.input.KeyEvent",
|
217
|
+
:Mnemonic => "javafx.scene.input.Mnemonic",
|
218
|
+
:MouseDragEvent => "javafx.scene.input.MouseDragEvent",
|
219
|
+
:MouseEvent => "javafx.scene.input.MouseEvent",
|
220
|
+
:RotateEvent => "javafx.scene.input.RotateEvent",
|
221
|
+
:ScrollEvent => "javafx.scene.input.ScrollEvent",
|
222
|
+
:SwipeEvent => "javafx.scene.input.SwipeEvent",
|
223
|
+
:TouchEvent => "javafx.scene.input.TouchEvent",
|
224
|
+
:TransferMode => "javafx.scene.input.TransferMode",
|
225
|
+
:ZoomEvent => "javafx.scene.input.ZoomEvent",
|
226
|
+
:AnchorPane => "javafx.scene.layout.AnchorPane",
|
227
|
+
:BorderPane => "javafx.scene.layout.BorderPane",
|
228
|
+
:ColumnConstraints => "javafx.scene.layout.ColumnConstraints",
|
229
|
+
:FlowPane => "javafx.scene.layout.FlowPane",
|
230
|
+
:GridPane => "javafx.scene.layout.GridPane",
|
231
|
+
:HBox => "javafx.scene.layout.HBox",
|
232
|
+
:Pane => "javafx.scene.layout.Pane",
|
233
|
+
:Priority => "javafx.scene.layout.Priority",
|
234
|
+
:RowConstraints => "javafx.scene.layout.RowConstraints",
|
235
|
+
:StackPane => "javafx.scene.layout.StackPane",
|
236
|
+
:TilePane => "javafx.scene.layout.TilePane",
|
237
|
+
:VBox => "javafx.scene.layout.VBox",
|
238
|
+
:AudioClip => "javafx.scene.media.AudioClip",
|
239
|
+
:AudioEqualizer => "javafx.scene.media.AudioEqualizer",
|
240
|
+
:AudioTrack => "javafx.scene.media.AudioTrack",
|
241
|
+
:EqualizerBand => "javafx.scene.media.EqualizerBand",
|
242
|
+
:Media => "javafx.scene.media.Media",
|
243
|
+
:MediaException => "javafx.scene.media.MediaException",
|
244
|
+
:MediaErrorEvent => "javafx.scene.media.MediaErrorEvent",
|
245
|
+
:MediaMarkerEvent => "javafx.scene.media.MediaMarkerEvent",
|
246
|
+
:MediaPlayer => "javafx.scene.media.MediaPlayer",
|
247
|
+
:MediaView => "javafx.scene.media.MediaView",
|
248
|
+
:VideoTrack => "javafx.scene.media.VideoTrack",
|
249
|
+
:Color => "javafx.scene.paint.Color",
|
250
|
+
:CycleMethod => "javafx.scene.paint.CycleMethod",
|
251
|
+
:ImagePattern => "javafx.scene.paint.ImagePattern",
|
252
|
+
:LinearGradient => "javafx.scene.paint.LinearGradient",
|
253
|
+
:Paint => "javafx.scene.paint.Paint",
|
254
|
+
:RadialGradient => "javafx.scene.paint.RadialGradient",
|
255
|
+
:Stop => "javafx.scene.paint.Stop",
|
256
|
+
:Arc => "javafx.scene.shape.Arc",
|
257
|
+
:ArcTo => "javafx.scene.shape.ArcTo",
|
258
|
+
:ArcType => "javafx.scene.shape.ArcType",
|
259
|
+
:Circle => "javafx.scene.shape.Circle",
|
260
|
+
:ClosePath => "javafx.scene.shape.ClosePath",
|
261
|
+
:CubicCurve => "javafx.scene.shape.CubicCurve",
|
262
|
+
:CubicCurveTo => "javafx.scene.shape.CubicCurveTo",
|
263
|
+
:Ellipse => "javafx.scene.shape.Ellipse",
|
264
|
+
:FillRule => "javafx.scene.shape.FillRule",
|
265
|
+
:HLineTo => "javafx.scene.shape.HLineTo",
|
266
|
+
:Line => "javafx.scene.shape.Line",
|
267
|
+
:LineTo => "javafx.scene.shape.LineTo",
|
268
|
+
:MoveTo => "javafx.scene.shape.MoveTo",
|
269
|
+
:Path => "javafx.scene.shape.Path",
|
270
|
+
:PathElement => "javafx.scene.shape.PathElement",
|
271
|
+
:Polygon => "javafx.scene.shape.Polygon",
|
272
|
+
:Polyline => "javafx.scene.shape.Polyline",
|
273
|
+
:QuadCurve => "javafx.scene.shape.QuadCurve",
|
274
|
+
:QuadCurveTo => "javafx.scene.shape.QuadCurveTo",
|
275
|
+
:Rectangle => "javafx.scene.shape.Rectangle",
|
276
|
+
:Shape => "javafx.scene.shape.Shape",
|
277
|
+
:StrokeLineCap => "javafx.scene.shape.StrokeLineCap",
|
278
|
+
:StrokeLineJoin => "javafx.scene.shape.StrokeLineJoin",
|
279
|
+
:StrokeType => "javafx.scene.shape.StrokeType",
|
280
|
+
:SVGPath => "javafx.scene.shape.SVGPath",
|
281
|
+
:VLineTo => "javafx.scene.shape.VLineTo",
|
282
|
+
:Font => "javafx.scene.text.Font",
|
283
|
+
:FontPosture => "javafx.scene.text.FontPosture",
|
284
|
+
:FontSmoothingType => "javafx.scene.text.FontSmoothingType",
|
285
|
+
:FontWeight => "javafx.scene.text.FontWeight",
|
286
|
+
:Text => "javafx.scene.text.Text",
|
287
|
+
:TextAlignment => "javafx.scene.text.TextAlignment",
|
288
|
+
:TextBoundsType => "javafx.scene.text.TextBoundsType",
|
289
|
+
:Affine => "javafx.scene.transform.Affine",
|
290
|
+
:Rotate => "javafx.scene.transform.Rotate",
|
291
|
+
:Scale => "javafx.scene.transform.Scale",
|
292
|
+
:Shear => "javafx.scene.transform.Shear",
|
293
|
+
:Translate => "javafx.scene.transform.Translate",
|
294
|
+
:WebView => "javafx.scene.web.WebView",
|
295
|
+
:HTMLEditor => "javafx.scene.web.HTMLEditor",
|
296
|
+
:DirectoryChooser => "javafx.stage.DirectoryChooser",
|
297
|
+
:FileChooser => "javafx.stage.FileChooser",
|
298
|
+
:Modality => "javafx.stage.Modality",
|
299
|
+
:Popup => "javafx.stage.Popup",
|
300
|
+
:PopupWindow => "javafx.stage.PopupWindow",
|
301
|
+
:Screen => "javafx.stage.Screen",
|
302
|
+
:Stage => "javafx.stage.Stage",
|
303
|
+
:StageStyle => "javafx.stage.StageStyle",
|
304
|
+
:Window => "javafx.stage.Window",
|
305
|
+
:WindowEvent => "javafx.stage.WindowEvent",
|
306
|
+
:Duration => "javafx.util.Duration"
|
307
|
+
}
|
308
|
+
java_import 'java.lang.Void'
|
62
309
|
end
|
63
310
|
end
|
64
311
|
|
data/lib/jrubyfx/java_fx_impl.rb
CHANGED
@@ -23,43 +23,44 @@ limitations under the License.
|
|
23
23
|
module JavaFXImpl #:nodoc: all
|
24
24
|
java_import 'com.sun.javafx.application.PlatformImpl'
|
25
25
|
java_import 'javafx.stage.Stage'
|
26
|
-
|
26
|
+
|
27
27
|
#JRuby, you make me have to create real classes!
|
28
28
|
class FinisherInterface
|
29
29
|
include PlatformImpl::FinishListener
|
30
|
-
|
30
|
+
|
31
31
|
def initialize(&block)
|
32
32
|
@exitBlock = block
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
def idle(someBoolean)
|
36
36
|
@exitBlock.call
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
def exitCalled()
|
40
40
|
@exitBlock.call
|
41
41
|
end
|
42
42
|
end
|
43
|
-
|
43
|
+
|
44
44
|
class Launcher
|
45
45
|
java_import 'java.util.concurrent.atomic.AtomicBoolean'
|
46
46
|
java_import 'java.util.concurrent.CountDownLatch'
|
47
47
|
java_import 'java.lang.IllegalStateException'
|
48
|
-
|
48
|
+
java_import 'com.sun.javafx.application.ParametersImpl'
|
49
|
+
|
49
50
|
@@launchCalled = AtomicBoolean.new(false) # Atomic boolean go boom on bikini
|
50
|
-
|
51
|
-
def self.launch_app(
|
51
|
+
|
52
|
+
def self.launch_app(application_class, *args)
|
52
53
|
#prevent multiple!
|
53
54
|
if @@launchCalled.getAndSet(true)
|
54
55
|
throw IllegalStateException.new "Application launch must not be called more than once"
|
55
56
|
end
|
56
|
-
|
57
|
+
|
57
58
|
begin
|
58
59
|
#create a java thread, and run the real worker, and wait till it exits
|
59
60
|
count_down_latch = CountDownLatch.new(1)
|
60
61
|
thread = Java.java.lang.Thread.new do
|
61
62
|
begin
|
62
|
-
launch_app_from_thread(
|
63
|
+
launch_app_from_thread(application_class, args)
|
63
64
|
rescue => ex
|
64
65
|
puts "Exception starting app:"
|
65
66
|
p ex
|
@@ -76,48 +77,52 @@ module JavaFXImpl #:nodoc: all
|
|
76
77
|
puts ex.backtrace
|
77
78
|
end
|
78
79
|
end
|
79
|
-
|
80
|
-
def self.launch_app_from_thread(
|
80
|
+
|
81
|
+
def self.launch_app_from_thread(application_class, args)
|
81
82
|
#platformImpl startup?
|
82
|
-
|
83
|
-
|
84
|
-
|
83
|
+
CountDownLatch.new(1).tap do |latch|
|
84
|
+
PlatformImpl.startup { latch.countDown }
|
85
|
+
latch.await
|
85
86
|
end
|
86
|
-
|
87
|
-
|
87
|
+
|
88
88
|
begin
|
89
|
-
launch_app_after_platform(
|
89
|
+
launch_app_after_platform(application_class, args)
|
90
90
|
rescue => ex
|
91
91
|
puts "Error running Application:"
|
92
92
|
p ex
|
93
93
|
puts ex.backtrace
|
94
94
|
end
|
95
|
-
|
96
|
-
#kill the toolkit and exit
|
97
|
-
PlatformImpl.tkExit
|
95
|
+
|
96
|
+
PlatformImpl.tkExit # kill the toolkit and exit
|
98
97
|
end
|
99
|
-
|
100
|
-
def self.launch_app_after_platform(
|
98
|
+
|
99
|
+
def self.launch_app_after_platform(application_class, args)
|
101
100
|
#listeners - for the end
|
102
101
|
finished_latch = CountDownLatch.new(1)
|
103
|
-
|
102
|
+
|
104
103
|
# register for shutdown
|
105
104
|
PlatformImpl.addListener(FinisherInterface.new {
|
106
105
|
# this is called when the stage exits
|
107
106
|
finished_latch.countDown
|
108
107
|
})
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
108
|
+
|
109
|
+
application = application_class.new
|
110
|
+
|
111
|
+
unless application.is_a? Java::javafx.application.Application
|
112
|
+
raise "Invalid type: cannot launch non-Application"
|
113
|
+
end
|
114
|
+
|
115
|
+
ParametersImpl.registerParameters(application, ParametersImpl.new(args))
|
116
|
+
|
117
|
+
application.init
|
118
|
+
|
114
119
|
error = false
|
115
120
|
#RUN! and hope it works!
|
116
121
|
PlatformImpl.runAndWait do
|
117
122
|
begin
|
118
123
|
stage = Stage.new
|
119
124
|
stage.impl_setPrimary(true)
|
120
|
-
|
125
|
+
application.start(stage)
|
121
126
|
# no countDown here because its up top... yes I know
|
122
127
|
rescue => ex
|
123
128
|
puts "Exception running Application:"
|
@@ -127,12 +132,12 @@ module JavaFXImpl #:nodoc: all
|
|
127
132
|
finished_latch.countDown # but if we fail, we need to unlatch it
|
128
133
|
end
|
129
134
|
end
|
130
|
-
|
135
|
+
|
131
136
|
#wait for stage exit
|
132
137
|
finished_latch.await
|
133
|
-
|
138
|
+
|
134
139
|
# call stop on the interface
|
135
|
-
|
140
|
+
application.stop unless error
|
136
141
|
end
|
137
142
|
end
|
138
143
|
end
|
data/lib/jrubyfx/module.rb
CHANGED
@@ -28,7 +28,7 @@ module JRubyFX
|
|
28
28
|
# with(obj, hash) => obj
|
29
29
|
# with(obj) { block } => obj
|
30
30
|
# with(obj, hash) { block }=> obj
|
31
|
-
#
|
31
|
+
#
|
32
32
|
# Set properties (e.g. setters) on the passed in object plus also invoke
|
33
33
|
# any block passed against this object.
|
34
34
|
# === Examples
|
@@ -39,6 +39,7 @@ module JRubyFX
|
|
39
39
|
# end
|
40
40
|
#
|
41
41
|
def with(obj, properties = {}, &block)
|
42
|
+
puts "Warning: calling 'with' on a nil object from #{caller[0]}" if obj.nil?
|
42
43
|
populate_properties(obj, properties)
|
43
44
|
|
44
45
|
if block_given?
|
@@ -47,18 +48,18 @@ module JRubyFX
|
|
47
48
|
obj.extend(JRubyFX)
|
48
49
|
obj.instance_eval(&block)
|
49
50
|
end
|
50
|
-
|
51
|
+
|
51
52
|
obj
|
52
53
|
end
|
53
54
|
|
54
55
|
##
|
55
56
|
# call-seq:
|
56
57
|
# run_later { block }
|
57
|
-
#
|
58
|
+
#
|
58
59
|
# Convenience method so anything can safely schedule to run on JavaFX
|
59
60
|
# main thread.
|
60
61
|
def run_later(&block)
|
61
|
-
Platform.run_later &block
|
62
|
+
Java::javafx.application.Platform.run_later &block
|
62
63
|
end
|
63
64
|
|
64
65
|
##
|
@@ -67,11 +68,11 @@ module JRubyFX
|
|
67
68
|
# build(class, hash) => obj
|
68
69
|
# build(class) { block } => obj
|
69
70
|
# build(class, hash) { block } => obj
|
70
|
-
#
|
71
|
+
#
|
71
72
|
# Create "build" a new JavaFX instance with the provided class and
|
72
73
|
# set properties (e.g. setters) on that new instance plus also invoke
|
73
74
|
# any block passed against this new instance. This also can build a proc
|
74
|
-
# or lambda form in which case the return value of the block will be what
|
75
|
+
# or lambda form in which case the return value of the block will be what
|
75
76
|
# is used to set the additional properties on.
|
76
77
|
# === Examples
|
77
78
|
#
|
@@ -93,11 +94,12 @@ module JRubyFX
|
|
93
94
|
|
94
95
|
with(obj, properties, &block)
|
95
96
|
end
|
96
|
-
|
97
|
+
|
97
98
|
def self.included(mod)
|
98
99
|
mod.extend(JRubyFX::FXMLClassUtils)
|
100
|
+
mod.extend(JRubyFX::FXImports)
|
99
101
|
end
|
100
|
-
|
102
|
+
|
101
103
|
module FXMLClassUtils
|
102
104
|
def fxml_raw_accessor(symbol_name, type=java::lang::String)
|
103
105
|
# TODO: RDoc
|
@@ -129,6 +131,7 @@ module JRubyFX
|
|
129
131
|
# TODO: somebody clean this up
|
130
132
|
# TODO: _reader and _writer ? maybe? not?
|
131
133
|
pname = symbol_name.id2name + "Property"
|
134
|
+
raise "#{ptype} does not inherit from Property." unless ptype.ancestors.include? Java::javafx.beans.property.Property
|
132
135
|
unless type
|
133
136
|
type = ptype.java_class.java_instance_methods.find_all{|x|x.name == "getValue"}.map{|x|x.return_type}.find_all{|x|x != java.lang.Object.java_class}
|
134
137
|
if type.length != 1
|