Module: Rubeus::Awt::Nestable::ClassMethods
- Defined in:
- lib/rubeus/awt/nestable.rb
Instance Method Summary collapse
- #add_new_component_to(object, &block) ⇒ Object
- #container? ⇒ Boolean
- #default_event_type ⇒ Object
- #new_with_nestable(*args, &block) ⇒ Object
- #perform_as_containee ⇒ Object
- #perform_as_container ⇒ Object
- #process_block_for_new(object, &block) ⇒ Object
Instance Method Details
#add_new_component_to(object, &block) ⇒ Object
79 80 81 |
# File 'lib/rubeus/awt/nestable.rb', line 79 def add_new_component_to(object, &block) Context.add_new_component_to(object, &block) end |
#container? ⇒ Boolean
57 58 59 |
# File 'lib/rubeus/awt/nestable.rb', line 57 def container? Context.container_class_names.include?(self.java_class.name) end |
#default_event_type ⇒ Object
83 84 85 |
# File 'lib/rubeus/awt/nestable.rb', line 83 def default_event_type :action end |
#new_with_nestable(*args, &block) ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/rubeus/awt/nestable.rb', line 49 def new_with_nestable(*args, &block) object = self.new_without_nestable(*args) Context.add_component_if_container_exist(object) return object unless block_given? process_block_for_new(object, &block) return object end |
#perform_as_containee ⇒ Object
65 66 67 |
# File 'lib/rubeus/awt/nestable.rb', line 65 def perform_as_containee Context.container_class_names.delete(self.java_class.name) end |
#perform_as_container ⇒ Object
61 62 63 |
# File 'lib/rubeus/awt/nestable.rb', line 61 def perform_as_container Context.container_class_names << self.java_class.name end |
#process_block_for_new(object, &block) ⇒ Object
69 70 71 72 73 74 75 76 77 |
# File 'lib/rubeus/awt/nestable.rb', line 69 def process_block_for_new(object, &block) if self.container? self.add_new_component_to(object, &block) elsif object.respond_to?(:listen) object.listen(*self.default_event_type, &block) else raise "#{self.java_class.name} doesn't support process_block_for_new" end end |