class Lebowski::Foundation::Views::Support::CollectionItemArray

Represents a generic array of content objects for a collection view

Public Class Methods

new(parent, *params) click to toggle source
Calls superclass method Lebowski::Foundation::ObjectArray::new
# File lib/lebowski/foundation/views/collection.rb, line 79
def initialize(parent, *params)
  super(parent, 'content', 'length', *params)
end

Public Instance Methods

selected() click to toggle source
# File lib/lebowski/foundation/views/collection.rb, line 83
def selected()
  @selected = self.filter({ :is_selected => true }) if @selected.nil?
  return @selected
end

Protected Instance Methods

create_filtered_object_array(parent, array_rel_path, array_length_property_name, prefilter) click to toggle source
# File lib/lebowski/foundation/views/collection.rb, line 90
def create_filtered_object_array(parent, array_rel_path, array_length_property_name, prefilter)
  klass = self.class
  return klass.new parent, prefilter
end
find_indexes_process_filter(filter) click to toggle source

@override

Handle special flags

# File lib/lebowski/foundation/views/collection.rb, line 120
def find_indexes_process_filter(filter)
  processed_filter = {}

  @item_is_selected_flag = :no_flag
  @item_is_group_flag = :no_flag
  @item_outline_level_flag = :no_flag
  @item_disclosure_state_flag = :no_flag

  filter.each do |key, value|
    case key
    when :is_selected
      @item_is_selected_flag = value
    when :is_group
      @item_is_group_flag = value
    when :outline_level
      @item_outline_level_flag = value
    when :disclosure_state
      @item_disclosure_state_flag = value
    else
      processed_filter[key] = value
    end
  end

  return processed_filter
end
find_indexes_process_indexes(indexes) click to toggle source

@override

Handle special flags

# File lib/lebowski/foundation/views/collection.rb, line 149
def find_indexes_process_indexes(indexes)
  processed_indexes = []

  indexes.each do |index|
    if @item_is_selected_flag != :no_flag
      next if item_is_selected?(index) != @item_is_selected_flag
    end

    if @item_is_group_flag != :no_flag
      next if item_is_group?(index) != @item_is_group_flag
    end

    if @item_outline_level_flag != :no_flag
      next if item_outline_level(index) != @item_outline_level_flag
    end

    if @item_disclosure_state_flag != :no_flag
      next if item_disclosure_state(index) != @item_disclosure_state_flag
    end

    processed_indexes << index
  end

  return processed_indexes
end
init_validate_parent(parent) click to toggle source
# File lib/lebowski/foundation/views/collection.rb, line 95
def init_validate_parent(parent)
  if not parent.kind_of? CollectionView
    raise ArgumentInvalidTypeError.new "parent", parent, CollectionView
  end
end
item_disclosure_state(index) click to toggle source
# File lib/lebowski/foundation/views/collection.rb, line 113
def item_disclosure_state(index)
  return @driver.get_sc_collection_view_content_disclosure_state(@parent.abs_path, index)
end
item_is_group?(index) click to toggle source
# File lib/lebowski/foundation/views/collection.rb, line 105
def item_is_group?(index)
  return @driver.get_sc_collection_view_content_is_group(@parent.abs_path, index)
end
item_is_selected?(index) click to toggle source
# File lib/lebowski/foundation/views/collection.rb, line 101
def item_is_selected?(index)
  return @driver.get_sc_collection_view_content_is_selected(@parent.abs_path, index)
end
item_outline_level(index) click to toggle source
# File lib/lebowski/foundation/views/collection.rb, line 109
def item_outline_level(index) 
  return @driver.get_sc_collection_view_content_outline_level(@parent.abs_path, index)
end