thinreports 0.7.6 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -5
- data/.travis.yml +8 -4
- data/CHANGELOG.md +220 -0
- data/Gemfile +2 -9
- data/MIT-LICENSE +1 -1
- data/README.md +286 -0
- data/Rakefile +38 -8
- data/examples/character_spacing/character_spacing.rb +8 -0
- data/examples/character_spacing/character_spacing.tlf +1 -0
- data/examples/dynamic_image/dynamic_image.rb +31 -0
- data/examples/dynamic_image/dynamic_image.tlf +1 -0
- data/examples/dynamic_style/dynamic_style.rb +150 -0
- data/examples/dynamic_style/dynamic_style.tlf +1 -0
- data/examples/dynamic_style/dynamic_style_in_list.tlf +1 -0
- data/examples/eudc/eudc.rb +20 -0
- data/examples/eudc/eudc.tlf +1 -0
- data/examples/helper.rb +50 -0
- data/examples/hidden_shapes/hidden_shapes.rb +9 -0
- data/examples/hidden_shapes/hidden_shapes.tlf +1 -0
- data/examples/list_events/list_events.rb +59 -0
- data/examples/list_events/list_events_0_7_7.tlf +1 -0
- data/examples/list_events/list_events_0_8.tlf +1 -0
- data/examples/list_manual_generation/list_manual_generation.rb +22 -0
- data/examples/list_manual_generation/list_manual_generation.tlf +1 -0
- data/examples/list_page_number/list_page_number.rb +17 -0
- data/examples/list_page_number/list_page_number.tlf +1 -0
- data/examples/page_number/page_number.rb +33 -0
- data/examples/page_number/page_number.tlf +1 -0
- data/examples/password_setting/password_setting.rb +10 -0
- data/examples/password_setting/password_setting.tlf +1 -0
- data/examples/report_callbacks/report_callbacks.rb +31 -0
- data/examples/report_callbacks/report_callbacks.tlf +1 -0
- data/examples/single_line_tblock/single_line_tblock.rb +13 -0
- data/examples/single_line_tblock/single_line_tblock.tlf +1 -0
- data/examples/tblock_overflow/tblock_overflow.rb +20 -0
- data/examples/tblock_overflow/tblock_overflow.tlf +1 -0
- data/examples/tblock_styles/font_size.tlf +1 -0
- data/examples/tblock_styles/tblock_styles.rb +43 -0
- data/examples/tblock_styles/tblock_styles.tlf +1 -0
- data/examples/text_align/text_align.rb +8 -0
- data/examples/text_align/text_align.tlf +1 -0
- data/examples/typeB_page_size/B4_ISO.tlf +1 -0
- data/examples/typeB_page_size/B4_JIS.tlf +1 -0
- data/examples/typeB_page_size/typeB_page_size.rb +17 -0
- data/examples/word_wrap/word_wrap.rb +26 -0
- data/examples/word_wrap/word_wrap.tlf +1 -0
- data/lib/thinreports/config.rb +30 -10
- data/lib/thinreports/core/errors.rb +23 -20
- data/lib/thinreports/core/events.rb +18 -19
- data/lib/thinreports/core/format/base.rb +20 -25
- data/lib/thinreports/core/format/builder.rb +19 -27
- data/lib/thinreports/core/shape/base/interface.rb +15 -15
- data/lib/thinreports/core/shape/base/internal.rb +15 -20
- data/lib/thinreports/core/shape/base.rb +4 -5
- data/lib/thinreports/core/shape/basic/block_format.rb +3 -4
- data/lib/thinreports/core/shape/basic/block_interface.rb +9 -4
- data/lib/thinreports/core/shape/basic/block_internal.rb +9 -10
- data/lib/thinreports/core/shape/basic/format.rb +11 -10
- data/lib/thinreports/core/shape/basic/interface.rb +3 -3
- data/lib/thinreports/core/shape/basic/internal.rb +9 -6
- data/lib/thinreports/core/shape/basic.rb +1 -1
- data/lib/thinreports/core/shape/image_block/format.rb +5 -6
- data/lib/thinreports/core/shape/image_block/interface.rb +9 -7
- data/lib/thinreports/core/shape/image_block/internal.rb +5 -6
- data/lib/thinreports/core/shape/image_block.rb +1 -1
- data/lib/thinreports/core/shape/list/configuration.rb +37 -16
- data/lib/thinreports/core/shape/list/events.rb +11 -11
- data/lib/thinreports/core/shape/list/format.rb +27 -28
- data/lib/thinreports/core/shape/list/manager.rb +135 -95
- data/lib/thinreports/core/shape/list/page.rb +57 -51
- data/lib/thinreports/core/shape/list/page_state.rb +19 -17
- data/lib/thinreports/core/shape/list/section_format.rb +14 -15
- data/lib/thinreports/core/shape/list/section_interface.rb +15 -16
- data/lib/thinreports/core/shape/list/section_internal.rb +7 -8
- data/lib/thinreports/core/shape/list/store.rb +10 -11
- data/lib/thinreports/core/shape/list.rb +1 -1
- data/lib/thinreports/core/shape/manager/format.rb +10 -11
- data/lib/thinreports/core/shape/manager/internal.rb +22 -21
- data/lib/thinreports/core/shape/manager/target.rb +63 -34
- data/lib/thinreports/core/shape/manager.rb +1 -1
- data/lib/thinreports/core/shape/page_number/format.rb +25 -0
- data/lib/thinreports/core/shape/page_number/interface.rb +27 -0
- data/lib/thinreports/core/shape/page_number/internal.rb +57 -0
- data/lib/thinreports/core/shape/page_number.rb +15 -0
- data/lib/thinreports/core/shape/style/base.rb +29 -29
- data/lib/thinreports/core/shape/style/basic.rb +1 -1
- data/lib/thinreports/core/shape/style/graphic.rb +10 -25
- data/lib/thinreports/core/shape/style/text.rb +41 -31
- data/lib/thinreports/core/shape/style.rb +1 -1
- data/lib/thinreports/core/shape/text/format.rb +8 -9
- data/lib/thinreports/core/shape/text/interface.rb +2 -2
- data/lib/thinreports/core/shape/text/internal.rb +6 -7
- data/lib/thinreports/core/shape/text.rb +1 -1
- data/lib/thinreports/core/shape/text_block/format.rb +17 -17
- data/lib/thinreports/core/shape/text_block/formatter/basic.rb +13 -12
- data/lib/thinreports/core/shape/text_block/formatter/datetime.rb +8 -9
- data/lib/thinreports/core/shape/text_block/formatter/number.rb +11 -12
- data/lib/thinreports/core/shape/text_block/formatter/padding.rb +9 -32
- data/lib/thinreports/core/shape/text_block/formatter.rb +7 -8
- data/lib/thinreports/core/shape/text_block/interface.rb +2 -2
- data/lib/thinreports/core/shape/text_block/internal.rb +19 -20
- data/lib/thinreports/core/shape/text_block.rb +1 -1
- data/lib/thinreports/core/shape.rb +11 -13
- data/lib/thinreports/core/utils.rb +33 -32
- data/lib/thinreports/generator/base.rb +15 -24
- data/lib/thinreports/generator/configuration.rb +10 -9
- data/lib/thinreports/generator/pdf/configuration.rb +11 -6
- data/lib/thinreports/generator/pdf/document/draw_shape.rb +41 -32
- data/lib/thinreports/generator/pdf/document/font.rb +53 -44
- data/lib/thinreports/generator/pdf/document/graphics/attributes.rb +34 -25
- data/lib/thinreports/generator/pdf/document/graphics/basic.rb +25 -25
- data/lib/thinreports/generator/pdf/document/graphics/image.rb +15 -15
- data/lib/thinreports/generator/pdf/document/graphics/text.rb +43 -41
- data/lib/thinreports/generator/pdf/document/graphics.rb +8 -9
- data/lib/thinreports/generator/pdf/document/page.rb +37 -23
- data/lib/thinreports/generator/pdf/document/parse_color.rb +9 -10
- data/lib/thinreports/generator/pdf/document/parse_svg.rb +14 -15
- data/lib/thinreports/generator/pdf/document.rb +28 -28
- data/lib/thinreports/generator/pdf/drawer/base.rb +16 -22
- data/lib/thinreports/generator/pdf/drawer/list.rb +39 -21
- data/lib/thinreports/generator/pdf/drawer/list_section.rb +17 -18
- data/lib/thinreports/generator/pdf/drawer/page.rb +37 -26
- data/lib/thinreports/generator/pdf/prawn_ext.rb +18 -17
- data/lib/thinreports/generator/pdf.rb +28 -31
- data/lib/thinreports/generator.rb +6 -8
- data/lib/thinreports/layout/base.rb +24 -36
- data/lib/thinreports/layout/configuration.rb +11 -9
- data/lib/thinreports/layout/format.rb +26 -31
- data/lib/thinreports/layout/version.rb +8 -9
- data/lib/thinreports/layout.rb +2 -2
- data/lib/thinreports/report/base.rb +117 -109
- data/lib/thinreports/report/events.rb +5 -5
- data/lib/thinreports/report/internal.rb +48 -38
- data/lib/thinreports/{core → report}/page.rb +42 -32
- data/lib/thinreports/report.rb +10 -14
- data/lib/thinreports/version.rb +2 -3
- data/lib/thinreports.rb +14 -2
- data/test/data/font.ttf +0 -0
- data/test/data/layout_block.tlf +1 -0
- data/test/data/layout_list.tlf +1 -0
- data/test/data/layout_list_noheader.tlf +1 -0
- data/test/data/layout_text1.tlf +1 -0
- data/test/data/layout_text2.tlf +1 -0
- data/test/test_helper.rb +74 -0
- data/test/tmp/.gitkeep +0 -0
- data/test/unit/core/format/test_base.rb +14 -14
- data/test/unit/core/format/test_builder.rb +20 -25
- data/test/unit/core/shape/base/test_internal.rb +34 -37
- data/test/unit/core/shape/basic/test_basic_format.rb +4 -4
- data/test/unit/core/shape/basic/test_basic_interface.rb +15 -13
- data/test/unit/core/shape/basic/test_basic_internal.rb +19 -16
- data/test/unit/core/shape/basic/test_format.rb +4 -4
- data/test/unit/core/shape/basic/test_interface.rb +36 -46
- data/test/unit/core/shape/basic/test_internal.rb +29 -18
- data/test/unit/core/shape/image_block/test_format.rb +5 -5
- data/test/unit/core/shape/image_block/test_interface.rb +17 -16
- data/test/unit/core/shape/image_block/test_internal.rb +19 -16
- data/test/unit/core/shape/list/test_configuration.rb +50 -33
- data/test/unit/core/shape/list/test_events.rb +7 -7
- data/test/unit/core/shape/list/test_format.rb +16 -18
- data/test/unit/core/shape/list/test_manager.rb +15 -5
- data/test/unit/core/shape/list/test_page.rb +80 -22
- data/test/unit/core/shape/list/test_page_state.rb +13 -13
- data/test/unit/core/shape/list/test_section_format.rb +16 -17
- data/test/unit/core/shape/list/test_section_interface.rb +30 -22
- data/test/unit/core/shape/list/test_section_internal.rb +21 -19
- data/test/unit/core/shape/list/test_store.rb +7 -7
- data/test/unit/core/shape/manager/test_format.rb +11 -15
- data/test/unit/core/shape/manager/test_internal.rb +9 -9
- data/test/unit/core/shape/manager/test_target.rb +85 -57
- data/test/unit/core/shape/page_number/test_format.rb +73 -0
- data/test/unit/core/shape/page_number/test_interface.rb +33 -0
- data/test/unit/core/shape/page_number/test_internal.rb +81 -0
- data/test/unit/core/shape/styles/test_base.rb +9 -9
- data/test/unit/core/shape/styles/test_basic.rb +5 -5
- data/test/unit/core/shape/styles/test_graphic.rb +19 -33
- data/test/unit/core/shape/styles/test_text.rb +29 -7
- data/test/unit/core/shape/text/test_format.rb +6 -6
- data/test/unit/core/shape/text/test_internal.rb +11 -12
- data/test/unit/core/shape/text_block/formatter/test_basic.rb +16 -16
- data/test/unit/core/shape/text_block/formatter/test_datetime.rb +22 -20
- data/test/unit/core/shape/text_block/formatter/test_number.rb +34 -34
- data/test/unit/core/shape/text_block/formatter/test_padding.rb +44 -44
- data/test/unit/core/shape/text_block/test_format.rb +13 -8
- data/test/unit/core/shape/text_block/test_formatter.rb +17 -17
- data/test/unit/core/shape/text_block/test_interface.rb +37 -20
- data/test/unit/core/shape/text_block/test_internal.rb +38 -38
- data/test/unit/core/test_events.rb +10 -8
- data/test/unit/core/test_shape.rb +11 -7
- data/test/unit/core/test_utils.rb +68 -0
- data/test/unit/generator/pdf/document/graphics/test_attributes.rb +10 -4
- data/test/unit/generator/pdf/document/graphics/test_text.rb +60 -53
- data/test/unit/generator/pdf/document/test_draw_shape.rb +14 -6
- data/test/unit/generator/pdf/document/test_font.rb +79 -58
- data/test/unit/generator/pdf/document/test_graphics.rb +18 -19
- data/test/unit/generator/pdf/document/test_page.rb +68 -43
- data/test/unit/generator/pdf/document/test_parse_color.rb +5 -5
- data/test/unit/generator/pdf/test_configuration.rb +16 -9
- data/test/unit/generator/pdf/test_document.rb +8 -16
- data/test/unit/generator/test_base.rb +31 -42
- data/test/unit/generator/test_configuration.rb +6 -6
- data/test/unit/generator/test_pdf.rb +15 -21
- data/test/unit/layout/test_base.rb +34 -79
- data/test/unit/layout/test_configuration.rb +12 -37
- data/test/unit/layout/test_format.rb +36 -39
- data/test/unit/layout/test_version.rb +4 -4
- data/test/unit/report/test_base.rb +160 -192
- data/test/unit/report/test_events.rb +4 -4
- data/test/unit/report/test_internal.rb +102 -82
- data/test/unit/test_config.rb +31 -12
- data/test/unit/test_layout.rb +7 -7
- data/test/unit/test_report.rb +12 -24
- data/thinreports.gemspec +23 -26
- metadata +118 -181
- data/.yardopts +0 -1
- data/LICENSE +0 -1
- data/README.rdoc +0 -167
- data/doc/yardoc_templates/default/layout/html/footer.erb +0 -10
- data/lib/thinreports/core/ext/array.rb +0 -19
- data/lib/thinreports/core/ext/hash.rb +0 -19
- data/lib/thinreports/core/ext/object.rb +0 -25
- data/lib/thinreports/core/ext.rb +0 -5
- data/lib/thinreports/core/format.rb +0 -14
- data/lib/thinreports/core/ordered_hash.rb +0 -39
- data/lib/thinreports/core.rb +0 -20
- data/lib/thinreports/generator/pdf/drawer.rb +0 -16
- data/tasks/doc.rake +0 -13
- data/tasks/test.rake +0 -56
- data/test/benchmark/basic_estimate.tlf +0 -1
- data/test/benchmark/bench_basic_estimate.rb +0 -95
- data/test/case/character_spacing/character_spacing.rb +0 -7
- data/test/case/character_spacing/character_spacing.tlf +0 -1
- data/test/case/dynamic_image/dynamic_image.rb +0 -41
- data/test/case/dynamic_image/dynamic_image.tlf +0 -1
- data/test/case/dynamic_style/dynamic_style.rb +0 -154
- data/test/case/dynamic_style/dynamic_style.tlf +0 -1
- data/test/case/dynamic_style/dynamic_style_in_list.tlf +0 -1
- data/test/case/eudc/eudc.rb +0 -20
- data/test/case/eudc/eudc.tlf +0 -1
- data/test/case/helper.rb +0 -29
- data/test/case/hidden_shapes/hidden_shapes.rb +0 -13
- data/test/case/hidden_shapes/hidden_shapes.tlf +0 -1
- data/test/case/list_events/list_events.rb +0 -32
- data/test/case/list_events/list_events.tlf +0 -1
- data/test/case/list_header_inheriting/list_header_inheriting.rb +0 -17
- data/test/case/list_header_inheriting/list_header_inheriting.tlf +0 -1
- data/test/case/list_manual_generation/list_manual_generation.rb +0 -22
- data/test/case/list_manual_generation/list_manual_generation.tlf +0 -1
- data/test/case/single_line_tblock/single_line_tblock.rb +0 -15
- data/test/case/single_line_tblock/single_line_tblock.tlf +0 -1
- data/test/case/tblock_overflow/tblock_overflow.rb +0 -20
- data/test/case/tblock_overflow/tblock_overflow.tlf +0 -1
- data/test/case/tblock_styles/tblock_styles.rb +0 -27
- data/test/case/tblock_styles/tblock_styles.tlf +0 -1
- data/test/case/text_align/text_align.rb +0 -9
- data/test/case/text_align/text_align.tlf +0 -1
- data/test/unit/core/ext/array_spec.rb +0 -29
- data/test/unit/core/ext/hash_spec.rb +0 -29
- data/test/unit/core/ext/object_spec.rb +0 -30
- data/test/unit/core/ordered_hash_spec.rb +0 -51
- data/test/unit/core/shape/base/test_interface.rb +0 -52
- data/test/unit/core/utils_spec.rb +0 -56
- data/test/unit/data/basic_layout1.tlf +0 -1
- data/test/unit/data/basic_layout2.tlf +0 -1
- data/test/unit/data/basic_list_layout.tlf +0 -1
- data/test/unit/data/basic_list_noheader_layout.tlf +0 -1
- data/test/unit/helper.rb +0 -65
- /data/{test/case → examples}/dynamic_image/img200x100.png +0 -0
- /data/{test/case → examples}/dynamic_image/img50x50.png +0 -0
- /data/{test/case → examples}/dynamic_style/image.png +0 -0
- /data/{test/case → examples}/eudc/eudc.ttf +0 -0
- /data/{resources/fonts → fonts}/IPA_Font_License_Agreement_v1.0.txt +0 -0
- /data/{resources/fonts → fonts}/ipag.ttf +0 -0
- /data/{resources/fonts → fonts}/ipagp.ttf +0 -0
- /data/{resources/fonts → fonts}/ipam.ttf +0 -0
- /data/{resources/fonts → fonts}/ipamp.ttf +0 -0
@@ -1,8 +1,8 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
module
|
3
|
+
module Thinreports
|
4
4
|
module Core::Shape
|
5
|
-
|
5
|
+
|
6
6
|
class Basic::BlockInterface < Basic::Interface
|
7
7
|
# @overload value(val)
|
8
8
|
# Set a val
|
@@ -19,7 +19,12 @@ module ThinReports
|
|
19
19
|
self
|
20
20
|
end
|
21
21
|
end
|
22
|
+
|
23
|
+
# @param [Object] val
|
24
|
+
def value=(val)
|
25
|
+
value(val)
|
26
|
+
end
|
22
27
|
end
|
23
|
-
|
28
|
+
|
24
29
|
end
|
25
|
-
end
|
30
|
+
end
|
@@ -1,33 +1,32 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
module
|
3
|
+
module Thinreports
|
4
4
|
module Core::Shape
|
5
|
-
|
6
|
-
# @private
|
5
|
+
|
7
6
|
class Basic::BlockInternal < Basic::Internal
|
8
7
|
format_delegators :box
|
9
|
-
|
8
|
+
|
10
9
|
def style
|
11
10
|
@style ||= Style::Basic.new(format)
|
12
11
|
end
|
13
|
-
|
12
|
+
|
14
13
|
def read_value
|
15
14
|
states.key?(:value) ? states[:value] : format.value.dup
|
16
15
|
end
|
17
16
|
alias_method :value, :read_value
|
18
|
-
|
17
|
+
|
19
18
|
def write_value(val)
|
20
19
|
states[:value] = val
|
21
20
|
end
|
22
|
-
|
21
|
+
|
23
22
|
def real_value
|
24
23
|
read_value
|
25
24
|
end
|
26
|
-
|
25
|
+
|
27
26
|
def type_of?(type_name)
|
28
27
|
type_name == :block
|
29
28
|
end
|
30
29
|
end
|
31
|
-
|
30
|
+
|
32
31
|
end
|
33
|
-
end
|
32
|
+
end
|
@@ -1,26 +1,27 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
module
|
3
|
+
module Thinreports
|
4
4
|
module Core::Shape
|
5
|
-
|
6
|
-
# @private
|
5
|
+
|
7
6
|
class Basic::Format < Core::Format::Base
|
7
|
+
include Utils
|
8
|
+
|
8
9
|
config_reader :type, :id
|
9
|
-
config_reader :
|
10
|
-
:
|
11
|
-
|
10
|
+
config_reader svg_tag: %w( svg tag ),
|
11
|
+
svg_attrs: %w( svg attrs )
|
12
|
+
|
12
13
|
config_checker 'true', :display
|
13
|
-
|
14
|
+
|
14
15
|
class << self
|
15
16
|
private
|
16
|
-
|
17
|
+
|
17
18
|
# @param [Hash] raw_format
|
18
|
-
# @return [
|
19
|
+
# @return [Thinreports::Core::Shape::Basic::Format]
|
19
20
|
def build_internal(raw_format)
|
20
21
|
new(raw_format)
|
21
22
|
end
|
22
23
|
end
|
23
24
|
end
|
24
|
-
|
25
|
+
|
25
26
|
end
|
26
27
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
module
|
3
|
+
module Thinreports
|
4
4
|
module Core::Shape
|
5
5
|
|
6
6
|
class Basic::Interface < Base::Interface
|
@@ -50,7 +50,7 @@ module ThinReports
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
# @param [Hash] settings :
|
53
|
+
# @param [Hash] settings style_name: value
|
54
54
|
# @return [self]
|
55
55
|
def styles(settings)
|
56
56
|
settings.each{ |args| style(*args) }
|
@@ -73,7 +73,7 @@ module ThinReports
|
|
73
73
|
|
74
74
|
private
|
75
75
|
|
76
|
-
# @see
|
76
|
+
# @see Thinreports::Core::Shape::Base::Interface#init_internal
|
77
77
|
def init_internal(parent, format)
|
78
78
|
Basic::Internal.new(parent, format)
|
79
79
|
end
|
@@ -1,20 +1,23 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
module
|
3
|
+
module Thinreports
|
4
4
|
module Core::Shape
|
5
|
-
|
6
|
-
# @private
|
5
|
+
|
7
6
|
class Basic::Internal < Base::Internal
|
8
7
|
# Delegate to Format's methods
|
9
8
|
format_delegators :id, :svg_tag, :type
|
10
|
-
|
9
|
+
|
11
10
|
def style
|
12
11
|
@style ||= Style::Graphic.new(format)
|
13
12
|
end
|
14
|
-
|
13
|
+
|
15
14
|
def type_of?(type_name)
|
16
15
|
['s-basic', self.type].include?("s-#{type_name}")
|
17
16
|
end
|
17
|
+
|
18
|
+
def identifier
|
19
|
+
"#{id}#{style.identifier}"
|
20
|
+
end
|
18
21
|
end
|
19
22
|
end
|
20
|
-
end
|
23
|
+
end
|
@@ -1,13 +1,12 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
module
|
3
|
+
module Thinreports
|
4
4
|
module Core::Shape
|
5
|
-
|
6
|
-
# @private
|
5
|
+
|
7
6
|
class ImageBlock::Format < Basic::BlockFormat
|
8
|
-
config_reader :
|
9
|
-
:
|
7
|
+
config_reader position_x: %w( position-x ),
|
8
|
+
position_y: %w( position-y )
|
10
9
|
end
|
11
|
-
|
10
|
+
|
12
11
|
end
|
13
12
|
end
|
@@ -1,19 +1,21 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
module
|
3
|
+
module Thinreports
|
4
4
|
module Core::Shape
|
5
|
-
|
5
|
+
|
6
6
|
class ImageBlock::Interface < Basic::BlockInterface
|
7
7
|
# @see #value
|
8
8
|
alias_method :src, :value
|
9
|
-
|
9
|
+
# @see #value=
|
10
|
+
alias_method :src=, :value=
|
11
|
+
|
10
12
|
private
|
11
|
-
|
12
|
-
# @see
|
13
|
+
|
14
|
+
# @see Thinreports::Core::Shape::Base::Interface#init_internal
|
13
15
|
def init_internal(parent, format)
|
14
16
|
ImageBlock::Internal.new(parent, format)
|
15
17
|
end
|
16
18
|
end
|
17
|
-
|
19
|
+
|
18
20
|
end
|
19
|
-
end
|
21
|
+
end
|
@@ -1,16 +1,15 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
module
|
3
|
+
module Thinreports
|
4
4
|
module Core::Shape
|
5
|
-
|
6
|
-
# @private
|
5
|
+
|
7
6
|
class ImageBlock::Internal < Basic::BlockInternal
|
8
7
|
alias_method :src, :read_value
|
9
|
-
|
8
|
+
|
10
9
|
def type_of?(type_name)
|
11
10
|
type_name == :iblock || super
|
12
11
|
end
|
13
12
|
end
|
14
|
-
|
13
|
+
|
15
14
|
end
|
16
|
-
end
|
15
|
+
end
|
@@ -1,33 +1,54 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
module
|
3
|
+
module Thinreports
|
4
4
|
module Core::Shape
|
5
|
-
|
5
|
+
|
6
6
|
class List::Configuration
|
7
|
-
# @return [
|
8
|
-
|
9
|
-
|
10
|
-
#
|
7
|
+
# @return [Thinreports::Core::Shape::List::Store]
|
8
|
+
# @deprecated
|
9
|
+
# `List::Page#store` will be removed in the next major version.
|
10
|
+
# You can create a list using #on_page_footer_insert, #on_footer_insert and #on_page_finalize callbacks instead.
|
11
|
+
# See also https://github.com/thinreports/thinreports-generator/blob/master/examples/list_events/list_events.rb.
|
11
12
|
attr_reader :store
|
12
|
-
|
13
|
-
# @param [
|
14
|
-
# @param [
|
13
|
+
|
14
|
+
# @param [Thinreports::Core::Shape::List::Events, nil] events (nil)
|
15
|
+
# @param [Thinreports::Core::Shape::List::Store, nil] store (nil)
|
15
16
|
def initialize(events = nil, store = nil)
|
16
17
|
@events = events || List::Events.new
|
17
18
|
@store = store
|
18
19
|
end
|
19
|
-
|
20
|
-
# @
|
20
|
+
|
21
|
+
# @return [Thinreports::Core::Shape::List::Events]
|
22
|
+
# @deprecated
|
23
|
+
# `List::Page#events` will be removed in the next major version.
|
24
|
+
# Please use #on_page_footer_insert, #on_footer_insert and #on_page_finalize callbacks instead.
|
25
|
+
# See also https://github.com/thinreports/thinreports-generator/blob/master/examples/list_events/list_events.rb.
|
26
|
+
def events
|
27
|
+
warn '[DEPRECATION] `List#events` will be removed in the next major version. ' +
|
28
|
+
'Please use #on_page_footer_insert, #on_footer_insert and #on_page_finalize callbacks instead. ' +
|
29
|
+
'See also https://github.com/thinreports/thinreports-generator/blob/master/examples/list_events/list_events.rb.'
|
30
|
+
@events
|
31
|
+
end
|
32
|
+
|
33
|
+
def internal_events
|
34
|
+
@events
|
35
|
+
end
|
36
|
+
|
37
|
+
# @param [Hash] stores name: default value
|
21
38
|
def use_stores(stores)
|
22
39
|
@store = List::Store.init(stores)
|
23
40
|
end
|
24
|
-
|
25
|
-
# @return [
|
26
|
-
# @private
|
41
|
+
|
42
|
+
# @return [Thinreports::Core::Shape::List::Configuration]
|
27
43
|
def copy
|
28
44
|
self.class.new(@events.copy, @store && @store.copy)
|
29
45
|
end
|
46
|
+
|
47
|
+
# @return [String]
|
48
|
+
def type
|
49
|
+
List::TYPE_NAME
|
50
|
+
end
|
30
51
|
end
|
31
|
-
|
52
|
+
|
32
53
|
end
|
33
|
-
end
|
54
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
module
|
3
|
+
module Thinreports
|
4
4
|
module Core::Shape
|
5
5
|
|
6
6
|
class List::Events < Core::Events
|
@@ -11,34 +11,34 @@ module ThinReports
|
|
11
11
|
end
|
12
12
|
|
13
13
|
class PageEvent < Event
|
14
|
-
# @return [
|
14
|
+
# @return [Thinreports::Report::Page]
|
15
15
|
attr_reader :page
|
16
16
|
|
17
|
-
# @param type (see
|
18
|
-
# @param [
|
19
|
-
# @param [
|
17
|
+
# @param type (see Thinreports::Core::Events::Event#initialize)
|
18
|
+
# @param [Thinreports::Core::Shape::List::Page] target
|
19
|
+
# @param [Thinreports::Report::Page] page
|
20
20
|
def initialize(type, target, page)
|
21
21
|
super(type, target)
|
22
22
|
@page = page
|
23
23
|
end
|
24
24
|
|
25
|
-
# @return [
|
25
|
+
# @return [Thinreports::Core::Shape::List::Page]
|
26
26
|
alias_method :list, :target
|
27
27
|
end
|
28
28
|
|
29
29
|
class SectionEvent < Event
|
30
|
-
# @return [
|
30
|
+
# @return [Thinreports::Core::Shape::List::Store]
|
31
31
|
attr_reader :store
|
32
32
|
|
33
|
-
# @param type (see
|
34
|
-
# @param [
|
35
|
-
# @param [
|
33
|
+
# @param type (see Thinreports::Core::Events::Event#initialize)
|
34
|
+
# @param [Thinreports::Core::Shape::List::SectionInterface] target
|
35
|
+
# @param [Thinreports::Core::Shape::List::Store] store
|
36
36
|
def initialize(type, target, store)
|
37
37
|
super(type, target)
|
38
38
|
@store = store
|
39
39
|
end
|
40
40
|
|
41
|
-
# @return [
|
41
|
+
# @return [Thinreports::Core::Shape::List::SectionInterface]
|
42
42
|
alias_method :section, :target
|
43
43
|
end
|
44
44
|
end
|
@@ -1,53 +1,52 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
module
|
3
|
+
module Thinreports
|
4
4
|
module Core::Shape
|
5
|
-
|
6
|
-
# @private
|
5
|
+
|
7
6
|
class List::Format < Basic::Format
|
8
|
-
config_reader :
|
9
|
-
config_checker 'true', :
|
10
|
-
|
7
|
+
config_reader height: %w( content-height )
|
8
|
+
config_checker 'true', auto_page_break: %w( page-break )
|
9
|
+
|
11
10
|
config_reader :header,
|
12
11
|
:detail,
|
13
12
|
:footer
|
14
|
-
config_reader :
|
15
|
-
|
16
|
-
config_checker 'true', :
|
17
|
-
config_checker 'true', :
|
18
|
-
config_checker 'true', :
|
19
|
-
|
20
|
-
config_reader :
|
21
|
-
config_reader :
|
22
|
-
config_reader :
|
23
|
-
config_reader :
|
24
|
-
|
13
|
+
config_reader page_footer: %w( page-footer )
|
14
|
+
|
15
|
+
config_checker 'true', has_header: %w( header-enabled )
|
16
|
+
config_checker 'true', has_footer: %w( footer-enabled )
|
17
|
+
config_checker 'true', has_page_footer: %w( page-footer-enabled )
|
18
|
+
|
19
|
+
config_reader page_footer_height: %w( page-footer height )
|
20
|
+
config_reader footer_height: %w( footer height )
|
21
|
+
config_reader header_height: %w( header height )
|
22
|
+
config_reader detail_height: %w( detail height )
|
23
|
+
|
25
24
|
config_accessor :sections
|
26
|
-
|
25
|
+
|
27
26
|
# @param [Symbol] section_name
|
28
27
|
# @return [Hash]
|
29
28
|
def section(section_name)
|
30
29
|
__send__(section_name)
|
31
30
|
end
|
32
|
-
|
31
|
+
|
33
32
|
# @param [Symbol] section_name
|
34
33
|
# @return [Boolean]
|
35
34
|
def has_section?(section_name)
|
36
35
|
section_name == :detail ? true : __send__(:"has_#{section_name}?")
|
37
36
|
end
|
38
|
-
|
37
|
+
|
39
38
|
# @param [Symbol] section_name
|
40
39
|
# @return [Numeric]
|
41
40
|
def section_height(section_name)
|
42
41
|
has_section?(section_name) ? __send__(:"#{section_name}_height") : 0
|
43
42
|
end
|
44
|
-
|
43
|
+
|
45
44
|
class << self
|
46
|
-
|
45
|
+
|
47
46
|
private
|
48
|
-
|
47
|
+
|
49
48
|
# @param [Hash] raw_format
|
50
|
-
# @return [
|
49
|
+
# @return [Thinreports::Core::Shape::List::Format]
|
51
50
|
def build_internal(raw_format)
|
52
51
|
new(raw_format) do |f|
|
53
52
|
f.sections = {}
|
@@ -57,16 +56,16 @@ module ThinReports
|
|
57
56
|
build_section(:page_footer, f) if f.has_page_footer?
|
58
57
|
end
|
59
58
|
end
|
60
|
-
|
59
|
+
|
61
60
|
# @param [Symbol] section_name
|
62
|
-
# @param [
|
63
|
-
# @return [
|
61
|
+
# @param [Thinreports::Core::Shape::List::Format] list
|
62
|
+
# @return [Thinreports::Core::Shape::List::SectionFormat]
|
64
63
|
def build_section(section_name, list)
|
65
64
|
list.sections[section_name] =
|
66
65
|
List::SectionFormat.build(list.section(section_name))
|
67
66
|
end
|
68
67
|
end
|
69
68
|
end
|
70
|
-
|
69
|
+
|
71
70
|
end
|
72
71
|
end
|