Class: Cheri::JRuby::Explorer::ConnectionDialog

Inherits:
Object
  • Object
show all
Includes:
Swing
Defined in:
lib/cheri/jruby/explorer/dialogs.rb,
lib/cheri/jruby/explorer/dialogs-old.rb

Constant Summary

Constants included from Swing

Swing::SwingConnecter

Instance Method Summary collapse

Constructor Details

#initialize(main) ⇒ ConnectionDialog

Returns a new instance of ConnectionDialog.



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/cheri/jruby/explorer/dialogs.rb', line 32

def initialize(main)
  swing[:auto=>true]
  @main = main
  @main_frame = main.main_frame
  @dialog = dialog @main_frame, 'New Connection', true do |dlg|
    grid_table_layout dlg
    empty_border 4,4,4,4
    size 240,180
    default_close_operation :HIDE_ON_CLOSE
    grid_row do
      grid_table :i=>[0,8] do
        compound_border etched_border(:LOWERED), empty_border(7,7,7,7)
        defaults :i=>[4,1], :a=>:w
        grid_row {label 'Host:'; @con_host = text_field('localhost') {columns 10}}
        grid_row {label 'Port:'; @con_port = text_field {columns 10}}
        grid_row {label 'Display name:'; @con_name = text_field {columns 10}}
      end
    end
    grid_row  do
      grid_table :wy=>0.1, :a=>:s do
        grid_row :i=>4 do
          button('Connect') {on_click{do_connect}}
          button('Cancel') {on_click{@dialog.visible = false; reset_fields}}
        end
      end
    end
  end
  reset_fields
  @main.center(@main_frame,@dialog)
end

Instance Method Details

#hideObject



97
98
99
# File 'lib/cheri/jruby/explorer/dialogs.rb', line 97

def hide
  @dialog.visible = false  
end

#showObject



93
94
95
# File 'lib/cheri/jruby/explorer/dialogs.rb', line 93

def show
  @dialog.visible = true  
end

#valueObject



89
90
91
# File 'lib/cheri/jruby/explorer/dialogs.rb', line 89

def value
  @dialog  
end