|
@@ -1,16 +1,16 @@
|
1
|
1
|
/*
|
2
|
2
|
* Copyright (c) 2006-2010 Chris Smith, Shane Mc Cormack, Gregory Holmes
|
3
|
|
- *
|
|
3
|
+ *
|
4
|
4
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
5
|
* of this software and associated documentation files (the "Software"), to deal
|
6
|
6
|
* in the Software without restriction, including without limitation the rights
|
7
|
7
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
8
|
* copies of the Software, and to permit persons to whom the Software is
|
9
|
9
|
* furnished to do so, subject to the following conditions:
|
10
|
|
- *
|
|
10
|
+ *
|
11
|
11
|
* The above copyright notice and this permission notice shall be included in
|
12
|
12
|
* all copies or substantial portions of the Software.
|
13
|
|
- *
|
|
13
|
+ *
|
14
|
14
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
15
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
16
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
@@ -33,6 +33,7 @@ import java.beans.PropertyChangeEvent;
|
33
|
33
|
import java.beans.PropertyChangeListener;
|
34
|
34
|
|
35
|
35
|
import javax.swing.JButton;
|
|
36
|
+import javax.swing.SwingUtilities;
|
36
|
37
|
|
37
|
38
|
import net.miginfocom.swing.MigLayout;
|
38
|
39
|
|
|
@@ -73,9 +74,9 @@ public class ActionEditorDialog extends StandardDialog implements ActionListener
|
73
|
74
|
/** Action group. */
|
74
|
75
|
private String group;
|
75
|
76
|
|
76
|
|
- /**
|
|
77
|
+ /**
|
77
|
78
|
* Instantiates the panel.
|
78
|
|
- *
|
|
79
|
+ *
|
79
|
80
|
* @param window Parent window
|
80
|
81
|
* @param group Action's group
|
81
|
82
|
*/
|
|
@@ -83,9 +84,9 @@ public class ActionEditorDialog extends StandardDialog implements ActionListener
|
83
|
84
|
this(window, group, null);
|
84
|
85
|
}
|
85
|
86
|
|
86
|
|
- /**
|
|
87
|
+ /**
|
87
|
88
|
* Instantiates the panel.
|
88
|
|
- *
|
|
89
|
+ *
|
89
|
90
|
* @param window Parent window
|
90
|
91
|
* @param action Action to be edited
|
91
|
92
|
* @param group Action's group
|
|
@@ -103,13 +104,13 @@ public class ActionEditorDialog extends StandardDialog implements ActionListener
|
103
|
104
|
addListeners();
|
104
|
105
|
doComponents();
|
105
|
106
|
layoutComponents();
|
106
|
|
-
|
|
107
|
+
|
107
|
108
|
setResizable(false);
|
108
|
109
|
}
|
109
|
|
-
|
|
110
|
+
|
110
|
111
|
/**
|
111
|
112
|
* Is the dialog open?
|
112
|
|
- *
|
|
113
|
+ *
|
113
|
114
|
* @return is the dialog open
|
114
|
115
|
*/
|
115
|
116
|
public static boolean isOpen() {
|
|
@@ -118,9 +119,9 @@ public class ActionEditorDialog extends StandardDialog implements ActionListener
|
118
|
119
|
}
|
119
|
120
|
}
|
120
|
121
|
|
121
|
|
- /**
|
122
|
|
- * Creates the dialog if one doesn't exist, and displays it.
|
123
|
|
- *
|
|
122
|
+ /**
|
|
123
|
+ * Creates the dialog if one doesn't exist, and displays it.
|
|
124
|
+ *
|
124
|
125
|
* @param window Parent window
|
125
|
126
|
* @param group Action's group
|
126
|
127
|
*/
|
|
@@ -129,9 +130,9 @@ public class ActionEditorDialog extends StandardDialog implements ActionListener
|
129
|
130
|
showActionEditorDialog(window, group, null);
|
130
|
131
|
}
|
131
|
132
|
|
132
|
|
- /**
|
133
|
|
- * Creates the dialog if one doesn't exist, and displays it.
|
134
|
|
- *
|
|
133
|
+ /**
|
|
134
|
+ * Creates the dialog if one doesn't exist, and displays it.
|
|
135
|
+ *
|
135
|
136
|
* @param window Parent window
|
136
|
137
|
* @param group Action's group
|
137
|
138
|
* @param action Action to be edited
|
|
@@ -148,7 +149,7 @@ public class ActionEditorDialog extends StandardDialog implements ActionListener
|
148
|
149
|
*
|
149
|
150
|
* @param window Parent window
|
150
|
151
|
* @param group Action's group
|
151
|
|
- *
|
|
152
|
+ *
|
152
|
153
|
* @return The current ActionEditorDialog instance
|
153
|
154
|
*/
|
154
|
155
|
public static ActionEditorDialog getActionEditorDialog(final Window window,
|
|
@@ -158,7 +159,7 @@ public class ActionEditorDialog extends StandardDialog implements ActionListener
|
158
|
159
|
|
159
|
160
|
/**
|
160
|
161
|
* Returns the current instance of the ActionEditorDialog.
|
161
|
|
- *
|
|
162
|
+ *
|
162
|
163
|
* @param window Parent window
|
163
|
164
|
* @param group Action's group
|
164
|
165
|
* @param action Action to be edited
|
|
@@ -236,9 +237,9 @@ public class ActionEditorDialog extends StandardDialog implements ActionListener
|
236
|
237
|
add(getRightButton(), "right, sgx button");
|
237
|
238
|
}
|
238
|
239
|
|
239
|
|
- /**
|
|
240
|
+ /**
|
240
|
241
|
* @{inheritDoc}
|
241
|
|
- *
|
|
242
|
+ *
|
242
|
243
|
* @param e Action event
|
243
|
244
|
*/
|
244
|
245
|
@Override
|
|
@@ -247,7 +248,7 @@ public class ActionEditorDialog extends StandardDialog implements ActionListener
|
247
|
248
|
substitutions.setVisible(!substitutions.isVisible());
|
248
|
249
|
showSubstitutions.setText(substitutions.isVisible() ? "Hide Substitutions"
|
249
|
250
|
: "Show Substitutions");
|
250
|
|
- pack();
|
|
251
|
+ pack();
|
251
|
252
|
} else if (e.getSource().equals(getOkButton())) {
|
252
|
253
|
save();
|
253
|
254
|
dispose();
|
|
@@ -260,8 +261,15 @@ public class ActionEditorDialog extends StandardDialog implements ActionListener
|
260
|
261
|
@Override
|
261
|
262
|
public void validate() {
|
262
|
263
|
super.validate();
|
263
|
|
-
|
264
|
|
- centreOnOwner();
|
|
264
|
+
|
|
265
|
+ SwingUtilities.invokeLater(new Runnable() {
|
|
266
|
+
|
|
267
|
+ /** {@inheritDoc} */
|
|
268
|
+ @Override
|
|
269
|
+ public void run() {
|
|
270
|
+ centreOnOwner();
|
|
271
|
+ }
|
|
272
|
+ });
|
265
|
273
|
}
|
266
|
274
|
|
267
|
275
|
/** Saves the action being edited. */
|