Class: TaskJuggler::ReportTableLine
- Defined in:
- lib/taskjuggler/reports/ReportTableLine.rb
Instance Attribute Summary collapse
-
#bold ⇒ Object
Returns the value of attribute bold.
-
#fontSize ⇒ Object
Returns the value of attribute fontSize.
-
#height ⇒ Object
Returns the value of attribute height.
-
#indentation ⇒ Object
Returns the value of attribute indentation.
-
#lineNo ⇒ Object
Returns the value of attribute lineNo.
-
#no ⇒ Object
Returns the value of attribute no.
-
#property ⇒ Object
readonly
Returns the value of attribute property.
-
#scopeLine ⇒ Object
readonly
Returns the value of attribute scopeLine.
-
#subLineNo ⇒ Object
Returns the value of attribute subLineNo.
-
#table ⇒ Object
readonly
Returns the value of attribute table.
Instance Method Summary collapse
-
#addCell(cell) ⇒ Object
Add the new cell to the line.
-
#initialize(table, property, scopeLine) ⇒ ReportTableLine
constructor
Create a ReportTableCell object and initialize the variables with default values.
-
#last(count = 0) ⇒ Object
Return the last non-hidden cell of the line.
-
#scopeProperty ⇒ Object
Return the scope property or nil.
-
#to_csv(csv, startColumn, lineIdx) ⇒ Object
Convert the intermediate format into an Array of values.
-
#to_html ⇒ Object
Return this line as a set of XMLElement that represent the line in HTML.
Constructor Details
#initialize(table, property, scopeLine) ⇒ ReportTableLine
Create a ReportTableCell object and initialize the variables with default values. table is a reference to the ReportTable object this line belongs to. property is a reference to the Task or Resource that is displayed in this line. scopeLine is the line that sets the scope for this line. The value is nil if this is a primary line.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/taskjuggler/reports/ReportTableLine.rb', line 29 def initialize(table, property, scopeLine) @table = table @property = property @scopeLine = scopeLine # Register the new line with the table it belongs to. @table.addLine(self) # The cells of this line. Should be references to ReportTableCell objects. @cells = [] # Heigh of the line in screen pixels @height = 21 # Indentation for hierachiecal columns in screen pixels. @indentation = 0 # The factor used to enlarge or shrink the font size for this line. @fontSize = 12 # Specifies whether the whole line should be in bold type or not. @bold = false # Counter that counts primary and nested lines separately. It restarts # with 0 for each new nested line set. Scenario lines don't count. @no = nil # Counter that counts the primary lines. Scenario lines don't count. @lineNo = nil # Counter that counts all lines. @subLineNo = nil end |
Instance Attribute Details
#bold ⇒ Object
Returns the value of attribute bold.
21 22 23 |
# File 'lib/taskjuggler/reports/ReportTableLine.rb', line 21 def bold @bold end |
#fontSize ⇒ Object
Returns the value of attribute fontSize.
21 22 23 |
# File 'lib/taskjuggler/reports/ReportTableLine.rb', line 21 def fontSize @fontSize end |
#height ⇒ Object
Returns the value of attribute height.
21 22 23 |
# File 'lib/taskjuggler/reports/ReportTableLine.rb', line 21 def height @height end |
#indentation ⇒ Object
Returns the value of attribute indentation.
21 22 23 |
# File 'lib/taskjuggler/reports/ReportTableLine.rb', line 21 def indentation @indentation end |
#lineNo ⇒ Object
Returns the value of attribute lineNo.
21 22 23 |
# File 'lib/taskjuggler/reports/ReportTableLine.rb', line 21 def lineNo @lineNo end |
#no ⇒ Object
Returns the value of attribute no.
21 22 23 |
# File 'lib/taskjuggler/reports/ReportTableLine.rb', line 21 def no @no end |
#property ⇒ Object (readonly)
Returns the value of attribute property.
20 21 22 |
# File 'lib/taskjuggler/reports/ReportTableLine.rb', line 20 def property @property end |
#scopeLine ⇒ Object (readonly)
Returns the value of attribute scopeLine.
20 21 22 |
# File 'lib/taskjuggler/reports/ReportTableLine.rb', line 20 def scopeLine @scopeLine end |
#subLineNo ⇒ Object
Returns the value of attribute subLineNo.
21 22 23 |
# File 'lib/taskjuggler/reports/ReportTableLine.rb', line 21 def subLineNo @subLineNo end |
#table ⇒ Object (readonly)
Returns the value of attribute table.
20 21 22 |
# File 'lib/taskjuggler/reports/ReportTableLine.rb', line 20 def table @table end |
Instance Method Details
#addCell(cell) ⇒ Object
Add the new cell to the line. cell must reference a ReportTableCell object.
66 67 68 |
# File 'lib/taskjuggler/reports/ReportTableLine.rb', line 66 def addCell(cell) @cells << cell end |
#last(count = 0) ⇒ Object
Return the last non-hidden cell of the line. Start to look for the cell at the first cell after count cells.
57 58 59 60 61 62 |
# File 'lib/taskjuggler/reports/ReportTableLine.rb', line 57 def last(count = 0) (1 + count).upto(@cells.length) do |i| return @cells[-i] unless @cells[-i].hidden end nil end |
#scopeProperty ⇒ Object
Return the scope property or nil
71 72 73 |
# File 'lib/taskjuggler/reports/ReportTableLine.rb', line 71 def scopeProperty @scopeLine ? @scopeLine.property : nil end |
#to_csv(csv, startColumn, lineIdx) ⇒ Object
Convert the intermediate format into an Array of values. One entry for every column cell of this line.
87 88 89 90 91 92 93 |
# File 'lib/taskjuggler/reports/ReportTableLine.rb', line 87 def to_csv(csv, startColumn, lineIdx) columnIdx = startColumn @cells.each do |cell| columnIdx += cell.to_csv(csv, columnIdx, lineIdx) end columnIdx - startColumn end |
#to_html ⇒ Object
Return this line as a set of XMLElement that represent the line in HTML.
76 77 78 79 80 81 82 83 |
# File 'lib/taskjuggler/reports/ReportTableLine.rb', line 76 def to_html style = "" style += "height:#{@height}px; " if @table.equiLines style += "font-size:#{@fontSize}px; " if @fontSize tr = XMLElement.new('tr', 'class' => 'tabline', 'style' => style) @cells.each { |cell| tr << cell.to_html } tr end |