1 | |
package org.jtheque.films.view.impl.actions.file; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
import org.jtheque.core.managers.Managers; |
20 | |
import org.jtheque.core.managers.beans.IBeansManager; |
21 | |
import org.jtheque.core.managers.view.able.IViewManager; |
22 | |
import org.jtheque.core.managers.view.edt.SimpleTask; |
23 | |
import org.jtheque.core.managers.view.impl.actions.JThequeAction; |
24 | |
import org.jtheque.films.controllers.able.IExportController; |
25 | |
import org.jtheque.films.view.able.IExportView; |
26 | |
|
27 | |
import java.awt.event.ActionEvent; |
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
public final class AcValidateExportView extends JThequeAction { |
35 | |
|
36 | |
|
37 | |
|
38 | |
public AcValidateExportView() { |
39 | 0 | super("generic.view.actions.validate"); |
40 | 0 | } |
41 | |
|
42 | |
@Override |
43 | |
public void actionPerformed(ActionEvent e) { |
44 | 0 | if (Managers.getManager(IBeansManager.class).<IExportView>getBean("exportView").validateContent()) { |
45 | 0 | Managers.getManager(IViewManager.class).execute(new ExportTask()); |
46 | |
} |
47 | 0 | } |
48 | |
|
49 | |
|
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | 0 | private final class ExportTask extends SimpleTask { |
55 | |
@Override |
56 | |
public void run() { |
57 | 0 | final IExportController exportController = Managers.getManager(IBeansManager.class).getBean("exportController"); |
58 | |
|
59 | 0 | exportController.getView().startWait(); |
60 | |
|
61 | 0 | new Thread(new Runnable() { |
62 | |
@Override |
63 | |
public void run() { |
64 | 0 | exportController.export(exportController.getView().getSearcher(), exportController.getView().getFilePath()); |
65 | |
|
66 | 0 | Managers.getManager(IViewManager.class).execute(new SimpleTask() { |
67 | |
@Override |
68 | |
public void run() { |
69 | 0 | exportController.getView().stopWait(); |
70 | 0 | } |
71 | |
}); |
72 | |
|
73 | 0 | exportController.closeView(); |
74 | 0 | } |
75 | |
}).start(); |
76 | 0 | } |
77 | |
} |
78 | |
} |