Class: CWM::Tree

Inherits:
CustomWidget show all
Defined in:
library/cwm/src/lib/cwm/tree.rb

Overview

A tree of nested TreeItems

Instance Attribute Summary

Attributes inherited from AbstractWidget

#handle_all_events, #widget_id

Instance Method Summary collapse

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=

Instance Method Details

#change_items(items) ⇒ Object

Parameters:



64
65
66
67
# File 'library/cwm/src/lib/cwm/tree.rb', line 64

def change_items(items)
  item_terms = items.map(&:ui_term)
  Yast::UI.ChangeWidget(Id(widget_id), :Items, item_terms)
end

#contentsObject



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

def contents
  item_terms = items.map(&:ui_term)
  Tree(Id(widget_id), Opt(:notify), label, item_terms)
end

#itemsEnumerable<TreeItem>

Returns:



59
60
61
# File 'library/cwm/src/lib/cwm/tree.rb', line 59

def items
  []
end

#new_item(*args, **kwargs) ⇒ Object

An alias for TreeItem.new



54
55
56
# File 'library/cwm/src/lib/cwm/tree.rb', line 54

def new_item(*args, **kwargs)
  TreeItem.new(*args, **kwargs)
end

#valueObject

FIXME: CurrentBranch? item id uniqueness? TODO: extract value/value= to CurrentItemBasedWidget or declare: value_property :CurrentItem



45
46
47
# File 'library/cwm/src/lib/cwm/tree.rb', line 45

def value
  Yast::UI.QueryWidget(Id(widget_id), :CurrentItem)
end

#value=(val) ⇒ Object



49
50
51
# File 'library/cwm/src/lib/cwm/tree.rb', line 49

def value=(val)
  Yast::UI.ChangeWidget(Id(widget_id), :CurrentItem, val)
end