Class: TaskJuggler::TextReport
- Inherits:
-
ReportBase
- Object
- ReportBase
- TaskJuggler::TextReport
- Defined in:
- lib/taskjuggler/reports/TextReport.rb
Overview
This is the most basic type of report. It only contains 5 RichText elements. It’s got a header and footer and a central text with margin elements left and right.
Instance Attribute Summary collapse
-
#center ⇒ Object
Returns the value of attribute center.
-
#footer ⇒ Object
Returns the value of attribute footer.
-
#header ⇒ Object
Returns the value of attribute header.
-
#left ⇒ Object
Returns the value of attribute left.
-
#right ⇒ Object
Returns the value of attribute right.
Instance Method Summary collapse
- #generateIntermediateFormat ⇒ Object
-
#initialize(report) ⇒ TextReport
constructor
A new instance of TextReport.
- #to_csv ⇒ Object
- #to_html ⇒ Object
Methods inherited from ReportBase
#a, #filterAccountList, #filterResourceList, #filterTaskList
Constructor Details
#initialize(report) ⇒ TextReport
Returns a new instance of TextReport.
26 27 28 29 30 31 |
# File 'lib/taskjuggler/reports/TextReport.rb', line 26 def initialize(report) super @lWidth = @cWidth = @rWidth = 0 @lPadding = @cPadding = @rPadding = 0 end |
Instance Attribute Details
#center ⇒ Object
Returns the value of attribute center.
24 25 26 |
# File 'lib/taskjuggler/reports/TextReport.rb', line 24 def center @center end |
#footer ⇒ Object
Returns the value of attribute footer.
24 25 26 |
# File 'lib/taskjuggler/reports/TextReport.rb', line 24 def @footer end |
#header ⇒ Object
Returns the value of attribute header.
24 25 26 |
# File 'lib/taskjuggler/reports/TextReport.rb', line 24 def header @header end |
#left ⇒ Object
Returns the value of attribute left.
24 25 26 |
# File 'lib/taskjuggler/reports/TextReport.rb', line 24 def left @left end |
#right ⇒ Object
Returns the value of attribute right.
24 25 26 |
# File 'lib/taskjuggler/reports/TextReport.rb', line 24 def right @right end |
Instance Method Details
#generateIntermediateFormat ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/taskjuggler/reports/TextReport.rb', line 33 def generateIntermediateFormat super # A width of 0 means, the columns flexible. if a('center') if a('left') && a('right') @lWidth = @rWidth = 20 @cWidth = 60 @lPadding = @cPadding = 2 elsif a('left') && !a('right') @lWidth = 25 @cWidth = 75 @lPadding = 2 elsif !a('left') && a('right') @cWidth = 75 @rWidth = 25 @cPadding = 2 else @cWidth = 100 end else if a('left') && a('right') @lWidth = @rWidth = 50 @lPadding = 2 elsif a('left') && !a('right') @lWidth = 100 elsif !a('left') && a('right') @rWidth = 100 end end end |
#to_csv ⇒ Object
91 92 93 94 95 96 |
# File 'lib/taskjuggler/reports/TextReport.rb', line 91 def to_csv @report.warning('text_report_no_csv', "textreport '#{@report.fullId}' cannot be converted " + "into CSV format") nil end |
#to_html ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/taskjuggler/reports/TextReport.rb', line 65 def to_html html = [] html << rt_to_html('header') if a('left') || a('center') || a('right') html << (table = XMLElement.new('table', 'class' => 'tj_text_page', 'cellspacing' => '0')) table << (row = XMLElement.new('tr', 'class' => 'tj_text_row')) %w( left center right).each do |i| width = instance_variable_get('@' + i[0].chr + 'Width') padding = instance_variable_get('@' + i[0].chr + 'Padding') if a(i) row << (col = XMLElement.new('td', 'class' => "tj_column_#{i}")) style = +'' style += "width:#{width}%; " if width > 0 style += "padding-right:#{padding}%; " if padding > 0 col['style'] = style col << rt_to_html(i) end end end html << rt_to_html('footer') html end |