Class TaskJuggler::ReportTableLine
In: lib/taskjuggler/reports/ReportTableLine.rb
Parent: Object

Methods

addCell   last   new   scopeProperty   to_csv   to_html  

Attributes

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

Public Class methods

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.

[Source]

# 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

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

[Source]

# File lib/taskjuggler/reports/ReportTableLine.rb, line 66
    def addCell(cell)
      @cells << cell
    end

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

[Source]

# 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

Return the scope property or nil

[Source]

# File lib/taskjuggler/reports/ReportTableLine.rb, line 71
    def scopeProperty
      @scopeLine ? @scopeLine.property : nil
    end

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

[Source]

# 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

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

[Source]

# 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

[Validate]