Author: Eric Latham
Email: ericoliverlatham@gmail.com
I initially developed this program as a team leader for a final project in a software engineering course taught by Dr. Ramaraju Rudraraju at UAB with the help of Tahseen Robbani, Wesley Hataway, Daniel Swinney, and Hardik Patel.
This program is a prototype for a farmer utility application built with JavaFX as an exercise in using design patterns such as entity-control-boundary, composite, visitor, and adapter.
- ItemComponent class (composite, pro-transparency)
- Item class
- ItemContainer class
- ItemComponentVisitor class
- AggregatePurchasePriceVisitor class
- AggregateMarketValueVisitor class
- AnimatedDroneInterface class
- AnimatedDrone class
- TelloDroneAdapter class (adapts TelloDrone to AnimatedDrone)
- TelloDrone class (provided by Seth)
- Dashboard class (main)
- DashboardController class
All classes other than TelloDroneAdapter
in the physical drone module were provided by Seth Lewis from his drone library in order for the adapter design pattern to be completed.
I used a TreeView object to allow the user to add, edit, and remove Items
and ItemContainers
from the Farm Map.
I used a Group object to contain and display the shape of each Item
and ItemContainer
, as well as the drone icon that is used in the drone animation.
I used an ImageView object to display the drone icon in the farm map and SequentialTransition objects to animate the drone icon for two different flight simulations:
Item
/ItemContainer
visits- full farm scans
Note that the drone animation feature is intended to mirror what a real drone would do on a real farm if commanded by the TelloDroneAdapter
class. However, the TelloDroneAdapter
is untested on real drones and currently only exists for simulation purposes.
I implemented a bonus feature that does the following things:
- automatically saves the root
ItemContainer
of theDashboard
every time a component is added, updated, or deleted - automatically loads the previous saved root
ItemContainer
when theDashboard
is re-opened
This feature allows the Dashboard
to "remember" its previous state so that the user does not have to recreate all of the desired farm items each time they run the application.
To implement this feature, I added static methods in the ItemContainer
class for saving and loading ItemContainer
objects via JSON serialization and deserialization.
public static void saveJSON(ItemContainer itemContainer, String filePath);
I used the saveJSON
method in the DashboardController
class to save the root ItemContainer
as a JSON string in a file named rootItemContainer.json
whenever changes were made by the user.
public static ItemContainer loadJSON(String filePath);
I used the loadJSON
method in the DashboardController
class to load the previous root ItemContainer
(saved as a JSON string in rootItemContainer.json
by saveJSON
) whenever the Dashboard
and DashboardController
objects are initialized (which is whenever the application starts).
In both saveJSON
and loadJSON
, I leveraged the power of the Gson library to serialize and deserialize ItemComponent
objects to/from JSON. Gson
is a popular tool used for Java object-JSON serialization and deserialization, and I found it easy to use, especially with the help of its excellent documentation.
Also, I added the required Gson
jars as dependencies in the project so that there would be no need to import Gson
manually when building and running the project.
(assuming you have Eclipse IDE and Java JDK 8 installed)
- clone this repository into
farm-dashboard-prototype
- open Eclipse
- select File -> Import -> Existing Projects into Workspace -> Next -> Browse
- locate the cloned
farm-dashboard-prototype
directory in the filesystem dialogue and select to open it - select Finish
- click the green play button labeled "Run" on the upper icon bar