Class: RubyCurses::OLDDefaultListSelectionModel

Inherits:
Object
  • Object
show all
Includes:
EventHandler
Defined in:
lib/rbcurse/rtable.rb

Overview

LSM XXX UNUSED

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from EventHandler

#bind, #fire_handler, #fire_property_change

Constructor Details

#initializeOLDDefaultListSelectionModel

Returns a new instance of OLDDefaultListSelectionModel.



1556
1557
1558
1559
1560
1561
1562
# File 'lib/rbcurse/rtable.rb', line 1556

def initialize
  @selected_indices=[]
  @anchor_selection_index = -1
  @lead_selection_index = -1
  @selection_mode = :MULTIPLE
  $log.debug " OLD VERSION OF LIST SELECTION MODEL IN rtable.rb"
end

Instance Attribute Details

#anchor_selection_indexObject (readonly)

Returns the value of attribute anchor_selection_index.



1554
1555
1556
# File 'lib/rbcurse/rtable.rb', line 1554

def anchor_selection_index
  @anchor_selection_index
end

#lead_selection_indexObject (readonly)

Returns the value of attribute lead_selection_index.



1555
1556
1557
# File 'lib/rbcurse/rtable.rb', line 1555

def lead_selection_index
  @lead_selection_index
end

#selection_modeObject

Returns the value of attribute selection_mode.



1553
1554
1555
# File 'lib/rbcurse/rtable.rb', line 1553

def selection_mode
  @selection_mode
end

Instance Method Details

#add_selection_interval(ix0, ix1) ⇒ Object

TODO should go in sorted, and no dupes



1580
1581
1582
1583
1584
# File 'lib/rbcurse/rtable.rb', line 1580

def add_selection_interval ix0, ix1
  @anchor_selection_index = ix0
  @lead_selection_index = ix1
  ix0.upto(ix1) {|i| @selected_indices  << i unless @selected_indices.include? i }
end

#clear_selectionObject



1564
1565
1566
# File 'lib/rbcurse/rtable.rb', line 1564

def clear_selection
  @selected_indices=[]
end

#get_max_selection_indexObject



1570
1571
1572
# File 'lib/rbcurse/rtable.rb', line 1570

def get_max_selection_index
  @selected_indices[-1]
end

#get_min_selection_indexObject



1573
1574
1575
# File 'lib/rbcurse/rtable.rb', line 1573

def get_min_selection_index
  @selected_indices[0]
end

#get_selected_rowsObject



1576
1577
1578
# File 'lib/rbcurse/rtable.rb', line 1576

def get_selected_rows
  @selected_indices
end

#insert_index_interval(ix0, len) ⇒ Object



1590
1591
1592
1593
1594
# File 'lib/rbcurse/rtable.rb', line 1590

def insert_index_interval ix0, len
  @anchor_selection_index = ix0
  @lead_selection_index = ix0+len
  add_selection_interval @anchor_selection_index, @lead_selection_index
end

#is_selected_index(ix) ⇒ Object



1567
1568
1569
# File 'lib/rbcurse/rtable.rb', line 1567

def is_selected_index ix
  @selected_indices.include? ix
end

#remove_selection_interval(ix0, ix1) ⇒ Object



1585
1586
1587
1588
1589
# File 'lib/rbcurse/rtable.rb', line 1585

def remove_selection_interval ix0, ix1
  @anchor_selection_index = ix0
  @lead_selection_index = ix1
  @selected_indices.delete_if {|x| x >= ix0 and x <= ix1}
end