Class: Wee::SingleSelectionDialog
- Inherits:
-
FormDialog
- Object
- Presenter
- Component
- Dialog
- FormDialog
- Wee::SingleSelectionDialog
- Defined in:
- lib/wee/dialog.rb
Overview
class ConfirmDialog
Constant Summary
Constants inherited from Component
Instance Attribute Summary collapse
-
#selected_item ⇒ Object
Returns the value of attribute selected_item.
Instance Method Summary collapse
- #buttons ⇒ Object
- #cancel ⇒ Object
-
#initialize(items, caption = nil, selected_item = nil) ⇒ SingleSelectionDialog
constructor
A new instance of SingleSelectionDialog.
- #ok ⇒ Object
- #render_body(r) ⇒ Object
- #state(s) ⇒ Object
Methods inherited from FormDialog
#render, #render_buttons, #render_caption, #render_form
Methods inherited from Component
#add_decoration, #children, #choose_from, #confirm, #decoration, #decoration=, depends, #each_decoration, #find_decoration, #inform, instanciate, #process_callbacks, #remove_decoration, #remove_decoration_if, #render
Methods inherited from Presenter
#process_callbacks, #render, #render!, #renderer_class
Constructor Details
#initialize(items, caption = nil, selected_item = nil) ⇒ SingleSelectionDialog
Returns a new instance of SingleSelectionDialog.
82 83 84 85 86 |
# File 'lib/wee/dialog.rb', line 82 def initialize(items, =nil, selected_item=nil) super() @items = items @selected_item = selected_item end |
Instance Attribute Details
#selected_item ⇒ Object
Returns the value of attribute selected_item.
80 81 82 |
# File 'lib/wee/dialog.rb', line 80 def selected_item @selected_item end |
Instance Method Details
#buttons ⇒ Object
96 97 98 |
# File 'lib/wee/dialog.rb', line 96 def [['Ok', nil, :ok, :ok], ['Cancel', nil, :cancel, :cancel]] end |
#cancel ⇒ Object
104 105 106 |
# File 'lib/wee/dialog.rb', line 104 def cancel answer nil end |
#ok ⇒ Object
100 101 102 |
# File 'lib/wee/dialog.rb', line 100 def ok answer @selected_item end |
#render_body(r) ⇒ Object
92 93 94 |
# File 'lib/wee/dialog.rb', line 92 def render_body(r) r.select_list(@items).selected(@selected_item).callback_method(:selected_item=) end |
#state(s) ⇒ Object
88 89 90 |
# File 'lib/wee/dialog.rb', line 88 def state(s) super s.add_ivar(self, :@selected_item) end |