How to build a JRebirth Presentation

Last year I decided to create an application framework dedicated to JavaFX; the brand new graphical toolkit for Java.

After having played with Swing, SWT/JFaces, Flex, Silverlight and for sure Web API during several years I wanted to go back to Swing…
… and JavaFX 2 had been launched.

So I called my framework : JRebirth to beat all web-kiddies Up !!!

After few weeks of work, I had the opportunity to talk about JavaFX API during a ToulouseJug evening meeting.
As Office suite was not my best friends, filling excel and powerpoint files all the day is not my main objectives (whereas it ‘s currently my everyday life …).

So I decided to challenge myself and to create a Powerpoint’s like presentation entirely in JavaFX.
I activated the dog-fooding mode and I created the org.jrebirth.presentation sub module for JRebirth.

If you are a little bit lazy, you can fork one of the 4 presentations/applications I had built :

Otherwise as JRebirth is based on Maven Tools; the best way to use is to create a Maven project.

Project configuration

Hereafter you can see a typical presentation folder hierarchy :

((/public/javafx2/.prez_tree_m.jpg|Presentation Application Tree Structure with JRebirth||Presentation Application Tree Structure with JRebirth, fév 2013))

The first step is to create your pom.xml, you can copy/paste the sample hereafter:

pom.xml

 

The sample pom also allow you releasing your application with Java WebStart with a self-signed certificate.
You must fill 2 parameters to create your self-signed certificate :

  • -Dkeypass= your pass
  • -Dstorepass= your pass

This org.jrebirth:presentation dependency will fetch automatically the dependency: org.jrebirth:core which is the core of the JRebirth Application Framework.

Obviously you must connect to repo.jrebirth.org to download latest files, to do it you should read this page : JRebirth Installation

Let’s code !

Now you have to create your package tree (for me org.jrebirth.presentation.lightningtalk), and add your first class.
This is your application main class and it must inherit from AbstractApplication class available into core library.
You can find more information about JRebirth Application class here : Application

You must load the StackModel view by overriding getFirstModelClass() method to create a Presentation application.
This will create for you a customized view that will handle some events:

  • Left click and PageDown to move forward into your slides stack
  • Right click and PageUp to move backward into your slides stack
  • Ctrl + ‘+’ to zoom in the scene
  • Ctrl + ‘-‘ to zoom out the scene

JRebirth Core also adds these shortcuts (they could be changed by overriding methods too)

  • F10 to maximize
  • F11 for fullscreen mode

How to add content ?

You must create a presentation/Presentation.xml file compliant with the Presentation.xsd XML schema.
You can write raw text and create slides and sub-slides with image and hyperlink.
You should launch the application and compare the xml file to evaluate all features.
Here you have a full sample with a lot of different slides.

How to add JavaFX content ?

For each slide XML element you can declare a modelClass which will be loaded and used according MVC principles of JRebirth Application Framework (JRebirth Overview).
Your model should inherit from AbstractSlideModel.
Your view should inherit from AbstractSlideView.
Your controller should inherit from AbstractSlideController.

Customizable method are available into your view to trigger and stop you slide animation.

Example:

How to package ?

Your pom.xml allow to package it as a Java WebStart Application, so you can broadcast your slides online !
Hereafter you have some examples :

Enjoy It and contact me on twitter (@s8bordes) if you have any question !

What’s next ?

I will probably add an archetype to build quickly a new fresh presentation application.
In the future I will add some JRebirth Services and Commands to manipulate Images and create some exciting animation,
this module is called org.jrebirt:transition and will be released soon … (depending if I have to create another presentation for another conference)

Currently I mainly work on JRebirth core new features.

Leave a Reply