Skip to content

Instantly share code, notes, and snippets.

@vpereira
Created December 1, 2014 10:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vpereira/b2c7d252a55a260e38fb to your computer and use it in GitHub Desktop.
Save vpereira/b2c7d252a55a260e38fb to your computer and use it in GitHub Desktop.
# main.rb
class Foo < JrubyFX::Application
def start(stage)
lbl1 = label "Insert your client number"
txt1 = text_field
btn1 = button "OK"
btn1.set_on_action do |e|
# active record objects
Posts.all.each do |post|
MyController.load_into(stage,:initialize=>[:client_id=>txt1.text.to_s,
:post=>post])
end
end
pane = vbox 10
pane.add lbl1
pane.add txt1
pane.add btn1
pane.set_alignment(Pos::CENTER)
scene1 = scene(pane,250,150)
stage.scene = scene1
stage.title = "Foobar"
stage.show
end
end
Foo::launch
### my controller
class MyController
include JRubyFX::Controller
def initialize(args)
# get the post and client_id
...
end
on :button_clicked do |e|
# the data was edited, reviewed, whatever and the user want to get the next
# object being iterated on start method
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment