|
@@ -55,6 +55,8 @@ import java.util.List;
|
55
|
55
|
import java.util.Set;
|
56
|
56
|
import java.util.concurrent.CopyOnWriteArrayList;
|
57
|
57
|
|
|
58
|
+import javax.annotation.Nullable;
|
|
59
|
+
|
58
|
60
|
import static com.google.common.base.Preconditions.checkState;
|
59
|
61
|
|
60
|
62
|
/**
|
|
@@ -72,7 +74,7 @@ public abstract class FrameContainer {
|
72
|
74
|
/** The children of this frame. */
|
73
|
75
|
private final Collection<FrameContainer> children = new CopyOnWriteArrayList<>();
|
74
|
76
|
/** The parent of this frame. */
|
75
|
|
- private FrameContainer parent;
|
|
77
|
+ private final FrameContainer parent;
|
76
|
78
|
/** The name of the icon being used for this container's frame. */
|
77
|
79
|
private String icon;
|
78
|
80
|
/** The name of this container. */
|
|
@@ -119,6 +121,7 @@ public abstract class FrameContainer {
|
119
|
121
|
/**
|
120
|
122
|
* Instantiate new frame container.
|
121
|
123
|
*
|
|
124
|
+ * @param parent The parent of this frame container, if any.
|
122
|
125
|
* @param icon The icon to use for this container
|
123
|
126
|
* @param name The name of this container
|
124
|
127
|
* @param title The title of this container
|
|
@@ -130,6 +133,7 @@ public abstract class FrameContainer {
|
130
|
133
|
* @since 0.6.4
|
131
|
134
|
*/
|
132
|
135
|
protected FrameContainer(
|
|
136
|
+ @Nullable final FrameContainer parent,
|
133
|
137
|
final String icon,
|
134
|
138
|
final String name,
|
135
|
139
|
final String title,
|
|
@@ -137,6 +141,7 @@ public abstract class FrameContainer {
|
137
|
141
|
final URLBuilder urlBuilder,
|
138
|
142
|
final EventBus eventBus,
|
139
|
143
|
final Collection<String> components) {
|
|
144
|
+ this.parent = parent;
|
140
|
145
|
this.configManager = config;
|
141
|
146
|
this.name = name;
|
142
|
147
|
this.title = title;
|
|
@@ -154,6 +159,7 @@ public abstract class FrameContainer {
|
154
|
159
|
/**
|
155
|
160
|
* Instantiate new frame container that accepts user input.
|
156
|
161
|
*
|
|
162
|
+ * @param parent The parent of this frame container, if any.
|
157
|
163
|
* @param icon The icon to use for this container
|
158
|
164
|
* @param name The name of this container
|
159
|
165
|
* @param title The title of this container
|
|
@@ -168,6 +174,7 @@ public abstract class FrameContainer {
|
168
|
174
|
* @since 0.6.4
|
169
|
175
|
*/
|
170
|
176
|
protected FrameContainer(
|
|
177
|
+ @Nullable final FrameContainer parent,
|
171
|
178
|
final String icon,
|
172
|
179
|
final String name,
|
173
|
180
|
final String title,
|
|
@@ -178,6 +185,7 @@ public abstract class FrameContainer {
|
178
|
185
|
final MessageSinkManager messageSinkManager,
|
179
|
186
|
final EventBus eventbus,
|
180
|
187
|
final Collection<String> components) {
|
|
188
|
+ this.parent = parent;
|
181
|
189
|
this.configManager = config;
|
182
|
190
|
this.name = name;
|
183
|
191
|
this.title = title;
|
|
@@ -241,7 +249,6 @@ public abstract class FrameContainer {
|
241
|
249
|
*/
|
242
|
250
|
public void addChild(final FrameContainer child) {
|
243
|
251
|
children.add(child);
|
244
|
|
- child.setParent(this);
|
245
|
252
|
}
|
246
|
253
|
|
247
|
254
|
/**
|
|
@@ -255,22 +262,6 @@ public abstract class FrameContainer {
|
255
|
262
|
children.remove(child);
|
256
|
263
|
}
|
257
|
264
|
|
258
|
|
- /**
|
259
|
|
- * Sets the parent of this container to the one specified. If this container already had a
|
260
|
|
- * parent, it will deregister itself with the old parent.
|
261
|
|
- *
|
262
|
|
- * @param parent The new parent for this container
|
263
|
|
- *
|
264
|
|
- * @since 0.6.4
|
265
|
|
- */
|
266
|
|
- public synchronized void setParent(final FrameContainer parent) {
|
267
|
|
- if (this.parent != null && (parent == null || !parent.equals(this.parent))) {
|
268
|
|
- this.parent.removeChild(this);
|
269
|
|
- }
|
270
|
|
-
|
271
|
|
- this.parent = parent;
|
272
|
|
- }
|
273
|
|
-
|
274
|
265
|
/**
|
275
|
266
|
* Gets an icon manager for this container.
|
276
|
267
|
*
|