1 | |
package org.jtheque.core.managers.view.impl.actions.about; |
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.ILicenceView; |
22 | |
import org.jtheque.core.managers.view.able.IViewManager; |
23 | |
import org.jtheque.core.managers.view.edt.SimpleTask; |
24 | |
import org.jtheque.core.managers.view.impl.actions.JThequeAction; |
25 | |
import org.jtheque.utils.print.PrintUtils; |
26 | |
|
27 | |
import javax.annotation.Resource; |
28 | |
import java.awt.event.ActionEvent; |
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | 0 | public final class PrintLicenseAction extends JThequeAction { |
36 | |
@Resource |
37 | |
private ILicenceView licenceView; |
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
public PrintLicenseAction() { |
43 | 0 | super("licence.actions.print"); |
44 | |
|
45 | 0 | Managers.getManager(IBeansManager.class).inject(this); |
46 | 0 | } |
47 | |
|
48 | |
@Override |
49 | |
public void actionPerformed(ActionEvent arg0) { |
50 | 0 | Managers.getManager(IViewManager.class).execute(new SimpleTask() { |
51 | |
@Override |
52 | |
public void run() { |
53 | 0 | licenceView.startWait(); |
54 | |
|
55 | 0 | new Thread(new PrintRunnable()).start(); |
56 | 0 | } |
57 | |
}); |
58 | 0 | } |
59 | |
|
60 | |
|
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | 0 | private final class PrintRunnable implements Runnable { |
66 | |
@Override |
67 | |
public void run() { |
68 | 0 | PrintUtils.printLineFiles(getClass().getClassLoader(). |
69 | |
getResourceAsStream("org/jtheque/core/resources/others/licence.txt")); |
70 | |
|
71 | 0 | Managers.getManager(IViewManager.class).execute(new StopWaitTask()); |
72 | 0 | } |
73 | |
} |
74 | |
|
75 | |
|
76 | |
|
77 | |
|
78 | |
|
79 | |
|
80 | 0 | private final class StopWaitTask extends SimpleTask { |
81 | |
@Override |
82 | |
public void run() { |
83 | 0 | licenceView.stopWait(); |
84 | 0 | } |
85 | |
} |
86 | |
} |