Class: Watobo::Plugin::Sslchecker::Gui::CipherTable

Inherits:
FXTable
  • Object
show all
Defined in:
plugins/sslchecker/gui/cipher_table.rb

Constant Summary collapse

CTF_NONE =
0x00
CTF_GOOD =
0x01
CTF_BAD =
0x02
CTF_NA =
0x04
CTF_ALL =
0x07

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(owner, opts) ⇒ CipherTable

Returns a new instance of CipherTable.



143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'plugins/sslchecker/gui/cipher_table.rb', line 143

def initialize(owner, opts)
  super(owner, :opts => TABLE_COL_SIZABLE|TABLE_ROW_SIZABLE|LAYOUT_FILL_X|LAYOUT_FILL_Y|TABLE_READONLY|LAYOUT_SIDE_TOP, :padding => 2)
  @ciphers = []
  @min_bit_length = 128

  @columns = Hash.new
  @columns[:cipher] = { :label => "Cipher", :pos => 0, :width => 250 }
  @columns[:bits] = { :label => "Bits", :pos => 1, :width => 100 }
  @columns[:result] = { :label => "Result", :pos => 2, :width => 50 }

  @filter = CTF_ALL

  init_icons
  initColumns()
  adjustCellWidth
end

Instance Attribute Details

#ciphersObject (readonly)

Returns the value of attribute ciphers.



77
78
79
# File 'plugins/sslchecker/gui/cipher_table.rb', line 77

def ciphers
  @ciphers
end

#filterObject

Returns the value of attribute filter.



79
80
81
# File 'plugins/sslchecker/gui/cipher_table.rb', line 79

def filter
  @filter
end

#min_bit_lengthObject

Returns the value of attribute min_bit_length.



78
79
80
# File 'plugins/sslchecker/gui/cipher_table.rb', line 78

def min_bit_length
  @min_bit_length
end

Instance Method Details

#add_cipher(cipher) ⇒ Object



112
113
114
115
116
117
118
119
120
121
122
# File 'plugins/sslchecker/gui/cipher_table.rb', line 112

def add_cipher( cipher )

  [ :name, :bits, :result ].each do |k|
    return false unless cipher.has_key? k
  end

  @ciphers.push cipher
  add_cipher_row(cipher)

  true
end

#clear_ciphersObject



137
138
139
140
141
# File 'plugins/sslchecker/gui/cipher_table.rb', line 137

def clear_ciphers
  self.clearItems
  initColumns
  @ciphers.clear
end

#setNewFont(font_type = nil, size = nil) ⇒ Object



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'plugins/sslchecker/gui/cipher_table.rb', line 93

def setNewFont(font_type=nil, size=nil)
  begin
    new_size = size.nil? ? GUI_REGULAR_FONT_SIZE : size
    new_font_type = font_type.nil? ? "helvetica" : font_type
    new_font = FXFont.new(getApp(), new_font_type, new_size)
    new_font.create

    self.font = new_font
    self.rowHeader.font = new_font
    self.defRowHeight = new_size+10

    updateTable()

  rescue => bang
    puts bang
    puts bang.backtrace if $DEBUG
  end
end

#show_allObject



124
125
126
# File 'plugins/sslchecker/gui/cipher_table.rb', line 124

def show_all
  @filter = CTF_ALL
end

#to_csvObject

this returns a comma seperated list of the table [string]



82
83
84
85
86
87
88
89
90
91
# File 'plugins/sslchecker/gui/cipher_table.rb', line 82

def to_csv
  csv = ""
 self.each_row do |c,b,r|
    csv << c.text.strip << ";"
    csv << b.text.strip << ";"
    csv << r.text.strip
    csv << "\n"
  end
  csv
end

#update_tableObject



128
129
130
131
132
133
134
135
# File 'plugins/sslchecker/gui/cipher_table.rb', line 128

def update_table
#  puts "update table: #{filter}"
  self.clearItems
  initColumns
  @ciphers.each do |c|
    add_cipher_row c
  end
end