cheri 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -6,7 +6,7 @@ based on the framework, as well as a builder-builder tool for easily creating
6
6
  simple builders. Cheri also comes with a demo application, Cheri::JRuby::Explorer,
7
7
  that is built using two of the supplied builders (Cheri::Swing and Cheri::Html).
8
8
 
9
- This version (0.0.2) is an early beta release. Some features are not yet fully
9
+ This version (0.0.3) is an early beta release. Some features are not yet fully
10
10
  developed, in particular the HTML/XML components. On the other hand, Cheri::Swing,
11
11
  which is the successor to JRBuilder (http://www2.webng.com/bdortch/jrbuilder), is
12
12
  relatively mature, in an adolescent sort of way, though many features could be added.
@@ -54,7 +54,7 @@ Some known issues:
54
54
  NullPointerException (JList seems to get overwhelmed), requiring a restart of
55
55
  CJX. I had a fix in that did a GC on the target instance before each search,
56
56
  which seemed to help, but also seemed a little extreme. This will be a search
57
- option in 0.0.3.
57
+ option in 0.0.4.
58
58
 
59
59
  * There are lots of layout issues; neither HTML (JEditorPane) nor BoxLayout provide
60
60
  exactly what I'm looking for. Will probably have to bite the bullet and go to
@@ -62,13 +62,13 @@ Some known issues:
62
62
 
63
63
  * Close buttons on tabs aren't available pre-Java 1.6. There are alternatives for
64
64
  the top tabs, but currently not for the bottom (search result) tabs. Will resolve
65
- in 0.0.3.
65
+ in 0.0.4.
66
66
 
67
67
  * Speaking of tabs, tab management (and navigation in general) is not yet quite right.
68
- Will have history/back buttons and better tab management in 0.0.3.
68
+ Will have history/back buttons and better tab management in 0.0.4.
69
69
 
70
70
  * Global variables are currently shown, um, globally, when many of them should be shown
71
- per thread. This will be fixed in 0.0.3, which will include a Thread section with
71
+ per thread. This will be fixed in 0.0.4, which will include a Thread section with
72
72
  other goodies as well (thread-local vars, status, etc.).
73
73
 
74
74
  To install the CJX DRb server component in an instance (assuming the Cheri gem is
@@ -26,6 +26,8 @@ module Cheri
26
26
  module Builder
27
27
 
28
28
  class TypeConnecter
29
+ # TODO: cache based on parent/child ancestors
30
+ #@cache = {}
29
31
 
30
32
  def initialize(*parents,&k)
31
33
  @t = {}
data/lib/cheri/cheri.rb CHANGED
@@ -29,7 +29,7 @@ module Cheri
29
29
  module VERSION #:nodoc:
30
30
  MAJOR = 0
31
31
  MINOR = 0
32
- TINY = 2
32
+ TINY = 3
33
33
  STRING = [MAJOR, MINOR, TINY].join('.').freeze
34
34
  end
35
35
  PathExp = Regexp.new "cheri-#{VERSION::STRING}\\/lib$" #:nodoc:
data/lib/cheri/cjx.rb CHANGED
@@ -1,3 +1,4 @@
1
1
  # Loads and runs Cheri::JRuby::Explorer
2
+ require 'rubygems'
2
3
  require 'cheri/jruby/explorer'
3
4
  Cheri::JRuby::Explorer.run
@@ -128,6 +128,7 @@ CJava = Cheri::Java
128
128
  #:startdoc:
129
129
  ListenerInfo = Struct.new(:clazz, :methods, :add_method_name)
130
130
  @impls = {}
131
+ @info = {}
131
132
  class << self
132
133
  def get_listener_impl(info)
133
134
  @impls[info.clazz] ||= create_listener_impl(info)
@@ -155,6 +156,9 @@ class << self
155
156
  impl
156
157
  end
157
158
  def get_listener_info(java_class,method_name)
159
+ if (info = @info[key = [java_class,method_name]])
160
+ return info
161
+ end
158
162
  java_class.java_instance_methods.each do |m|
159
163
  if m.name.match(/add(\w+)Listener/) &&
160
164
  m.argument_types.length == 1 &&
@@ -163,7 +167,8 @@ class << self
163
167
  methods = clazz.java_instance_methods
164
168
  methods.each do |im|
165
169
  if im.name == method_name
166
- return ListenerInfo.new(CJava.get_class(clazz.name),methods,m.name)
170
+ info = @info[key] = ListenerInfo.new(CJava.get_class(clazz.name),methods,m.name)
171
+ return info
167
172
  end
168
173
  end
169
174
  end
@@ -63,7 +63,7 @@ class Main
63
63
  include Cheri::Swing
64
64
  System = ::Java::JavaLang::System
65
65
  Thread = ::Java::JavaLang::Thread
66
- JComponent = ::JavaxSwing::JComponent
66
+ JComponent = ::Java::JavaxSwing::JComponent
67
67
  WeakHashMap = ::Java::JavaUtil::WeakHashMap
68
68
  JOptionPane = ::Java::JavaxSwing::JOptionPane
69
69
  Math = ::Java::JavaLang::Math
@@ -246,6 +246,11 @@ class Main
246
246
  close_active_view
247
247
  end
248
248
  end
249
+ menu_item 'Close current search results' do
250
+ on_click do
251
+ close_active_search_view
252
+ end
253
+ end
249
254
  end
250
255
  cheri_yield(@view_menu,&block) if block
251
256
  @view_menu
@@ -540,6 +545,12 @@ class Main
540
545
  end
541
546
  end
542
547
 
548
+ def close_active_search_view
549
+ if (viewer = search_tab_pane.active_viewer)
550
+ close_search_view(viewer)
551
+ end
552
+ end
553
+
543
554
  def close_view(viewer)
544
555
  view = viewer.view
545
556
  main_tab_pane.remove(view)
@@ -552,30 +552,25 @@ class ResultListViewer < Viewer
552
552
  include NavViewerConstants
553
553
 
554
554
  class ResultListItem
555
- def initialize(id,viewer)
556
- #puts "RLI init, id = #{id}"
555
+ def initialize(id,value)
557
556
  @i = id
558
- @w = viewer
557
+ @v = value || 'Unavailable'
558
+ end
559
+ def id
560
+ @i
559
561
  end
560
562
  def value
561
- unless @v
562
- @v = @w.item_value(@i)
563
- #@v = @v.to_s unless String === @v
564
- #puts "RLI set value [#{@v}] class #{@v.class}"
565
- end
566
563
  @v
567
564
  end
568
565
  def to_s
569
- value || 'Unavailable'
566
+ @v
570
567
  end
571
- alias_method :to_str,:to_s
568
+ alias_method :to_str, :to_s
569
+ #alias_method :toString, :to_s
572
570
  end
573
571
 
574
572
  def item_value(id)
575
- #@count += 1
576
- v = @main.simple_value(@instance,id)
577
- #puts "#{@count} val [#{v}]"
578
- #v
573
+ @main.simple_value(@instance,id)
579
574
  end
580
575
 
581
576
  def initialize(*r,&k)
@@ -585,11 +580,20 @@ class ResultListViewer < Viewer
585
580
 
586
581
  def create_object_list
587
582
  res = @value.results
588
- #puts "results.length = #{res.length}"
589
- arr = Array.new(res.length) {|i| ResultListItem.new(res[i],self)}
590
- @obj_list = arr.to_java
591
- #puts "list.length = #{@obj_list.length}"
592
- #@count = 0
583
+ proxy = @instance.proxy
584
+ len = res.length;
585
+ list = @obj_list = ::Java::JavaLang::Object[len].new
586
+ len.times do |i|
587
+ id = res[i]
588
+ val = nil
589
+ begin
590
+ val = proxy.simple_value
591
+ rescue
592
+ val = 'Unavailable'
593
+ end
594
+ list[i] = ResultListItem.new(id,value)
595
+ end
596
+ list
593
597
  end
594
598
 
595
599
  def title
@@ -872,18 +876,18 @@ class NavModuleViewer
872
876
 
873
877
  def content_section
874
878
  val = @value
875
- empty_row
876
879
  header_section
880
+ empty_row
877
881
  if (anc = val.ancestors) && (first = anc.first)
878
882
  anc.shift if first.id == val.id && first.value == val.qname
879
883
  end
880
884
  if anc && !anc.empty?
881
- empty_row
882
885
  ancestor_section
886
+ empty_row
883
887
  end
884
888
  if val.vars
885
- empty_row
886
889
  variables_section
890
+ empty_row
887
891
  end
888
892
  methods_section
889
893
  last_row @last_cols
@@ -951,7 +955,6 @@ class NavModuleViewer
951
955
 
952
956
  def methods_section
953
957
  return unless (meths = @methods ||= proxy.module_methods(@value.qname,@value.id))
954
- empty_row
955
958
  coldef = ColDef.new(NColor,nil,NFont,VColor,nil,VFont)
956
959
 
957
960
  @mcols = [coldef]
@@ -961,27 +964,39 @@ class NavModuleViewer
961
964
  end
962
965
  if (ms = meths.pub) && !ms.empty?
963
966
  header_row(@mcols,HdrPubClsMeth)
964
- ms.sort.each do |m| value_row(@mcols,m); end
967
+ ms.sort.each do |m|
968
+ value_row(@mcols,m)
969
+ end
965
970
  end
966
971
  if (ms = meths.pub_inst) && !ms.empty?
967
972
  header_row(@mcols,HdrPubInsMeth)
968
- ms.sort.each do |m| value_row(@mcols,m); end
973
+ ms.sort.each do |m|
974
+ value_row(@mcols,m)
975
+ end
969
976
  end
970
977
  if (ms = meths.pro) && !ms.empty?
971
978
  header_row(@mcols,HdrProClsMeth)
972
- ms.sort.each do |m| value_row(@mcols,m); end
979
+ ms.sort.each do |m|
980
+ value_row(@mcols,m)
981
+ end
973
982
  end
974
983
  if (ms = meths.pro_inst) && !ms.empty?
975
984
  header_row(@mcols,HdrProInsMeth)
976
- ms.sort.each do |m| value_row(@mcols,m); end
985
+ ms.sort.each do |m|
986
+ value_row(@mcols,m)
987
+ end
977
988
  end
978
989
  if (ms = meths.pri) && !ms.empty?
979
990
  header_row(@mcols,HdrPriClsMeth)
980
- ms.sort.each do |m| value_row(@mcols,m); end
991
+ ms.sort.each do |m|
992
+ value_row(@mcols,m)
993
+ end
981
994
  end
982
995
  if (ms = meths.pri_inst) && !ms.empty?
983
996
  header_row(@mcols, HdrPriInsMeth)
984
- ms.sort.each do |m| value_row(@mcols,m); end
997
+ ms.sort.each do |m|
998
+ value_row(@mcols,m)
999
+ end
985
1000
  end
986
1001
  @last_cols = @mcols
987
1002
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: cheri
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.2
7
- date: 2007-06-08 00:00:00 -07:00
6
+ version: 0.0.3
7
+ date: 2007-06-10 00:00:00 -07:00
8
8
  summary: Cheri Builder Platform
9
9
  require_paths:
10
10
  - lib