Permalink
Browse files

Many Changes

 * Refactor classes to match The Manual / Classes
 * Add Shoes::Button for SWT::Widgets::Buttons
  • Loading branch information...
pfitzgibbons
pfitzgibbons committed Jan 3, 2012
1 parent ea9a7bd commit 5f98b47ef01ab116d5613fa200a115e451e5e7ea
Showing with 1,023 additions and 192 deletions.
  1. +1 −0 .rspec
  2. +1 −1 .rvmrc
  3. +13 −0 Gemfile
  4. +33 −0 Gemfile.lock
  5. +29 −28 Rakefile
  6. +3 −1 lib/shoes.rb
  7. +7 −0 lib/shoes/animation.rb
  8. +6 −1 lib/shoes/app.rb
  9. +72 −0 lib/shoes/archive/elements/check.html
  10. +1 −1 lib/shoes/{ → archive}/elements/check.rb
  11. +86 −0 lib/shoes/archive/elements/edit_box.html
  12. +1 −1 lib/shoes/{ → archive}/elements/edit_box.rb
  13. +73 −0 lib/shoes/archive/elements/edit_line.html
  14. +1 −1 lib/shoes/{ → archive}/elements/edit_line.rb
  15. +255 −0 lib/shoes/archive/elements/element.html
  16. +1 −1 lib/shoes/{ → archive}/elements/element.rb
  17. +63 −0 lib/shoes/archive/elements/image.html
  18. +1 −1 lib/shoes/{ → archive}/elements/image.rb
  19. +66 −0 lib/shoes/archive/elements/stack.html
  20. +1 −1 lib/shoes/{ → archive}/elements/stack.rb
  21. +9 −7 lib/shoes/button.rb
  22. +0 −13 lib/shoes/composite.rb
  23. +0 −13 lib/shoes/composites.rb
  24. +0 −6 lib/shoes/element.rb
  25. +6 −0 lib/shoes/element_methods.rb
  26. +0 −20 lib/shoes/elements/flow.rb
  27. +26 −8 lib/shoes/flow.rb
  28. +21 −9 lib/shoes/{elements.rb → layout.rb}
  29. +70 −0 lib/shoes/native.rb
  30. +11 −6 lib/shoes/swt_constants.rb
  31. +5 −0 lib/shoes/timer_base.rb
  32. +5 −5 lib/shoes/window.rb
  33. +1 −1 req/hpricot/lib/hpricot.rb
  34. +13 −0 samples/simple-displace.rb
  35. +13 −0 samples/simple-move.rb
  36. 0 shooes → shoooes
  37. 0 shooesd → shoooesd
  38. 0 spec/{shoes → }/check_spec.rb
  39. +4 −4 spec/mock_helpers.rb
  40. +22 −0 spec/shoes/animation_spec.rb
  41. +9 −0 spec/shoes/button_spec.rb
  42. +0 −60 spec/shoes/element_methods_spec.rb
  43. +33 −0 spec/shoes/flow_spec.rb
  44. +5 −0 spec/shoes/native_spec.rb
  45. +15 −0 spec/shoes/swt_constants_spec.rb
  46. +37 −0 spec/support/shared_examples_for_common_elements_spec.rb
  47. +4 −3 testing/testing.rb
1 .rspec
@@ -1,2 +1,3 @@
-c
-f d
-d
2 .rvmrc
@@ -1 +1 @@
rvm use jruby@shoes
rvm --create use jruby-1.6.5@shoes
13 Gemfile
@@ -4,7 +4,20 @@ gem 'facets'
gem 'log4jruby'
group :development do
gem "ruby-debug"
gem "guard"
gem "spork"
gem 'yard'
## Dependencies for Rocco.
## Really... All Three Markdown gems?!
# A Jruby compatible gem for 'pygmentize'
gem "albino"
#gem "bluecloth"
gem "redcarpet"
#gem "rdiscount"
gem "rocco"
end
group :test do
@@ -1,7 +1,10 @@
GEM
remote: http://rubygems.org/
specs:
albino (1.3.3)
posix-spawn (>= 0.3.6)
builder (3.0.0)
columnize (0.3.6)
cucumber (1.1.0)
builder (>= 2.1.2)
diff-lcs (>= 1.1.2)
@@ -10,23 +13,37 @@ GEM
term-ansicolor (>= 1.0.6)
diff-lcs (1.1.3)
facets (2.9.2)
ffi (1.0.11)
ffi (1.0.11-java)
gherkin (2.5.1)
json (>= 1.4.6)
gherkin (2.5.1-java)
json (>= 1.4.6)
guard (0.9.4)
ffi (>= 0.5.0)
thor (~> 0.14.6)
json (1.6.1)
json (1.6.1-java)
linecache (0.46)
rbx-require-relative (> 0.0.4)
log4jruby (0.4.0)
mechanize (2.0.1)
net-http-digest_auth (~> 1.1, >= 1.1.1)
net-http-persistent (~> 1.8)
nokogiri (~> 1.4)
webrobots (~> 0.0, >= 0.0.9)
mustache (0.99.4)
net-http-digest_auth (1.1.1)
net-http-persistent (1.9)
nokogiri (1.5.0)
nokogiri (1.5.0-java)
posix-spawn (0.3.6)
rake (0.9.2)
rbx-require-relative (0.0.5)
redcarpet (2.0.1)
rocco (0.8)
mustache
redcarpet
rspec (2.6.0)
rspec-core (~> 2.6.0)
rspec-expectations (~> 2.6.0)
@@ -35,26 +52,42 @@ GEM
rspec-expectations (2.6.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.6.0)
ruby-debug (0.10.4)
columnize (>= 0.1)
ruby-debug-base (~> 0.10.4.0)
ruby-debug-base (0.10.4)
linecache (>= 0.3)
ruby-debug-base (0.10.4-java)
shoes-cucumber (0.0.2)
cucumber
rspec
shoes-mocks
shoes-mocks (0.0.2)
rspec
spork (0.8.5)
term-ansicolor (1.0.6)
thor (0.14.6)
webrobots (0.0.11)
nokogiri (>= 1.4.4)
yard (0.7.4)
PLATFORMS
java
ruby
DEPENDENCIES
albino
cucumber
facets
gherkin
guard
log4jruby
mechanize
rake
redcarpet
rocco
rspec
ruby-debug
shoes-cucumber
spork
yard
@@ -504,24 +504,24 @@ require 'rake'
#end
#
#=======
begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "shoes"
gem.summary = %Q{JRuby implementation of shoes}
gem.description = %Q{JRuby implementation of shoes}
gem.email = "stwerner@vt.edu"
gem.homepage = "http://github.com/scottw/shoes"
gem.authors = ["Scott Werner"]
gem.add_development_dependency "rspec", ">= 1.2.9"
gem.files.include('lib/**/*.rb')
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
end
Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
end
#
#begin
# require 'jeweler'
# Jeweler::Tasks.new do |gem|
# gem.name = "shoes"
# gem.summary = %Q{JRuby implementation of shoes}
# gem.description = %Q{JRuby implementation of shoes}
# gem.email = "stwerner@vt.edu"
# gem.homepage = "http://github.com/scottw/shoes"
# gem.authors = ["Scott Werner"]
# gem.add_development_dependency "rspec", ">= 1.2.9"
# gem.files.include('lib/**/*.rb')
# # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
# end
# Jeweler::GemcutterTasks.new
#rescue LoadError
# puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
#end
require 'spec/rake/spectask'
Spec::Rake::SpecTask.new(:spec) do |spec|
@@ -539,13 +539,14 @@ task :spec => :check_dependencies
task :default => :spec
require 'rake/rdoctask'
Rake::RDocTask.new do |rdoc|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
rdoc.rdoc_dir = 'rdoc'
rdoc.title = "shoes #{version}"
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end
>>>>>>> brown/master
#
#require 'rake/rdoctask'
#Rake::RDocTask.new do |rdoc|
# version = File.exist?('VERSION') ? File.read('VERSION') : ""
#
# rdoc.rdoc_dir = 'rdoc'
# rdoc.title = "shoes #{version}"
# rdoc.rdoc_files.include('README*')
# rdoc.rdoc_files.include('lib/**/*.rb')
#end
#>>>>>>> brown/master
@@ -15,10 +15,12 @@
require 'shoes/swt_constants'
require 'shoes/app'
require 'shoes/elements'
require 'shoes/element_methods'
require 'shoes/layout'
require 'shoes/window'
require 'shoes/flow'
require 'shoes/button'
require 'shoes/animation'
#require 'shoes/elements/element'
#require 'shoes/elements/button'
@@ -0,0 +1,7 @@
require 'shoes/timer_base'
module Shoes
class Animation < TimerBase
# To change this template use File | Settings | File Templates.
end
end
@@ -1,15 +1,20 @@
module Shoes
# Shoes::App.new creates a new Shoes application window!
# The default window is a [flow]
#
class App
include SwtConstants
include Log4jruby::LoggerForClass
attr_accessor :elements, :frame
attr_accessor :main_shell
def initialize(opts={}, &blk)
@elements = {}
$main_display = SwtDisplay.getDefault
$main_display = SWT::Widgets::Display.getDefault
window_opts = opts.merge(:on_close => main_window_on_close, :elements => @elements)
@main_window = Window.new(window_opts) do
@@ -0,0 +1,72 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>check.rb</title>
<link rel="stylesheet" href="http://jashkenas.github.com/docco/resources/docco.css">
</head>
<body>
<div id='container'>
<div id="background"></div>
<div id="jump_to">
Jump To &hellip;
<div id="jump_wrapper">
<div id="jump_page">
<a class="source" href="check.html">check.rb</a>
<a class="source" href="edit_box.html">edit_box.rb</a>
<a class="source" href="edit_line.html">edit_line.rb</a>
<a class="source" href="element.html">element.rb</a>
<a class="source" href="flow.html">flow.rb</a>
<a class="source" href="image.html">image.rb</a>
<a class="source" href="stack.html">stack.rb</a>
</div>
</div>
</div>
<table cellspacing=0 cellpadding=0>
<thead>
<tr>
<th class=docs><h1>check.rb</h1></th>
<th class=code></th>
</tr>
</thead>
<tbody>
<tr id='section-1'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-1">&#182;</a>
</div>
</td>
<td class=code>
<div class='highlight'><pre><span class="k">module</span> <span class="nn">Shoes</span>
<span class="k">class</span> <span class="nc">Check</span> <span class="o">&lt;</span> <span class="no">Element</span>
<span class="kp">attr_accessor</span> <span class="ss">:check</span>
<span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">parent</span><span class="p">,</span> <span class="n">opts</span><span class="o">=</span><span class="p">{},</span> <span class="o">&amp;</span><span class="n">blk</span><span class="p">)</span>
<span class="k">super</span><span class="p">(</span><span class="n">opts</span><span class="p">)</span>
<span class="vi">@check</span> <span class="o">=</span> <span class="n">javax</span><span class="o">.</span><span class="n">swing</span><span class="o">.</span><span class="n">JCheckBox</span><span class="o">.</span><span class="n">new</span><span class="p">()</span>
<span class="vi">@check</span><span class="o">.</span><span class="n">add_item_listener</span><span class="p">(</span><span class="o">&amp;</span><span class="n">blk</span><span class="p">)</span> <span class="k">unless</span> <span class="n">blk</span><span class="o">.</span><span class="n">nil?</span>
<span class="n">parent</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="vi">@check</span><span class="p">)</span>
<span class="k">return</span> <span class="vi">@check</span>
<span class="k">end</span>
<span class="k">def</span> <span class="nf">checked?</span>
<span class="vi">@check</span><span class="o">.</span><span class="n">isSelected</span><span class="p">()</span>
<span class="k">end</span>
<span class="k">def</span> <span class="nf">checked</span><span class="o">=</span><span class="p">(</span><span class="n">selected</span><span class="p">)</span>
<span class="vi">@check</span><span class="o">.</span><span class="n">setSelected</span><span class="p">(</span><span class="n">selected</span><span class="p">)</span>
<span class="k">end</span>
<span class="k">def</span> <span class="nf">to_java</span>
<span class="vi">@check</span><span class="o">.</span><span class="n">to_java</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="k">end</span></pre></div>
</td>
</tr>
</table>
</div>
</body>
@@ -1,5 +1,5 @@
module Shoes
class Check < Element
class Check < Native
attr_accessor :check
def initialize(parent, opts={}, &blk)
@@ -0,0 +1,86 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>edit_box.rb</title>
<link rel="stylesheet" href="http://jashkenas.github.com/docco/resources/docco.css">
</head>
<body>
<div id='container'>
<div id="background"></div>
<div id="jump_to">
Jump To &hellip;
<div id="jump_wrapper">
<div id="jump_page">
<a class="source" href="check.html">check.rb</a>
<a class="source" href="edit_box.html">edit_box.rb</a>
<a class="source" href="edit_line.html">edit_line.rb</a>
<a class="source" href="element.html">element.rb</a>
<a class="source" href="flow.html">flow.rb</a>
<a class="source" href="image.html">image.rb</a>
<a class="source" href="stack.html">stack.rb</a>
</div>
</div>
</div>
<table cellspacing=0 cellpadding=0>
<thead>
<tr>
<th class=docs><h1>edit_box.rb</h1></th>
<th class=code></th>
</tr>
</thead>
<tbody>
<tr id='section-1'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-1">&#182;</a>
</div>
</td>
<td class=code>
<div class='highlight'><pre><span class="k">module</span> <span class="nn">Shoes</span>
<span class="k">class</span> <span class="nc">Edit_box</span> <span class="o">&lt;</span> <span class="no">Element</span>
<span class="n">java_import</span> <span class="s1">&#39;javax.swing.JTextArea&#39;</span>
<span class="n">java_import</span> <span class="s1">&#39;javax.swing.JScrollPane&#39;</span>
<span class="kp">attr_accessor</span> <span class="ss">:scrollpane</span>
<span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">parent</span><span class="p">,</span> <span class="n">opts</span><span class="o">=</span><span class="p">{})</span>
<span class="k">super</span><span class="p">(</span><span class="n">opts</span><span class="p">)</span>
<span class="n">opts</span><span class="o">[</span><span class="ss">:width</span><span class="o">]</span> <span class="o">||=</span> <span class="mi">40</span>
<span class="n">opts</span><span class="o">[</span><span class="ss">:height</span><span class="o">]</span> <span class="o">||=</span> <span class="mi">40</span>
<span class="vi">@bottom</span> <span class="o">=</span> <span class="n">opts</span><span class="o">[</span><span class="ss">:bottom</span><span class="o">]</span>
<span class="vi">@editbox</span> <span class="o">=</span> <span class="no">JTextArea</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">opts</span><span class="o">[</span><span class="ss">:height</span><span class="o">]</span><span class="p">,</span> <span class="n">opts</span><span class="o">[</span><span class="ss">:width</span><span class="o">]</span><span class="p">)</span>
<span class="k">if</span><span class="p">(</span><span class="n">opts</span><span class="o">[</span><span class="ss">:scroll</span><span class="o">]</span><span class="p">)</span>
<span class="vi">@scrollpane</span> <span class="o">=</span> <span class="no">JScrollPane</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="vi">@editbox</span><span class="p">,</span> <span class="no">JScrollPane</span><span class="o">::</span><span class="no">VERTICAL_SCROLLBAR_ALWAYS</span><span class="p">,</span> <span class="no">JScrollPane</span><span class="o">::</span><span class="no">HORIZONTAL_SCROLLBAR_NEVER</span><span class="p">)</span>
<span class="n">parent</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="vi">@scrollpane</span><span class="p">)</span>
<span class="k">else</span>
<span class="n">parent</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="vi">@editbox</span><span class="p">)</span>
<span class="k">end</span>
<span class="k">return</span> <span class="vi">@editbox</span>
<span class="k">end</span>
<span class="k">def</span> <span class="nf">to_java</span>
<span class="vi">@editbox</span><span class="o">.</span><span class="n">to_java</span>
<span class="k">end</span>
<span class="k">def</span> <span class="nf">append</span><span class="p">(</span><span class="n">text</span><span class="p">)</span>
<span class="k">if</span><span class="p">(</span><span class="vi">@bottom</span><span class="p">)</span>
<span class="vi">@editbox</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">text</span><span class="o">.</span><span class="n">to_s</span><span class="p">)</span>
<span class="n">position</span> <span class="o">=</span> <span class="vi">@editbox</span><span class="o">.</span><span class="n">getDocument</span><span class="o">.</span><span class="n">getLength</span><span class="p">()</span>
<span class="k">if</span> <span class="vi">@editbox</span><span class="o">.</span><span class="n">modelToView</span><span class="p">(</span><span class="n">position</span><span class="p">)</span>
<span class="vi">@editbox</span><span class="o">.</span><span class="n">scrollRectToVisible</span><span class="p">(</span><span class="n">java</span><span class="o">.</span><span class="n">awt</span><span class="o">.</span><span class="n">Rectangle</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="vi">@editbox</span><span class="o">.</span><span class="n">modelToView</span><span class="p">(</span><span class="n">position</span><span class="p">)))</span>
<span class="k">end</span>
<span class="k">else</span>
<span class="vi">@editbox</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">text</span><span class="o">.</span><span class="n">to_s</span><span class="p">)</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="k">end</span></pre></div>
</td>
</tr>
</table>
</div>
</body>
Oops, something went wrong.

0 comments on commit 5f98b47

Please sign in to comment.