Module: TT::GUI::ContainerElement Abstract
Overview
This module is abstract.
Container
and Window
implements this.
Instance Attribute Summary collapse
- #controls ⇒ Object readonly
Instance Method Summary collapse
-
#add_control(control) ⇒ Boolean
True
if the webdialog was open and the control added. - #get_control_by_name(name) ⇒ Control, Nil (also: #[])
- #get_control_by_ui_id(ui_id) ⇒ Control, Nil
- #initialize(*args) ⇒ Object
- #release! ⇒ Nil
-
#remove_control(control) ⇒ Boolean
True
if the webdialog was open and the control removed.
Instance Attribute Details
#controls ⇒ Object (readonly)
387 388 389 |
# File 'TT_Lib2/gui.rb', line 387 def controls @controls end |
Instance Method Details
#add_control(control) ⇒ Boolean
Returns True
if the webdialog was open and the control added.
399 400 401 402 403 404 405 406 407 408 409 410 411 |
# File 'TT_Lib2/gui.rb', line 399 def add_control( control ) raise( ArgumentError, 'Expected Control' ) unless control.is_a?( Control ) # Add to Ruby DOM tree @controls << control control.parent = self control.window = self.window # Add to Webdialog if self.window && self.window.visible? self.window.add_control_to_webdialog( control ) return true end false end |
#get_control_by_name(name) ⇒ Control, Nil Also known as: []
465 466 467 468 469 470 471 472 473 474 |
# File 'TT_Lib2/gui.rb', line 465 def get_control_by_name( name ) for control in @controls return control if control.name == name if control.is_a?( ContainerElement ) result = control.get_control_by_name( name ) return result if result end end nil end |
#get_control_by_ui_id(ui_id) ⇒ Control, Nil
450 451 452 453 454 455 456 457 458 459 |
# File 'TT_Lib2/gui.rb', line 450 def get_control_by_ui_id( ui_id ) for control in @controls return control if control.ui_id == ui_id if control.is_a?( ContainerElement ) result = control.get_control_by_ui_id( ui_id ) return result if result end end nil end |
#initialize(*args) ⇒ Object
390 391 392 393 |
# File 'TT_Lib2/gui.rb', line 390 def initialize( *args ) super( *args ) @controls = [] end |
#release! ⇒ Nil
480 481 482 483 484 485 486 |
# File 'TT_Lib2/gui.rb', line 480 def release! for control in @controls control.release! end @controls.clear super end |
#remove_control(control) ⇒ Boolean
Returns True
if the webdialog was open and the control
removed.
417 418 419 420 421 422 423 424 425 426 427 428 |
# File 'TT_Lib2/gui.rb', line 417 def remove_control( control ) raise( ArgumentError, 'Expected Control' ) unless control.is_a?( Control ) raise( IndexError, 'Control not found' ) unless controls.include?( control ) @controls.delete( control ) control_ui_id = control.ui_id control.release! if self.window && self.window.visible? self.window.call_script( 'UI.remove_control', control_ui_id ) return true end false end |