class TaskJuggler::ReportTableLine

Attributes

bold[RW]
fontSize[RW]
height[RW]
indentation[RW]
lineNo[RW]
no[RW]
property[R]
scopeLine[R]
subLineNo[RW]
table[R]

Public Class Methods

new(table, property, scopeLine) click to toggle source

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.

# 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

Public Instance Methods

addCell(cell) click to toggle source

Add the new cell to the line. cell must reference a ReportTableCell object.

# File lib/taskjuggler/reports/ReportTableLine.rb, line 66
def addCell(cell)
  @cells << cell
end
last(count = 0) click to toggle source

Return the last non-hidden cell of the line. Start to look for the cell at the first cell after count cells.

# 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() click to toggle source

Return the scope property or nil

# File lib/taskjuggler/reports/ReportTableLine.rb, line 71
def scopeProperty
  @scopeLine ? @scopeLine.property : nil
end
to_csv(csv, startColumn, lineIdx) click to toggle source

Convert the intermediate format into an Array of values. One entry for every column cell of this line.

# 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() click to toggle source

Return this line as a set of XMLElement that represent the line in HTML.

# 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