Last week I was in the process of wrapping-up my plug-in that allows
the user to import survey point data in a text delimited format. I
wanted to show the user a progress bar as the data was being loaded. I
first attempted to use the TaskMonitorDialog directly, which didn't
work very well. (The dialog displayed, but never went away. This was
due to an error in my code, no doubt.)

So I started digging around to figure out the best way to use the
TaskMonitorDialog when loading data into OpenJUMP. The deeper I dug,
the more questions I got. I could just write the plug-in without the
TaskMonitorDialog, but I would really like to figure this out so I can
do things properly. Have you written a plug-in that used the
TaskMonitorDialog? Did this plug-in load data into OpenJUMP? Then
maybe you can halp me with a couple of questions:

When is it OK to use the TaskMonitorDialog class directly? (It looks
like existing plug-ins that load data don't do this. Instead, they use
an implementation of the ThreadedPlugIn interface. I believe the
LoadDataSetPlugIn is an example of this.)

I wonder if it is appropriate to use an implementation of
ThreadedPlugIn to load data into OpenJUMP in this way. Here is why:

Loading data (like the data stored in a shapefile) into OpenJUMP
usually involves adding a layer to the active Task and repainting the
LayerViewPanel. When we use a ThreadedPlugIn to do this, are we trying
to repaint the LayerViewPanel outside of the main Swing thread? In my
case it would seem better to load the data from the delimited text
file in a separate thread, and then to add the data in a new Layer in
part of the main application thread, so as not to mess with Swing. Can
I separate the reading of the data from the file and adding the layer
by putting separate code in the run and execute methods of the
ThreadedPlugIn interface?

I'm trying to figure out how to separate the code by putting the one
task in the execute method and the other task in the run method, but I
can't find a solution yet. (I need to determine the relationship
between the execute and run method. The Javadoc doesn't seem to
indicate when the two methods are invoked in relation to each other.
Is execute called first, and followed immediately by the run method?
Must I call explicitly call the run method from within the execute
method?)

I'm not any good at using Java threads, so I appreciate any
suggestions. I will keep digging in the code in an attempt to get some
answers. Hopefully I can update the Javadoc comments when I am done.

Landon

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to