1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui.support.swing;
14
15 import com.eviware.x.dialogs.Worker;
16 import com.eviware.x.dialogs.XProgressDialog;
17 import com.eviware.x.dialogs.XProgressMonitor;
18
19 /***
20 *
21 * @author Lars Høidahl
22 */
23 public class SwingWorkerDelegator extends SwingWorker
24 {
25 private XProgressMonitor monitor;
26 private Worker delegate;
27 private XProgressDialog dialog;
28
29 /***
30 * Start a thread that will call <code>delegate.construct</code> and then
31 * exit.
32 */
33 public SwingWorkerDelegator( XProgressMonitor monitor, XProgressDialog dialog, Worker delegate )
34 {
35 this.monitor = monitor;
36 this.dialog = dialog;
37 this.delegate = delegate;
38 }
39
40 /***
41 * Compute the value to be returned by the <code>get</code> method.
42 */
43
44 public Object construct()
45 {
46 return delegate.construct( monitor );
47 }
48
49 /***
50 * Called on the event dispatching thread (not on the worker thread) after
51 * the <code>construct</code> method has returned.
52 */
53 public void finished()
54 {
55 delegate.finished();
56 if( dialog != null )
57 dialog.setVisible( false );
58 delegate = null;
59 monitor = null;
60 dialog = null;
61 }
62 }