Class: Watobo::Gui::FilterTable

Inherits:
FXTable
  • Object
show all
Defined in:
lib/watobo/gui/rewrite_filters_dialog.rb

Direct Known Subclasses

RequestFilterTable

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(owner, filters = [], opts = {}) ⇒ FilterTable

Returns a new instance of FilterTable.


210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/watobo/gui/rewrite_filters_dialog.rb', line 210

def initialize( owner, filters=[], opts={} )
  @event_dispatcher_listeners = Hash.new
  parms = { :opts => TABLE_COL_SIZABLE|TABLE_ROW_SIZABLE|LAYOUT_FILL_X|LAYOUT_FILL_Y|TABLE_READONLY|LAYOUT_SIDE_TOP,
    :padding => 2
  }
  parms.update opts

  super(owner, parms)
  
  self.extend Watobo::Subscriber
  self.setBackColor(FXRGB(255, 255, 255))
  self.setCellColor(0, 0, FXRGB(255, 255, 255))
  self.setCellColor(0, 1, FXRGB(255, 240, 240))
  self.setCellColor(1, 0, FXRGB(240, 255, 240))
  self.setCellColor(1, 1, FXRGB(240, 240, 255))

  @columns=Hash.new
  
  @filters = []
  @filters.concat filters

  add_column "Location", 80
  add_column "Match", 80
  add_column "Pattern", 80
   add_column "Flags", 80


  init_columns
  
  @filters.each do |r|
    add_filter_row r
  end
  adjust_cell_width
  
  self.connect(SEL_SELECTED){|sender,sel,pos| 
             self.selectRow pos.row
           #  notify(:filter_selected, @filters[pos.row])
             }
end

Instance Attribute Details

#filtersObject (readonly)

Returns the value of attribute filters


179
180
181
# File 'lib/watobo/gui/rewrite_filters_dialog.rb', line 179

def filters
  @filters
end

Instance Method Details

#add_filter(filter) ⇒ Object


180
181
182
183
# File 'lib/watobo/gui/rewrite_filters_dialog.rb', line 180

def add_filter(filter)
  @filters << filter
  add_filter_row(filter)
end

#delete_current_rowObject


204
205
206
207
208
# File 'lib/watobo/gui/rewrite_filters_dialog.rb', line 204

def delete_current_row
  i = self.currentRow
  return false if i < 0
  delete_row_by_index i
end

#delete_row_by_index(index) ⇒ Object


189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/watobo/gui/rewrite_filters_dialog.rb', line 189

def delete_row_by_index(index)
  return false if index < 0
  return false if index > self.numRows-1
  @filters.delete_at index
  self.clearItems
   init_columns
  
  @filters.each do |r|
    add_filter_row r
  end
  adjust_cell_width
  self.selectRow self.currentRow if self.currentRow >= 0
  true
end

#get_current_filterObject


185
186
187
# File 'lib/watobo/gui/rewrite_filters_dialog.rb', line 185

def get_current_filter
  puts self.currentRow
end