Class: GxtWidgets::GxtGroupingGrid

Inherits:
GxtGrid show all
Defined in:
lib/gxt-widgets/gxt_grouping_grid.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from GxtGrid

#initialize_header

Constructor Details

#initialize(element, platform) ⇒ GxtGroupingGrid

Returns a new instance of GxtGroupingGrid.



13
14
15
16
# File 'lib/gxt-widgets/gxt_grouping_grid.rb', line 13

def initialize(element, platform)
  super(element,platform)
  @current_platform = platform
end

Instance Attribute Details

#current_platformObject (readonly)

Returns the value of attribute current_platform.



11
12
13
# File 'lib/gxt-widgets/gxt_grouping_grid.rb', line 11

def current_platform
  @current_platform
end

Instance Method Details

#find_group_index_by_title(group_name, group_elements) ⇒ Object



35
36
37
38
# File 'lib/gxt-widgets/gxt_grouping_grid.rb', line 35

def find_group_index_by_title(group_name, group_elements)
  group_elements.find_index { |grp|
    grp.name.include? group_name }
end

#group(group_index) ⇒ Object



24
25
26
27
28
# File 'lib/gxt-widgets/gxt_grouping_grid.rb', line 24

def group(group_index)
  group_index = find_group_index_by_title(group_index, groups) if group_index.kind_of?(String)
  return nil unless group_index
  groups[group_index]
end

#groupsObject



18
19
20
21
22
# File 'lib/gxt-widgets/gxt_grouping_grid.rb', line 18

def groups
  get_groups.map do |group|
    initialize_group(group, @current_platform)
  end
end

#include_platform_for(platform) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/gxt-widgets/gxt_grouping_grid.rb', line 40

def include_platform_for platform
  super
  if platform[:platform] == :watir_webdriver
    require 'gxt-widgets/platforms/watir_webdriver/gxt_grid'
    self.class.send :include, GxtWidgets::Platforms::WatirWebDriver::GxtGroupingGrid
  elsif platform[:platform] == :selenium_webdriver
    require 'gxt-widgets/platforms/selenium_webdriver/gxt_grid'
    self.class.send :include, GxtWidgets::Platforms::SeleniumWebDriver::GxtGroupingGrid
  else
    raise ArgumentError, "expect platform to be :watir_webdriver or :selenium_webdriver"
  end
end

#initialize_group(group_element, platform) ⇒ Object



30
31
32
# File 'lib/gxt-widgets/gxt_grouping_grid.rb', line 30

def initialize_group(group_element, platform)
  Object::GxtWidgets::GxtGridGroup.new(group_element, self, platform)
end