module Canis::DefaultListSelection

Public Class Methods

extended(obj) click to toggle source
# 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