Module: Canis::DefaultListSelection

Defined in:
lib/canis/core/include/listselectionmodel.rb

Class Method Summary collapse

Class Method Details

.extended(obj) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/canis/core/include/listselectionmodel.rb', line 41

def self.extended(obj)
  extend Forwardable
  # selection modes may be :multiple, :single or :none
  dsl_accessor :selection_mode
  # color of selected rows, and attribute of selected rows
  dsl_property :selected_color, :selected_bgcolor, :selected_attr
  # indices of selected rows
  dsl_accessor :selected_indices
  # model that takes care of selection operations
  dsl_accessor :list_selection_model
  #
  # all operations of selection are delegated to the ListSelectionModel
  def_delegators :@list_selection_model, :is_row_selected?, :toggle_row_selection, :select, :unselect, :is_selection_empty?, :clear_selection, :selected_rows, :select_all, :selected_values, :selected_value


  obj.instance_exec {
    @selected_indices = []
    @selection_mode = :multiple # default is multiple intervals
    #@list_selection_model = DefaultListSelectionModel.new obj
  }

end