rubeus 0.0.6-java → 0.0.7-java
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +26 -0
- data/examples/jdbc_example.rb +5 -24
- data/lib/rubeus.jar +0 -0
- data/lib/rubeus.rb +18 -2
- data/lib/rubeus/component_loader.rb +25 -20
- data/lib/rubeus/extensions.rb +44 -4
- data/lib/rubeus/extensions/java/awt/dimension.rb +8 -2
- data/lib/rubeus/extensions/java/sql/driver_manager.rb +240 -1
- data/lib/rubeus/extensions/javax/swing/j_table.rb +7 -23
- data/lib/rubeus/extensions/javax/swing/table/default_table_model.rb +7 -0
- data/lib/rubeus/extensions/javax/swing/table/readonlyable_table_model.rb +10 -0
- data/lib/rubeus/jdbc.rb +5 -0
- data/lib/rubeus/swing.rb +9 -6
- data/lib/rubeus/verboseable.rb +41 -0
- data/rmaven.yml +6 -0
- data/test/rubeus/awt/test_attributes.rb +58 -0
- data/test/rubeus/awt/test_event.rb +216 -0
- data/test/rubeus/awt/test_nestable.rb +92 -0
- data/test/rubeus/awt/test_setter.rb +42 -0
- data/test/rubeus/extensions/java/awt/test_dimension.rb +67 -0
- data/test/rubeus/extensions/java/sql/test_connection.rb +50 -0
- data/test/rubeus/extensions/java/sql/test_driver_manager.rb +37 -0
- data/test/rubeus/extensions/java/sql/test_result_set.rb +67 -0
- data/test/rubeus/extensions/java/sql/test_result_set_meta_data.rb +121 -0
- data/test/rubeus/extensions/java/sql/test_statement.rb +43 -0
- data/test/rubeus/extensions/javax/swing/table/test_default_table_model.rb +359 -0
- data/test/rubeus/extensions/javax/swing/table/test_default_table_model/nhk_words.xml +15 -0
- data/test/rubeus/extensions/javax/swing/test_box_layout.rb +56 -0
- data/test/rubeus/extensions/javax/swing/test_j_component.rb +30 -0
- data/test/rubeus/extensions/javax/swing/test_j_frame.rb +42 -0
- data/test/rubeus/extensions/javax/swing/test_j_panel.rb +23 -0
- data/test/rubeus/extensions/javax/swing/test_j_scroll_pane.rb +24 -0
- data/test/rubeus/extensions/javax/swing/test_j_split_pane.rb +54 -0
- data/test/rubeus/extensions/javax/swing/test_j_tabbed_pane.rb +204 -0
- data/test/rubeus/extensions/javax/swing/test_j_table.rb +71 -0
- data/test/rubeus/extensions/javax/swing/test_j_text_field.rb +48 -0
- data/test/rubeus/extensions/javax/swing/test_timer.rb +28 -0
- data/test/rubeus/test_extensions.rb +44 -0
- data/test/test_all.rb +2 -0
- metadata +50 -16
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'rubeus'
|
4
|
+
|
5
|
+
# Test for j_table.rb
|
6
|
+
class TestJTable < Test::Unit::TestCase
|
7
|
+
include Rubeus::Swing
|
8
|
+
|
9
|
+
# setup method
|
10
|
+
def setup
|
11
|
+
end
|
12
|
+
|
13
|
+
# test default preferred size
|
14
|
+
def test_default_preferred_size
|
15
|
+
JFrame.new do |f|
|
16
|
+
jt = JTable.new
|
17
|
+
|
18
|
+
f.set_size(500, 500)
|
19
|
+
f.pack
|
20
|
+
|
21
|
+
assert_equal(200, jt.width)
|
22
|
+
assert_equal(150, jt.height)
|
23
|
+
|
24
|
+
f.dispose
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# test model accessor
|
29
|
+
def test_model_accessor
|
30
|
+
jt = JTable.new
|
31
|
+
|
32
|
+
# set_model and model
|
33
|
+
jt.set_model(["first", "second"])
|
34
|
+
|
35
|
+
assert_equal(2, jt.model.column_count)
|
36
|
+
assert_equal("first", jt.model.get_column_name(0))
|
37
|
+
assert_equal("second", jt.model.get_column_name(1))
|
38
|
+
|
39
|
+
# =model and get_model
|
40
|
+
jt.model = ["third", "forth", "fifth"]
|
41
|
+
|
42
|
+
assert_equal(3, jt.get_model.column_count)
|
43
|
+
assert_equal("third", jt.get_model.get_column_name(0))
|
44
|
+
assert_equal("forth", jt.get_model.get_column_name(1))
|
45
|
+
assert_equal("fifth", jt.get_model.get_column_name(2))
|
46
|
+
end
|
47
|
+
|
48
|
+
# test model readonly
|
49
|
+
def test_readonly
|
50
|
+
jt = JTable.new
|
51
|
+
|
52
|
+
# set test data
|
53
|
+
jt.model = {:data => [["1", "ないわ〜"], ["2", "格好いい"]], :column_names => ["ID", "NHK語"]}
|
54
|
+
|
55
|
+
for i in 0..(jt.model.row_count - 1)
|
56
|
+
for j in 0..(jt.model.column_count - 1)
|
57
|
+
assert_equal(true, jt.model.is_cell_editable(i, j))
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# set to readonly
|
62
|
+
jt.model.readonly = true
|
63
|
+
|
64
|
+
for i in 0..(jt.model.row_count - 1)
|
65
|
+
for j in 0..(jt.model.column_count - 1)
|
66
|
+
# is_cell_editable always returns true
|
67
|
+
assert_equal(false, jt.model.isCellEditable(i, j))
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'rubeus'
|
4
|
+
|
5
|
+
# Test for j_scroll_pane.rb
|
6
|
+
class TestJTextField < Test::Unit::TestCase
|
7
|
+
include Rubeus::Swing
|
8
|
+
|
9
|
+
# setup method
|
10
|
+
def setup
|
11
|
+
end
|
12
|
+
|
13
|
+
# normal pattern
|
14
|
+
def test_normal
|
15
|
+
@key_event_processed = false
|
16
|
+
|
17
|
+
JFrame.new do |f|
|
18
|
+
# Register default event keyPress
|
19
|
+
jtf = JTextField.new do |key_event|
|
20
|
+
assert_equal(java.awt.event.KeyEvent::KEY_PRESSED, key_event.get_id)
|
21
|
+
assert_equal(java.awt.event.KeyEvent::VK_A, key_event.get_key_code)
|
22
|
+
assert_equal(97, key_event.get_key_char)
|
23
|
+
assert_equal(0, key_event.get_modifiers)
|
24
|
+
|
25
|
+
@key_event_processed = true
|
26
|
+
end
|
27
|
+
|
28
|
+
f.visible = true
|
29
|
+
|
30
|
+
# Send key pressed event to JTextField
|
31
|
+
jtf.dispatch_event(
|
32
|
+
java.awt.event.KeyEvent.new(
|
33
|
+
jtf,
|
34
|
+
java.awt.event.KeyEvent::KEY_PRESSED,
|
35
|
+
java.lang.System.current_time_millis,
|
36
|
+
0,
|
37
|
+
java.awt.event.KeyEvent::VK_A,
|
38
|
+
97
|
39
|
+
)
|
40
|
+
)
|
41
|
+
|
42
|
+
f.dispose
|
43
|
+
f.visible = false
|
44
|
+
|
45
|
+
assert_equal(true, @key_event_processed)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'rubeus'
|
4
|
+
|
5
|
+
# Test for timer.rb
|
6
|
+
class TestTimer < Test::Unit::TestCase
|
7
|
+
include Rubeus::Swing
|
8
|
+
|
9
|
+
# setup method
|
10
|
+
def setup
|
11
|
+
end
|
12
|
+
|
13
|
+
# normal pattern
|
14
|
+
def test_normal
|
15
|
+
count = 0
|
16
|
+
t = Timer.new(100) do
|
17
|
+
count += 1
|
18
|
+
end
|
19
|
+
t.start
|
20
|
+
|
21
|
+
sleep(1)
|
22
|
+
|
23
|
+
assert(count > 1)
|
24
|
+
|
25
|
+
t.stop
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'rubeus'
|
4
|
+
# Rubeus.verbose = true
|
5
|
+
|
6
|
+
# Test for extensions.rb
|
7
|
+
class TestExtensions < Test::Unit::TestCase
|
8
|
+
# setup method
|
9
|
+
def setup
|
10
|
+
end
|
11
|
+
|
12
|
+
# test path_for
|
13
|
+
def test_path_for
|
14
|
+
# java fqn
|
15
|
+
assert_equal("rubeus/extensions/javax/swing/j_table", Rubeus::Extensions.path_for("javax.swing.JTable"))
|
16
|
+
assert_equal("rubeus/extensions/javax/swing/j_tabbed_pane", Rubeus::Extensions.path_for("javax.swing.JTabbedPane"))
|
17
|
+
|
18
|
+
# parts
|
19
|
+
assert_equal("rubeus/extensions/javax/swing/j_table", Rubeus::Extensions.path_for(["javax", "swing", "JTable"]))
|
20
|
+
assert_equal("rubeus/extensions/javax/swing/j_tabbed_pane", Rubeus::Extensions.path_for(["javax", "swing", "JTabbedPane"]))
|
21
|
+
end
|
22
|
+
|
23
|
+
# test class_name_for
|
24
|
+
def test_class_name_for
|
25
|
+
# java fqn
|
26
|
+
assert_equal("Rubeus::Extensions::Javax::Swing::JTable", Rubeus::Extensions.class_name_for("javax.swing.JTable"))
|
27
|
+
assert_equal("Rubeus::Extensions::Javax::Swing::JTabbedPane", Rubeus::Extensions.class_name_for("javax.swing.JTabbedPane"))
|
28
|
+
|
29
|
+
# parts
|
30
|
+
assert_equal("Rubeus::Extensions::Javax::Swing::JTable", Rubeus::Extensions.class_name_for(["javax", "swing", "JTable"]))
|
31
|
+
assert_equal("Rubeus::Extensions::Javax::Swing::JTabbedPane", Rubeus::Extensions.class_name_for(["javax", "swing", "JTabbedPane"]))
|
32
|
+
end
|
33
|
+
|
34
|
+
# test find_for
|
35
|
+
def test_find_for
|
36
|
+
# normal
|
37
|
+
assert_nothing_raised do
|
38
|
+
Rubeus::Extensions.find_for("javax.swing.JTable")
|
39
|
+
end
|
40
|
+
|
41
|
+
# LoadError
|
42
|
+
assert_nil(Rubeus::Extensions.find_for("javax.swing.DoesNotExistClass"))
|
43
|
+
end
|
44
|
+
end
|
data/test/test_all.rb
ADDED
metadata
CHANGED
@@ -1,14 +1,17 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
extensions: []
|
3
|
+
|
3
4
|
homepage: http://code.google.com/p/rubeus/
|
4
5
|
executables:
|
5
6
|
- jirb_rubeus
|
6
7
|
- jirb_rubeus.bat
|
7
|
-
version: !ruby/object:Gem::Version
|
8
|
-
version: 0.0.
|
8
|
+
version: !ruby/object:Gem::Version
|
9
|
+
version: 0.0.7
|
9
10
|
post_install_message:
|
10
|
-
date: 2008-
|
11
|
+
date: 2008-11-21 15:00:00 +00:00
|
11
12
|
files:
|
13
|
+
- Rakefile
|
14
|
+
- rmaven.yml
|
12
15
|
- bin/jirb_rubeus
|
13
16
|
- bin/jirb_rubeus.bat
|
14
17
|
- lib/rubeus.rb
|
@@ -17,6 +20,7 @@ files:
|
|
17
20
|
- lib/rubeus/extensions.rb
|
18
21
|
- lib/rubeus/jdbc.rb
|
19
22
|
- lib/rubeus/swing.rb
|
23
|
+
- lib/rubeus/verboseable.rb
|
20
24
|
- lib/rubeus/awt/attributes.rb
|
21
25
|
- lib/rubeus/awt/event.rb
|
22
26
|
- lib/rubeus/awt/nestable.rb
|
@@ -47,8 +51,10 @@ files:
|
|
47
51
|
- lib/rubeus/extensions/javax/swing/j_window.rb
|
48
52
|
- lib/rubeus/extensions/javax/swing/timer.rb
|
49
53
|
- lib/rubeus/extensions/javax/swing/table/default_table_model.rb
|
54
|
+
- lib/rubeus/extensions/javax/swing/table/readonlyable_table_model.rb
|
50
55
|
- lib/rubeus/jdbc/closeable_resource.rb
|
51
56
|
- lib/rubeus/jdbc/column.rb
|
57
|
+
- lib/rubeus.jar
|
52
58
|
- examples/jdbc_example.rb
|
53
59
|
- examples/notepad.rb
|
54
60
|
- examples/rubeus_swing_example01.rb
|
@@ -59,48 +65,76 @@ files:
|
|
59
65
|
- examples/nyanco_viewer/nyanco_viewer_rubeus.rb
|
60
66
|
- examples/notepad.rtf
|
61
67
|
- examples/nyanco_viewer/nekobean_s.png
|
62
|
-
|
68
|
+
- test/test_all.rb
|
69
|
+
- test/rubeus/test_extensions.rb
|
70
|
+
- test/rubeus/awt/test_attributes.rb
|
71
|
+
- test/rubeus/awt/test_event.rb
|
72
|
+
- test/rubeus/awt/test_nestable.rb
|
73
|
+
- test/rubeus/awt/test_setter.rb
|
74
|
+
- test/rubeus/extensions/java/awt/test_dimension.rb
|
75
|
+
- test/rubeus/extensions/java/sql/test_connection.rb
|
76
|
+
- test/rubeus/extensions/java/sql/test_driver_manager.rb
|
77
|
+
- test/rubeus/extensions/java/sql/test_result_set.rb
|
78
|
+
- test/rubeus/extensions/java/sql/test_result_set_meta_data.rb
|
79
|
+
- test/rubeus/extensions/java/sql/test_statement.rb
|
80
|
+
- test/rubeus/extensions/javax/swing/test_box_layout.rb
|
81
|
+
- test/rubeus/extensions/javax/swing/test_j_component.rb
|
82
|
+
- test/rubeus/extensions/javax/swing/test_j_frame.rb
|
83
|
+
- test/rubeus/extensions/javax/swing/test_j_panel.rb
|
84
|
+
- test/rubeus/extensions/javax/swing/test_j_scroll_pane.rb
|
85
|
+
- test/rubeus/extensions/javax/swing/test_j_split_pane.rb
|
86
|
+
- test/rubeus/extensions/javax/swing/test_j_tabbed_pane.rb
|
87
|
+
- test/rubeus/extensions/javax/swing/test_j_table.rb
|
88
|
+
- test/rubeus/extensions/javax/swing/test_j_text_field.rb
|
89
|
+
- test/rubeus/extensions/javax/swing/test_timer.rb
|
90
|
+
- test/rubeus/extensions/javax/swing/table/test_default_table_model.rb
|
91
|
+
- test/rubeus/extensions/javax/swing/table/test_default_table_model/nhk_words.xml
|
92
|
+
rubygems_version: 1.3.1
|
63
93
|
rdoc_options: []
|
94
|
+
|
64
95
|
signing_key:
|
65
96
|
cert_chain: []
|
97
|
+
|
66
98
|
name: rubeus
|
67
99
|
has_rdoc: false
|
68
100
|
platform: java
|
69
101
|
summary: Rubeus provides you an easy access to Java objects from Ruby scripts on JRuby
|
70
102
|
default_executable: jirb_rubeus
|
71
103
|
bindir: bin
|
72
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
105
|
version:
|
74
106
|
requirements:
|
75
107
|
- - '>='
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version:
|
78
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: "0"
|
110
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
79
111
|
version:
|
80
112
|
requirements:
|
81
113
|
- - '>='
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
version:
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: "0"
|
84
116
|
require_paths:
|
85
117
|
- lib
|
86
118
|
specification_version: 2
|
87
119
|
test_files: []
|
120
|
+
|
88
121
|
dependencies:
|
89
|
-
- !ruby/object:Gem::Dependency
|
122
|
+
- !ruby/object:Gem::Dependency
|
90
123
|
type: :runtime
|
91
124
|
name: activesupport
|
92
125
|
version_requirement:
|
93
|
-
version_requirements: !ruby/object:Gem::Requirement
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
127
|
version:
|
95
128
|
requirements:
|
96
|
-
- -
|
97
|
-
- !ruby/object:Gem::Version
|
98
|
-
version: 2.
|
129
|
+
- - "="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 2.1.2
|
99
132
|
description:
|
100
133
|
email: rubeus@googlegroups.com
|
101
134
|
authors:
|
102
135
|
- Takeshi Akima
|
103
136
|
extra_rdoc_files: []
|
137
|
+
|
104
138
|
requirements:
|
105
139
|
- none
|
106
140
|
rubyforge_project: rubybizcommons
|