Class: CWM::TreePager
- Inherits:
-
Pager
- Object
- AbstractWidget
- CustomWidget
- Pager
- CWM::TreePager
- Defined in:
- library/cwm/src/lib/cwm/tree_pager.rb
Overview
Instance Attribute Summary
Attributes inherited from Pager
Attributes inherited from AbstractWidget
#handle_all_events, #widget_id
Instance Method Summary collapse
- #contents ⇒ Object
-
#initialize(tree) ⇒ TreePager
constructor
A new instance of TreePager.
- #mark_page(page) ⇒ Object protected
- #page_for_id(id) ⇒ Object protected
Methods inherited from Pager
#handle, #init, #initial_page, #page_order, #replace_point, #store_page, #switch_page
Methods inherited from CustomWidget
#cwm_contents, #cwm_definition, #find_ids, #ids_in_contents
Methods inherited from AbstractWidget
#cleanup, #cwm_definition, #disable, #displayed?, #enable, #enabled?, #focus, #fun_ref, #handle, #help, #init, #label, #my_event?, #opt, #refresh_help, #store, #validate, widget_type=
Constructor Details
#initialize(tree) ⇒ TreePager
Returns a new instance of TreePager.
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
#contents ⇒ Object
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 |
#mark_page(page) ⇒ Object (protected)
51 52 53 |
# File 'library/cwm/src/lib/cwm/tree_pager.rb', line 51 def mark_page(page) @tree.value = page. end |
#page_for_id(id) ⇒ Object (protected)
46 47 48 49 |
# File 'library/cwm/src/lib/cwm/tree_pager.rb', line 46 def page_for_id(id) id = @tree.value if id == @tree. super(id) end |