Methods

Class Index [+]

Quicksearch

TaskJuggler::ColumnTable

This class is essentially a wrapper around ReportTable that allows us to embed a ReportTable object as a column of another ReportTable object. Both ReportTables must have the same number of lines.

Attributes

viewWidth[W]

Public Class Methods

new() click to toggle source

Create a new ColumnTable object.

    # File lib/reports/ColumnTable.rb, line 25
25:     def initialize
26:       super
27:       # The user requested width of the column (chart)
28:       @viewWidth = nil
29:       # The header will have 2 lines. So, use a smaller font. This should match
30:       # the font size used for the GanttChart header.
31:       @headerFontSize = 10
32:       # This is an embedded table.
33:       @embedded = true
34:     end

Public Instance Methods

to_html() click to toggle source
    # File lib/reports/ColumnTable.rb, line 36
36:     def to_html
37:       height = 2 * @headerLineHeight + 1
38:       @lines.each do |line|
39:         # Add line height plus 1 pixel padding
40:         height += line.height + 1
41:       end
42: 
43:       # Since we don't know the resulting width of the column, we need to always
44:       # add an extra space for the scrollbar.
45:       td = XMLElement.new('td', 'rowspan' => "#{2 + @lines.length + 1}",
46:         'style' => 'padding:0px; vertical-align:top;')
47:       # Now we generate a 'div' that will contain the nested table. It has a
48:       # height that fits all lines but has a maximum width. In case the embedded
49:       # table is larger, a scrollbar will appear. We assume that the scrollbar
50:       # has a height of SCROLLBARHEIGHT pixels or less.
51:       # If there is a user specified with, use it. Otherwise use the
52:       # calculated minimum with.
53:       width = @viewWidth ? @viewWidth : minWidth
54:       td << (scrollDiv = XMLElement.new('div', 'class' => 'tabback',
55:         'style' => 'position:relative; overflow:auto; ' +
56:                    "width:#{width}px; " +
57:                    'margin-top:-1px; margin-bottom:-1px; ' +
58:                    "height:#{height + SCROLLBARHEIGHT + 2}px;"))
59: 
60:       scrollDiv << (contentDiv = XMLElement.new('div',
61:         'style' => 'margin: 0px; padding: 0px; position: absolute; top: 0px;' +
62:                    "left: 0px; width: #{@viewWidth}px; height: #{height}px; "))
63:       contentDiv << super
64:       td
65:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.