Parent

Class Index [+]

Quicksearch

TaskJuggler::ReportTableColumn

The ReportTableColumn class models the output format independend column of a ReportTable. It usually just contains the table header description. The table header comprises of one or two lines per column. So each column header consists of 2 cells. @cell1 is the top cell and must be present. @cell2 is the optional bottom cell. If @cell2 is hidden, @cell1 takes all the vertical space.

For some columns, the table does not contain the usual grid lines but another abstract object that responds to the usual generator methods such as to_html(). In such a case, @cell1 references the embedded object via its special variable. The embedded object then replaced the complete column content.

Attributes

definition[R]
cell1[R]
cell2[R]
scrollbar[RW]

Public Class Methods

new(table, definition, title) click to toggle source

Create a new column. table is a reference to the ReportTable this column belongs to. definition is the TableColumnDefinition of the column from the project definition. title is the text that is used for the column header.

    # File lib/taskjuggler/reports/ReportTableColumn.rb, line 37
37:     def initialize(table, definition, title)
38:       @table = table
39:       # Register this new column with the ReportTable.
40:       @table.addColumn(self)
41:       @definition = definition
42:       # Register this new column with the TableColumnDefinition.
43:       definition.column = self if definition
44: 
45:       # Create the 2 cells of the header.
46:       @cell1 = ReportTableCell.new(nil, nil, title, true)
47:       @cell1.padding = 5
48:       @cell2 = ReportTableCell.new(nil, nil, '', true)
49:       # Header text is always bold.
50:       @cell1.bold = @cell2.bold = true
51:       # This variable is set to true if the column requires a scrollbar later
52:       # on.
53:       @scrollbar = false
54:     end

Public Instance Methods

minWidth() click to toggle source

Return the mininum required width for the column.

    # File lib/taskjuggler/reports/ReportTableColumn.rb, line 57
57:     def minWidth
58:       width = @cell1.width
59:       width = @cell2.width if width.nil? || @cell2.width > width
60:       width
61:     end
to_csv(csv, startColumn) click to toggle source

Put the abstract representation into an Array. csv is an Array of Arrays of Strings. We have an Array with Strings for every cell. The outer Array holds the Arrays representing the lines.

    # File lib/taskjuggler/reports/ReportTableColumn.rb, line 75
75:     def to_csv(csv, startColumn)
76:       # For CSV reports we can only include the first header line.
77:       @cell1.to_csv(csv, startColumn, 0)
78:     end
to_html(row) click to toggle source

Convert the abstract representation into HTML elements.

    # File lib/taskjuggler/reports/ReportTableColumn.rb, line 64
64:     def to_html(row)
65:       if row == 1
66:         @cell1.to_html
67:       else
68:         @cell2.to_html
69:       end
70:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.