Navigation Menu

Skip to content

Commit

Permalink
Renaming back to JRubyFX
Browse files Browse the repository at this point in the history
  • Loading branch information
byteit101 committed Jan 2, 2013
1 parent 3edbb1a commit e390893
Show file tree
Hide file tree
Showing 26 changed files with 67 additions and 67 deletions.
2 changes: 1 addition & 1 deletion Gemfile
@@ -1,4 +1,4 @@
source 'https://rubygems.org'

# Specify your gem's dependencies in JRubyFXML.gemspec
# Specify your gem's dependencies in JRubyFX.gemspec
gemspec
32 changes: 16 additions & 16 deletions Getting Started.md
@@ -1,27 +1,27 @@
Using JRubyFXML
Using JRubyFX
===============
This guide assumes you have basic knowledge of Ruby, and have JRuby 1.7 or greater and Java 7u6 or greater installed. Java 6 will also work if you are on Windows and download JavaFX runtime separately and put its path in JFX_DIR enviroment variable. At the moment, OpenJDK will unfortunatly not work as it does not have JavaFX.

Installing JRubyFXML
Installing JRubyFX
--------------------
The first thing you need to do is to install the JRubyFXML gem. Currently it is not on any gem sites, so you must do this manually, but don't worry, its easy.
The first thing you need to do is to install the JRubyFX gem. Currently it is not on any gem sites, so you must do this manually, but don't worry, its easy.

The first thing we need to install is rake and bundler:

$ gem install rake bundler

Now we can clone the JRubyFXML sources and install them:
Now we can clone the JRubyFX sources and install them:

$ git clone https://github.com/byteit101/JRubyFXML
$ cd JRubyFXML
$ git clone https://github.com/byteit101/JRubyFX
$ cd JRubyFX
$ rake install

Success! JRubyFXML should be installed now!
Success! JRubyFX should be installed now!

Creating your first JRubyFXML application
Creating your first JRubyFX application
-----------------------------------------
Lets creating a JavaFX app that has the text "Hello World".
Create a new ruby file (this tutorial will call it `hello.rb`). To use JRubyFXML, we must require it in ruby, so add `require 'jrubyfxml'` at the top of the file. Now since JavaFX was originally for Java, we must create a class that inherits from `javafx.application.Application`, however using it raw is no fun, so inherit from the ruby class `FXApplication` to gain ruby's super power.
Create a new ruby file (this tutorial will call it `hello.rb`). To use JRubyFX, we must require it in ruby, so add `require 'jrubyfx'` at the top of the file. Now since JavaFX was originally for Java, we must create a class that inherits from `javafx.application.Application`, however using it raw is no fun, so inherit from the ruby class `FXApplication` to gain ruby's super power.

class HelloWorldApp < FXApplication
end
Expand Down Expand Up @@ -50,7 +50,7 @@ Wait, what? Nothing happened! We never actually launched the app, we only define

Code listing so far:

require 'jrubyfxml'
require 'jrubyfx'

class HelloWorldApp < FXApplication
def start(stage)
Expand All @@ -64,14 +64,14 @@ Code listing so far:
HelloWorldApp.launch

### Adding a bit of text
Cool, we made an empty window, but usually you want something in it. Lets add a label that says "Hello World!". There are three ways to do everything in JRubyFXML: the straight-up Java way, the generic JRubyFXML way, and using a specific DSL (Domain Specific Language). As it sounds like, the Java way is basically copy-paste Java style, and the RubyFXML way is much more elegant, though its good to know both.
Cool, we made an empty window, but usually you want something in it. Lets add a label that says "Hello World!". There are three ways to do everything in JRubyFX: the straight-up Java way, the generic JRubyFX way, and using a specific DSL (Domain Specific Language). As it sounds like, the Java way is basically copy-paste Java style, and the RubyFXML way is much more elegant, though its good to know both.

#### Creating a Label the Java way

label = Label.new()
label.text = "Hello World!"

#### Creating a Label the JRubyFXML way
#### Creating a Label the JRubyFX way

label = build(Label, text: "Hello World!")

Expand All @@ -83,7 +83,7 @@ Whoa! So what does `build` do? Build takes a name of a class (`Label`), creates

For this single contrived example, it makes no sense, but for certain things (like animations and file save dialogs), it can save some serious typing.

#### Creating a Label the JRubyFXML DSL way
#### Creating a Label the JRubyFX DSL way
The DSL is very similar to the `build` way:

label_variable = label(text: "Hello World!")
Expand Down Expand Up @@ -175,7 +175,7 @@ In the Scene Builder, drag a `Button` onto the surface of the designer, and clic

Now, to change the text of the label, we must somehow get access to the label in code. To do this, we must set the `fx:id` property on it (first at the top of the properties pane). Set the `fx:id` value to "helloLabel" and save the FXML file.

**WARNING:** JavaFX has an fx:id property and a normal id property. For JRubyFXML to work, id must not be set (defaults to fx:id), or it must be the same as fx:id.
**WARNING:** JavaFX has an fx:id property and a normal id property. For JRubyFX to work, id must not be set (defaults to fx:id), or it must be the same as fx:id.

### Creating our controller
In the code, we need to create a new class that inherits from FXController
Expand Down Expand Up @@ -249,7 +249,7 @@ Code listing for Hello.fxml:

Code listing for Hello.rb:

require 'jrubyfxml'
require 'jrubyfx'

class HelloWorldApp < FXApplication
def start(stage)
Expand All @@ -271,7 +271,7 @@ Code listing for Hello.rb:

Now what?
---------
Now you know the basics of FXML and JRubyFXML! If you haven't already, I suggest looking over samples/fxml/Demo.rb for a bit more detail. JavaFX help is all around, and most of it is applicable to JRubyFXML.
Now you know the basics of FXML and JRubyFX! If you haven't already, I suggest looking over samples/fxml/Demo.rb for a bit more detail. JavaFX help is all around, and most of it is applicable to JRubyFX.

### Using the generator
Got a large FXML file with dozens of fx:id's and events? Assuming you only have a FXML file:
Expand Down
12 changes: 6 additions & 6 deletions README.md
@@ -1,11 +1,11 @@
JRubyFXML
JRubyFX
=======
JRubyFXML is a pure ruby wrapper for JavaFX 2.x with FXML support (based on JRubyFX)
JRubyFX is a pure ruby wrapper for JavaFX 2.x with FXML support (based on JRubyFX)

Status
------
JRubyFXML should be usable in its current form and able to run FXML apps if used properly (see Issues).
The syntax of the FXML side of JRubyFXML should be fairly stable, but the JavaFX DSL may change.
JRubyFX should be usable in its current form and able to run FXML apps if used properly (see Issues).
The syntax of the FXML side of JRubyFX should be fairly stable, but the JavaFX DSL may change.
At this point in time, no custom ruby controls are supported from FXML, though you
can certainly create them in code.

Expand Down Expand Up @@ -43,7 +43,7 @@ To run sample:
jruby samples/fxml/Demo.rb
```

Or, if you have not installed the gem, or are testing edits to jrubyfxml.rb:
Or, if you have not installed the gem, or are testing edits to jrubyfx.rb:

```text
rake run main_script=samples/fxml/Demo.rb
Expand All @@ -52,7 +52,7 @@ rake run main_script=samples/fxml/Demo.rb
Creating Application and Controller
-----------------------------------

Import jrubyfxml file, and subclass FXApplication and FXController.
Import jrubyfx file, and subclass FXApplication and FXController.
At the bottom of the file, call _yourFXApplicationClass_.launch().
Override start(stage) in the application, and initialize(url, resources) in
the controller. See samples/fxml/Demo.rb for commented example, or see the Getting Started guide
Expand Down
12 changes: 6 additions & 6 deletions Rakefile
@@ -1,5 +1,5 @@
=begin
JRubyFXML - Write JavaFX and FXML in Ruby
JRubyFX - Write JavaFX and FXML in Ruby
Copyright (C) 2012 Patrick Plenefisch
This program is free software: you can redistribute it and/or modify
Expand All @@ -19,7 +19,7 @@ require 'rubygems'
require 'rubygems/installer'
require 'rubygems/package_task'
require 'rdoc/task'
require_relative 'lib/jrubyfxml_tasks'
require_relative 'lib/jrubyfx_tasks'
task :default => [:build, :run]

jar = ENV['jar'] || "jar"
Expand Down Expand Up @@ -49,15 +49,15 @@ task :run do
ruby "-I lib '#{main_script||'samples/fxml/Demo.rb'}'"
end

load 'jrubyfxml.gemspec'
load 'jrubyfx.gemspec'
Gem::PackageTask.new($spec) do |pkg|
pkg.need_zip = false
pkg.need_tar = false
end

desc "Build and install the gem"
task :install => :gem do
Gem::Installer.new("pkg/jrubyfxml-#{JRubyFX::VERSION}-java.gem").install
Gem::Installer.new("pkg/jrubyfx-#{JRubyFX::VERSION}-java.gem").install
end

task :download_jruby_jar do
Expand All @@ -66,7 +66,7 @@ end

desc "Create a full jar with embedded JRuby and given script (via main_script and src ENV var)"
task :jar => [:clean, :download_jruby_jar] do
JRubyFX::Tasks::jarify_jrubyfxml(src, main_script, target, output_jar, jar)
JRubyFX::Tasks::jarify_jrubyfx(src, main_script, target, output_jar, jar)
end

desc "Create a full jar and run it"
Expand All @@ -78,6 +78,6 @@ RDoc::Task.new do |rdoc|
files = ['lib'] # FIXME: readme and markdown
rdoc.rdoc_files.add(files)
rdoc.main = "README.md"
rdoc.title = "JRubyFXML Docs"
rdoc.title = "JRubyFX Docs"
rdoc.rdoc_dir = 'doc/'
end
4 changes: 2 additions & 2 deletions bin/rubyfx-generator
@@ -1,6 +1,6 @@
#!/usr/bin/env jruby
=begin
JRubyFXML - Write JavaFX and FXML in Ruby
JRubyFX - Write JavaFX and FXML in Ruby
Copyright (C) 2012 Patrick Plenefisch
This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -39,7 +39,7 @@ File.open(rb, "w") do |output|
output << <<END
# This file was auto-generated by rubyfx-generator at #{DateTime.now.to_s}
require 'jrubyfxml'
require 'jrubyfx'
class #{name_guess}Application < FXApplication
def start(stage)
Expand Down
6 changes: 3 additions & 3 deletions jrubyfxml.gemspec → jrubyfx.gemspec
Expand Up @@ -4,17 +4,17 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'jrubyfx/version'

$spec = Gem::Specification.new do |s|
s.name = "jrubyfxml"
s.name = "jrubyfx"
s.version = JRubyFX::VERSION
s.platform = 'java'
s.authors = ["Patrick Plenefisch", "Thomas E Enebo", "Hiroshi Nakamura", "Hiro Asari"]
s.email = ["simonpatp@gmail.com", "tom.enebo@gmail.com", "nahi@ruby-lang.org", "asari.ruby@gmail.com"]
s.homepage = "https://github.com/byteit101/JRubyFXML"
s.homepage = "https://github.com/byteit101/JRubyFX"
s.summary = "JavaFX for JRuby with FXML"
s.description = "Enables JavaFX with FXML controllers and application in pure ruby"

s.add_development_dependency "rake" # should I even bother?
s.rubyforge_project = "jrubyfxml"
s.rubyforge_project = "jrubyfx"

s.files = Dir.glob("lib/**/*") + %w(LICENSE README.md)
s.executables = ['rubyfx-generator']
Expand Down
4 changes: 2 additions & 2 deletions lib/jrubyfxml.rb → lib/jrubyfx.rb
@@ -1,5 +1,5 @@
=begin
JRubyFXML - Write JavaFX and FXML in Ruby
JRubyFX - Write JavaFX and FXML in Ruby
Copyright (C) 2013 Patrick Plenefisch
This program is free software: you can redistribute it and/or modify
Expand All @@ -19,7 +19,7 @@
require 'java' # for java_import
require 'jruby/core_ext' # for the become_java!

# JRubyFXML includes
# JRubyFX includes
require_relative 'jrubyfx/jfx_imports'
require_relative 'jrubyfx/fxml_module'
require_relative 'jrubyfx/dsl'
Expand Down
2 changes: 1 addition & 1 deletion lib/jrubyfx/core_ext/observable_value.rb
@@ -1,4 +1,4 @@
require 'jrubyfxml'
require 'jrubyfx'

# JRubyFX DSL extensions for JavaFX ObservableValues
module Java::javafx::beans::value::ObservableValue
Expand Down
4 changes: 2 additions & 2 deletions lib/jrubyfx/dsl.rb
@@ -1,5 +1,5 @@
=begin
JRubyFXML - Write JavaFX and FXML in Ruby
JRubyFX - Write JavaFX and FXML in Ruby
Copyright (C) 2013 Patrick Plenefisch
This program is free software: you can redistribute it and/or modify
Expand All @@ -16,7 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
=end
require 'java'
require 'jrubyfxml'
require 'jrubyfx'

module JRubyFX
# Defines a nice DSL for building JavaFX applications. Include it in a class for
Expand Down
4 changes: 2 additions & 2 deletions lib/jrubyfx/fxml_application.rb
@@ -1,5 +1,5 @@
=begin
JRubyFXML - Write JavaFX and FXML in Ruby
JRubyFX - Write JavaFX and FXML in Ruby
Copyright (C) 2013 Patrick Plenefisch
This program is free software: you can redistribute it and/or modify
Expand All @@ -16,7 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
=end

require 'jrubyfxml'
require 'jrubyfx'

##
# Inherit from this class for FXML Applications. You must use this class for both
Expand Down
4 changes: 2 additions & 2 deletions lib/jrubyfx/fxml_controller.rb
@@ -1,5 +1,5 @@
=begin
JRubyFXML - Write JavaFX and FXML in Ruby
JRubyFX - Write JavaFX and FXML in Ruby
Copyright (C) 2013 Patrick Plenefisch
This program is free software: you can redistribute it and/or modify
Expand All @@ -16,7 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
=end

require 'jrubyfxml'
require 'jrubyfx'

# Inherit from this class for FXML controllers
class FXController
Expand Down
4 changes: 2 additions & 2 deletions lib/jrubyfx/fxml_module.rb
@@ -1,5 +1,5 @@
=begin
JRubyFXML - Write JavaFX and FXML in Ruby
JRubyFX - Write JavaFX and FXML in Ruby
Copyright (C) 2012 Patrick Plenefisch
This program is free software: you can redistribute it and/or modify
Expand All @@ -16,7 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
=end

require 'jrubyfxml'
require 'jrubyfx'
require 'jrubyfx/utils/common_utils'

# This module contains useful methods for defining JavaFX code. Include it in your
Expand Down
4 changes: 2 additions & 2 deletions lib/jrubyfx/java_fx_impl.rb
@@ -1,5 +1,5 @@
=begin
JRubyFXML - Write JavaFX and FXML in Ruby
JRubyFX - Write JavaFX and FXML in Ruby
Copyright (C) 2013 Patrick Plenefisch
This program is free software: you can redistribute it and/or modify
Expand All @@ -16,7 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
=end
#:nodoc: all
require 'jrubyfxml'
require 'jrubyfx'

# Due to certain bugs in JRuby 1.7 (namely some newInstance mapping bugs), we
# are forced to re-create the Launcher if we want a pure ruby wrapper
Expand Down
2 changes: 1 addition & 1 deletion lib/jrubyfx/jfx_imports.rb
@@ -1,5 +1,5 @@
=begin
JRubyFXML - Write JavaFX and FXML in Ruby
JRubyFX - Write JavaFX and FXML in Ruby
Copyright (C) 2012 Patrick Plenefisch
This program is free software: you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion lib/jrubyfx/utils.rb
@@ -1,5 +1,5 @@
=begin
JRubyFXML - Write JavaFX and FXML in Ruby
JRubyFX - Write JavaFX and FXML in Ruby
Copyright (C) 2012 Patrick Plenefisch
This program is free software: you can redistribute it and/or modify
Expand Down
8 changes: 4 additions & 4 deletions lib/jrubyfxml_tasks.rb → lib/jrubyfx_tasks.rb
@@ -1,5 +1,5 @@
=begin
JRubyFXML - Write JavaFX and FXML in Ruby
JRubyFX - Write JavaFX and FXML in Ruby
Copyright (C) 2012 Patrick Plenefisch
This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -50,9 +50,9 @@ def download_jruby(jruby_version, force=false)
# temporary work dir. `jar` is the executable that makes jars. If `target` is
# nill then a random temporary directory is created, and output_jar is the
# full path to the jar file to save
def jarify_jrubyfxml(src="src/*" ,main_script=nil, target="target", output_jar="jrubyfx-app.jar", jar="jar")
def jarify_jrubyfx(src="src/*" ,main_script=nil, target="target", output_jar="jrubyfx-app.jar", jar="jar")
if target_was_nil = target == nil
target = Dir.mktmpdir("jrubyfxml")
target = Dir.mktmpdir("jrubyfx")
final_jar = output_jar
output_jar = File.basename output_jar
end
Expand Down Expand Up @@ -101,7 +101,7 @@ def download(version_string) #:nodoc:
end
end

module_function :jarify_jrubyfxml
module_function :jarify_jrubyfx
module_function :download_jruby
module_function :download
end
2 changes: 1 addition & 1 deletion samples/contrib/fxmlexample/FXMLExample.rb
Expand Up @@ -34,7 +34,7 @@
*/
=end

require 'jrubyfxml'
require 'jrubyfx'
require_relative 'FXMLExampleController'

class FXMLExample < FXApplication
Expand Down
2 changes: 1 addition & 1 deletion samples/contrib/fxmlexample/FXMLExampleController.rb
Expand Up @@ -33,7 +33,7 @@
*/
=end

require 'jrubyfxml'
require 'jrubyfx'

class FXMLExampleController < FXController
# you can comma separate them, or provide multiple definitions
Expand Down

0 comments on commit e390893

Please sign in to comment.