jrubyconf-button 1-java → 2-java

Sign up to get free protection for your applications and to get access to all the features.
data/bin/jrubyconf-button CHANGED
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env jruby -J-d32 -J-client -J-Dfile.encoding=UTF8 -J-Xmx320m -J-Xss1024k -J-Djruby.memory.max=320m -J-Djruby.stack.max=1024k
1
2
 
2
3
  require 'java'
3
4
  require 'rubygems'
@@ -6,13 +7,15 @@ require 'swt'
6
7
  class ButtonApp
7
8
  attr_reader :shell
8
9
 
10
+ LABELS = ["Drink Me", "Eat Me"]
11
+
9
12
  def initialize
10
13
  display = Swt::Widgets::Display.get_current
11
14
  @shell = Swt::Widgets::Shell.new
12
15
  @shell.setLayout(Swt::Layout::FillLayout.new)
13
16
  button = Swt::Widgets::Button.new(@shell, Swt::SWT::PUSH)
14
- button.set_text("Click Me")
15
- button.add_selection_listener { puts "Clicked!" }
17
+ button.set_text(LABELS[0])
18
+ button.add_selection_listener { button.text = LABELS[(LABELS.index(button.text) - 1).abs] }
16
19
  @shell.pack
17
20
  @shell.open
18
21
  end
@@ -21,4 +24,3 @@ end
21
24
  app = ButtonApp.new
22
25
 
23
26
  Swt.event_loop { app.shell.disposed? }
24
-
@@ -1,4 +1,10 @@
1
1
  Feature: The button
2
2
 
3
3
  Scenario: Button exists
4
- Then the button should show the text "Click Me"
4
+ Then the button should show the text "Drink Me"
5
+
6
+ Scenario: Button changes text
7
+ When I press the button
8
+ Then the button should show the text "Eat Me"
9
+ When I press the button
10
+ Then the button should show the text "Drink Me"
@@ -1,12 +1,8 @@
1
- def shell
2
- display = Swt::Widgets::Display.get_current
3
- shell = display.get_shells.to_a.first
4
- end
5
1
 
6
- def button
7
- shell.children.to_a.first
2
+ Then /^the button should show the text "([^"]*)"$/ do |arg1|
3
+ Swt.bot.button.text.should == arg1
8
4
  end
9
5
 
10
- Then /^the button should show the text "([^"]*)"$/ do |arg1|
11
- button.text.should == arg1
6
+ When /^I press the button$/ do
7
+ Swt.bot.button.click
12
8
  end
@@ -1,5 +1,9 @@
1
1
  $:.unshift(File.expand_path("../../../bin", __FILE__))
2
2
 
3
+ Dir["vendor/*.jar"].each do |fn|
4
+ require fn unless fn =~ /source/
5
+ end
6
+
3
7
  Swt.sync_exec do
4
8
  load 'jrubyconf-button'
5
- end
9
+ end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: jrubyconf-button
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: "1"
5
+ version: "2"
6
6
  platform: java
7
7
  authors:
8
8
  - Daniel Lucraft
@@ -10,10 +10,20 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-08-03 00:00:00 -04:00
13
+ date: 2011-08-04 00:00:00 -04:00
14
14
  default_executable:
15
- dependencies: []
16
-
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: swt
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: "0.7"
25
+ type: :runtime
26
+ version_requirements: *id001
17
27
  description: A JRubyConf button!
18
28
  email:
19
29
  - dan@fluentradical.com