Class: ODDB::View::PointerSteps

Inherits:
HtmlGrid::List show all
Defined in:
src/view/pointersteps.rb

Constant Summary

COMPONENTS =
{
  [0,0] =>  :pointer_descr,
}
CSS_HEAD_MAP =
{
  [0,0] =>  'th-pointersteps',
}
CSS_MAP =
{
  [0,0] =>  'th-pointersteps',
}
OFFSET_STEP =
[1,0]
SORT_DEFAULT =
nil
SORT_HEADER =
false
SORT_REVERSE =
false
STEP_DIVISOR =
' - '
STRIPED_BG =
false
SYMBOL_MAP =
{
  :pointer_descr => View::PointerLink,
}

Constants inherited from HtmlGrid::List

BACKGROUND_SUFFIX

Instance Method Summary (collapse)

Instance Method Details

- (Object) compose(model = @model, offset = [0,0])



30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'src/view/pointersteps.rb', line 30

def compose(model=@model, offset=[0,0])
  unless(@lookandfeel.disabled?(:pointer_steps_header))
    compose_header(offset) 
  end
  offset = resolve_offset(offset, self::class::OFFSET_STEP)
  offset = compose_snapback(offset)
  model = if(model.respond_to? :structural_ancestors)
            model.structural_ancestors(@session.app) 
          elsif(sbm = @session.state.snapback_model)
            [sbm]
          end || [] 
  offset = compose_list(model, offset)
  compose_footer(offset)
end


44
45
46
47
48
49
50
51
52
# File 'src/view/pointersteps.rb', line 44

def compose_footer(offset=[0,0])
  if(@model.is_a?(LimitationText))
    value = @lookandfeel.lookup(:limitation)
    compose_footer_add(value,offset)
  elsif @model.respond_to?(:pointer_descr) 
    value = View::PointerValue.new(:pointer_descr, @model, @session, self)
    compose_footer_add(value,offset)
  end
end


53
54
55
56
57
58
# File 'src/view/pointersteps.rb', line 53

def compose_footer_add(value, offset=[0,0])
  @grid.add_field(self::class::STEP_DIVISOR, *offset)
  offset = resolve_offset(offset, self::class::OFFSET_STEP)
  @grid.add_field(value, *offset)
  @grid.add_style('th-pointersteps', *offset)
end

- (Object) compose_list(model = @model, offset = [0,0])



59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'src/view/pointersteps.rb', line 59

def compose_list(model=@model, offset=[0,0])
  #bg_flag = false
  model.each{ |mdl|
    @grid.add_field(self::class::STEP_DIVISOR, *offset)
    offset = resolve_offset(offset, self::class::OFFSET_STEP)
    _compose(mdl, offset)#, bg_flag)
    #compose_components(mdl, offset)
    #compose_css(offset, resolve_suffix(mdl, bg_flag))
    offset = resolve_offset(offset, self::class::OFFSET_STEP)
    #bg_flag = !bg_flag if self::class::STRIPED_BG
  }
  offset
end

- (Object) compose_snapback(offset)



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'src/view/pointersteps.rb', line 72

def compose_snapback(offset)
  if @container.respond_to?(:snapback)
    event, url = @container.snapback
    link = HtmlGrid::Link.new(event, @model, @session, self)
    unless (@lookandfeel.direct_event == event)
      link.set_attribute('href', url)
      link.set_attribute('class', 'th-pointersteps')
      if(link.value.nil?)
        link.value = event
      end
    end
    @grid.add(link, *offset)
    offset = resolve_offset(offset, self::class::OFFSET_STEP)
  end
  offset
end

- (Object) pointer_descr(model, session = @session)



88
89
90
91
92
93
94
# File 'src/view/pointersteps.rb', line 88

def pointer_descr(model, session=@session)
  link = PointerLink.new(:pointer_descr, model, @session, self)
  unless(@session.allowed?('edit', model))
    link.href = @lookandfeel._event_url(:show, :pointer => model.pointer)
  end
  link
end