Open Source JavaFX Now!

JFXtras Samples Logo

Guide to Uploading Samples

This site is open to contributions from anyone who has JavaFX language projects that they would like to share with the community.  There are three basic steps to uploading new content on the JFXtras Samples website.

  1. Commit your source code to the JFXtras Google Code project
  2. Upload your project artifacts to the Document Library
  3. Create a new project entry for your sample

The end result is that you will have a customized listing for your JavaFX application that allows anyone to browse the source code, launch the application, download a project file, and even run it as a desktop widget (if applicable).

It is also possible to add an Inline Applet by following the optional instructions in Part 4.

The rest of this guide goes over how to accomplish each of these steps in detail.

1. Committing Source Code to Subversion

To commit source code to the JFXtras Samples project you must first become a project member.  Please post a request on the JFXtras Mailing List mentioning the sample you are working on or would like to submit.  One of the project admins will then grant you project member status so you can commit to the source control repository.

Once you are a JFXtras project member, you will have https access with write permission to the repository.  Using the subversion client of your choice, sync the following url:

 https://jfxtras.googlecode.com/svn/jfxtras.samples/trunk/


When prompted, enter your generated googlecode.com password.

The source code repository is organized first by source and then in folders by individual samples.  If this is your first time creating a sample, feel free to create a new top-level folder for all your projects.

When checking in source code, please try to adhere to the following guidelines:

  1. Do not check in build or deployment artifacts.  These should be generated from source during compilation.
  2. Add a BSD-style license to the top of each of your source files.  For more information about the New BSD License, Wikipedia has an excellent article.
  3. Feel free to check in project files from your IDE, but be cautious to not check in private files that have paths specific to your machine.

Once you have committed your code to subversion, you are ready to move on to the next step.

2. Uploading Artifacts to the Document Library

This portal also houses a Document Library that you can use to store your samples.  Some artifacts that you may want to upload include:

  1. A ZIP file containing the latest version of your sample project sources.
  2. JAR files containing the executable code for your sample.
  3. A JNLP file that can be used to launch your sample form the web.

Before uploading any artifacts you must first have an account with the proper access priveleges.  Please create a new account using the link on the left side of this page.  Once your account has been created, post a message on the JFXtras Mailing List requesting access to the website, and you will be granted community member status.

Once you are logged into an account with the right level of permissions, you should be able to create new folders and upload files in the Document Library (notice the link on the left navigation bar for future convenience).

The document library is structured very similarly to the source code repository.  Create a top-level folder for your project, a sub-folder with your sample name, and upload all your artifacts into that folder.

One file that will require special treatment during the upload process is your JNLP file.  If you used the javafxpackager to create a JNLP file for you, there are a few things that will need to be corrected:

  1. The codebase needs to be fixed. Set the codebase to a webdav path that matches where the folder you created for your sample. For example, if you created your samples in a path called "bobsamples/dancing pandas", you would need to specify a JNLP codebase of:
    http://jfxtras.org/portal/webdav/liferay.com/guest/document_library/Samples/bobsamples/dancing%20pandas/
    Notice that the all spaces in the codebase have been replaced with '%20' and the codebase ends with a trailing slash '/'.

  2. Please remove the shortcut creation command.  Most folks will not appreciate getting asked to create a shortcut, or the proliferation of shortcuts on their desktop as they try out various samples.
  3. Make sure to use a valid code signing certficate if you need to request all permissions for your application.  Please do not use a self-signed certificate!  A great way to get a free code signing certificate validated by a root certificate authority is to use the Thawte Freemail service per these instructions.

Once you have uploaded all your artifacts you are ready to proceed to the final step.

3. Creating a New Project Entry

To create a new project entry you will have to add a new Web Content item that follows the uses the per-built Sample Structure and Template.  As a shortcut, you can simply click on the "Add New Sample" link on the left side of this page.

On the add sample page, you will be presented with a list of fields with different options.  Here is a brief description of what to populate for each field:

  • Name - Choose a unique name for your sample
  • Author - The responsible individual(s) who created the sample
  • Homepage - A url link to the homepage for this sample, the author's blog, or other relevant reference
  • License - New BSD License is the only option
  • Short Description - Briefly describe your sample in one sentence
  • Screenshot - Upload a PNG or JPG file that shows a picture of the sample.  Please limit the size to a maximum width of 300 pixels.
  • Source URL - A link to where the source code can be downloaded.  This should preferably be a link to the google code repository browser, such as the following:
    http://code.google.com/p/jfxtras/source/browse/jfxtras.samples/trunk/DZone/JFXPoetry/src/dzone/refcard/Main.fx
    If there are multiple files, refer to the parent folder that encompasses them all.
  • Download - This will provide a project download link on the entry if specified.  Use the Select button to navigate to the ZIP file you uploaded earlier.
  • Jnlp File - This will provide a jnlp launch link if specified.  Use the Select button to navigate to the JNLP file you uploaded earlier.
  • Jnlp Url - This is an alternative to Jnlp File that allows a link to an externally hosted application.
  • Widget File - Similar to Jnlp File, but will create a link that launches the application in the WidgetFX dock instead.
  • Widget Url - Alternative to Widget File for externally hosted widgets.
  • Long Description - This field allows you to enter in full html text to describe your sample, its usage, and anything else relevant to users browsing the site.  Please limit this to half a page of content at most (with the option of linking to another page with more detail).
  • Tags - Make sure to add the appropriate tags so that your entry will show up on different pages correctly (e.g. add a source tag to make it show up on one of the book subpages)
  • Abstract - It is also a good idea to fill out the abstract section, so that your entry will show up correctly on any pages that use this view (include a 100x100 thumbnail)

You may also want to add some labels at this time.  There are categorizations based on source, project category, chapter number, etc.  Remember, you can always go back and update anything in this form later on.

After completing all the fields that pertain to your widget, click the Save button.  This will send your sample through the workflow approval process.  As soon as an administrator reviews the entry and approves it, the sample will be available to all the visitors of the JFXtras Samples website.

Congratulations on successfully completing your first JFXtras Sample!

 

4. Adding an Inline Applet (optional)

It is also possible to add an Inline Applet to your sample entry.  This is accomplished by following exactly the same steps as above (1-3), with some extra html code added to the full description of your sample.

Assuming that you have already uploaded the jar and jnlp files as specified above, the following html snippet would add a draggable applet with dimenions 500x400:

 <script src="http://dl.javafx.com/1.2/dtfx.js"></script>
 <script>
     javafx(
         {
               archive: "http://jfxtras.org/portal/webdav/liferay.com/guest/document_library/Samples/bobsamples/dancing%20pandas/DancingPandas.jar",
               draggable: true,
               width: 500,
               height: 400,
               code: "org.bob.dancingpandas.Main",
               name: "Dancing Pandas",
               id: "dancingPandas"
         },
         { isApplet: "true" }
     );
 </script> 

 

To enter this in to the editor, make sure you have "Source" mode selected so that it does not apply any WYSIWYG format