cheri 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- 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
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (C) 2007 William N Dortch <bill.dortch@gmail.com>
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
= Cheri -- A Builder Framework
|
2
|
+
|
3
|
+
Cheri is a framework for creating builder applications (those that create
|
4
|
+
hierarchical, tree-like, structures). It includes a number of builders
|
5
|
+
based on the framework, as well as a builder-builder tool for easily creating
|
6
|
+
simple builders. Cheri also comes with a demo application, Cheri::JRuby::Explorer,
|
7
|
+
that is built using two of the supplied builders (Cheri::Swing and Cheri::Html).
|
8
|
+
|
9
|
+
This version (0.0.2) is an early beta release. Some features are not yet fully
|
10
|
+
developed, in particular the HTML/XML components. On the other hand, Cheri::Swing,
|
11
|
+
which is the successor to JRBuilder (http://www2.webng.com/bdortch/jrbuilder), is
|
12
|
+
relatively mature, in an adolescent sort of way, though many features could be added.
|
13
|
+
|
14
|
+
But do expect some bugs, especially in Cheri::JRuby::Explorer (CJX), which is very
|
15
|
+
much a work in progress. I note some known problems in the section below.
|
16
|
+
|
17
|
+
Documentation will be forthcoming over the next couple of days (from this writing,
|
18
|
+
8 June 2007), so watch the Cheri websites at RubyForge for updates:
|
19
|
+
|
20
|
+
http://cheri.rubyforge.org/
|
21
|
+
http://rubyforge.org/projects/cheri
|
22
|
+
|
23
|
+
In the meantime, here is a very brief summary of CJX.
|
24
|
+
|
25
|
+
== Cheri::JRuby::Explorer (CJX)
|
26
|
+
|
27
|
+
CJX is a Swing application written entirely in (J)Ruby using the Cheri::Swing and
|
28
|
+
Cheri::Html builders. It enables you to easily browse classes/modules,
|
29
|
+
configuration/environment settings, and, if ObjectSpace is enabled, any objects
|
30
|
+
in a JRuby instance. A small DRb server component can be installed in other JRuby
|
31
|
+
instances, enabling you to browse them as well. (Note that I have been trying to get
|
32
|
+
the DRb server component working in C/MRI Ruby as well, but have run up against
|
33
|
+
threading/IO conflicts. Suggestions welcome!)
|
34
|
+
|
35
|
+
The CJX client requires JRuby 1.0.0RC3 or later. To run it (after installing the
|
36
|
+
Cheri gem):
|
37
|
+
|
38
|
+
require 'rubygems'
|
39
|
+
require 'cheri/jruby/explorer'
|
40
|
+
|
41
|
+
Cheri::JRuby::Explorer.run
|
42
|
+
|
43
|
+
This will take several seconds to load and start -- performance will be one area
|
44
|
+
of improvement for versions 0.0.3 and beyond. Once it loads, it should be fairly
|
45
|
+
clear what to do.
|
46
|
+
|
47
|
+
Some known issues:
|
48
|
+
|
49
|
+
* Browsing the class hierarchy is very slow right now -- this actually slowed down
|
50
|
+
in the past couple of days when I switched from HTML to straight Swing layout, the
|
51
|
+
opposite of what I expected to happen.
|
52
|
+
|
53
|
+
* ObjectSpace searches that return large numbers of objects sometimes result in a
|
54
|
+
NullPointerException (JList seems to get overwhelmed), requiring a restart of
|
55
|
+
CJX. I had a fix in that did a GC on the target instance before each search,
|
56
|
+
which seemed to help, but also seemed a little extreme. This will be a search
|
57
|
+
option in 0.0.3.
|
58
|
+
|
59
|
+
* There are lots of layout issues; neither HTML (JEditorPane) nor BoxLayout provide
|
60
|
+
exactly what I'm looking for. Will probably have to bite the bullet and go to
|
61
|
+
GridBagLayout. Ugh.
|
62
|
+
|
63
|
+
* Close buttons on tabs aren't available pre-Java 1.6. There are alternatives for
|
64
|
+
the top tabs, but currently not for the bottom (search result) tabs. Will resolve
|
65
|
+
in 0.0.3.
|
66
|
+
|
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.
|
69
|
+
|
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
|
72
|
+
other goodies as well (thread-local vars, status, etc.).
|
73
|
+
|
74
|
+
To install the CJX DRb server component in an instance (assuming the Cheri gem is
|
75
|
+
installed):
|
76
|
+
|
77
|
+
require 'rubygems'
|
78
|
+
require 'cheri/explorer'
|
79
|
+
|
80
|
+
Cheri::Explorer.start nnnn #=> where nnnn is a port number
|
81
|
+
|
82
|
+
Note that for the server, you require 'cheri/explorer', _not_ 'cheri/jruby/explorer'.
|
83
|
+
Also note that the above actually _does_ work in C/MRI Ruby, but requests to the
|
84
|
+
server then hang in CJX, unless you join the thread:
|
85
|
+
|
86
|
+
Cheri::Explorer.thread.join
|
87
|
+
|
88
|
+
After that, you can browse just fine in CJX, but you can't do anything more in the
|
89
|
+
C-Ruby instance, so it's kind of pointless. Again, if anyone with some DRb experience
|
90
|
+
(of which I have none) can offer any suggestions, I'd appreciate it.
|
91
|
+
|
92
|
+
== The Rest
|
93
|
+
|
94
|
+
Please visit the Cheri site for more documentation, I'll be continually adding to it
|
95
|
+
in the coming days.
|
96
|
+
|
97
|
+
Bill Dortch <cheri.project@gmail.com>
|
98
|
+
8 June 2007
|
data/Rakefile
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/testtask'
|
4
|
+
require 'rake/rdoctask'
|
5
|
+
require 'rake/packagetask'
|
6
|
+
require 'rake/gempackagetask'
|
7
|
+
require 'rake/contrib/rubyforgepublisher'
|
8
|
+
require 'fileutils'
|
9
|
+
require File.join(File.dirname(__FILE__), 'lib', 'cheri', 'cheri')
|
10
|
+
|
11
|
+
PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
|
12
|
+
PKG_NAME = 'cheri'
|
13
|
+
PKG_VERSION = Cheri::VERSION::STRING + PKG_BUILD
|
14
|
+
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
|
15
|
+
PKG_DESTINATION = "../#{PKG_NAME}"
|
16
|
+
|
17
|
+
RELEASE_NAME = "REL #{PKG_VERSION}"
|
18
|
+
|
19
|
+
RUBY_FORGE_PROJECT = "cheri"
|
20
|
+
RUBY_FORGE_USER = "bill_dortch"
|
21
|
+
|
22
|
+
desc "Default Task"
|
23
|
+
#task :default => [ :test ]
|
24
|
+
task :default => [ :gem ]
|
25
|
+
|
26
|
+
|
27
|
+
# Run the unit tests
|
28
|
+
Rake::TestTask.new { |t|
|
29
|
+
t.libs << "test"
|
30
|
+
t.test_files = Dir['test/*_test.rb']
|
31
|
+
t.verbose = true
|
32
|
+
}
|
33
|
+
|
34
|
+
# Generate the RDoc documentation
|
35
|
+
Rake::RDocTask.new { |rdoc|
|
36
|
+
rdoc.rdoc_dir = 'doc'
|
37
|
+
rdoc.title = "Cheri Builder Platform"
|
38
|
+
#rdoc.options << '--all'
|
39
|
+
#rdoc.options << '--line-numbers' << '--inline-source'
|
40
|
+
rdoc.template = "#{ENV['template']}.rb" if ENV['template']
|
41
|
+
rdoc.rdoc_files.include('README')
|
42
|
+
#rdoc.rdoc_files.include('CHANGELOG')
|
43
|
+
rdoc.rdoc_files.include("lib/**/*.rb")
|
44
|
+
}
|
45
|
+
|
46
|
+
|
47
|
+
# Create compressed packages
|
48
|
+
spec = Gem::Specification.new do |s|
|
49
|
+
s.platform = Gem::Platform::RUBY
|
50
|
+
s.name = PKG_NAME
|
51
|
+
s.summary = "Cheri Builder Platform"
|
52
|
+
s.description = %q{The Cheri Builder Platform.}
|
53
|
+
s.version = PKG_VERSION
|
54
|
+
|
55
|
+
s.author = "Bill Dortch"
|
56
|
+
s.email = "cheri.project@gmail.com"
|
57
|
+
s.rubyforge_project = "cheri"
|
58
|
+
s.homepage = "http://cheri.rubyforge.org"
|
59
|
+
|
60
|
+
s.has_rdoc = true
|
61
|
+
s.requirements << 'none'
|
62
|
+
s.require_path = 'lib'
|
63
|
+
|
64
|
+
s.files = [ "Rakefile", "README", "MIT-LICENSE" ]
|
65
|
+
s.files = s.files + Dir.glob( "examples/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
|
66
|
+
s.files = s.files + Dir.glob( "lib/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
|
67
|
+
s.files = s.files + Dir.glob( "test/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
|
68
|
+
end
|
69
|
+
Rake::GemPackageTask.new(spec) do |p|
|
70
|
+
p.gem_spec = spec
|
71
|
+
p.need_tar = true
|
72
|
+
p.need_zip = true
|
73
|
+
end
|
74
|
+
|
75
|
+
|
76
|
+
def each_source_file(*args)
|
77
|
+
prefix, includes, excludes, open_file = args
|
78
|
+
prefix ||= File.dirname(__FILE__)
|
79
|
+
open_file = true if open_file.nil?
|
80
|
+
includes ||= %w[lib\/cheri\.rb$ lib\/cheri\/.*\.rb$]
|
81
|
+
Find.find(prefix) do |file_name|
|
82
|
+
next if file_name =~ /\.svn/
|
83
|
+
file_name.gsub!(/^\.\//, '')
|
84
|
+
continue = false
|
85
|
+
includes.each do |inc|
|
86
|
+
if file_name.match(/#{inc}/)
|
87
|
+
continue = true
|
88
|
+
break
|
89
|
+
end
|
90
|
+
end
|
91
|
+
next unless continue
|
92
|
+
if open_file
|
93
|
+
File.open(file_name) do |f|
|
94
|
+
yield file_name, f
|
95
|
+
end
|
96
|
+
else
|
97
|
+
yield file_name
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
desc "Count lines of the Cheri source code"
|
103
|
+
task :lines do
|
104
|
+
total_lines = total_loc = 0
|
105
|
+
puts "Per File:"
|
106
|
+
each_source_file do |file_name, f|
|
107
|
+
file_lines = file_loc = 0
|
108
|
+
while line = f.gets
|
109
|
+
file_lines += 1
|
110
|
+
next if line =~ /^\s*$/
|
111
|
+
next if line =~ /^\s*#/
|
112
|
+
file_loc += 1
|
113
|
+
end
|
114
|
+
puts " #{file_name}: Lines #{file_lines}, LOC #{file_loc}"
|
115
|
+
total_lines += file_lines
|
116
|
+
total_loc += file_loc
|
117
|
+
end
|
118
|
+
puts "Total:"
|
119
|
+
puts " Lines #{total_lines}, LOC #{total_loc}"
|
120
|
+
end
|
121
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'cheri/swing'
|
3
|
+
|
4
|
+
include Cheri::Swing
|
5
|
+
|
6
|
+
frame = swing {
|
7
|
+
|
8
|
+
frame('Hello World Demo 1') { |obj| size 320, 240
|
9
|
+
box_layout obj,:Y_AXIS
|
10
|
+
content_pane { background :RED }
|
11
|
+
on_window_closing { frame.dispose }
|
12
|
+
menu_bar {
|
13
|
+
menu('File') { mnemonic :VK_F; background :WHITE
|
14
|
+
menu_item('Exit') { mnemonic :VK_X; background :WHITE
|
15
|
+
on_click { frame.dispose }
|
16
|
+
}
|
17
|
+
}
|
18
|
+
}
|
19
|
+
y_glue
|
20
|
+
x_panel { background :WHITE
|
21
|
+
label('Hello, World!') { foreground :BLUE }
|
22
|
+
}
|
23
|
+
y_glue
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
frame.show
|
28
|
+
|
data/examples/table_1.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'cheri/swing'
|
3
|
+
|
4
|
+
include Cheri::Swing
|
5
|
+
|
6
|
+
frame = swing {
|
7
|
+
|
8
|
+
bgcolor = color(240,238,220)
|
9
|
+
|
10
|
+
column_headings = ['SKU','Product Name','Quantity','Unit Price','Total Price'].to_java
|
11
|
+
data = [
|
12
|
+
['123-456-789','Foo',3,2.75,3*2.75],
|
13
|
+
['123-456-790','Foo Plus',5,3.75,5*3.75],
|
14
|
+
['555-867-5309','Super Foo',2,9.27,2*9.27],
|
15
|
+
['987-654-321','Foo for Bars',4,7.99,4*7.99]
|
16
|
+
].to_java
|
17
|
+
|
18
|
+
frame('Table Demo 1') { |frm| size 500, 375
|
19
|
+
content_pane { background bgcolor; box_layout frm, :Y_AXIS
|
20
|
+
bevel_border :RAISED }
|
21
|
+
on_window_closing { frame.dispose }
|
22
|
+
menu_bar { background bgcolor
|
23
|
+
menu("File") { mnemonic :VK_F; background :WHITE
|
24
|
+
menu_item("Exit") { mnemonic :VK_X; background :WHITE
|
25
|
+
on_click { frame.dispose }
|
26
|
+
}
|
27
|
+
} }
|
28
|
+
y_panel { background bgcolor
|
29
|
+
compound_border(titled_border('Current Order Items') {
|
30
|
+
etched_border :LOWERED }, empty_border( 7,7,7,7) )
|
31
|
+
scroll_pane(
|
32
|
+
@my_table = table(data,column_headings) {
|
33
|
+
get_table_header {
|
34
|
+
background :BLUE; foreground :WHITE;
|
35
|
+
font('Dialog',:BOLD,12)
|
36
|
+
}
|
37
|
+
}) {
|
38
|
+
get_viewport { background :WHITE }
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
frame.show
|
data/lib/cheri/awt.rb
ADDED
@@ -0,0 +1,41 @@
|
|
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
|
+
|
28
|
+
require 'cheri/java/builder'
|
29
|
+
require 'cheri/builder/awt/types'
|
30
|
+
require 'cheri/builder/awt/connecter'
|
31
|
+
require 'cheri/builder/awt/constants'
|
32
|
+
require 'cheri/builder/awt/main'
|
33
|
+
|
34
|
+
else
|
35
|
+
STDERR.puts %{
|
36
|
+
Cheri::AWT requires JRuby (1.0.0RC3 or later)
|
37
|
+
Download the latest version of JRuby at:
|
38
|
+
http://www.jruby.org/
|
39
|
+
}
|
40
|
+
|
41
|
+
end
|
@@ -0,0 +1,31 @@
|
|
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
|
+
require 'cheri/cheri'
|
26
|
+
require 'cheri/builder/base'
|
27
|
+
require 'cheri/builder/config'
|
28
|
+
require 'cheri/builder/connecter'
|
29
|
+
require 'cheri/builder/context'
|
30
|
+
require 'cheri/builder/generator'
|
31
|
+
require 'cheri/builder/main'
|
@@ -0,0 +1,63 @@
|
|
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 AWT
|
27
|
+
|
28
|
+
AWTConnecter = Cheri::Builder::TypeConnecter.new(Cheri::Java::Builder::DefaultConnecter) do
|
29
|
+
|
30
|
+
type java.awt.Component do
|
31
|
+
connect java.awt.Font, :setFont
|
32
|
+
end
|
33
|
+
|
34
|
+
type java.awt.Container do
|
35
|
+
connect java.awt.LayoutManager, :setLayout
|
36
|
+
|
37
|
+
connect java.awt.Component do |par,obj,sym,props|
|
38
|
+
if props
|
39
|
+
cs = props[:constraints]
|
40
|
+
ix = props[:index]
|
41
|
+
n = props[:name]
|
42
|
+
if cs && Fixnum === ix
|
43
|
+
par.add(obj,cs,ix)
|
44
|
+
elsif cs
|
45
|
+
par.add(obj,cs)
|
46
|
+
elsif Fixnum === ix
|
47
|
+
par.add(obj,ix)
|
48
|
+
elsif String === n
|
49
|
+
par.add(n,obj)
|
50
|
+
else
|
51
|
+
par.add(obj)
|
52
|
+
end
|
53
|
+
else
|
54
|
+
par.add(obj)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
end #java.awt.Container
|
59
|
+
|
60
|
+
end #AWTConnecter
|
61
|
+
|
62
|
+
end #AWT
|
63
|
+
end #Cheri
|