| ... |
... |
@@ -38,24 +38,46 @@ import org.nuiton.jaxx.runtime.swing.wizard.ext.WizardState; |
|
38
|
38
|
|
|
39
|
39
|
import javax.swing.JTextArea;
|
|
40
|
40
|
import javax.swing.KeyStroke;
|
|
|
41
|
+import java.beans.PropertyChangeListener;
|
|
41
|
42
|
import java.util.concurrent.Callable;
|
|
42
|
43
|
|
|
43
|
44
|
public abstract class AdminTabUIActionSupport<U extends AdminTabUI> extends JComponentActionSupport<U> implements WithClientUIContextApi {
|
|
44
|
45
|
|
|
|
46
|
+ /**
|
|
|
47
|
+ * To listen progression model messages (to add them in action messages area).
|
|
|
48
|
+ */
|
|
|
49
|
+ private final PropertyChangeListener progressionModelListener;
|
|
|
50
|
+
|
|
45
|
51
|
public AdminTabUIActionSupport(String label, String shortDescription, String actionIcon, KeyStroke acceleratorKey) {
|
|
46
|
52
|
super(label, shortDescription, actionIcon, acceleratorKey);
|
|
|
53
|
+ progressionModelListener = evt -> {
|
|
|
54
|
+ String message = (String) evt.getNewValue();
|
|
|
55
|
+ addMessage(message);
|
|
|
56
|
+ };
|
|
47
|
57
|
}
|
|
48
|
58
|
|
|
49
|
59
|
public AdminTabUIActionSupport(String actionCommandKey, String label, String shortDescription, String actionIcon, KeyStroke acceleratorKey) {
|
|
50
|
60
|
super(actionCommandKey, label, shortDescription, actionIcon, acceleratorKey);
|
|
|
61
|
+ progressionModelListener = evt -> {
|
|
|
62
|
+ String message = (String) evt.getNewValue();
|
|
|
63
|
+ addMessage(message);
|
|
|
64
|
+ };
|
|
51
|
65
|
}
|
|
52
|
66
|
|
|
53
|
67
|
public AdminTabUIActionSupport(String label, String shortDescription, String actionIcon, char acceleratorKey) {
|
|
54
|
68
|
super(label, shortDescription, actionIcon, acceleratorKey);
|
|
|
69
|
+ progressionModelListener = evt -> {
|
|
|
70
|
+ String message = (String) evt.getNewValue();
|
|
|
71
|
+ addMessage(message);
|
|
|
72
|
+ };
|
|
55
|
73
|
}
|
|
56
|
74
|
|
|
57
|
75
|
public AdminTabUIActionSupport(String actionCommandKey, String label, String shortDescription, String actionIcon, char acceleratorKey) {
|
|
58
|
76
|
super(actionCommandKey, label, shortDescription, actionIcon, acceleratorKey);
|
|
|
77
|
+ progressionModelListener = evt -> {
|
|
|
78
|
+ String message = (String) evt.getNewValue();
|
|
|
79
|
+ addMessage(message);
|
|
|
80
|
+ };
|
|
59
|
81
|
}
|
|
60
|
82
|
|
|
61
|
83
|
protected void addAdminWorkerWithNoProgress(String label, Callable<WizardState> callable) {
|
| ... |
... |
@@ -94,15 +116,14 @@ public abstract class AdminTabUIActionSupport<U extends AdminTabUI> extends JCom |
|
94
|
116
|
protected void installProgressBar() {
|
|
95
|
117
|
ProgressionModel model = ui.getStepModel().getProgressModel();
|
|
96
|
118
|
model.installUI(ui.getProgressBar(), false);
|
|
97
|
|
- model.addPropertyChangeListener(ProgressionModel.PROPERTY_MESSAGE, evt -> {
|
|
98
|
|
- String message = (String) evt.getNewValue();
|
|
99
|
|
- addMessage(message);
|
|
100
|
|
- });
|
|
|
119
|
+ model.removePropertyChangeListener(ProgressionModel.PROPERTY_MESSAGE, progressionModelListener);
|
|
|
120
|
+ model.addPropertyChangeListener(ProgressionModel.PROPERTY_MESSAGE, progressionModelListener);
|
|
101
|
121
|
}
|
|
102
|
122
|
|
|
103
|
123
|
protected void unInstallProgressBar() {
|
|
104
|
124
|
ProgressionModel model = ui.getStepModel().getProgressModel();
|
|
105
|
125
|
model.uninstallUI(ui.getProgressBar());
|
|
|
126
|
+ model.removePropertyChangeListener(ProgressionModel.PROPERTY_MESSAGE, progressionModelListener);
|
|
106
|
127
|
}
|
|
107
|
128
|
|
|
108
|
129
|
} |