[ImageJ-devel] [fiji-devel] Re: Move of the Fiji Updater into ImageJ complete
Johannes Schindelin
Johannes.Schindelin at gmx.de
Wed Jul 25 17:25:08 CDT 2012
Hi Simon,
On Wed, 25 Jul 2012, simon.ochsenreither at googlemail.com wrote:
> > ImageJ will figure out how to construct a dialog from the annotated
> > fields. Parameters do not need to be information to be gathered via a
> > dialog, though. For example, if you want to interact with a service
> > (such as the log service to report exceptions) you also add them as
> > fields annotated as a parameter.
>
> Wow, that's an quite advanced design! I hope it works out that way, I
> think especially the layouting will be hard to get right. So there will
> be custom compiler plugins to process the annotations and create
> classfiles from them?
It actually works already, but it is not a custom compiler. The
annotations are processed by a subclass of the
AbstractInputHarvesterPlugin such as the SwingInputHarvesterPlugin:
http://fiji.sc/javadoc/imagej/ext/ui/swing/SwingInputHarvester.html
This is a preprocessor plugin and discovered at runtime via annotations,
too. In general, quite a lot of things are discovered at runtime in
ImageJ.
The trick is to have a library called sezpoz in the classpath while
compiling; it processes the annotations and stores the list of the
accumulated classes in the .jar files. At runtime, these files are loaded
via the class loader; thereby classes which are in the classpath will be
found, others not.
An example is the GUI binding. By default, we have the Swing binding in
the classpath. But if you put the AWT binding into the classpath instead,
that one will be instantiated (our AWT bindings are basically
proofs-of-concept, and not feature complete at this time).
The same is true for plugins: they are discovered at runtime through the
annotations that were processed by sezpoz at compile time.
In general, our focus was on making the simple easy and the complicated at
least possible. For example, we do have facilities that allow things such
as locking the aspect ratio in the resize dialog, but all of these
facilities were added with the flexibility in mind to let other programs
show the GUI, or even show no GUI at all.
Ciao,
Johannes
More information about the ImageJ-devel
mailing list