Neurogami-jimpanzee 1.0.3.2 → 1.0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +1 -1
- data/Jimpanzee.gemspec +0 -0
- data/Manifest.txt +21 -21
- data/README.md +3 -3
- data/Rakefile +8 -8
- data/bin/jimpanzee +6 -6
- data/lib/jimpanzee.rb +7 -0
- data/lib/{monkeybars → jimpanzee}/controller.rb +21 -20
- data/lib/{monkeybars → jimpanzee}/debug.rb +4 -4
- data/lib/{monkeybars → jimpanzee}/event_handler.rb +12 -12
- data/lib/{monkeybars → jimpanzee}/event_handler_registration_and_dispatch_mixin.rb +11 -11
- data/lib/{monkeybars → jimpanzee}/exceptions.rb +1 -1
- data/lib/{monkeybars → jimpanzee}/global_error_handler.rb +0 -0
- data/lib/{monkeybars → jimpanzee}/inflector.rb +3 -3
- data/lib/{monkeybars → jimpanzee}/key.rb +1 -1
- data/lib/{monkeybars → jimpanzee}/task_processor.rb +1 -1
- data/lib/{monkeybars → jimpanzee}/validated_hash.rb +0 -0
- data/lib/{monkeybars → jimpanzee}/view.rb +22 -23
- data/lib/{monkeybars → jimpanzee}/view_mapping.rb +4 -4
- data/lib/{monkeybars → jimpanzee}/view_nesting.rb +2 -2
- data/lib/{monkeybars → jimpanzee}/view_positioning.rb +1 -1
- data/lib/jimpanzee_version.rb +1 -1
- data/skeleton/lib/java/jimpanzee-1.0.3.4.jar +0 -0
- data/skeleton/src/application_controller.rb +1 -1
- data/skeleton/src/application_view.rb +1 -1
- data/skeleton/src/manifest.rb +13 -13
- data/skeleton/src/resolver.rb +1 -1
- metadata +19 -19
- data/lib/monkeybars.rb +0 -7
- data/skeleton/lib/java/monkeybars-1.0.3.1.jar +0 -0
data/History.txt
CHANGED
data/Jimpanzee.gemspec
CHANGED
Binary file
|
data/Manifest.txt
CHANGED
@@ -5,24 +5,24 @@ README.md
|
|
5
5
|
Rakefile
|
6
6
|
bin/jimpanzee
|
7
7
|
lib/foxtrot.jar
|
8
|
-
lib/
|
9
|
-
lib/
|
10
|
-
lib/
|
11
|
-
lib/
|
12
|
-
lib/
|
13
|
-
lib/
|
14
|
-
lib/
|
15
|
-
lib/
|
16
|
-
lib/
|
17
|
-
lib/
|
18
|
-
lib/
|
19
|
-
lib/
|
20
|
-
lib/
|
21
|
-
lib/
|
22
|
-
lib/
|
8
|
+
lib/jimpanzee.rb
|
9
|
+
lib/jimpanzee/controller.rb
|
10
|
+
lib/jimpanzee/debug.rb
|
11
|
+
lib/jimpanzee/event_handler.rb
|
12
|
+
lib/jimpanzee/event_handler_registration_and_dispatch_mixin.rb
|
13
|
+
lib/jimpanzee/exceptions.rb
|
14
|
+
lib/jimpanzee/global_error_handler.rb
|
15
|
+
lib/jimpanzee/inflector.rb
|
16
|
+
lib/jimpanzee/key.rb
|
17
|
+
lib/jimpanzee/task_processor.rb
|
18
|
+
lib/jimpanzee/validated_hash.rb
|
19
|
+
lib/jimpanzee/view.rb
|
20
|
+
lib/jimpanzee/view_mapping.rb
|
21
|
+
lib/jimpanzee/view_nesting.rb
|
22
|
+
lib/jimpanzee/view_positioning.rb
|
23
23
|
lib/jimpanzee_version.rb
|
24
24
|
skeleton/Rakefile
|
25
|
-
skeleton/lib/java/
|
25
|
+
skeleton/lib/java/jimpanzee-1.0.3.4.jar
|
26
26
|
skeleton/lib/ruby/README.txt
|
27
27
|
skeleton/src/application_controller.rb
|
28
28
|
skeleton/src/application_view.rb
|
@@ -34,10 +34,10 @@ spec/spec_helper.rb
|
|
34
34
|
spec/unit/component_mixin_spec.rb
|
35
35
|
spec/unit/controller_spec.rb
|
36
36
|
spec/unit/inflector_spec.rb
|
37
|
-
spec/unit/
|
38
|
-
spec/unit/org/
|
39
|
-
spec/unit/org/
|
40
|
-
spec/unit/org/
|
37
|
+
spec/unit/jimpanzee_window_adapter_spec.rb
|
38
|
+
spec/unit/org/jimpanzee/TestView.class
|
39
|
+
spec/unit/org/jimpanzee/TestView.form
|
40
|
+
spec/unit/org/jimpanzee/TestView.java
|
41
41
|
spec/unit/task_processor_spec.rb
|
42
42
|
spec/unit/validated_hash_spec.rb
|
43
43
|
spec/unit/view_map_methods_spec.rb
|
@@ -58,5 +58,5 @@ tasks/svn.rake
|
|
58
58
|
tasks/test.rake
|
59
59
|
lib/util/rspec/application_user.rb
|
60
60
|
lib/util/rspec/user.rb
|
61
|
-
lib/util/rspec/
|
61
|
+
lib/util/rspec/jimpanzee_steps.rb
|
62
62
|
|
data/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
|
1
|
+
Jimpanzee 1.0.3.4
|
2
2
|
|
3
3
|
http://github.com/Neurogami/Jimpanzee/tree/master
|
4
4
|
|
5
5
|
= DESCRIPTION
|
6
6
|
==============
|
7
7
|
|
8
|
-
Jimpanzee is the avant-garde fork of
|
8
|
+
Jimpanzee is the avant-garde fork of Jimpanzee, a library that enables you to interface (via JRuby) with and take advantage of Swing without writing any Java directly. Using any editor you like, you create Java GUI elements and Jimpanzee takes care of registering event listeners, receiving and handling events, updating your view from a model, etc. Jimpanzee makes very few assumptions about your model or the structure of the code in your Java forms so it can be integrated into existing projects with a minimum of hassle.
|
9
9
|
|
10
10
|
= LICENSE
|
11
11
|
==========
|
@@ -16,7 +16,7 @@ Jimpanzee is licensed under the Ruby licence, see COPYING.txt.
|
|
16
16
|
= ATTRIBUTION:
|
17
17
|
============
|
18
18
|
|
19
|
-
|
19
|
+
Jimpanzee is the work of many contributors. See the orignal README.txt for somewhat outdated info.
|
20
20
|
|
21
21
|
Jimpanzee is perpetrated by James Britt
|
22
22
|
|
data/Rakefile
CHANGED
@@ -35,13 +35,13 @@ task :default => 'spec'
|
|
35
35
|
desc "Removes the output directory"
|
36
36
|
task :clean do
|
37
37
|
FileUtils.remove_dir(OUTPUT_DIR) if File.directory? OUTPUT_DIR
|
38
|
-
FileUtils.rm("skeleton/lib/java/
|
38
|
+
FileUtils.rm("skeleton/lib/java/jimpanzee-#{Jimpanzee::VERSION}.jar", :force => true)
|
39
39
|
end
|
40
40
|
|
41
41
|
task :update_version_readme do
|
42
42
|
readme = IO.readlines( 'README.md')
|
43
43
|
File.open( 'README.md', 'w' ) { |f|
|
44
|
-
f << "
|
44
|
+
f << "Jimpanzee #{Jimpanzee::VERSION}\n"
|
45
45
|
readme.shift
|
46
46
|
f << readme
|
47
47
|
}
|
@@ -58,19 +58,19 @@ end
|
|
58
58
|
|
59
59
|
task :gem => [:jar]
|
60
60
|
|
61
|
-
desc "Creates
|
61
|
+
desc "Creates jimpanzee.jar file for distribution"
|
62
62
|
task :jar => [:prepare, :update_version_readme] do
|
63
63
|
Dir.chdir(BUILD_DIR) do
|
64
64
|
$stdout << `jar xvf ../../lib/foxtrot.jar`
|
65
65
|
FileUtils.remove_dir('META-INF', true)
|
66
66
|
end
|
67
|
-
$stdout << `jar cf #{OUTPUT_DIR}/
|
68
|
-
FileUtils.cp("#{OUTPUT_DIR}/
|
67
|
+
$stdout << `jar cf #{OUTPUT_DIR}/jimpanzee-#{Jimpanzee::VERSION}.jar -C lib jimpanzee.rb -C lib jimpanzee -C lib util -C #{BUILD_DIR} .`
|
68
|
+
FileUtils.cp("#{OUTPUT_DIR}/jimpanzee-#{Jimpanzee::VERSION}.jar", "skeleton/lib/java/jimpanzee-#{Jimpanzee::VERSION}.jar")
|
69
69
|
end
|
70
70
|
|
71
71
|
desc "Creates a zip file version of the project, excluding files from exclude.lst. **ONLY WORKS ON OSX/Linux** Yes this sucks, no I don't want to add another dependency at the moment."
|
72
72
|
task :zip do
|
73
|
-
`zip -vr pkg/
|
73
|
+
`zip -vr pkg/jimpanzee-#{Jimpanzee::VERSION}.zip ../jimpanzee -x@exclude.lst`
|
74
74
|
end
|
75
75
|
|
76
76
|
desc "Executes a clean followed by a jar"
|
@@ -78,7 +78,7 @@ task :clean_jar => [:clean, :jar]
|
|
78
78
|
|
79
79
|
#desc "Use this instead of the hoe included install_gem"
|
80
80
|
#task :mb_install_gem => [:jar, :gem] do
|
81
|
-
# $stdout << `gem install -l pkg/
|
81
|
+
# $stdout << `gem install -l pkg/jimpanzee-#{Jimpanzee::VERSION}.gem`
|
82
82
|
#end
|
83
83
|
|
84
84
|
desc "Only used to make RSpec usable with Java Swing code. Wraps up the target of various view tests into a jar that can be require'd and thus loaded on the classpath by JRuby"
|
@@ -93,6 +93,6 @@ task :prepare_spec do
|
|
93
93
|
end
|
94
94
|
|
95
95
|
def create_test_jar_file
|
96
|
-
$stdout << `javac spec/unit/org/
|
96
|
+
$stdout << `javac spec/unit/org/jimpanzee/TestView.java`
|
97
97
|
$stdout << `jar -cf spec/unit/test_files.jar -C spec/unit org`
|
98
98
|
end
|
data/bin/jimpanzee
CHANGED
@@ -8,11 +8,11 @@ def help(message = nil)
|
|
8
8
|
$stdout << message + "\n-----------------------------------\n" unless message.nil?
|
9
9
|
$stdout << <<-ENDL
|
10
10
|
Usage:
|
11
|
-
|
12
|
-
|
11
|
+
jimpanzee -h/--help
|
12
|
+
jimpanzee -v/--version
|
13
13
|
|
14
|
-
|
15
|
-
Creates a new directory (project_name) containing a project skeleton with all files needed to run a
|
14
|
+
jimpanzee project_name
|
15
|
+
Creates a new directory (project_name) containing a project skeleton with all files needed to run a jimpanzee application.
|
16
16
|
ENDL
|
17
17
|
end
|
18
18
|
|
@@ -23,7 +23,7 @@ else
|
|
23
23
|
when "-h" || "--help" || nil
|
24
24
|
help
|
25
25
|
when "-v" || "--version"
|
26
|
-
$stdout << "
|
26
|
+
$stdout << "Jimpanzee version #{Jimpanzee::VERSION}\n"
|
27
27
|
else
|
28
28
|
# create new directory and copy app skeleton over
|
29
29
|
project_name = ARGV[0]
|
@@ -32,7 +32,7 @@ else
|
|
32
32
|
$stdout << "Creating directory #{project_name}\n"
|
33
33
|
FileUtils.mkdir_p(project_name)
|
34
34
|
FileUtils.cd(project_name)
|
35
|
-
$stdout << "Copying
|
35
|
+
$stdout << "Copying jimpanzee project structure\n"
|
36
36
|
FileUtils.cp_r(File.dirname(__FILE__) + "/../skeleton/.", "./")
|
37
37
|
else
|
38
38
|
$stdout << "Directory already exists, aborting\n"
|
data/lib/jimpanzee.rb
ADDED
@@ -1,18 +1,18 @@
|
|
1
1
|
require 'thread'
|
2
2
|
|
3
|
-
require "
|
4
|
-
require "
|
5
|
-
require "
|
6
|
-
require "
|
7
|
-
require "
|
3
|
+
require "jimpanzee/inflector"
|
4
|
+
require "jimpanzee/view"
|
5
|
+
require "jimpanzee/event_handler"
|
6
|
+
require "jimpanzee/task_processor"
|
7
|
+
require "jimpanzee/event_handler_registration_and_dispatch_mixin"
|
8
8
|
|
9
|
-
module
|
9
|
+
module Jimpanzee
|
10
10
|
# Controllers are the traffic cops of your application. They decide how to react to
|
11
11
|
# events, they coordinate interaction with other controllers and they define some of
|
12
12
|
# the overall characteristics of a view such as which events it will generate and how
|
13
13
|
# it should respond to things like the close button being pressed.
|
14
14
|
# For a general introduction to the idea of MVC and the role of a controller,
|
15
|
-
# please see: http://en.wikipedia.org/wiki/Model-view-controller.
|
15
|
+
# please see: http://en.wikipedia.org/wiki/Model-view-controller. Jimpanzee is not,
|
16
16
|
# strictly speaking, an MVC framework. However the general idea of the seperations
|
17
17
|
# of concerns that most people think of when you say 'MVC' is applicable.
|
18
18
|
#
|
@@ -62,12 +62,12 @@ module Monkeybars
|
|
62
62
|
#
|
63
63
|
# Example of a controller, this assumes the existance of a Ruby class named MyModel that
|
64
64
|
# has an attribute named user_name that is mapped to a field on a subclass of
|
65
|
-
#
|
65
|
+
# Jimpanzee::View named MyView that has a button named "ok_button" and a text field called
|
66
66
|
# user_name
|
67
67
|
#
|
68
|
-
# require '
|
68
|
+
# require 'jimpanzee'
|
69
69
|
#
|
70
|
-
# class MyController <
|
70
|
+
# class MyController < Jimpanzee::Controller
|
71
71
|
# set_view :MyView
|
72
72
|
# set_model :MyModel
|
73
73
|
#
|
@@ -128,7 +128,7 @@ module Monkeybars
|
|
128
128
|
|
129
129
|
# See set_view. The declared model class is also auto-required prior to the
|
130
130
|
# class being instantiated. It is not a requirement that you have a model,
|
131
|
-
#
|
131
|
+
# Jimpanzee will operate without one as long as you do not attempt to use
|
132
132
|
# methods that interact with the model.
|
133
133
|
#
|
134
134
|
# The set_model method may be used in 3 different ways.
|
@@ -160,7 +160,7 @@ module Monkeybars
|
|
160
160
|
# class FooModel
|
161
161
|
# attr_accessor :some_value
|
162
162
|
# end
|
163
|
-
# class FooController <
|
163
|
+
# class FooController < Jimpanzee::Controller
|
164
164
|
# set_model "FooModel" do
|
165
165
|
# model.some_value = 5
|
166
166
|
# end
|
@@ -205,7 +205,7 @@ module Monkeybars
|
|
205
205
|
# list, even if open is subsequently called. If you need a window to remain
|
206
206
|
# in the list but not be updated when not visible you can do:
|
207
207
|
#
|
208
|
-
#
|
208
|
+
# Jimpanzee::Controller.active_controllers.values.flatten.each{|c| c.update if c.visible? }
|
209
209
|
def self.active_controllers
|
210
210
|
@@instance_list.clone.freeze
|
211
211
|
end
|
@@ -253,7 +253,7 @@ module Monkeybars
|
|
253
253
|
end
|
254
254
|
|
255
255
|
unless @__view.nil?
|
256
|
-
@__view.close_action(
|
256
|
+
@__view.close_action(Jimpanzee::View::CloseActions::METHOD, JimpanzeeWindowAdapter.new(:"#{window_type}Closing" => self.method(:built_in_close_method)))
|
257
257
|
end
|
258
258
|
|
259
259
|
@closed = true
|
@@ -303,7 +303,7 @@ module Monkeybars
|
|
303
303
|
# @controllers.last.open
|
304
304
|
# end
|
305
305
|
# This forces the view to perform its nesting.
|
306
|
-
# See also
|
306
|
+
# See also Jimpanzee::Controller#remove_nested_controller
|
307
307
|
#
|
308
308
|
def add_nested_controller(name, sub_controller)
|
309
309
|
nested_view = sub_controller.instance_variable_get(:@__view)
|
@@ -320,7 +320,7 @@ module Monkeybars
|
|
320
320
|
# end
|
321
321
|
#
|
322
322
|
# This performs the view's nesting.
|
323
|
-
# See also
|
323
|
+
# See also Jimpanzee::Controller#add_nested_controller
|
324
324
|
#
|
325
325
|
def remove_nested_controller(name, sub_controller)
|
326
326
|
nested_view = sub_controller.instance_variable_get(:@__view)
|
@@ -409,8 +409,9 @@ module Monkeybars
|
|
409
409
|
|
410
410
|
|
411
411
|
def have_focus?
|
412
|
-
|
412
|
+
@__view.have_focus?
|
413
413
|
end
|
414
|
+
|
414
415
|
alias_method :focused?, :have_focus?
|
415
416
|
|
416
417
|
private
|
@@ -431,7 +432,7 @@ module Monkeybars
|
|
431
432
|
# put things like the currently selected item into your model. That data
|
432
433
|
# could instead be passed as a value in the transfer.
|
433
434
|
#
|
434
|
-
# transfer[:selected_framework] = "
|
435
|
+
# transfer[:selected_framework] = "jimpanzee"
|
435
436
|
#
|
436
437
|
# Then in your view, you could use that transfer value to select the correct
|
437
438
|
# value out of a list.
|
@@ -579,14 +580,14 @@ module Monkeybars
|
|
579
580
|
when :close
|
580
581
|
close
|
581
582
|
when :exit
|
582
|
-
|
583
|
+
Jimpanzee::Controller.active_controllers.values.flatten.each {|c| c.close }
|
583
584
|
java.lang.System.exit(0)
|
584
585
|
when :hide
|
585
586
|
hide
|
586
587
|
when :dispose
|
587
588
|
dispose
|
588
589
|
else
|
589
|
-
raise
|
590
|
+
raise Jimpanzee::InvalidCloseAction.new("Invalid close action: #{action}") unless action == :nothing
|
590
591
|
end
|
591
592
|
end
|
592
593
|
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
require "
|
1
|
+
require "jimpanzee/task_processor"
|
2
2
|
|
3
|
-
module
|
3
|
+
module Jimpanzee
|
4
4
|
class Debug
|
5
|
-
extend
|
5
|
+
extend Jimpanzee::TaskProcessor
|
6
6
|
|
7
|
-
# Reads in ARGV, and enables various
|
7
|
+
# Reads in ARGV, and enables various Jimpanzee specific debugging capabilities
|
8
8
|
# TODO: Restore args not used
|
9
9
|
def self.enable_on_debugging_args
|
10
10
|
puts "inspecting args"
|
@@ -1,11 +1,11 @@
|
|
1
|
-
require '
|
1
|
+
require 'jimpanzee/inflector'
|
2
2
|
|
3
3
|
include_class 'javax.swing.SwingUtilities'
|
4
4
|
|
5
|
-
module
|
5
|
+
module Jimpanzee
|
6
6
|
# This class is primarily used internally for setting up a handler for window
|
7
7
|
# close events although any of the WindowAdapter methods can be set. To instantiate
|
8
|
-
# a new
|
8
|
+
# a new JimpanzeeWindowAdapter, pass in a hash of method name symbols and method
|
9
9
|
# objects. The method names must be the various methods from the
|
10
10
|
# java.awt.event.WindowListener interface.
|
11
11
|
#
|
@@ -15,12 +15,12 @@ module Monkeybars
|
|
15
15
|
# puts "the window is closing"
|
16
16
|
# end
|
17
17
|
#
|
18
|
-
# handler =
|
19
|
-
class
|
18
|
+
# handler = JimpanzeeWindowAdapter.new(:windowClosing => method(handle_window_closing))
|
19
|
+
class JimpanzeeWindowAdapter #:nodoc:
|
20
20
|
def initialize(methods)
|
21
21
|
super()
|
22
22
|
raise ArgumentError if methods.empty?
|
23
|
-
methods.each { |method, proc| raise ArgumentError.new("Only window and internalFrame events can be used to create a
|
23
|
+
methods.each { |method, proc| raise ArgumentError.new("Only window and internalFrame events can be used to create a JimpanzeeWindowAdapter") unless (/^(window|internalFrame)/ =~ method.to_s) and (proc.respond_to? :to_proc) }
|
24
24
|
@methods = methods
|
25
25
|
end
|
26
26
|
|
@@ -59,10 +59,10 @@ module Monkeybars
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
-
{"java.awt.event" =>
|
62
|
+
{"java.awt.event" => Jimpanzee::Handlers::AWT_TYPES, "javax.swing.event" => Jimpanzee::Handlers::SWING_TYPES, "java.beans" => Jimpanzee::Handlers::BEAN_TYPES}.each do |java_package, types|
|
63
63
|
types.each do |type|
|
64
64
|
eval <<-ENDL
|
65
|
-
module
|
65
|
+
module Jimpanzee
|
66
66
|
class #{type}Handler
|
67
67
|
def initialize(callback, component_name)
|
68
68
|
@callback = callback
|
@@ -73,7 +73,7 @@ end
|
|
73
73
|
"#{type}"
|
74
74
|
end
|
75
75
|
|
76
|
-
include
|
76
|
+
include Jimpanzee::BaseHandler
|
77
77
|
include #{java_package}.#{type}Listener
|
78
78
|
end
|
79
79
|
end
|
@@ -81,9 +81,9 @@ end
|
|
81
81
|
|
82
82
|
interface = eval "#{java_package}.#{type}Listener"
|
83
83
|
interface.java_class.java_instance_methods.each do |method|
|
84
|
-
|
85
|
-
|
84
|
+
Jimpanzee::Handlers::ALL_EVENT_NAMES << method.name.underscore
|
85
|
+
Jimpanzee::Handlers::EVENT_NAMES_BY_TYPE[type] << method.name.underscore
|
86
86
|
end
|
87
|
-
|
87
|
+
Jimpanzee::Handlers::ALL_EVENT_NAMES.uniq!
|
88
88
|
end
|
89
89
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require '
|
2
|
-
module
|
1
|
+
require 'jimpanzee/exceptions'
|
2
|
+
module Jimpanzee
|
3
3
|
module EventHandlerRegistrationAndDispatchMixin
|
4
4
|
def self.included(target)
|
5
5
|
target.extend ClassMethods
|
@@ -18,7 +18,7 @@ module Monkeybars
|
|
18
18
|
|
19
19
|
# Declares which components you want events to be generated for. add_listener
|
20
20
|
# takes a hash of the form :type => type, :components => [components for events]
|
21
|
-
# All AWT and Swing listener types are supported. See
|
21
|
+
# All AWT and Swing listener types are supported. See Jimpanzee::Handlers for
|
22
22
|
# the full list.
|
23
23
|
#
|
24
24
|
# The array of components should be strings or symbols with the exact naming of the
|
@@ -94,7 +94,7 @@ module Monkeybars
|
|
94
94
|
# this mixin to set up the needed instance variables and both declared
|
95
95
|
# and implicit handlers
|
96
96
|
def setup_implicit_and_explicit_event_handlers # :nodoc:
|
97
|
-
@__event_handler_view_target = if self.class.ancestors.member?(
|
97
|
+
@__event_handler_view_target = if self.class.ancestors.member?(Jimpanzee::Controller)
|
98
98
|
@__view
|
99
99
|
else
|
100
100
|
self
|
@@ -123,13 +123,13 @@ module Monkeybars
|
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
126
|
-
|
127
|
-
(methods.grep(/_/) - (EventHandlerRegistrationAndDispatchMixin.instance_methods +
|
126
|
+
jimpanzee_base_class = self.class.ancestors.find {|klass| /^Jimpanzee::(Controller|View)$/ =~ klass.name }
|
127
|
+
(methods.grep(/_/) - (EventHandlerRegistrationAndDispatchMixin.instance_methods + jimpanzee_base_class.instance_methods)).each {|method| add_implicit_handler_for_method(method) }
|
128
128
|
|
129
129
|
self.class.event_handler_procs.each {|method, proc| add_implicit_handler_for_method(method)}
|
130
130
|
end
|
131
131
|
|
132
|
-
# Instance-level version of
|
132
|
+
# Instance-level version of Jimpanzee::Controller.define_handler. It follows the same
|
133
133
|
# syntax as the class-level version but applies the callback block as a listener to events
|
134
134
|
# generated by this instance of the controller class' view. This callback is
|
135
135
|
# useful when the application has nested controllers and event handling needs to be different
|
@@ -196,7 +196,7 @@ module Monkeybars
|
|
196
196
|
def add_implicit_handler_for_method(method, component_to_alias = nil)
|
197
197
|
component_match = nil
|
198
198
|
|
199
|
-
|
199
|
+
Jimpanzee::Handlers::ALL_EVENT_NAMES.each do |event|
|
200
200
|
component_match = Regexp.new("(.*)_(#{event})").match(method.to_s)
|
201
201
|
break unless component_match.nil?
|
202
202
|
end
|
@@ -211,13 +211,13 @@ module Monkeybars
|
|
211
211
|
component = @__event_handler_view_target.instance_eval(component_to_alias)
|
212
212
|
end
|
213
213
|
rescue NameError => e
|
214
|
-
rescue
|
214
|
+
rescue Jimpanzee::UndefinedComponentError => e
|
215
215
|
# swallow, handler style methods for controls that don't exist is allowed
|
216
216
|
else
|
217
217
|
component.methods.each do |method|
|
218
218
|
listener_match = /add(.*)Listener/.match(method)
|
219
219
|
next if listener_match.nil?
|
220
|
-
if
|
220
|
+
if Jimpanzee::Handlers::EVENT_NAMES_BY_TYPE[listener_match[1]].member? event_name
|
221
221
|
if component_to_alias.nil?
|
222
222
|
add_handler_for listener_match[1], component_name, component
|
223
223
|
else
|
@@ -241,7 +241,7 @@ module Monkeybars
|
|
241
241
|
component_field = component
|
242
242
|
end
|
243
243
|
unless @__registered_handlers[java_component].member? handler_type.underscore
|
244
|
-
handler = "
|
244
|
+
handler = "Jimpanzee::#{handler_type.camelize}Handler".constantize.new(self, component_name.to_s)
|
245
245
|
@__event_handler_view_target.add_handler(handler, component_field)
|
246
246
|
@__registered_handlers[java_component] << handler_type.underscore
|
247
247
|
end
|
File without changes
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# This code is a modified version of the Inflector class
|
2
2
|
# from the Ruby on Rails project (http://www.rubyonrails.com)
|
3
3
|
|
4
|
-
module
|
4
|
+
module Jimpanzee
|
5
5
|
module Inflector
|
6
6
|
# The reverse of +camelize+. Makes an underscored form from the expression in the string.
|
7
7
|
#
|
@@ -54,11 +54,11 @@ module Monkeybars
|
|
54
54
|
end
|
55
55
|
|
56
56
|
class String
|
57
|
-
include
|
57
|
+
include Jimpanzee::Inflector
|
58
58
|
end
|
59
59
|
|
60
60
|
class Symbol
|
61
|
-
include
|
61
|
+
include Jimpanzee::Inflector
|
62
62
|
end
|
63
63
|
|
64
64
|
class Class
|
@@ -1,7 +1,7 @@
|
|
1
1
|
include_class "foxtrot.Worker"
|
2
2
|
include_class "foxtrot.Job"
|
3
3
|
|
4
|
-
module
|
4
|
+
module Jimpanzee
|
5
5
|
# Module that contains methods and classes used to take care of background
|
6
6
|
# task processing. Primarily this is the repaint_while method.
|
7
7
|
module TaskProcessor
|
File without changes
|
@@ -1,16 +1,16 @@
|
|
1
1
|
include_class javax.swing.JComponent
|
2
2
|
include_class javax.swing.KeyStroke
|
3
3
|
|
4
|
-
require '
|
5
|
-
require '
|
6
|
-
require '
|
7
|
-
require '
|
8
|
-
require '
|
9
|
-
require '
|
10
|
-
require '
|
11
|
-
require "
|
12
|
-
|
13
|
-
module
|
4
|
+
require 'jimpanzee/exceptions'
|
5
|
+
require 'jimpanzee/inflector'
|
6
|
+
require 'jimpanzee/validated_hash'
|
7
|
+
require 'jimpanzee/view_mapping'
|
8
|
+
require 'jimpanzee/task_processor'
|
9
|
+
require 'jimpanzee/view_nesting'
|
10
|
+
require 'jimpanzee/view_positioning'
|
11
|
+
require "jimpanzee/event_handler_registration_and_dispatch_mixin"
|
12
|
+
|
13
|
+
module Jimpanzee
|
14
14
|
# The view is the gatekeeper to the actual Java (or sometimes non-Java) view class.
|
15
15
|
# The view defines how data moves into and out of the view via the model.
|
16
16
|
#
|
@@ -28,9 +28,9 @@ module Monkeybars
|
|
28
28
|
#
|
29
29
|
# Example, (assume a JFrame with a label, text area and button):
|
30
30
|
#
|
31
|
-
# require '
|
31
|
+
# require 'jimpanzee'
|
32
32
|
#
|
33
|
-
# class MyView <
|
33
|
+
# class MyView < Jimpanzee::View
|
34
34
|
# set_java_class "com.project.MyCoolJFrame"
|
35
35
|
# map :view => "titleLabel.text", :model => :title_text
|
36
36
|
# map :view => "okButton.text", :model => :button_text
|
@@ -262,8 +262,8 @@ module Monkeybars
|
|
262
262
|
#
|
263
263
|
# nest :sub_view => :user_list, :view => :user_panel
|
264
264
|
#
|
265
|
-
# This essentially calls user_panel.add nested_view_component on
|
266
|
-
# and user_panel.remove nested_view_componenent on
|
265
|
+
# This essentially calls user_panel.add nested_view_component on Jimpanzee::Controller#add_nested_controller
|
266
|
+
# and user_panel.remove nested_view_componenent on Jimpanzee::Controller#remove_nested_controller.
|
267
267
|
# A layout on the container being used is preferred, as no orientational information will be conveyed
|
268
268
|
# to either component.
|
269
269
|
#
|
@@ -285,7 +285,7 @@ module Monkeybars
|
|
285
285
|
# end
|
286
286
|
#
|
287
287
|
# Method nesting calls the methods in :using (in the same way that :using works for mapping) during
|
288
|
-
# add and remove (
|
288
|
+
# add and remove (Jimpanzee::Controller#add_nested_controller and Jimpanzee::Controller#remove_nested_controller).
|
289
289
|
# Both methods are passed in the view, the view's main view component, the mode, and the transfer, respectively.
|
290
290
|
#
|
291
291
|
# New users using Netbeans will need to know that the GroupLayout (aka FreeDesign) is a picky layout that demands
|
@@ -318,10 +318,10 @@ module Monkeybars
|
|
318
318
|
# Defines the close action for a visible window. This method is only applicable
|
319
319
|
# for JFrame or decendants, it is ignored for all other classes.
|
320
320
|
#
|
321
|
-
# close_action expects an action from
|
321
|
+
# close_action expects an action from Jimpanzee::View::CloseActions
|
322
322
|
#
|
323
323
|
# The CloseActions::METHOD action expects a second parameter which should be a
|
324
|
-
#
|
324
|
+
# JimpanzeeWindowAdapter.
|
325
325
|
def close_action(action, handler = nil)
|
326
326
|
if @main_view_component.kind_of?(javax.swing.JFrame) || @main_view_component.kind_of?(javax.swing.JInternalFrame) || @main_view_component.kind_of?(javax.swing.JDialog)
|
327
327
|
if CloseActions::METHOD == action
|
@@ -440,11 +440,10 @@ module Monkeybars
|
|
440
440
|
end
|
441
441
|
|
442
442
|
def have_focus?
|
443
|
-
|
443
|
+
@main_view_component.focus_owner?
|
444
444
|
end
|
445
|
-
alias_method :focused?, :have_focus?
|
446
|
-
|
447
445
|
|
446
|
+
alias_method :focused?, :have_focus?
|
448
447
|
|
449
448
|
def update(model, transfer)
|
450
449
|
self.class.view_mappings.select{|mapping| mapping.maps_to_view?}.each {|mapping| mapping.to_view(self, model, transfer)}
|
@@ -584,11 +583,11 @@ module HandlerContainer
|
|
584
583
|
types.map! { |t| t.camelize }
|
585
584
|
listeners = {}
|
586
585
|
types.each do |type|
|
587
|
-
listener_class = if
|
586
|
+
listener_class = if Jimpanzee::Handlers::AWT_TYPES.member?(type)
|
588
587
|
instance_eval("java.awt.event.#{type}Listener", __FILE__, __LINE__)
|
589
|
-
elsif
|
588
|
+
elsif Jimpanzee::Handlers::SWING_TYPES.member?(type)
|
590
589
|
instance_eval("javax.swing.event.#{type}Listener", __FILE__, __LINE__)
|
591
|
-
elsif
|
590
|
+
elsif Jimpanzee::Handlers::BEAN_TYPES.member?(type)
|
592
591
|
instance_eval("java.beans.#{type}Listener", __FILE__, __LINE__)
|
593
592
|
end
|
594
593
|
listeners[type] = self.get_listeners(listener_class.java_class)
|
@@ -1,7 +1,7 @@
|
|
1
|
-
require '
|
1
|
+
require 'jimpanzee/validated_hash'
|
2
2
|
|
3
|
-
module
|
4
|
-
# This is an internal class used only by
|
3
|
+
module Jimpanzee
|
4
|
+
# This is an internal class used only by Jimpanzee::View
|
5
5
|
#
|
6
6
|
# A Mapping records the relationship between the fields of a model or
|
7
7
|
# transfer hash and the fields of a view. Mappings are created for each call
|
@@ -150,7 +150,7 @@ module Monkeybars
|
|
150
150
|
raise InvalidMappingError, "Either model.#{@model_property} or self.#{@view_property} in #{view.class} is not valid."
|
151
151
|
rescue TypeError => e
|
152
152
|
raise InvalidMappingError, "Invalid types when assigning from model.#{@model_property} to self.#{@view_property}, #{e.message} in #{view.class}"
|
153
|
-
rescue
|
153
|
+
rescue Jimpanzee::UndefinedComponentError
|
154
154
|
raise InvalidMappingError, "The view property #{@view_property} was not found on view #{view.class}"
|
155
155
|
rescue SyntaxError, Exception => e
|
156
156
|
raise InvalidMappingError, "Error while trying to map for #{view.class}: #{to_s}\n#{e.class} - #{e}"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Jimpanzee
|
2
2
|
class Nesting
|
3
3
|
class << self
|
4
4
|
alias_method :__new__, :new
|
@@ -6,7 +6,7 @@ module Monkeybars
|
|
6
6
|
|
7
7
|
def self.new(nesting_options = {})
|
8
8
|
nesting_options.validate_only(:sub_view, :using, :view)
|
9
|
-
nesting_options.extend
|
9
|
+
nesting_options.extend Jimpanzee::HashNestingValidation
|
10
10
|
|
11
11
|
if nesting_options.property_only?
|
12
12
|
PropertyNesting.__new__(nesting_options)
|
data/lib/jimpanzee_version.rb
CHANGED
Binary file
|
data/skeleton/src/manifest.rb
CHANGED
@@ -17,31 +17,31 @@ end
|
|
17
17
|
# like ActiveSupport and Prawn
|
18
18
|
|
19
19
|
#===============================================================================
|
20
|
-
#
|
21
|
-
#
|
20
|
+
# Jimpanzee requires, this pulls in the requisite libraries needed for
|
21
|
+
# Jimpanzee to operate.
|
22
22
|
|
23
23
|
require 'resolver'
|
24
24
|
|
25
25
|
|
26
26
|
# Good for when you replace an old version with a new version.
|
27
27
|
# Not good if you have more than one version in the same directory. :)
|
28
|
-
# But if take care to have only one
|
28
|
+
# But if take care to have only one jimpanzee jar in the folder,
|
29
29
|
# then you don not need to re-edit this file.
|
30
|
-
def
|
31
|
-
Dir.glob(path).select { |f| f =~ /(
|
30
|
+
def jimpanzee_jar path
|
31
|
+
Dir.glob(path).select { |f| f =~ /(jimpanzee-)(.+).jar$/}.first
|
32
32
|
end
|
33
33
|
|
34
|
-
case
|
35
|
-
when
|
34
|
+
case Jimpanzee::Resolver.run_location
|
35
|
+
when Jimpanzee::Resolver::IN_FILE_SYSTEM
|
36
36
|
here = File.expand_path File.dirname(__FILE__)
|
37
|
-
add_to_classpath
|
37
|
+
add_to_classpath jimpanzee_jar( here + '/../lib/java/*.jar' )
|
38
38
|
end
|
39
39
|
|
40
|
-
require '
|
40
|
+
require 'jimpanzee'
|
41
41
|
require 'application_controller'
|
42
42
|
require 'application_view'
|
43
43
|
|
44
|
-
# End of
|
44
|
+
# End of Jimpanzee requires
|
45
45
|
#===============================================================================
|
46
46
|
#
|
47
47
|
# Add your own application-wide libraries below. To include jars, append to
|
@@ -60,9 +60,9 @@ require 'application_view'
|
|
60
60
|
# add_to_load_path "../lib/java"
|
61
61
|
#
|
62
62
|
|
63
|
-
case
|
64
|
-
when
|
63
|
+
case Jimpanzee::Resolver.run_location
|
64
|
+
when Jimpanzee::Resolver::IN_FILE_SYSTEM
|
65
65
|
# Files to be added only when running from the file system go here
|
66
|
-
when
|
66
|
+
when Jimpanzee::Resolver::IN_JAR_FILE
|
67
67
|
# Files to be added only when run from inside a jar file
|
68
68
|
end
|
data/skeleton/src/resolver.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Neurogami-jimpanzee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.3.
|
4
|
+
version: 1.0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Britt
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: 2.5.0
|
24
24
|
version:
|
25
|
-
description: The avant-garde fork of
|
25
|
+
description: The avant-garde fork of Jimpanzee
|
26
26
|
email: james@neurogami.com
|
27
27
|
executables:
|
28
28
|
- jimpanzee
|
@@ -39,22 +39,22 @@ files:
|
|
39
39
|
- README.md
|
40
40
|
- Rakefile
|
41
41
|
- bin/jimpanzee
|
42
|
-
- lib/
|
43
|
-
- lib/
|
42
|
+
- lib/jimpanzee.rb
|
43
|
+
- lib/jimpanzee/controller.rb
|
44
44
|
- lib/jimpanzee_version.rb
|
45
|
-
- lib/
|
46
|
-
- lib/
|
47
|
-
- lib/
|
48
|
-
- lib/
|
49
|
-
- lib/
|
50
|
-
- lib/
|
51
|
-
- lib/
|
52
|
-
- lib/
|
53
|
-
- lib/
|
54
|
-
- lib/
|
55
|
-
- lib/
|
56
|
-
- lib/
|
57
|
-
- lib/
|
45
|
+
- lib/jimpanzee/debug.rb
|
46
|
+
- lib/jimpanzee/event_handler.rb
|
47
|
+
- lib/jimpanzee/event_handler_registration_and_dispatch_mixin.rb
|
48
|
+
- lib/jimpanzee/exceptions.rb
|
49
|
+
- lib/jimpanzee/global_error_handler.rb
|
50
|
+
- lib/jimpanzee/inflector.rb
|
51
|
+
- lib/jimpanzee/key.rb
|
52
|
+
- lib/jimpanzee/task_processor.rb
|
53
|
+
- lib/jimpanzee/validated_hash.rb
|
54
|
+
- lib/jimpanzee/view_mapping.rb
|
55
|
+
- lib/jimpanzee/view_nesting.rb
|
56
|
+
- lib/jimpanzee/view_positioning.rb
|
57
|
+
- lib/jimpanzee/view.rb
|
58
58
|
- skeleton/tasks/jimpanzee.rake
|
59
59
|
- skeleton/src/application_view.rb
|
60
60
|
- skeleton/src/main.rb
|
@@ -62,7 +62,7 @@ files:
|
|
62
62
|
- skeleton/src/resolver.rb
|
63
63
|
- skeleton/src/manifest.rb
|
64
64
|
- skeleton/lib/java/README.txt
|
65
|
-
- skeleton/lib/java/
|
65
|
+
- skeleton/lib/java/jimpanzee-1.0.3.4.jar
|
66
66
|
- skeleton/lib/ruby/README.md
|
67
67
|
- skeleton/lib/ruby/README.txt
|
68
68
|
- skeleton/Rakefile
|
@@ -95,6 +95,6 @@ rubyforge_project: !binary |
|
|
95
95
|
rubygems_version: 1.2.0
|
96
96
|
signing_key:
|
97
97
|
specification_version: 3
|
98
|
-
summary: The avante-garde fork of
|
98
|
+
summary: The avante-garde fork of Jimpanzee
|
99
99
|
test_files: []
|
100
100
|
|
data/lib/monkeybars.rb
DELETED
Binary file
|