I've just figured out an intersting part of JUMP/OpenJUMP's plug-in
management and I wanted to share it with others. This might also be
intersting for those working with OpenJUMP's rendering system.

The intialize method of the InstallRendererPlugIn class adds a
listener to the JUMPWorkbench. This listener notifies the plug-in
whenver a new component is added to the Workbench. When this event
occurs the plug-in checks to see if the component that was added was a
TaskFrame. If it was a TaskFrame the plug-in adds any renderers
encapsulated in a plug-in to that TaskFrames RenderingManager.

This is some really ingenious code. It is a great way to get access to
a TaskFrame and its public members. This is tricky because you never
know when a TaskFrame is going to be created. (That is, the user can
create multiple TaskFrames, and can create a TaskFrame at any point
during JUMP's existence.)

This means I will be able to use a modified form of the
InstallRendererPlugIn class for my pluggable rendering system. This
will allow us to add any custom renderer using JUMP's normal plug-in
class, instead of using the funky hack I had come up with, which
basically involved reading a text file with a name of custom renderers
from within the constructor of the RenderingManager class.

I've now got some major tweaking to do in my pluggable rendering code,
but the end result will be a much better system.

At any rate, if you ever need to access the public members of a
TaskFrame during or shortly after its creation from within a standard
JUMP plug-in, the code in the initialize method of the
InstallRendererPlugIn is the way to do it!

I'm always humbled at the Java wizardry that I discover in JUMP. It
makes me realize that I will always be just a closet programmer. :]

The Sunburned Surveyor

P.S. - I really need to take some notes on how all this works and get
it on the wiki.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Jump-pilot-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to