You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Jim Cobban <jc...@magma.ca> on 2003/01/02 19:14:51 UTC

HSSF event model and Swing

I have a program which reads spreadsheets using the HSSF event model under Swing.  The issue I have is that I need to periodically release control to Swing so it can permit other activities, such as repainting the window, to take place.  The standard way of doing this is to implement Runnable and perform the long-running task in the run method, which is actually called by Swing and reschedules itself with SwingUtilities.invokeLater(this) as long as there is more work to be done.  But in the HSSF event model all of the work is done in a single call to HSSFEventFactory.processEvents, and I cannot see an easy way to interrupt this process to give control back to Swing.

Jim Cobban   jcobban@magma.ca
34 Palomino Dr.
Kanata, ON, CANADA
K2M 1M1
+1-613-592-9438

Re: HSSF event model and Swing

Posted by "Andrew C. Oliver" <ac...@apache.org>.
Jim Cobban wrote:

>I have a program which reads spreadsheets using the HSSF event model under Swing.  The issue I have is that I need to periodically release control to Swing so it can permit other activities, such as repainting the window, to take place.  The standard way of doing this is to implement Runnable and perform the long-running task in the run method, which is actually called by Swing and reschedules itself with SwingUtilities.invokeLater(this) as long as there is more work to be done.  But in the HSSF event model all of the work is done in a single call to HSSFEventFactory.processEvents, and I cannot see an easy way to interrupt this process to give control back to Swing.
>
>Jim Cobban   jcobban@magma.ca
>34 Palomino Dr.
>Kanata, ON, CANADA
>K2M 1M1
>+1-613-592-9438
>  
>
Create a model which surrounds HSSF and communicates with your GUI via 
an event when its done.  Run that model thingy in another
thread, synchronize access to it (or launch seperate threads).  Wrapping 
the long running task is something I view as the application developer's 
area of concern.

-Andy