Class: TaskJuggler::GanttContainer
- Includes:
- HTMLGraphics
- Defined in:
- lib/taskjuggler/reports/GanttContainer.rb
Overview
The GanttContainer represents a container task (task with sub-tasks).
Constant Summary collapse
- @@size =
The size of the bars in pixels from center to top/bottom.
5
Instance Method Summary collapse
- #addBlockedZones(router) ⇒ Object
-
#endDepLineEnd ⇒ Object
Return the point [ x, y ] where task end dependency lines should end at.
-
#endDepLineStart ⇒ Object
Return the point [ x, y ] where task end dependency lines should start from.
-
#initialize(lineHeight, xStart, xEnd, y) ⇒ GanttContainer
constructor
Create a GanttContainer object based on the following information: line is a reference to the GanttLine.
-
#startDepLineEnd ⇒ Object
Return the point [ x, y ] where task start dependency lines should end at.
-
#startDepLineStart ⇒ Object
Return the point [ x, y ] where task start dependency lines should start from.
-
#to_html ⇒ Object
Convert the abstact representation of the GanttContainer into HTML elements.
Methods included from HTMLGraphics
#arrowHeadToHTML, #diamondToHTML, #jagToHTML, #lineToHTML, #rectToHTML
Constructor Details
#initialize(lineHeight, xStart, xEnd, y) ⇒ GanttContainer
Create a GanttContainer object based on the following information: line is a reference to the GanttLine. xStart is the left edge of the task in chart coordinates. xEnd is the right edge. The container extends over the edges due to the shape of the jags.
30 31 32 33 34 35 |
# File 'lib/taskjuggler/reports/GanttContainer.rb', line 30 def initialize(lineHeight, xStart, xEnd, y) @lineHeight = lineHeight @start = xStart @end = xEnd @y = y end |
Instance Method Details
#addBlockedZones(router) ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/taskjuggler/reports/GanttContainer.rb', line 59 def addBlockedZones(router) # Horizontal block router.addZone(@start - @@size, @y + (@lineHeight / 2) - @@size - 2, @end - @start + 1 + 2 * @@size, 2 * @@size + 5, true, false) # Block for arrowhead. router.addZone(@start - @@size - 9, @y + (@lineHeight / 2) - 7, 10, 15, true, true) # Vertical block for end cap router.addZone(@start - @@size - 2, @y, 2 * @@size + 5, @lineHeight, false, true) router.addZone(@end - @@size - 2, @y, 2 * @@size + 5, @lineHeight, false, true) end |
#endDepLineEnd ⇒ Object
Return the point [ x, y ] where task end dependency lines should end at.
55 56 57 |
# File 'lib/taskjuggler/reports/GanttContainer.rb', line 55 def endDepLineEnd [ @end, @y + @lineHeight / 2 ] end |
#endDepLineStart ⇒ Object
Return the point [ x, y ] where task end dependency lines should start from.
50 51 52 |
# File 'lib/taskjuggler/reports/GanttContainer.rb', line 50 def endDepLineStart [ @end + @@size, @y + @lineHeight / 2 ] end |
#startDepLineEnd ⇒ Object
Return the point [ x, y ] where task start dependency lines should end at.
44 45 46 |
# File 'lib/taskjuggler/reports/GanttContainer.rb', line 44 def startDepLineEnd [ @start - @@size, @y + @lineHeight / 2 ] end |
#startDepLineStart ⇒ Object
Return the point [ x, y ] where task start dependency lines should start from.
39 40 41 |
# File 'lib/taskjuggler/reports/GanttContainer.rb', line 39 def startDepLineStart [ @start, @y + @lineHeight / 2 ] end |
#to_html ⇒ Object
Convert the abstact representation of the GanttContainer into HTML elements.
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/taskjuggler/reports/GanttContainer.rb', line 76 def to_html xStart = @start.to_i yCenter = (@lineHeight / 2).to_i width = @end.to_i - @start.to_i + 1 html = [] # Invisible trigger frame for tooltips. html << rectToHTML(xStart - @@size, 0, width + 2 * @@size, @lineHeight, 'tj_gantt_frame') # The bar html << rectToHTML(xStart - @@size, yCenter - @@size, width + 2 * @@size, @@size, 'containerbar') # The left jag html << jagToHTML(xStart, yCenter) # The right jag html << jagToHTML(xStart + width, yCenter) html end |