cheri 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/MIT-LICENSE +20 -0
- data/README +98 -0
- data/Rakefile +121 -0
- data/examples/hello_world_1.rb +28 -0
- data/examples/table_1.rb +44 -0
- data/lib/cheri/awt.rb +41 -0
- data/lib/cheri/builder.rb +31 -0
- data/lib/cheri/builder/awt/connecter.rb +63 -0
- data/lib/cheri/builder/awt/constants.rb +1003 -0
- data/lib/cheri/builder/awt/main.rb +191 -0
- data/lib/cheri/builder/awt/types.rb +220 -0
- data/lib/cheri/builder/base.rb +533 -0
- data/lib/cheri/builder/config.rb +187 -0
- data/lib/cheri/builder/connecter.rb +386 -0
- data/lib/cheri/builder/context.rb +655 -0
- data/lib/cheri/builder/generator.rb +425 -0
- data/lib/cheri/builder/html/charsets.rb +154 -0
- data/lib/cheri/builder/html/common.rb +32 -0
- data/lib/cheri/builder/html/connecter.rb +57 -0
- data/lib/cheri/builder/html/element.rb +156 -0
- data/lib/cheri/builder/html/main.rb +116 -0
- data/lib/cheri/builder/html/types.rb +123 -0
- data/lib/cheri/builder/main.rb +483 -0
- data/lib/cheri/builder/swing/connecter.rb +141 -0
- data/lib/cheri/builder/swing/constants.rb +420 -0
- data/lib/cheri/builder/swing/main.rb +446 -0
- data/lib/cheri/builder/swing/types.rb +270 -0
- data/lib/cheri/builder/xml/charsets.rb +154 -0
- data/lib/cheri/builder/xml/common.rb +32 -0
- data/lib/cheri/builder/xml/connecter.rb +42 -0
- data/lib/cheri/builder/xml/element.rb +189 -0
- data/lib/cheri/builder/xml/main.rb +130 -0
- data/lib/cheri/builder/xml/types.rb +36 -0
- data/lib/cheri/cheri.rb +70 -0
- data/lib/cheri/cjx.rb +3 -0
- data/lib/cheri/explorer.rb +32 -0
- data/lib/cheri/explorer/explorer.rb +560 -0
- data/lib/cheri/html.rb +31 -0
- data/lib/cheri/image/Delete24.gif +0 -0
- data/lib/cheri/image/Find24.gif +0 -0
- data/lib/cheri/image/FindAgain24.gif +0 -0
- data/lib/cheri/image/Refresh24.gif +0 -0
- data/lib/cheri/image/Search24.gif +0 -0
- data/lib/cheri/image/Thumbs.db +0 -0
- data/lib/cheri/image/cheri_icon_16x16.png +0 -0
- data/lib/cheri/image/cheri_icon_24x24.png +0 -0
- data/lib/cheri/image/cheri_logo_medium.png +0 -0
- data/lib/cheri/image/close_10x10.png +0 -0
- data/lib/cheri/image/close_10x10s.png +0 -0
- data/lib/cheri/image/close_12x12.png +0 -0
- data/lib/cheri/image/close_14x14.png +0 -0
- data/lib/cheri/image/close_24x24.png +0 -0
- data/lib/cheri/image/close_dim2_12x12.png +0 -0
- data/lib/cheri/image/close_dim_12x12.png +0 -0
- data/lib/cheri/image/cls_tree.png +0 -0
- data/lib/cheri/image/con_tree.png +0 -0
- data/lib/cheri/image/jruby_14x16.png +0 -0
- data/lib/cheri/image/jruby_logo.png +0 -0
- data/lib/cheri/image/mod_tree.png +0 -0
- data/lib/cheri/image/obj_tree.png +0 -0
- data/lib/cheri/image/ruby_16x16.png +0 -0
- data/lib/cheri/image/vars_tree.png +0 -0
- data/lib/cheri/java.rb +26 -0
- data/lib/cheri/java/builder.rb +28 -0
- data/lib/cheri/java/builder/main.rb +407 -0
- data/lib/cheri/java/builder/util.rb +480 -0
- data/lib/cheri/java/java.rb +56 -0
- data/lib/cheri/jruby.rb +32 -0
- data/lib/cheri/jruby/explorer.rb +43 -0
- data/lib/cheri/jruby/explorer/common.rb +38 -0
- data/lib/cheri/jruby/explorer/dialogs.rb +383 -0
- data/lib/cheri/jruby/explorer/explorer.rb +904 -0
- data/lib/cheri/jruby/explorer/splash.rb +80 -0
- data/lib/cheri/jruby/explorer/viewer.rb +619 -0
- data/lib/cheri/jruby/explorer/viewers.rb +1057 -0
- data/lib/cheri/jruby/jruby.rb +59 -0
- data/lib/cheri/swing.rb +41 -0
- data/lib/cheri/xml.rb +31 -0
- metadata +135 -0
@@ -0,0 +1,56 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (C) 2007 William N Dortch <bill.dortch@gmail.com>
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
# a copy of this software and associated documentation files (the
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
# the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
#++
|
23
|
+
#
|
24
|
+
|
25
|
+
module Cheri
|
26
|
+
module Java
|
27
|
+
JRuby = Cheri::JRuby #:nodoc:
|
28
|
+
class LocatableIcon < ::Java::JavaxSwing::ImageIcon
|
29
|
+
def initialize(location,*r)
|
30
|
+
super
|
31
|
+
@location = location
|
32
|
+
end
|
33
|
+
def location
|
34
|
+
@location
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
class << self
|
39
|
+
def get_class(*r)
|
40
|
+
JRuby.get_class(*r)
|
41
|
+
end
|
42
|
+
# call-seq:
|
43
|
+
# Cheri::Java.get_icon(filename) -> icon
|
44
|
+
#
|
45
|
+
# Returns an instance of LocatableIcon for file at #{Cheri.img_path}#{filename}.
|
46
|
+
def get_icon(n)
|
47
|
+
LocatableIcon.new("#{Cheri.img_path}#{n}")
|
48
|
+
end
|
49
|
+
# Returns the 16x16 Cheri icon.
|
50
|
+
def cheri_icon
|
51
|
+
@cheri_icon ||= get_icon('cheri_icon_16x16.png')
|
52
|
+
end
|
53
|
+
end #self
|
54
|
+
|
55
|
+
end #Java
|
56
|
+
end #Cheri
|
data/lib/cheri/jruby.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (C) 2007 William N Dortch <bill.dortch@gmail.com>
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
# a copy of this software and associated documentation files (the
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
# the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
#++
|
23
|
+
#
|
24
|
+
|
25
|
+
if (defined?JRUBY_VERSION) && 0 == (JRUBY_VERSION =~ /(\d+\.\d+\.\d+)([-\.A-Z0-9]*)/) &&
|
26
|
+
(($1 == '1.0.0' && ($2.empty? || $2 >= 'RC3')) || $1 > '1.0.0')
|
27
|
+
require 'java'
|
28
|
+
require 'cheri/cheri'
|
29
|
+
require 'cheri/jruby/jruby'
|
30
|
+
else
|
31
|
+
raise ArgumentError,"invalid or undefined JRUBY_VERSION (JRuby 1.0.0RC3 or later required)"
|
32
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (C) 2007 William N Dortch <bill.dortch@gmail.com>
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
# a copy of this software and associated documentation files (the
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
# the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
#++
|
23
|
+
#
|
24
|
+
if (defined?JRUBY_VERSION) && 0 == (JRUBY_VERSION =~ /(\d+\.\d+\.\d+)([-\.A-Z0-9]*)/) &&
|
25
|
+
(($1 == '1.0.0' && ($2.empty? || $2 >= 'RC3')) || $1 > '1.0.0')
|
26
|
+
|
27
|
+
require 'cheri/html'
|
28
|
+
require 'cheri/swing'
|
29
|
+
require 'cheri/explorer/explorer'
|
30
|
+
require 'cheri/jruby/explorer/splash'
|
31
|
+
require 'cheri/jruby/explorer/common'
|
32
|
+
require 'cheri/jruby/explorer/viewer'
|
33
|
+
require 'cheri/jruby/explorer/dialogs'
|
34
|
+
require 'cheri/jruby/explorer/explorer'
|
35
|
+
require 'cheri/jruby/explorer/viewers'
|
36
|
+
else
|
37
|
+
STDERR.puts %{
|
38
|
+
Cheri::JRuby::Explorer requires JRuby (1.0.0-RC3 or later)
|
39
|
+
Download the latest version of JRuby at:
|
40
|
+
http://www.jruby.org/
|
41
|
+
|
42
|
+
}
|
43
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (C) 2007 William N Dortch <bill.dortch@gmail.com>
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
# a copy of this software and associated documentation files (the
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
# the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
#++
|
23
|
+
#
|
24
|
+
|
25
|
+
module Cheri
|
26
|
+
module JRuby
|
27
|
+
module Explorer
|
28
|
+
|
29
|
+
module InstanceListener
|
30
|
+
def instance_added(instance)
|
31
|
+
end
|
32
|
+
def instance_removed(instance)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end #Explorer
|
37
|
+
end #JRuby
|
38
|
+
end #Cheri
|
@@ -0,0 +1,383 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (C) 2007 William N Dortch <bill.dortch@gmail.com>
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
# a copy of this software and associated documentation files (the
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
# the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
#++
|
23
|
+
#
|
24
|
+
|
25
|
+
|
26
|
+
module Cheri
|
27
|
+
module JRuby
|
28
|
+
module Explorer
|
29
|
+
|
30
|
+
class ConnectionDialog
|
31
|
+
include Cheri::Swing
|
32
|
+
def initialize(main)
|
33
|
+
swing[:auto=>true]
|
34
|
+
@main = main
|
35
|
+
@main_frame = main.main_frame
|
36
|
+
@dialog = dialog @main_frame, 'New Connection', true do |d|
|
37
|
+
box_layout(d, :Y_AXIS)
|
38
|
+
size 240,180
|
39
|
+
default_close_operation :HIDE_ON_CLOSE
|
40
|
+
y_glue
|
41
|
+
|
42
|
+
x_box do
|
43
|
+
y_box do
|
44
|
+
label 'Host:'
|
45
|
+
y_spacer 4
|
46
|
+
label 'Port:'
|
47
|
+
y_spacer 4
|
48
|
+
label 'Display name:'
|
49
|
+
end
|
50
|
+
x_spacer 10
|
51
|
+
y_box do
|
52
|
+
@con_host = text_field do
|
53
|
+
columns 10
|
54
|
+
maximum_size dimension(100,24)
|
55
|
+
text 'localhost'
|
56
|
+
end
|
57
|
+
y_spacer 4
|
58
|
+
@con_port = text_field do
|
59
|
+
columns 10
|
60
|
+
maximum_size dimension(100,24)
|
61
|
+
end
|
62
|
+
y_spacer 4
|
63
|
+
@con_name = text_field do
|
64
|
+
#align :RIGHT
|
65
|
+
columns 10
|
66
|
+
maximum_size dimension(100,24)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
y_spacer 16
|
71
|
+
x_box do
|
72
|
+
x_glue
|
73
|
+
button 'Connect' do
|
74
|
+
on_click do
|
75
|
+
host = @con_host.text
|
76
|
+
host.strip! if host
|
77
|
+
port = @con_port.text
|
78
|
+
port.strip! if port
|
79
|
+
name = @con_name.text
|
80
|
+
if name
|
81
|
+
name.strip!
|
82
|
+
name = nil if name.empty?
|
83
|
+
end
|
84
|
+
if !port || port.empty?
|
85
|
+
JOptionPane.show_message_dialog(@main_frame,"Please enter a port number",
|
86
|
+
'Connection Error', JOptionPane::ERROR_MESSAGE)
|
87
|
+
elsif !(port = Integer(port) rescue nil)
|
88
|
+
JOptionPane.show_message_dialog(@main_frame,"Invalid port: #{@con_port.text}",
|
89
|
+
'Connection Error', JOptionPane::ERROR_MESSAGE)
|
90
|
+
else
|
91
|
+
@dialog.visible = false
|
92
|
+
reset_fields
|
93
|
+
@main.new_connection(port,name,host)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
x_spacer 10
|
98
|
+
button 'Cancel' do
|
99
|
+
on_click do
|
100
|
+
@dialog.visible = false
|
101
|
+
reset_fields
|
102
|
+
end
|
103
|
+
end
|
104
|
+
x_glue
|
105
|
+
end
|
106
|
+
y_glue
|
107
|
+
end
|
108
|
+
reset_fields
|
109
|
+
@main.center(@main_frame,@dialog)
|
110
|
+
end
|
111
|
+
|
112
|
+
def reset_fields
|
113
|
+
@con_host.text = 'localhost'
|
114
|
+
@con_port.text = ''
|
115
|
+
@con_name.text = ''
|
116
|
+
end
|
117
|
+
private :reset_fields
|
118
|
+
|
119
|
+
def value
|
120
|
+
@dialog
|
121
|
+
end
|
122
|
+
|
123
|
+
def show
|
124
|
+
@dialog.visible = true
|
125
|
+
end
|
126
|
+
|
127
|
+
def hide
|
128
|
+
@dialog.visible = false
|
129
|
+
end
|
130
|
+
|
131
|
+
end
|
132
|
+
|
133
|
+
class SearchDialog
|
134
|
+
include Cheri::Swing
|
135
|
+
def initialize(main)
|
136
|
+
swing[:auto=>true]
|
137
|
+
@main = main
|
138
|
+
@main_frame = main.main_frame
|
139
|
+
@dialog = dialog @main_frame, 'Search ObjectSpace', true do |d|
|
140
|
+
box_layout d, :Y_AXIS
|
141
|
+
size 400,300
|
142
|
+
default_close_operation :HIDE_ON_CLOSE
|
143
|
+
y_glue
|
144
|
+
x_panel do
|
145
|
+
x_spacer 4
|
146
|
+
label 'Instance:'
|
147
|
+
x_spacer 10
|
148
|
+
@instance_list = combo_box instance_list do
|
149
|
+
editable false
|
150
|
+
end
|
151
|
+
x_spacer 4
|
152
|
+
end
|
153
|
+
y_glue
|
154
|
+
x_panel do
|
155
|
+
compound_border(
|
156
|
+
titled_border('Find specific object') { etched_border :LOWERED },
|
157
|
+
empty_border(4,8,4,8)
|
158
|
+
)
|
159
|
+
y_box do
|
160
|
+
label 'Object id:'
|
161
|
+
end
|
162
|
+
x_spacer 10
|
163
|
+
y_box do
|
164
|
+
y_glue
|
165
|
+
@object_id = text_field do
|
166
|
+
columns 16
|
167
|
+
fixed_size 100,24
|
168
|
+
#maximum_size dimension(100,24)
|
169
|
+
#minimum_size dimension(100,24)
|
170
|
+
end
|
171
|
+
y_glue
|
172
|
+
end
|
173
|
+
x_glue
|
174
|
+
y_box do
|
175
|
+
y_glue
|
176
|
+
button 'Find' do
|
177
|
+
on_click do
|
178
|
+
id = nil_if_empty(@object_id.text)
|
179
|
+
id = Integer(id) rescue nil if id
|
180
|
+
if !id
|
181
|
+
JOptionPane.show_message_dialog(@dialog,"Please enter a valid id",
|
182
|
+
'Search Error', JOptionPane::ERROR_MESSAGE)
|
183
|
+
else
|
184
|
+
@dialog.visible = false
|
185
|
+
@main.new_find(@instances[@instance_list.selected_index],id)
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
y_glue
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
y_glue
|
194
|
+
|
195
|
+
x_panel do
|
196
|
+
compound_border(
|
197
|
+
titled_border('Search for instances by type and optional variable/value') { etched_border :LOWERED },
|
198
|
+
empty_border(4,8,4,8)
|
199
|
+
)
|
200
|
+
y_box do
|
201
|
+
y_glue
|
202
|
+
label 'Class or Module:'
|
203
|
+
y_glue
|
204
|
+
label 'Variable name:'
|
205
|
+
y_glue
|
206
|
+
label 'Search string or /regexp/:'
|
207
|
+
y_glue
|
208
|
+
end
|
209
|
+
x_spacer 6
|
210
|
+
y_box do
|
211
|
+
y_glue
|
212
|
+
label '@'
|
213
|
+
y_glue
|
214
|
+
end
|
215
|
+
y_box do
|
216
|
+
y_glue
|
217
|
+
@clazz = text_field do
|
218
|
+
columns 20
|
219
|
+
fixed_size 200,24
|
220
|
+
#maximum_size dimension(200,24)
|
221
|
+
#minimum_size dimension(200,24)
|
222
|
+
end
|
223
|
+
y_glue
|
224
|
+
@name1 = text_field do
|
225
|
+
columns 20
|
226
|
+
fixed_size 200,24
|
227
|
+
#maximum_size dimension(200,24)
|
228
|
+
#minimum_size dimension(200,24)
|
229
|
+
end
|
230
|
+
y_glue
|
231
|
+
@value1 = text_field do
|
232
|
+
columns 20
|
233
|
+
fixed_size 200,24
|
234
|
+
#maximum_size dimension(200,24)
|
235
|
+
#minimum_size dimension(200,24)
|
236
|
+
end
|
237
|
+
y_glue
|
238
|
+
end
|
239
|
+
x_glue
|
240
|
+
y_box do
|
241
|
+
button 'Find' do
|
242
|
+
on_click do
|
243
|
+
clazz = nil_if_empty(@clazz.text)
|
244
|
+
name = nil_if_empty(@name1.text)
|
245
|
+
value = @value1.text
|
246
|
+
value = nil if value.empty?
|
247
|
+
if !clazz
|
248
|
+
JOptionPane.show_message_dialog(@dialog,"Please enter a Class or Module name",
|
249
|
+
'Search Error', JOptionPane::ERROR_MESSAGE)
|
250
|
+
elsif clazz !~ /^([A-Z])((\w|::[A-Z])*)$/
|
251
|
+
JOptionPane.show_message_dialog(@dialog,"Invalid Class or Module name, please re-enter",
|
252
|
+
'Search Error', JOptionPane::ERROR_MESSAGE)
|
253
|
+
elsif name && name !~ /^([A-Za-z_])(\w*)$/
|
254
|
+
JOptionPane.show_message_dialog(@dialog,"Invalid variable name, please re-enter",
|
255
|
+
'Search Error', JOptionPane::ERROR_MESSAGE)
|
256
|
+
elsif value && !name && !value.empty?
|
257
|
+
JOptionPane.show_message_dialog(@dialog,"Please enter a variable name (or omit value)",
|
258
|
+
'Search Error', JOptionPane::ERROR_MESSAGE)
|
259
|
+
else
|
260
|
+
@dialog.visible = false
|
261
|
+
@main.new_search(@instances[@instance_list.selected_index],clazz,name,value)
|
262
|
+
end
|
263
|
+
end
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|
267
|
+
y_glue
|
268
|
+
button 'Cancel' do
|
269
|
+
on_click do
|
270
|
+
@dialog.visible = false
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
y_glue
|
275
|
+
end
|
276
|
+
|
277
|
+
@main.center(@main_frame,@dialog)
|
278
|
+
end
|
279
|
+
|
280
|
+
def nil_if_empty(val)
|
281
|
+
if val
|
282
|
+
val.strip!
|
283
|
+
val = nil if val.empty?
|
284
|
+
end
|
285
|
+
val
|
286
|
+
end
|
287
|
+
|
288
|
+
def value
|
289
|
+
@dialog
|
290
|
+
end
|
291
|
+
|
292
|
+
def show(clazz = nil)
|
293
|
+
@clazz.text = clazz if clazz
|
294
|
+
update_instance_list
|
295
|
+
@dialog.visible = true
|
296
|
+
end
|
297
|
+
|
298
|
+
def hide
|
299
|
+
@dialog.visible = false
|
300
|
+
end
|
301
|
+
|
302
|
+
def instance_list
|
303
|
+
@instances = @main.instance_list
|
304
|
+
arr = Array.new(@instances.length) {|i| @instances[i].name}
|
305
|
+
arr.to_java
|
306
|
+
end
|
307
|
+
|
308
|
+
def update_instance_list
|
309
|
+
new_list = instance_list
|
310
|
+
@instance_list.remove_all_items
|
311
|
+
new_list.each do |name|
|
312
|
+
@instance_list.add_item name
|
313
|
+
end
|
314
|
+
end
|
315
|
+
|
316
|
+
|
317
|
+
end
|
318
|
+
|
319
|
+
class AboutDialog
|
320
|
+
include Cheri::Swing
|
321
|
+
include Cheri::Html
|
322
|
+
def initialize(main)
|
323
|
+
swing[:auto]
|
324
|
+
undef p
|
325
|
+
@main = main
|
326
|
+
@main_frame = main.main_frame
|
327
|
+
@dialog = dialog @main_frame, 'About Cheri::JRuby::Explorer', true do |d|
|
328
|
+
size 600,450
|
329
|
+
default_close_operation :HIDE_ON_CLOSE
|
330
|
+
@view ||= scroll_pane do
|
331
|
+
align :LEFT
|
332
|
+
@html_view = editor_pane do
|
333
|
+
editable false
|
334
|
+
content_type 'text/html'
|
335
|
+
html { head { style 'body { font-family: sans-serif; }' }
|
336
|
+
body(:bgolor=>:white) { div(:align=>:center) {
|
337
|
+
h3 font(:color=>:blue) {'Cheri::JRuby::Explorer version 0.0.2'}
|
338
|
+
p 'Written by Bill Dortch ', esc('<cheri.project@gmail.com>'), br,
|
339
|
+
'Copyright © 2007 William N Dortch'
|
340
|
+
p
|
341
|
+
table(:width=>'97%') {
|
342
|
+
tr{td(:align=>:left) {
|
343
|
+
p 'Cheri::JRuby::Explorer (CJX) demonstrates some of the features ',
|
344
|
+
'of the Cheri builder framework, and with any luck may prove useful ',
|
345
|
+
'in its own right. CJX is built using the Cheri::Swing and Cheri::Html ',
|
346
|
+
'components of the framework.'
|
347
|
+
p
|
348
|
+
p 'This is a ',i('very'),' early Beta release, of both Cheri and CJX, so do ',
|
349
|
+
'expect bugs, crashes, and the like. The Cheri framework itself is pretty ',
|
350
|
+
'stable (though I refactor it weekly, it seems), but the CJX code is mostly ',
|
351
|
+
'untested beyond the confines of my desktop.'
|
352
|
+
p
|
353
|
+
p 'For more information, and to report bugs or suggest features, please visit ',
|
354
|
+
'the Cheri project pages on RubyForge, at ', a(b('http://cheri.rubyforge.org'),
|
355
|
+
:href=>'http://cheri.rubyforge.org/'), ' and ', a(b('http://rubyforge.org/projects/cheri'),
|
356
|
+
:href=>'http://rubyforge.org/projects/cheri'), '.'
|
357
|
+
}}
|
358
|
+
}
|
359
|
+
}}}
|
360
|
+
end
|
361
|
+
end
|
362
|
+
end
|
363
|
+
@main.center(@main_frame,@dialog)
|
364
|
+
end
|
365
|
+
|
366
|
+
def value
|
367
|
+
@dialog
|
368
|
+
end
|
369
|
+
|
370
|
+
def show
|
371
|
+
@dialog.visible = true
|
372
|
+
end
|
373
|
+
|
374
|
+
def hide
|
375
|
+
@dialog.visible = false
|
376
|
+
end
|
377
|
+
|
378
|
+
end
|
379
|
+
|
380
|
+
|
381
|
+
end #Explorer
|
382
|
+
end #JRuby
|
383
|
+
end #Cheri
|