Class: TaskJuggler::GanttHeaderScaleItem

Inherits:
Object
  • Object
show all
Defined in:
lib/taskjuggler/reports/GanttHeaderScaleItem.rb

Overview

This class is a storate container for all data related to a scale step of a GanttChart header.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label, x, y, width, height) ⇒ GanttHeaderScaleItem

Returns a new instance of GanttHeaderScaleItem.



23
24
25
26
27
28
29
# File 'lib/taskjuggler/reports/GanttHeaderScaleItem.rb', line 23

def initialize(label, x, y, width, height)
  @label = label
  @x = x
  @y = y
  @width = width
  @height = height
end

Instance Attribute Details

#labelObject (readonly)

Returns the value of attribute label.



21
22
23
# File 'lib/taskjuggler/reports/GanttHeaderScaleItem.rb', line 21

def label
  @label
end

#posObject (readonly)

Returns the value of attribute pos.



21
22
23
# File 'lib/taskjuggler/reports/GanttHeaderScaleItem.rb', line 21

def pos
  @pos
end

#widthObject (readonly)

Returns the value of attribute width.



21
22
23
# File 'lib/taskjuggler/reports/GanttHeaderScaleItem.rb', line 21

def width
  @width
end

Instance Method Details

#to_htmlObject



31
32
33
34
35
36
37
38
39
# File 'lib/taskjuggler/reports/GanttHeaderScaleItem.rb', line 31

def to_html
  div = XMLElement.new('div', 'class' => 'tabhead',
    'style' => "font-weight:bold; position:absolute; " +
    "left:#{@x}px; top:#{@y}px; width:#{@width}px; height:#{@height}px; ")
  div << (div1 = XMLElement.new('div', 'style' => 'padding:3px; '))
  div1 << XMLText.new("#{label}")

  div
end