class Glimmer::JFX::WindowProxy
WindowProxy
is a Proxy for JavaFX Stage/Scene objects, abstracing their details away.
Follows the Proxy Design Pattern
Constants
- DEFAULT_HEIGHT
- DEFAULT_WIDTH
Attributes
application[R]
args[R]
block[R]
jfx[RW]
keyword[R]
parent_proxy[R]
scene[RW]
stage[RW]
stage=[RW]
Public Instance Methods
content(&block)
click to toggle source
# File lib/glimmer/jfx/window_proxy.rb, line 79 def content(&block) Glimmer::DSL::Engine.add_content(self, Glimmer::DSL::JFX::WindowExpression.new, @keyword, &block) end
method_missing(method_name, *args, &block)
click to toggle source
Calls superclass method
Glimmer::JFX::ControlProxy#method_missing
# File lib/glimmer/jfx/window_proxy.rb, line 67 def method_missing(method_name, *args, &block) if respond_to?("#{method_name}=", true) && !args.empty? send("#{method_name}=", *args) elsif @scene.respond_to?("set_#{method_name}", true) && !args.empty? send_to_scene("set_#{method_name}", *args, &block) elsif @scene.respond_to?(method_name, true) send_to_scene(method_name, *args, &block) else super end end
post_add_content()
click to toggle source
Calls superclass method
Glimmer::JFX::ControlProxy#post_add_content
# File lib/glimmer/jfx/window_proxy.rb, line 41 def post_add_content super stage.width = DEFAULT_WIDTH if stage.width == 0 || stage.width.nan? stage.height = DEFAULT_HEIGHT if stage.height == 0 || stage.height.nan? stage.show end
post_initialize_child(child)
click to toggle source
Subclasses may override to perform post initialization work on an added child (normally must also call super)
# File lib/glimmer/jfx/window_proxy.rb, line 49 def post_initialize_child(child) self.scene = Scene.new(child.jfx) stage.set_scene(scene) end
respond_to?(method_name, *args, &block)
click to toggle source
Calls superclass method
Glimmer::JFX::ControlProxy#respond_to?
# File lib/glimmer/jfx/window_proxy.rb, line 54 def respond_to?(method_name, *args, &block) respond_to_scene?(method_name, *args, &block) || super(method_name, true) end
respond_to_scene?(method_name, *args, &block)
click to toggle source
# File lib/glimmer/jfx/window_proxy.rb, line 59 def respond_to_scene?(method_name, *args, &block) @scene.respond_to?(method_name, true) || @scene.respond_to?("set_#{method_name}", true) end
send_to_scene(method_name, *args, &block)
click to toggle source
# File lib/glimmer/jfx/window_proxy.rb, line 63 def send_to_scene(method_name, *args, &block) @scene.send(method_name, *normalize_args(args), &block) end
Private Instance Methods
build()
click to toggle source
# File lib/glimmer/jfx/window_proxy.rb, line 85 def build self.stage = javafx.stage.Stage.new end
normalize_args(args)
click to toggle source
# File lib/glimmer/jfx/window_proxy.rb, line 89 def normalize_args(args) args.map do |arg| arg.is_a?(ControlProxy) ? arg.jfx : arg end end