class Thinreports::Core::Shape::List::Page

Attributes

manager[R]

Public Class Methods

new(parent, format, internal = nil, manager = nil) click to toggle source

@param [Thinreports::Report::Page] parent @param [Thinreports::Core::Shape::Basic::Format] format @param [Thinreports::Core::Shape::List::PageState] internal (nil) @param [Thinreports::Core::Shape::List::Manager] manager (nil)

# File lib/thinreports/core/shape/list/page.rb, line 16
def initialize(parent, format, internal = nil, manager = nil)
  super(parent, format, internal)

  @manager =
    if manager
      manager.switch_current!(self)
    else
      List::Manager.new(self)
    end

  # Set a reference to List::PageState List::Manager
  self.internal.manager = self.manager
end

Public Instance Methods

add_row(values = {}, &block) click to toggle source

@param [Hash] values ({}) @yield [row,] @yieldparam [Thinreports::Core::Shape::List::SectionInterface] row @return [Boolean]

# File lib/thinreports/core/shape/list/page.rb, line 54
def add_row(values = {}, &block)
  manager.add_detail(values, &block)
end
copy(new_parent) click to toggle source

@param [Thinreports::Report::Page] new_parent @return [Thinreports::Core::Shape::List::Page]

# File lib/thinreports/core/shape/list/page.rb, line 77
def copy(new_parent)
  if manager.auto_page_break?
    new_list = self.class.new(new_parent, internal.format,
                              nil, manager)
  else
    manager.finalize

    new_list = self.class.new(new_parent, internal.format,
                              internal.copy(new_parent), manager)
    internal.rows.each do |row|
      new_list.internal.rows << row.copy(new_list)
    end
    new_list.internal.finalized!
  end

  new_list.internal.header = internal.header.copy(new_list) if internal.format.has_header?
  new_list
end
finalize()
Alias for: page_break
on_page_finalize(&block) click to toggle source
# File lib/thinreports/core/shape/list/page.rb, line 33
def on_page_finalize(&block)
  manager.page_finalize_handler = block
end
overflow?() click to toggle source

@return [Boolean] Returns true if list has overflowed

when `list#add_row` is called at the next time.
# File lib/thinreports/core/shape/list/page.rb, line 71
def overflow?
  manager.overflow_with?(:detail)
end
page_break() click to toggle source

If enabled, the auto-page-break of the list will force a page break at the time this method is called. Otherwise, this list will be finalized.

# File lib/thinreports/core/shape/list/page.rb, line 60
def page_break
  if manager.auto_page_break?
    manager.change_new_page
  else
    manager.finalize_page
  end
end
Also aliased as: finalize

Private Instance Methods

init_internal(parent, format) click to toggle source

@see Thinreports::Core::Shape::Base::Interface#init_internal

# File lib/thinreports/core/shape/list/page.rb, line 99
def init_internal(parent, format)
  List::PageState.new(parent, format)
end