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.



1522
1523
1524
1525
1526
1527
1528
# File 'lib/rbcurse/rtable.rb', line 1522

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.



1520
1521
1522
# File 'lib/rbcurse/rtable.rb', line 1520

def anchor_selection_index
  @anchor_selection_index
end

#lead_selection_indexObject (readonly)

Returns the value of attribute lead_selection_index.



1521
1522
1523
# File 'lib/rbcurse/rtable.rb', line 1521

def lead_selection_index
  @lead_selection_index
end

#selection_modeObject

Returns the value of attribute selection_mode.



1519
1520
1521
# File 'lib/rbcurse/rtable.rb', line 1519

def selection_mode
  @selection_mode
end

Instance Method Details

#add_selection_interval(ix0, ix1) ⇒ Object

TODO should go in sorted, and no dupes



1546
1547
1548
1549
1550
# File 'lib/rbcurse/rtable.rb', line 1546

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



1530
1531
1532
# File 'lib/rbcurse/rtable.rb', line 1530

def clear_selection
  @selected_indices=[]
end

#get_max_selection_indexObject



1536
1537
1538
# File 'lib/rbcurse/rtable.rb', line 1536

def get_max_selection_index
  @selected_indices[-1]
end

#get_min_selection_indexObject



1539
1540
1541
# File 'lib/rbcurse/rtable.rb', line 1539

def get_min_selection_index
  @selected_indices[0]
end

#get_selected_rowsObject



1542
1543
1544
# File 'lib/rbcurse/rtable.rb', line 1542

def get_selected_rows
  @selected_indices
end

#insert_index_interval(ix0, len) ⇒ Object



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

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



1533
1534
1535
# File 'lib/rbcurse/rtable.rb', line 1533

def is_selected_index ix
  @selected_indices.include? ix
end

#remove_selection_interval(ix0, ix1) ⇒ Object



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

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