Skip to content

Commit 734aa00

Browse files
committed
file chooser using native chooser
1 parent 4471d99 commit 734aa00

File tree

4 files changed

+65
-2
lines changed

4 files changed

+65
-2
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
**v1.1.2** Refactor `runner.rb` to `runner.rb`, `args.rb` and `installer.rb`. The `Installer` classes have the role of installing `jruby-complete`, the examples and providing `setup check` functionality. Refactored and improved default `config.yml` tool, all should make it easier for `collaborators/successors` to follow the code. Refactored `Vec2D` and `Vec3D` `==` and `eql?` methods.
2+
**v1.1.2** Refactor `runner.rb` to `runner.rb`, `args.rb` and `installer.rb`. The `Installer` classes have the role of installing `jruby-complete`, the examples and providing `setup check` functionality. Refactored and improved default `config.yml` tool, all should make it easier for `collaborators/successors` to follow the code. Refactored `Vec2D` and `Vec3D` `==` and `eql?` methods. New `chooser` library makes it possible to use `selectInput` reflection method.
33

44
**v1.1.1** Even more `data_path` fixes in examples, update to jruby-complete-9.1.2.0
55

library/chooser/chooser.rb

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# frozen_string_literal: true
2+
# Usage: :wq
3+
# load_library :chooser
4+
#
5+
# def setup
6+
# java_signature 'void selectInput(String, String)'
7+
# selectInput('Select a file to process:', 'fileSelected')
8+
# end
9+
#
10+
# def fileSelected(selection)
11+
# if selection.nil?
12+
# puts 'Window was closed or the user hit cancel.'
13+
# else
14+
# puts format('User selected %s', selection.get_absolute_path)
15+
# end
16+
# end
17+
class Processing::App
18+
include Java::MonkstoneFilechooser::Chooser
19+
end
+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Copyright (c) 2016 Martin Prout
3+
*
4+
* This library is free software; you can redistribute it and/or
5+
* modify it under the terms of the GNU Lesser General Public
6+
* License as published by the Free Software Foundation; either
7+
* version 2.1 of the License, or (at your option) any later version.
8+
*
9+
* http://creativecommons.org/licenses/LGPL/2.1/
10+
*
11+
* This library is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
* Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public
17+
* License along with this library; if not, write to the Free Software
18+
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19+
*/
20+
package monkstone.filechooser;
21+
22+
import java.io.File;
23+
24+
/**
25+
* This interface makes it easier/possible to use the reflection methods
26+
* selectInput
27+
* def setup
28+
* java_signature 'void selectInput(String, String)'
29+
* selectInput('Select a file to process:', 'fileSelected')
30+
* end
31+
*
32+
* def fileSelected(selection)
33+
* if selection.nil?
34+
* puts 'Window was closed or the user hit cancel.'
35+
* else
36+
* puts format('User selected %s', selection.get_absolute_path)
37+
* end
38+
* end
39+
* @author Martin Prout
40+
*/
41+
public interface Chooser {
42+
43+
public void fileSelected(File selection);
44+
}

src/monkstone/videoevent/VideoInterface.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import processing.video.Capture;
2424
/**
2525
* This interface makes it easier/possible to use the reflection methods
26-
* from Movie and Capture classes in Processing::App in ruby-processing
26+
* from Movie and Capture classes in Processing::App in JRubyArt
2727
* @author Martin Prout
2828
*/
2929
public interface VideoInterface {

0 commit comments

Comments
 (0)