Class: CWM::ServiceWidget

Inherits:
CustomWidget show all
Extended by:
Forwardable
Defined in:
library/cwm/src/lib/cwm/service_widget.rb

Overview

CWM wrapper for Yast2::ServiceWidget

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, #enable, #enabled?, #focus, #fun_ref, #help, #label, #my_event?, #opt, #refresh_help, #store, #validate, widget_type=

Constructor Details

#initialize(service) ⇒ ServiceWidget

creates new widget instance for given service

Parameters:


30
31
32
33
# File 'library/cwm/src/lib/cwm/service_widget.rb', line 30

def initialize(service)
  @service_widget = Yast2::ServiceWidget.new(service)
  self.handle_all_events = true
end

Instance Method Details

#contentsObject


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

def contents
  @service_widget.content
end

#handle(event) ⇒ Object


41
42
43
44
45
46
# File 'library/cwm/src/lib/cwm/service_widget.rb', line 41

def handle(event)
  log.info "handling event #{event.inspect}"
  return unless event

  @service_widget.handle_input(event["ID"])
end

#initObject

The widget needs to be refreshed each time it is rendered. Otherwise, cached service values would not be selected (e.g., when switching in a DialogTree)


50
51
52
# File 'library/cwm/src/lib/cwm/service_widget.rb', line 50

def init
  refresh
end