JDisplay displays Java, HTML, bat, SQL, ini, csv,
properties, Bali, MFT... files a variety of colours, fonts, sizes
and weights to help make them more presentable and readable.
Why would you use it? For the same sorts of reasons you use
colours and fonts in an IDE like IntelliJ or Eclipse. They
make the code much easier to understand.
There is no server-side code used. Java utilities parse the
code snippets into compact binary tokens, assigning colours,
fonts, sizes and weights to each token. Then the tokens can
be rendered three ways:
1. using a Java Applet. This is usually best for very
large listings.
2. as piece of CSS style-decorated HTML code you include in
your html as an iframe. This is usually best for
intermediate listings.
3. inline in your HTML. This is usually best for short
listings. The problem, in the process of editing the html
it is fairly easy to damage the generated listings. They
must be regenerated before every upload.
I have been using the JDisplay suite of utilities for many
years. I did not write it for public use. I offer it on an
as-is basis. The code itself in well documented, but there
is no step-by-step documentation on getting it to work.
I presume the user is familiar with bat and ant files and
Java building.
I have not included the enormous HTML static macros package
which I use for deciding the sizes and display rendering
method for each snippet, though I did include the code to
make those decisions hooked into your own framework.
The parsers are rough and ready. They need to work on code
snippets and erroneous code, not perfect code the way a
standard parser does. If improve the parsers, or add new
ones, please pass them along for the public distribution.
JDisplay is enormously more complicated than it appears on
the surface. You can spelunk and discover all manner of
interesting code you can cannibalise. There are finite
state machines, clipregion sensitive Canvas rendering, HTML
generators, ObjectStreams...
PACKAGES
com/mindprod/compactor compacts html to remove excess white space.
com/mindprod/entities interconvert & <-> & etc.
com/mindprod/filter set of FilenameFilters
com/mindprod/htmlmacros/jdisplay.java part of a large static
macros package to expand macros embedded in HTML before the
files are uploaded to the server.
com/mindprod/hunkio does IO in big hunks.
com/mindprod/jdisplayaux static macro to decide which of
three ways to render a given snippet and inserts the
appropriate HTML to do that into your HTML.
com/mindprod/jdisplayorphans detects orphan not referenced
by any of your HTML.
com/mindprod/jprep parses the snippets of code, producing
binary *.ser files.
com/mindprod/jtokens Tokens and parsers for various
languages rendered.
mindprod.css = style sheet that controls the
fonts/tokens/sizes
PROGRAM FLOW
1. Run jprep -- parse snippets to binary *.ser files and iframe/*.html files
2. Manually decide which of three methods to use, and insert appropriate HTML.
(or rig up some code to do this automatically using code in JDisplayAux)
3. Upload to website.
4. View code inline, as iframe, or via invocation of JDisplay Applet.
See http://mindprod.com/applet/jdisplay.html for samples of all three invocation styles.
DIRECTORY STRUCTURE
Let's say your html lives in:
E:\mindprod\jgloss
Then the corresponding program listing snippets will live in:
E:\mindprod\jgloss\snippets
the generated *.ser file live in
E:\mindprod\jgloss\snippets\ser
and the generated iframe *.html files will live in
E:\mindprod\jgloss\snippets\iframe
All off this must be uploaded to your website.
PROBLEMS
All code should be include with the exception of the
htmlmacros package. If you find something missing you can
probably get it at http://mindprod.com/products.html. In any
case, please let me know, so I can include it.
If you have questions, please feel free to ask. It will help
me put together some minimalist documentation.
Why the picture frame logo? It symbolises presenting the
program listing in an aesthetically pleasing form.