Class: Watobo::Gui::TableEditorFrame

Inherits:
FXVerticalFrame
  • Object
show all
Defined in:
lib/watobo/gui/table_editor.rb

Instance Method Summary collapse

Constructor Details

#initialize(owner, opts) ⇒ TableEditorFrame

Returns a new instance of TableEditorFrame.



456
457
458
459
460
461
462
463
464
# File 'lib/watobo/gui/table_editor.rb', line 456

def initialize(owner, opts)
  super(owner, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding => 0)
  #frame = FXVerticalFrame.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding => 0)
  @req_line = FXText.new(self, :opts => LAYOUT_FILL_X|TEXT_FIXEDWRAP)
  @req_line.visibleRows = 1
  @req_line.backColor = @req_line.parent.backColor
  @req_line.disable
  @editor = TableEditor.new(self, :opts => FRAME_SUNKEN|TABLE_COL_SIZABLE|TABLE_ROW_SIZABLE|LAYOUT_FILL_X|LAYOUT_FILL_Y|TABLE_READONLY|LAYOUT_SIDE_TOP, :padding => 2)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



466
467
468
469
470
471
472
473
474
# File 'lib/watobo/gui/table_editor.rb', line 466

def method_missing(name, *args, &block)
    
    if @editor.respond_to? name.to_sym
      return @editor.send(name.to_sym, *args, &block)
    else
      super
    end
  
end

Instance Method Details

#clearObject



429
430
431
432
# File 'lib/watobo/gui/table_editor.rb', line 429

def clear
  @editor.setRequest ''
  @req_line.text = ''
end

#setRequest(raw_request) ⇒ Object Also known as: setText



434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
# File 'lib/watobo/gui/table_editor.rb', line 434

def setRequest(raw_request)
  if raw_request.is_a? String
    request = Watobo::Utils.text2request(raw_request)
  elsif raw_request.respond_to? :copy
    request = raw_request.copy
  else
    request = Watobo::Request.new raw_request
  end
 
  begin
  @editor.setRequest request
  @req_line.text = request.first.strip unless request.empty?
  return true
  rescue => bang
    puts bang
  end
  false

end

#subscribe(event, &callback) ⇒ Object



425
426
427
# File 'lib/watobo/gui/table_editor.rb', line 425

def subscribe(event, &callback)
  @editor.subscribe event, &callback
end