Skip to content

Commit

Permalink
added components method which returns components-array
Browse files Browse the repository at this point in the history
  • Loading branch information
bakkdoor committed Nov 3, 2008
1 parent ae9e2fc commit 341f118
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/rswing/components/container.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def add_with_name(component, name_symbol)
# Removes a component from this container.
# Also removes it from the component_hash
def remove(component)
super.remove(component)
super(component)
# delete all entries with component as value in component_hash
self.component_hash.delete_if { |key,value| value == component }
end
Expand All @@ -70,6 +70,16 @@ def [](name_symbol)
end
end

# Returns the components of a container.
# If the container uses a content_pane, its components are returned.
def components
if self.respond_to?(:getContentPane)
self.content_pane.components
else
super
end
end

# Adds a component to a container, if specified via :belongs_to in options.
def self.add_if_requested(component, options)
if(container = Options.value_for(options => :belongs_to))
Expand Down

0 comments on commit 341f118

Please sign in to comment.