Replies: 5 comments 16 replies
-
Hi @byteit101 , |
Beta Was this translation helpful? Give feedback.
-
Just for reference, this is how it looks, based on the complex application template from Scene Builder: default view: class PleaseProvideControllerClassName
include JRubyFX::Controller
# fxml 'Untitled'
# @centerPane: AnchorPane
# @mainMenu: Menu
# @mainMenuBar: MenuBar
# @mainMenuItem: MenuItem
# @rightPaneLabel: Label
# @x1: Font
# @x2: Color
# @x3: Font
# @x4: Color
def mainAction(event) # event: ActionEvent
end
end with comments: #
# Sample Skeleton for 'Untitled' Controller Class
#
class PleaseProvideControllerClassName
include JRubyFX::Controller
# fxml 'Untitled'
# @centerPane: AnchorPane (Value injected by FXMLLoader & JRubyFX)
# @mainMenu: Menu (Value injected by FXMLLoader & JRubyFX)
# @mainMenuBar: MenuBar (Value injected by FXMLLoader & JRubyFX)
# @mainMenuItem: MenuItem (Value injected by FXMLLoader & JRubyFX)
# @rightPaneLabel: Label (Value injected by FXMLLoader & JRubyFX)
# @x1: Font (Value injected by FXMLLoader & JRubyFX)
# @x2: Color (Value injected by FXMLLoader & JRubyFX)
# @x3: Font (Value injected by FXMLLoader & JRubyFX)
# @x4: Color (Value injected by FXMLLoader & JRubyFX)
def mainAction(event) # event: ActionEvent
end
end full, with comments: #
# Sample Skeleton for 'Untitled' Controller Class
#
class PleaseProvideControllerClassName
include JRubyFX::Controller
fxml 'Untitled'
# @centerPane: AnchorPane (Value injected by FXMLLoader & JRubyFX)
# @mainMenu: Menu (Value injected by FXMLLoader & JRubyFX)
# @mainMenuBar: MenuBar (Value injected by FXMLLoader & JRubyFX)
# @mainMenuItem: MenuItem (Value injected by FXMLLoader & JRubyFX)
# @rightPaneLabel: Label (Value injected by FXMLLoader & JRubyFX)
# @x1: Font (Value injected by FXMLLoader & JRubyFX)
# @x2: Color (Value injected by FXMLLoader & JRubyFX)
# @x3: Font (Value injected by FXMLLoader & JRubyFX)
# @x4: Color (Value injected by FXMLLoader & JRubyFX)
def mainAction(event) # event: ActionEvent
end
# Called by JRubyFX after FXML loading is complete. Different from Java, same as normal Ruby
def initialize()
raise 'fx:id="centerPane" was not injected: check your FXML file "Untitled".' if @centerPane.nil?
raise 'fx:id="mainMenu" was not injected: check your FXML file "Untitled".' if @mainMenu.nil?
raise 'fx:id="mainMenuBar" was not injected: check your FXML file "Untitled".' if @mainMenuBar.nil?
raise 'fx:id="mainMenuItem" was not injected: check your FXML file "Untitled".' if @mainMenuItem.nil?
raise 'fx:id="rightPaneLabel" was not injected: check your FXML file "Untitled".' if @rightPaneLabel.nil?
raise 'fx:id="x1" was not injected: check your FXML file "Untitled".' if @x1.nil?
raise 'fx:id="x2" was not injected: check your FXML file "Untitled".' if @x2.nil?
raise 'fx:id="x3" was not injected: check your FXML file "Untitled".' if @x3.nil?
raise 'fx:id="x4" was not injected: check your FXML file "Untitled".' if @x4.nil?
end
end |
Beta Was this translation helpful? Give feedback.
-
I have opened #596 as a draft PR |
Beta Was this translation helpful? Give feedback.
-
This is a good idea and effectively it's probably a nice thing to add similar functionality for ScalaFX. But first we need the draft PR #596 developed so that we can merge it. |
Beta Was this translation helpful? Give feedback.
-
Great news @byteit101, the JRuby PR made it now into the mainline. Unfortunately, this means some rework for @rladstaetter as the structure changed a little. Not too much, but it wont merge automatically anymore. |
Beta Was this translation helpful? Give feedback.
-
I've been the maintainer for JRubyFX (JavaFX bindings for JRuby), for just about a decade. I'd like to add Ruby/JRuby/JRubyFX to the controller skeleton generation now that we use the standard FXMLLoader since JRubyFX 2.0. I made a quick hack at https://github.com/byteit101/scenebuilder/tree/jruby that generates ok skeletons. Do note that due to Ruby's dynamism, we hack the constructors and Java-Ruby interface so that it looks like a normal Ruby object when building objects in the "JRubyFX way" (the
fxml "blah.fxml"
line). This means that the usage is slightly different than Java/KotlinBeta Was this translation helpful? Give feedback.
All reactions