Juxta Source Overview
This document describes the java package originization of the Juxta source code. Hopefully this document will make it easier to get oriented in the project source and to find what you are looking for.
The code is organized into three source folders: the juxta application code, diff alogrithm code, and common code area which is for somewhat generalized and reusable code. What follows is a description of each high level package namespace.
This is the top level package for the Juxta application itself. The Juxta code base follows a model-view/controller paradigm. The package structure makes this obvious, with application code found in either the model or view packages.
This is where all loading, saving, processing and store of data occurs. This package is built on top of the diff package, which does the actual work of comparing documents.
This package is where all the display, reporting, and user interactivity code is housed. At this level are found dialogs and views which don't have enough supporting classes to merit their own package, the high level modules which organize the view, and the odd controller interface.
This is where you can find the DifferenceViewer and its supporting classes. This code displays the "heat map" color coded display of the base text.
Here is the code for displaying a side-by-side comparison of the documents.
This code uses a velocity script to generate the HTML report files. The script can be found in res/forms.
These are UI odds and ends that are reusable within the scope of the Juxta project, but probably not for other projects. Also in here is JuxtaUserInterfaceStyle, which houses many of the color constants and file paths to icon image resources. The icons are stored in res/icons.
Now for the code found in the common source folder. This is stuff I could imagine some other project wanting to use besides Juxta.
This package contains a simple scheme for standardizing exception handling and providing a consitent reporting UI to the user and to the log files. It uses SimpleLogger from the util package below.
These are slightly generalized based classes and interfaces used to construct the Juxta UI. I found it constructive to seperate the code that did Swing magic from the application code to keep these unrelated concerns unrelated.
Some good stuff in here, logging, file utilities, image loading, other odds and ends.
Ok, this is the fun part, the code that drives the diff algorithm itself. This package is found in the diff source folder. The top level classes do the actual diffing, with the sub packages containing supporting code, extensions, and tests.
There is diffing, and then there is collation. Collation takes all the diff results and pools them together into collections of Differences. These classes represent or work on this collection as a whole.
This package houses the world famous DocumentModel, which is the base class of JuxtaDocumentModel. Classes for reading and writing document models are found here.
The JUnit tests for the diff algorithm.
These classes handle the tokenization of the document into comparable tokens.