Caraibe - Presentation Framework

Caraibe is a resentation framework. Just write simple scripts, Caraibe make rich presentation materials.

It is easy to write Caraibe presentation scripts.

Caraibe has plural pages (Page class), pages consits of some parts (Part class).

For example, I show "Hello, World!" for presentation.

import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import net.javainthebox.caraibe.Caraibe;
import net.javainthebox.caraibe.effect.FadeEffect;
import net.javainthebox.caraibe.Page;
import net.javainthebox.caraibe.PageAggregator;
import net.javainthebox.caraibe.PageFactory;
import net.javainthebox.caraibe.pagetransition.SlideInOutTransition;
import net.javainthebox.caraibe.Part;

Caraibe {
    title: "Hello, World!"
    width: 1024
    height: 768

    pageAggregator: PageAggregator {
        // Default page background.
        // This background variable is applied to all of pages.
        // If you want to set a background of particular page,
        // set a backgroudn variable of Page class.
        background: Rectangle {
            x: 0 y: 0 width: 1024 height: 768
            fill: Color.PALETURQUOISE
        }

        // Animation of transition between pages
        // SlideInOutTransition means that new page slide in and old page slide out.
        pageTransition: SlideInOutTransition {}

        // Caraibe doesn't use to instantiate each page directory.
        // If Caraibe instantiate all page at the beggining,
        // it wastes enoumous time.
        // Therefore, Caraibe uses factory class PageFactory for lazy instantiation
        pageFactories: [
            PageFactory {
                pageTitle: "Hello, World!"
                // createPage is Page factory method
                createPage: function(): Page {
                    Page {
                       // Page consists of some parts
                        parts: [
                            Part {
                                // Part defines node and action
                                // node is for display
                                // action is function that is invoked when node is displayed
                                node: Text {
                                    x: 300 y: 300
                                    font: Font {
                                        size: 80
                                    }
                                    content: "Hello, World!"
                                }
                                action: function(page: Page, index: Integer) {
                                    FadeEffect {
                                        node: page.getNode(index)
                                        duration: 3s
                                    }.start();
                                }
                            }
                        ]
                    }
                }
            }
        ]
    }
}

When compiling and executing, add Cariabe.jar to CLASSPATH.

When this script file is named to main.fx, compiling is following:

javafxc -cp Caraibe.jar;. main.fx

execution is following:

javafx -cp Caraibe.jar;. main

The result of execution is below figure.

f:id:skrb:20090531170317j:image:medium

Page object has some Part object. parts[0] is diplayed when instantiating Page object. parts[1] is displayed after page transition.

parts[2] or later are displyed when clicking into Caraibe window.

There is no parts to displya in the present page, Caraibe moves to next page with page transition.

The fist page is not applied to page transition. Therefore, parts[1] is displayed at the same time of Page instantiation.

Next script has one page that consists on three parts. At first, "Hello, World!" is displayed. After clicking, "Hello, JavaFX!" is displayed.

Caraibe {
    title: "Hello, World!"
    width: 1024
    height: 768

    pageAggregator: PageAggregator {
        background: Rectangle {
            x: 0 y: 0 width: 1024 height: 768
            fill: Color.PALETURQUOISE
        }

        pageTransition: SlideInOutTransition {}

        pageFactories: [
            PageFactory {
                pageTitle: "Hello, World!"
                createPage: function(): Page {
                    Page {
                        parts: [
                            Part {
                                node: Text {
                                    x: 300 y: 300
                                    font: Font {
                                        size: 80
                                    }
                                    content: "Hello, World!"
                                }
                                action: function(page: Page, index: Integer) {
                                    FadeEffect {
                                        node: page.getNode(index)
                                        duration: 3s
                                    }.start();
                                }
                            },
                            // after page transition, this part is displayed,
                            // But the first page isn't applied to page transition.
                            // Therefore, this part is displayed at the same time of Page instantiation.
                            Part {}, 
                            Part {
                                node: Text {
                                    x: 300 y: 400
                                    font: Font {
                                        size: 80
                                    }
                                    content: "Hello, JavaFX!"
                                }
                                action: function(page: Page, index: Integer) {
                                    FadeEffect {
                                        node: page.getNode(index)
                                        duration: 1s
                                    }.start();
                                }
                            }
                        ]
                    }
                }
            }
        ]
    }
}


f:id:skrb:20090531170356j:image:medium

TBC