In this post we will lay down the requirements of the application and setup the basic Maven project.
Requirements on the application
Comparing two archives is not the hardest task, but some basic requirements are needed.
- It should be possible to compare *.WAR, *.JAR, and *.ZIP archives.
- The user should either select the file from a file-dialog or drop them into the application using drag and drop.
- The difference of the archives should be presented with size and entry differences (new, removed, and deleted).
- It should be possible to see the difference for each of the files in the archive.
A first sketch of the UI
Bellow is a first sketch of how the UI should look. When I'm about to create a new application or web-page for that part, I usually start by drawing some mocks using Pencil project, which is a nice free tool.
A first sketch of the UI. The areas for the archives should support that files be dragged to them. |
Setting up the project using Eclipse and Maven
A while ago I wrote a post "Get started with Maven, Eclipse and Java FX" which will describe all the steps we need to perform to get a first Java FX application up and running. However I would like to point out a slight improvement to that post. Instead of hard-code the path to the javafx-runtime decency we can use the environment.
Start by pointing JAVA_HOME to you JDKs home path. If you do not know how to set a environmental a quick Google will help you. Define a property in the pom.xml which points out the jfxrt.jar and use the property in the system path of the dependency.
... <groupId>com.loop81</groupId> <artifactId>fxcompare</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <properties> <dependecy.javafx.rj.path>${env.JAVA_HOME}\jre\lib\jfxrt.jar</dependecy.javafx.rj.path> </properties> <dependencies> <dependency> <groupId>com.oracle</groupId> <artifactId>javafx-runtime</artifactId> <version>1.7.u7</version> <scope>system</scope> <systemPath>${dependecy.javafx.rj.path}</systemPath> </dependency> </dependencies> ...If you followed the "Get started with Maven, Eclipse and Java FX" post you should have a project up and running. If you get stuck have a look at the source code to FXComparer, https://code.google.com/p/fx-comparer/.
That is all for this first part. I the next part we will take a look at how to transfer the sketch to a real UI using JavaFX Scene Builder to create our layout (FXML).
The articles in this series are the following:
- Defining the project, setup using Eclipse and Maven.
- Building the UI using FXML and JavaFX Sceen Builder.
- Handling input and showing results using a TableView.
- Packaging the application.
Inga kommentarer:
Skicka en kommentar