Module: Rubeus::Extensions::Javax::Swing::JTable

Defined in:
lib/rubeus/extensions/javax/swing/j_table.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/rubeus/extensions/javax/swing/j_table.rb', line 8

def self.included(base)
  base.default_attributes = {
    :preferred_size => [200, 150]
  }
  base.module_eval do
    alias_method :get_model_without_rubeus, :get_model
    alias_method :get_model, :get_model_with_rubeus
    alias_method :model, :get_model

    alias_method :set_model_without_rubeus, :set_model
    alias_method :set_model, :set_model_with_rubeus
    alias_method :model=, :set_model
  end
end

Instance Method Details

#get_model_with_rubeusObject



23
24
25
# File 'lib/rubeus/extensions/javax/swing/j_table.rb', line 23

def get_model_with_rubeus
  @model || get_model_without_rubeus
end

#set_model_with_rubeus(model, *args) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/rubeus/extensions/javax/swing/j_table.rb', line 27

def set_model_with_rubeus(model, *args)
  unless model.is_a?(Rubeus::Swing::TableModel)
    model = Rubeus::Swing::DefaultTableModel.new(model, *args)
  end
  delegator = Rubeus::Swing::ReadonlyableTableModel.new(model)
  @model = delegator
  set_model_without_rubeus(@model)
end