Friday, 10 August 2012

MLM Admin - Source code for JavaFX application

Hello and welcome to my blog :-).  In this blog post, I am sharing a JavaFX application that I have written. The application has been written using Java 7 Update 5 and JavaFX version 2.1.

Background for this post:

Actually, I never intended to write this blog, and made this application available public. But, it so happened that the client who had contracted me to write this application was offering peanuts to me as a fee for writing this app. His behavior was not unusual as software piracy is very rampant in Katni, Madhya Pradesh, India where I live, and people are just not inclined to shell out money for the software. They in general don't value any thing that can't be touched e.g writing (sorry for sounding accusative). So frustrated at on not getting the reasonable fee for this app, I decided to make it available to the public in large.

This application is a result of my first serious attempt at writing a JavaFX application. Prior to that I have written few Swing applications, but was not satisfied with the sedate looks they offered. So when I heard about the graphically rich behavior of the JavaFX framework, I was naturally excited.

So enough of background  info for the app and this blog post :-), now let me turn my attention to the app itself. Before I could start writing about the app, you may want to know how it looks. Well, few screenshots of the application are available here. The application (sans source code) can be downloaded by clicking here.

Objective of the application:

The objective is to the manage the membership details of a multi-level marketing firm. The client's primary demand was that the application should notify the user about the commissions due (if any) to the existing members when a new member joins the business. The application supports so-called Matrix plans, where formed a matrix of 3, 4 or etc. which continues to every level. If you choose a matrix of 3 then every member has to join three members under him/her.


The app works according to the principle that the the joining fee of a member becomes due to him/her on completing level 1. The commission due to a member on completing level 2 or more can be specified in the Business rules dialog box as a percentage of the total amount received as joining fee from the members of the completed level. See the image below:



As expected, the application allows to view the member tree, and let you find out the number of members that have joined (directly or indirectly) under a particular member. See the screenshot below:




FXML & Scene Builder:

When I started writing the application, I had heard about the JavaFX FXML language, but I didn't use it initially as I was not inclined to learn a new XML derivative just for writing the user interfaces (UIs). So, I wrote the user interfaces for the first two windows (a.k.a. Stages in JavaFX parlance) in Java code. But, I soon realized that it is not going to work out as writing code for designing UIs is very cumbersome. So, reluctantly I turned my attention to FXML, and fortunately I stumbled upon JavaFX Scene Builder tool. This tool is really good as it makes designing user faces just a matter of drag and drop (you of course need to know various layout panes available in JavaFX to effectively use the tool).

Relative newness of the JavaFX platform:

As the JavaFX platform is relatively new, it doesn't yet have all the necessary armory to design the modern day apps. They have started few separate projects to fill this void, and one such project is JFXtras2. It features, among other controls, a useful Calendar control that is missing from the standard control library of JavaFX. I though have not used it in this app as I found it midway through the development of this project.

The biggest plus point for JavaFX is its rich multimedia support and the support to design attractive user interfaces by just using the standard Cascading Style Sheets (CSS).  How I wish I had more knowledge of the CSS so that I could design better user interfaces for my apps.

Source Code:

You can download the complete source code for the application as a Netbeans 7.2 project from this link.

The applications uses few external libraries, and you will need to include those libraries in your Netbeans project to compile the application. The external libraries are: Joda Time, Jasper Reports, and Apache Derby.

Disclaimer:

I don't hold the license for the icons used in the application. I have used them for illustrative purposes only. Use the icons at your responsibility only.


Feedback:

I would be glad to hear your feedback regarding the application and this blog post. If you have any question related to the app, please feel free to ask, and time permitting, I shall try my best to answer them.

Thank you for reading the post. :-)