Module: Cheri::JRuby::Explorer::GBLViewer

Defined in:
lib/cheri/jruby/explorer/viewer.rb

Constant Summary collapse

White =
Color::WHITE
Black =
Color::BLACK
TColor =
Color.new(0,0,0x80)
NColor =
Color.new(0xf0,0xe2,0xe0)
VColor =
Color.new(0xf0,0xf0,0xf0)
HColor =
Color.new(0xd0,0xe0,0xff)
TFont =
Font.new('Dialog',Font::BOLD,18)
NFont =
Font.new('Dialog',Font::BOLD,14)
VFont =
Font.new('Monospaced',Font::PLAIN,14)
IFont =
Font.new('Monospaced',Font::BOLD,14)
CFont =
Font.new('Dialog',Font::PLAIN,14)
ResFont =
Font.new('Monospaced',Font::PLAIN,12)
SHIFT =
MouseEvent::SHIFT_DOWN_MASK
BUTTON1 =
MouseEvent::BUTTON1
BUTTON2 =
MouseEvent::BUTTON2
BUTTON3 =
MouseEvent::BUTTON3
TOP =
SwingConstants::TOP
LabelBorder =
javax.swing.border.EmptyBorder.new 0,2,0,0
LineInset =
Insets.new 1,0,0,0
CellInset =
Insets.new 0,0,1,1
HeaderInset =
Insets.new 12,0,1,1

Instance Method Summary collapse

Instance Method Details

#cell_label(text, font = ResFont, bgcolor = White, fgcolor = Black, *opts) ⇒ Object



467
468
469
470
471
472
473
474
475
476
# File 'lib/cheri/jruby/explorer/viewer.rb', line 467

def cell_label(text,font=ResFont,bgcolor=White,fgcolor=Black,*opts)
  label(text, *opts) do
    vertical_alignment TOP
    border LabelBorder
    opaque true
    background bgcolor
    foreground fgcolor
    set_font font
  end
end

#click_label(text, id, font = ResFont, bgcolor = White, altcolor = bgcolor, fgcolor = Black, *opts) ⇒ Object



492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
# File 'lib/cheri/jruby/explorer/viewer.rb', line 492

def click_label(text,id,font=ResFont,bgcolor=White,altcolor=bgcolor,fgcolor=Black,*opts)
  label(text, *opts) do
    vertical_alignment TOP
    border LabelBorder
    opaque true
    background bgcolor
    foreground fgcolor
    set_font font
    on_mouse_entered  {|e| e.source.background = altcolor}
    on_mouse_exited   {|e| e.source.background = bgcolor}
    on_mouse_clicked  {|e| mouse_clicked(e,id) }
    on_mouse_pressed  {|e| mouse_action(e,id) }
    on_mouse_released {|e| mouse_action(e,id) }
  end
end

#header_row(header_list, font = ResFont, bgcolor = White, fgcolor = Black, opts = {}) ⇒ Object



514
515
516
517
518
519
520
521
522
523
524
# File 'lib/cheri/jruby/explorer/viewer.rb', line 514

def header_row(header_list,font=ResFont,bgcolor=White,fgcolor=Black,opts={})
  grid_row(opts) {
    size = header_list.size
    last = size - 1
    wx = 0.0
    size.times {|i|
      wx = 0.1 if i == last
      cell_label(header_list[i],font,bgcolor,fgcolor,:wx=>wx)
    }
  }
end

#initialize(*r) ⇒ Object



462
463
464
465
# File 'lib/cheri/jruby/explorer/viewer.rb', line 462

def initialize(*r)
  super
  swing[:auto]
end

#mouse_action(e, val = nil) ⇒ Object



511
512
# File 'lib/cheri/jruby/explorer/viewer.rb', line 511

def mouse_action(e,val=nil)
end

#mouse_clicked(e, val = nil) ⇒ Object



508
509
# File 'lib/cheri/jruby/explorer/viewer.rb', line 508

def mouse_clicked(e,val=nil)
end

#value_label(value, font = ResFont, bgcolor = White, fgcolor = Black, *opts) ⇒ Object



478
479
480
481
482
483
484
485
486
487
488
489
490
# File 'lib/cheri/jruby/explorer/viewer.rb', line 478

def value_label(value,font=ResFont,bgcolor=White,fgcolor=Black,*opts)
  # not actually a label but a text area to support multiple lines
  text_area(*opts) do
    border LabelBorder
    opaque true
    editable false
    line_wrap true
    background bgcolor
    foreground fgcolor
    set_font font
    text value
  end
end