Class: CWM::TreePager

Inherits:
Pager show all
Defined in:
library/cwm/src/lib/cwm/tree_pager.rb

Overview

A Pager that uses a Tree to select the Pages

Instance Attribute Summary

Attributes inherited from Pager

#current_page

Attributes inherited from AbstractWidget

#handle_all_events, #widget_id

Instance Method Summary collapse

Methods inherited from Pager

#handle, #init

Methods inherited from CustomWidget

#cwm_definition

Methods inherited from AbstractWidget

#cleanup, #cwm_definition, #disable, #enable, #enabled?, #handle, #help, #init, #label, #opt, #store, #validate, widget_type=

Constructor Details

#initialize(tree) ⇒ TreePager

Returns a new instance of TreePager

Parameters:



31
32
33
34
35
# File 'library/cwm/src/lib/cwm/tree_pager.rb', line 31

def initialize(tree)
  @tree = tree
  pages = tree.items.flat_map(&:pages)
  super(*pages)
end

Instance Method Details

#contentsObject



37
38
39
40
41
42
# File 'library/cwm/src/lib/cwm/tree_pager.rb', line 37

def contents
  HBox(
    HWeight(30, @tree),
    HWeight(70, replace_point)
  )
end