Class: Student_List_View
- Inherits:
-
Object
- Object
- Student_List_View
- Defined in:
- lib/files/window.rb
Instance Attribute Summary collapse
-
#window ⇒ Object
Returns the value of attribute window.
Instance Method Summary collapse
-
#initialize ⇒ Student_List_View
constructor
A new instance of Student_List_View.
- #set_table_data(data_table) ⇒ Object
- #set_table_handlers ⇒ Object
- #set_table_params(column_names, whole_entities_count) ⇒ Object
Constructor Details
#initialize ⇒ Student_List_View
Returns a new instance of Student_List_View.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/files/window.rb', line 26 def initialize app = FXApp.new self.window = MainWindow.new(app) self.set_table_handlers self.set_lcr_handlers self.set_tab_book_handler app.create self.controller = StudentListController.new(self) self.window..connect(SEL_COMMAND) do self.controller.del_selected self.refresh end self.refresh app.run end |
Instance Attribute Details
#window ⇒ Object
Returns the value of attribute window.
92 93 94 |
# File 'lib/files/window.rb', line 92 def window @window end |
Instance Method Details
#set_table_data(data_table) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/files/window.rb', line 10 def set_table_data(data_table) table = self.window.table self.erase_table (0...data_table.get_rows_number).each do |x| if data_table.get_element(row:x, col:0).nil? then break end (0...data_table.get_cols_number).each do |y| value = data_table.get_element(row:x, col:y) puts value table.setItemText(x, y, value.to_s) end end end |
#set_table_handlers ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/files/window.rb', line 52 def set_table_handlers table = self.window.table = self.window. = self.window. cells_selected_handler = Proc.new do all_cols_selected = table.selEndColumn - table.selStartColumn + 1 == table.numColumns num_selected_rows = table.selEndRow - table.selStartRow + 1 self.controller.unselect (table.selStartRow..table.selEndRow).each do |row| self.controller.select(row) end if num_selected_rows == 1 and all_cols_selected .enable .enable elsif num_selected_rows > 1 and all_cols_selected .disable .enable else .disable .disable end end table.connect(SEL_SELECTED, &cells_selected_handler) table.connect(SEL_CHANGED, &cells_selected_handler) table.columnHeader.connect(SEL_COMMAND) do |_, _, index| if(index == 1) puts("Сортировка") self.sort else puts("Сортировочки пока нет...") end end end |
#set_table_params(column_names, whole_entities_count) ⇒ Object
5 6 7 8 |
# File 'lib/files/window.rb', line 5 def set_table_params(column_names, whole_entities_count) self.window.table.setTableSize(whole_entities_count, 4) self.window.set_table_headers(column_names) end |