Class: Thinreports::BasicReport::Core::Shape::List::Page
- Inherits:
-
Basic::Interface
- Object
- Base::Interface
- Basic::Interface
- Thinreports::BasicReport::Core::Shape::List::Page
- Extended by:
- Forwardable
- Defined in:
- lib/thinreports/basic_report/core/shape/list/page.rb
Instance Attribute Summary collapse
-
#manager ⇒ Object
readonly
Returns the value of attribute manager.
Attributes inherited from Base::Interface
Instance Method Summary collapse
- #add_row(values = {}) {|row, | ... } ⇒ Boolean
- #copy(new_parent) ⇒ Thinreports::BasicReport::Core::Shape::List::Page
-
#initialize(parent, format, internal = nil, manager = nil) ⇒ Page
constructor
A new instance of Page.
- #on_footer_insert {|footer| ... } ⇒ Thinreports::BasicReport::Core::Shape::List::SectionInterface
- #on_page_finalize(&block) ⇒ Object
- #on_page_footer_insert {|page_footer| ... } ⇒ Object
-
#overflow? ⇒ Boolean
Returns true if list has overflowed when ‘list#add_row` is called at the next time.
-
#page_break ⇒ Object
(also: #finalize)
If enabled, the auto-page-break of the list will force a page break at the time this method is called.
Methods inherited from Basic::Interface
#hide, #id, #show, #style, #styles, #visible, #visible?
Methods included from Utils
#blank_value?, #call_block_in, #deep_copy, included
Constructor Details
#initialize(parent, format, internal = nil, manager = nil) ⇒ Page
Returns a new instance of Page.
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/thinreports/basic_report/core/shape/list/page.rb', line 17 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 |
Instance Attribute Details
#manager ⇒ Object (readonly)
Returns the value of attribute manager.
11 12 13 |
# File 'lib/thinreports/basic_report/core/shape/list/page.rb', line 11 def manager @manager end |
Instance Method Details
#add_row(values = {}) {|row, | ... } ⇒ Boolean
55 56 57 |
# File 'lib/thinreports/basic_report/core/shape/list/page.rb', line 55 def add_row(values = {}, &block) manager.add_detail(values, &block) end |
#copy(new_parent) ⇒ Thinreports::BasicReport::Core::Shape::List::Page
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/thinreports/basic_report/core/shape/list/page.rb', line 78 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 |
#on_footer_insert {|footer| ... } ⇒ Thinreports::BasicReport::Core::Shape::List::SectionInterface
47 48 49 |
# File 'lib/thinreports/basic_report/core/shape/list/page.rb', line 47 def (&block) manager. = block end |
#on_page_finalize(&block) ⇒ Object
34 35 36 |
# File 'lib/thinreports/basic_report/core/shape/list/page.rb', line 34 def on_page_finalize(&block) manager.page_finalize_handler = block end |
#on_page_footer_insert {|page_footer| ... } ⇒ Object
40 41 42 |
# File 'lib/thinreports/basic_report/core/shape/list/page.rb', line 40 def (&block) manager. = block end |
#overflow? ⇒ Boolean
Returns true if list has overflowed when ‘list#add_row` is called at the next time.
72 73 74 |
# File 'lib/thinreports/basic_report/core/shape/list/page.rb', line 72 def overflow? manager.overflow_with?(:detail) end |
#page_break ⇒ Object Also known as: finalize
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.
61 62 63 64 65 66 67 |
# File 'lib/thinreports/basic_report/core/shape/list/page.rb', line 61 def page_break if manager.auto_page_break? manager.change_new_page else manager.finalize_page end end |