|
@@ -0,0 +1,432 @@
|
|
1
|
+/*
|
|
2
|
+ * Copyright (c) 2006-2014 DMDirc Developers
|
|
3
|
+ *
|
|
4
|
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+ * of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+ * in the Software without restriction, including without limitation the rights
|
|
7
|
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+ * copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+ * furnished to do so, subject to the following conditions:
|
|
10
|
+ *
|
|
11
|
+ * The above copyright notice and this permission notice shall be included in
|
|
12
|
+ * all copies or substantial portions of the Software.
|
|
13
|
+ *
|
|
14
|
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+ * SOFTWARE.
|
|
21
|
+ */
|
|
22
|
+
|
|
23
|
+package com.dmdirc.ui.core.profiles;
|
|
24
|
+
|
|
25
|
+import com.dmdirc.actions.wrappers.Profile;
|
|
26
|
+import com.dmdirc.interfaces.config.ConfigProvider;
|
|
27
|
+import com.dmdirc.interfaces.config.IdentityController;
|
|
28
|
+import com.dmdirc.interfaces.config.IdentityFactory;
|
|
29
|
+import com.dmdirc.interfaces.ui.ProfilesDialogModel;
|
|
30
|
+import com.dmdirc.interfaces.ui.ProfilesDialogModelListener;
|
|
31
|
+import com.dmdirc.util.collections.ListenerList;
|
|
32
|
+import com.dmdirc.util.validators.ListNotEmptyValidator;
|
|
33
|
+import com.dmdirc.util.validators.NotEmptyValidator;
|
|
34
|
+import com.dmdirc.util.validators.PermissiveValidator;
|
|
35
|
+import com.dmdirc.util.validators.Validator;
|
|
36
|
+
|
|
37
|
+import com.google.common.base.Optional;
|
|
38
|
+import com.google.common.collect.ImmutableList;
|
|
39
|
+import com.google.common.collect.Lists;
|
|
40
|
+
|
|
41
|
+import java.io.IOException;
|
|
42
|
+import java.util.HashMap;
|
|
43
|
+import java.util.List;
|
|
44
|
+
|
|
45
|
+import javax.inject.Inject;
|
|
46
|
+
|
|
47
|
+import static com.google.common.base.Preconditions.checkArgument;
|
|
48
|
+import static com.google.common.base.Preconditions.checkNotNull;
|
|
49
|
+import static com.google.common.base.Preconditions.checkState;
|
|
50
|
+
|
|
51
|
+public class CoreProfilesDialogModel implements ProfilesDialogModel {
|
|
52
|
+
|
|
53
|
+ private final ListenerList listeners;
|
|
54
|
+ private final IdentityFactory identityFactory;
|
|
55
|
+ private final IdentityController identityController;
|
|
56
|
+ private HashMap<String, Profile> profiles;
|
|
57
|
+ private Optional<Profile> selectedProfile = Optional.absent();
|
|
58
|
+ private Optional<String> name = Optional.absent();
|
|
59
|
+ private Optional<List<String>> nicknames = Optional.absent();
|
|
60
|
+ private Optional<String> selectedNickname = Optional.absent();
|
|
61
|
+ private Optional<String> realname = Optional.absent();
|
|
62
|
+ private Optional<String> ident = Optional.absent();
|
|
63
|
+
|
|
64
|
+ @Inject
|
|
65
|
+ public CoreProfilesDialogModel(final IdentityController identityController,
|
|
66
|
+ final IdentityFactory identityFactory) {
|
|
67
|
+ this.identityFactory = identityFactory;
|
|
68
|
+ this.identityController = identityController;
|
|
69
|
+ listeners = new ListenerList();
|
|
70
|
+ final List<ConfigProvider> identities = identityController.getProvidersByType("profile");
|
|
71
|
+ for (ConfigProvider identity : identities) {
|
|
72
|
+ profiles.put(identity.getName(), getProfile(identity));
|
|
73
|
+ }
|
|
74
|
+ }
|
|
75
|
+
|
|
76
|
+ private Profile getProfile(final ConfigProvider configProvider) {
|
|
77
|
+ final Profile newProfile = new Profile(configProvider.getName(), identityFactory);
|
|
78
|
+ this.name = Optional.fromNullable(configProvider.getOption("identity", "name"));
|
|
79
|
+ this.nicknames = Optional.fromNullable(configProvider.getOptionList("profile", "nicknames"));
|
|
80
|
+ this.realname = Optional.fromNullable(configProvider.getOption("profile", "realname"));
|
|
81
|
+ this.ident = Optional.fromNullable(configProvider.getOption("profile", "ident"));
|
|
82
|
+ return newProfile;
|
|
83
|
+ }
|
|
84
|
+
|
|
85
|
+ @Override
|
|
86
|
+ public List<Profile> getProfileList() {
|
|
87
|
+ return ImmutableList.copyOf(profiles.values());
|
|
88
|
+ }
|
|
89
|
+
|
|
90
|
+ @Override
|
|
91
|
+ public Optional<Profile> getProfile(final String name) {
|
|
92
|
+ checkNotNull(name, "Name cannot be null");
|
|
93
|
+ return Optional.fromNullable(profiles.get(name));
|
|
94
|
+ }
|
|
95
|
+
|
|
96
|
+ @Override
|
|
97
|
+ public boolean isProfileListValid() {
|
|
98
|
+ return !getProfileListValidator().validate(getProfileList()).isFailure();
|
|
99
|
+ }
|
|
100
|
+
|
|
101
|
+ @Override
|
|
102
|
+ public Validator<List<Profile>> getProfileListValidator() {
|
|
103
|
+ return new ListNotEmptyValidator<Profile>();
|
|
104
|
+ }
|
|
105
|
+
|
|
106
|
+ @Override
|
|
107
|
+ public void addProfile(final String name, final String realname, final String ident,
|
|
108
|
+ final List<String> nicknames) {
|
|
109
|
+ checkNotNull(name, "Name cannot be null");
|
|
110
|
+ checkArgument(!profiles.containsKey(name), "Name cannot already exist");
|
|
111
|
+ final Profile profile = new Profile(name, identityFactory);
|
|
112
|
+ profile.setRealname(realname);
|
|
113
|
+ profile.setIdent(ident);
|
|
114
|
+ profile.setNicknames(Lists.newArrayList(nicknames));
|
|
115
|
+ profiles.put(name, profile);
|
|
116
|
+ listeners.getCallable(ProfilesDialogModelListener.class).profileAdded(profile);
|
|
117
|
+ }
|
|
118
|
+
|
|
119
|
+ @Override
|
|
120
|
+ public void editProfile(final String name, final String realname, final String ident,
|
|
121
|
+ final List<String> nicknames) {
|
|
122
|
+ checkNotNull(name, "Name cannot be null");
|
|
123
|
+ checkArgument(profiles.containsKey(name), "Name must already exist");
|
|
124
|
+ final Profile profile = profiles.get(name);
|
|
125
|
+ profile.setRealname(realname);
|
|
126
|
+ profile.setIdent(ident);
|
|
127
|
+ profile.setNicknames(Lists.newArrayList(nicknames));
|
|
128
|
+ listeners.getCallable(ProfilesDialogModelListener.class).profileEdited(profile, profile);
|
|
129
|
+ }
|
|
130
|
+
|
|
131
|
+ @Override
|
|
132
|
+ public void renameProfile(final String oldName, final String newName) {
|
|
133
|
+ renameProfile(oldName, newName, false);
|
|
134
|
+ }
|
|
135
|
+
|
|
136
|
+ public void renameProfile(final String oldName, final String newName, final boolean selection) {
|
|
137
|
+ checkNotNull(oldName, "Oldname cannot be null");
|
|
138
|
+ checkNotNull(newName, "Newname cannot be null");
|
|
139
|
+ checkArgument(profiles.containsKey(oldName), "Old name must exist");
|
|
140
|
+ checkArgument(!profiles.containsKey(newName), "New name must not exist");
|
|
141
|
+ final Profile profile = profiles.get(oldName);
|
|
142
|
+ final Profile newProfile = new Profile(newName, identityFactory);
|
|
143
|
+ profile.setRealname(profile.getRealname());
|
|
144
|
+ profile.setIdent(profile.getIdent());
|
|
145
|
+ profile.setNicknames(Lists.newArrayList(profile.getNicknames()));
|
|
146
|
+ final Profile oldProfile = profiles.remove(oldName);
|
|
147
|
+ profiles.put(newName, newProfile);
|
|
148
|
+ listeners.getCallable(ProfilesDialogModelListener.class).profileRenamed(oldProfile,
|
|
149
|
+ newProfile);
|
|
150
|
+ }
|
|
151
|
+
|
|
152
|
+ @Override
|
|
153
|
+ public void removeProfile(final String name) {
|
|
154
|
+ checkNotNull(name, "Name cannot be null");
|
|
155
|
+ checkArgument(profiles.containsKey(name), "profile must exist in list");
|
|
156
|
+ final Profile profile = profiles.remove(name);
|
|
157
|
+ if (getSelectedProfile().isPresent() && getSelectedProfile().get().equals(profile)) {
|
|
158
|
+ setSelectedProfile(Optional.<Profile>absent());
|
|
159
|
+ }
|
|
160
|
+ listeners.getCallable(ProfilesDialogModelListener.class).profileRemoved(profile);
|
|
161
|
+ }
|
|
162
|
+
|
|
163
|
+ @Override
|
|
164
|
+ public void save() {
|
|
165
|
+ setSelectedProfile(Optional.<Profile>absent());
|
|
166
|
+ final List<ConfigProvider> identities = identityController.getProvidersByType("profile");
|
|
167
|
+ for (ConfigProvider identity : identities) {
|
|
168
|
+ try {
|
|
169
|
+ identity.delete();
|
|
170
|
+ } catch (IOException ex) {
|
|
171
|
+ //Can't handle and will be dealt with when profiles are redone.
|
|
172
|
+ }
|
|
173
|
+ }
|
|
174
|
+ for (Profile profile : profiles.values()) {
|
|
175
|
+ profile.save();
|
|
176
|
+ }
|
|
177
|
+ }
|
|
178
|
+
|
|
179
|
+ @Override
|
|
180
|
+ public void setSelectedProfile(final Optional<Profile> profile) {
|
|
181
|
+ checkNotNull(profile, "profile cannot be null");
|
|
182
|
+ if (profile.isPresent()) {
|
|
183
|
+ checkArgument(profiles.containsValue(profile.get()), "Profile must exist in list");
|
|
184
|
+ }
|
|
185
|
+ if (selectedProfile.isPresent()) {
|
|
186
|
+ if (!Optional.fromNullable(selectedProfile.get().getRealname()).equals(realname)
|
|
187
|
+ || !Optional.fromNullable(selectedProfile.get()
|
|
188
|
+ .getIdent()).equals(ident)
|
|
189
|
+ || !Optional.fromNullable(selectedProfile.get()
|
|
190
|
+ .getNicknames()).equals(nicknames)) {
|
|
191
|
+ editProfile(selectedProfile.get().getName(), realname.get(),
|
|
192
|
+ ident.get(), nicknames.get());
|
|
193
|
+ }
|
|
194
|
+ if (!Optional.fromNullable(selectedProfile.get().getName()).equals(name)) {
|
|
195
|
+ renameProfile(selectedProfile.get().getName(), name.get(), true);
|
|
196
|
+ }
|
|
197
|
+ }
|
|
198
|
+ selectedProfile = profile;
|
|
199
|
+ if (selectedProfile.isPresent()) {
|
|
200
|
+ name = Optional.fromNullable(selectedProfile.get().getName());
|
|
201
|
+ realname = Optional.fromNullable(selectedProfile.get().getRealname());
|
|
202
|
+ ident = Optional.fromNullable(selectedProfile.get().getIdent());
|
|
203
|
+ nicknames = Optional.fromNullable(selectedProfile.get().getNicknames());
|
|
204
|
+ } else {
|
|
205
|
+ name = Optional.absent();
|
|
206
|
+ realname = Optional.absent();
|
|
207
|
+ ident = Optional.absent();
|
|
208
|
+ nicknames = Optional.absent();
|
|
209
|
+ }
|
|
210
|
+ listeners.getCallable(ProfilesDialogModelListener.class).profileSelectionChanged(profile);
|
|
211
|
+ }
|
|
212
|
+
|
|
213
|
+ @Override
|
|
214
|
+ public Optional<Profile> getSelectedProfile() {
|
|
215
|
+ return selectedProfile;
|
|
216
|
+ }
|
|
217
|
+
|
|
218
|
+ @Override
|
|
219
|
+ public Optional<String> getSelectedProfileName() {
|
|
220
|
+ if (selectedProfile.isPresent()) {
|
|
221
|
+ return name;
|
|
222
|
+ }
|
|
223
|
+ return Optional.absent();
|
|
224
|
+ }
|
|
225
|
+
|
|
226
|
+ @Override
|
|
227
|
+ public void setSelectedProfileName(final Optional<String> name) {
|
|
228
|
+ checkNotNull(name, "Name cannot be null");
|
|
229
|
+ checkState(selectedProfile.isPresent(), "There must be a profile selected");
|
|
230
|
+ this.name = name;
|
|
231
|
+ listeners.getCallable(ProfilesDialogModelListener.class)
|
|
232
|
+ .selectedProfileEdited(name.get(), realname.get(), ident.get(), nicknames.get());
|
|
233
|
+ }
|
|
234
|
+
|
|
235
|
+ @Override
|
|
236
|
+ public Validator<String> getSelectedProfileNameValidator() {
|
|
237
|
+ return new EditSelectedProfileNameValidator(this);
|
|
238
|
+ }
|
|
239
|
+
|
|
240
|
+ @Override
|
|
241
|
+ public Validator<String> getNewProfileNameValidator() {
|
|
242
|
+ return new NewProfileNameValidator(this);
|
|
243
|
+ }
|
|
244
|
+
|
|
245
|
+ @Override
|
|
246
|
+ public boolean isSelectedProfileNameValid() {
|
|
247
|
+ if (getSelectedProfileName().isPresent()) {
|
|
248
|
+ return !getSelectedProfileNameValidator()
|
|
249
|
+ .validate(getSelectedProfileName().get()).isFailure();
|
|
250
|
+ }
|
|
251
|
+ return true;
|
|
252
|
+ }
|
|
253
|
+
|
|
254
|
+ @Override
|
|
255
|
+ public Optional<String> getSelectedProfileRealname() {
|
|
256
|
+ if (selectedProfile.isPresent()) {
|
|
257
|
+ return realname;
|
|
258
|
+ }
|
|
259
|
+ return Optional.absent();
|
|
260
|
+ }
|
|
261
|
+
|
|
262
|
+ @Override
|
|
263
|
+ public void setSelectedProfileRealname(final Optional<String> realname) {
|
|
264
|
+ checkNotNull(realname, "Realname cannot be null");
|
|
265
|
+ checkState(selectedProfile.isPresent(), "There must be a profile selected");
|
|
266
|
+ this.realname = realname;
|
|
267
|
+ listeners.getCallable(ProfilesDialogModelListener.class)
|
|
268
|
+ .selectedProfileEdited(name.get(), realname.get(), ident.get(), nicknames.get());
|
|
269
|
+ }
|
|
270
|
+
|
|
271
|
+ @Override
|
|
272
|
+ public Validator<String> getSelectedProfileRealnameValidator() {
|
|
273
|
+ return new NotEmptyValidator();
|
|
274
|
+ }
|
|
275
|
+
|
|
276
|
+ @Override
|
|
277
|
+ public boolean isSelectedProfileRealnameValid() {
|
|
278
|
+ if (getSelectedProfileRealname().isPresent()) {
|
|
279
|
+ return !getSelectedProfileRealnameValidator()
|
|
280
|
+ .validate(getSelectedProfileRealname().get()).isFailure();
|
|
281
|
+ }
|
|
282
|
+ return true;
|
|
283
|
+ }
|
|
284
|
+
|
|
285
|
+ @Override
|
|
286
|
+ public Optional<String> getSelectedProfileIdent() {
|
|
287
|
+ if (selectedProfile.isPresent()) {
|
|
288
|
+ return ident;
|
|
289
|
+ }
|
|
290
|
+ return Optional.absent();
|
|
291
|
+ }
|
|
292
|
+
|
|
293
|
+ @Override
|
|
294
|
+ public void setSelectedProfileIdent(final Optional<String> ident) {
|
|
295
|
+ checkNotNull(ident, "Ident cannot be null");
|
|
296
|
+ checkState(selectedProfile.isPresent(), "There must be a profile selected");
|
|
297
|
+ this.ident = ident;
|
|
298
|
+ listeners.getCallable(ProfilesDialogModelListener.class)
|
|
299
|
+ .selectedProfileEdited(name.get(), realname.get(), ident.get(), nicknames.get());
|
|
300
|
+ }
|
|
301
|
+
|
|
302
|
+ @Override
|
|
303
|
+ public Validator<String> getSelectedProfileIdentValidator() {
|
|
304
|
+ return new PermissiveValidator<>();
|
|
305
|
+ }
|
|
306
|
+
|
|
307
|
+ @Override
|
|
308
|
+ public boolean isSelectedProfileIdentValid() {
|
|
309
|
+ if (getSelectedProfileIdent().isPresent()) {
|
|
310
|
+ return !getSelectedProfileIdentValidator()
|
|
311
|
+ .validate(getSelectedProfileIdent().get()).isFailure();
|
|
312
|
+ }
|
|
313
|
+ return true;
|
|
314
|
+ }
|
|
315
|
+
|
|
316
|
+ @Override
|
|
317
|
+ public Optional<List<String>> getSelectedProfileNicknames() {
|
|
318
|
+ if (selectedProfile.isPresent()) {
|
|
319
|
+ return nicknames;
|
|
320
|
+ }
|
|
321
|
+ return Optional.absent();
|
|
322
|
+ }
|
|
323
|
+
|
|
324
|
+ @Override
|
|
325
|
+ public void setSelectedProfileNicknames(final Optional<List<String>> nicknames) {
|
|
326
|
+ checkNotNull(nicknames, "nicknames cannot be null");
|
|
327
|
+ checkState(selectedProfile.isPresent(), "There must be a profile selected");
|
|
328
|
+ if (nicknames.isPresent()) {
|
|
329
|
+ this.nicknames = nicknames;
|
|
330
|
+ } else {
|
|
331
|
+ this.nicknames = Optional.fromNullable((List<String>) Lists.
|
|
332
|
+ newArrayList(nicknames.get()));
|
|
333
|
+ }
|
|
334
|
+ listeners.getCallable(ProfilesDialogModelListener.class)
|
|
335
|
+ .selectedProfileEdited(name.get(), realname.get(), ident.get(), nicknames.get());
|
|
336
|
+ }
|
|
337
|
+
|
|
338
|
+ @Override
|
|
339
|
+ public Validator<List<String>> getSelectedProfileNicknamesValidator() {
|
|
340
|
+ return new ListNotEmptyValidator<String>();
|
|
341
|
+ }
|
|
342
|
+
|
|
343
|
+ @Override
|
|
344
|
+ public boolean isSelectedProfileNicknamesValid() {
|
|
345
|
+ if (getSelectedProfileNicknames().isPresent()) {
|
|
346
|
+ return !getSelectedProfileNicknamesValidator()
|
|
347
|
+ .validate(getSelectedProfileNicknames().get()).isFailure();
|
|
348
|
+ }
|
|
349
|
+ return true;
|
|
350
|
+ }
|
|
351
|
+
|
|
352
|
+ @Override
|
|
353
|
+ public void addSelectedProfileNickname(final String nickname) {
|
|
354
|
+ checkNotNull(nickname, "Nickname cannot be null");
|
|
355
|
+ checkState(selectedProfile.isPresent(), "There must be a profile selected");
|
|
356
|
+ checkState(nicknames.isPresent(), "There must be nicknames present");
|
|
357
|
+ checkArgument(!nicknames.get().contains(nickname), "New nickname must not exist");
|
|
358
|
+ nicknames.get().add(nickname);
|
|
359
|
+ listeners.getCallable(ProfilesDialogModelListener.class).selectedProfileNicknameAdded(
|
|
360
|
+ nickname);
|
|
361
|
+ }
|
|
362
|
+
|
|
363
|
+ @Override
|
|
364
|
+ public void removeSelectedProfileNickname(final String nickname) {
|
|
365
|
+ checkNotNull(nickname, "Nickname cannot be null");
|
|
366
|
+ checkState(selectedProfile.isPresent(), "There must be a profile selected");
|
|
367
|
+ checkState(nicknames.isPresent(), "There must be nicknames present");
|
|
368
|
+ checkArgument(nicknames.get().contains(nickname), "Nickname must exist");
|
|
369
|
+ nicknames.get().add(nickname);
|
|
370
|
+ listeners.getCallable(ProfilesDialogModelListener.class).selectedProfileNicknameRemoved(
|
|
371
|
+ nickname);
|
|
372
|
+ }
|
|
373
|
+
|
|
374
|
+ @Override
|
|
375
|
+ public Validator<String> getSelectedProfileAddNicknameValidator() {
|
|
376
|
+ return new AddNicknameValidator(this);
|
|
377
|
+ }
|
|
378
|
+
|
|
379
|
+ @Override
|
|
380
|
+ public void editSelectedProfileNickname(final String oldName, final String newName) {
|
|
381
|
+ checkNotNull(oldName, "Nickname cannot be null");
|
|
382
|
+ checkNotNull(newName, "Nickname cannot be null");
|
|
383
|
+ checkState(selectedProfile.isPresent(), "There must be a profile selected");
|
|
384
|
+ checkState(nicknames.isPresent(), "There must be nicknames present");
|
|
385
|
+ checkArgument(nicknames.get().contains(oldName), "Old nickname must exist");
|
|
386
|
+ checkArgument(!nicknames.get().contains(newName), "New nickname must not exist");
|
|
387
|
+ final int index = nicknames.get().indexOf(oldName);
|
|
388
|
+ nicknames.get().set(index, newName);
|
|
389
|
+ listeners.getCallable(ProfilesDialogModelListener.class).selectedProfileNicknameEdited(
|
|
390
|
+ oldName, newName);
|
|
391
|
+ }
|
|
392
|
+
|
|
393
|
+ @Override
|
|
394
|
+ public Validator<String> getSelectedProfileEditNicknameValidator() {
|
|
395
|
+ return new EditSelectedNicknameValidator(this);
|
|
396
|
+ }
|
|
397
|
+
|
|
398
|
+ @Override
|
|
399
|
+ public Optional<String> getSelectedProfileSelectedNickname() {
|
|
400
|
+ if (selectedProfile.isPresent()) {
|
|
401
|
+ return selectedNickname;
|
|
402
|
+ }
|
|
403
|
+ return Optional.absent();
|
|
404
|
+ }
|
|
405
|
+
|
|
406
|
+ @Override
|
|
407
|
+ public void setSelectedProfileSelectedNickname(final Optional<String> selectedNickname) {
|
|
408
|
+ checkNotNull(selectedNickname, "Nickname cannot be null");
|
|
409
|
+ checkState(selectedProfile.isPresent(), "There must be a profile selected");
|
|
410
|
+ checkState(nicknames.isPresent(), "There must be nicknames present");
|
|
411
|
+ if (selectedNickname.isPresent()) {
|
|
412
|
+ checkArgument(nicknames.get().contains(selectedNickname.get()),
|
|
413
|
+ "Nickname must exist in nicknames list");
|
|
414
|
+ }
|
|
415
|
+ this.selectedNickname = selectedNickname;
|
|
416
|
+ listeners.getCallable(ProfilesDialogModelListener.class)
|
|
417
|
+ .selectedNicknameChanged(selectedNickname);
|
|
418
|
+ }
|
|
419
|
+
|
|
420
|
+ @Override
|
|
421
|
+ public void addListener(final ProfilesDialogModelListener listener) {
|
|
422
|
+ checkNotNull(listener, "Listener must not be null");
|
|
423
|
+ listeners.add(ProfilesDialogModelListener.class, listener);
|
|
424
|
+ }
|
|
425
|
+
|
|
426
|
+ @Override
|
|
427
|
+ public void removeListener(final ProfilesDialogModelListener listener) {
|
|
428
|
+ checkNotNull(listener, "Listener must not be null");
|
|
429
|
+ listeners.remove(ProfilesDialogModelListener.class, listener);
|
|
430
|
+ }
|
|
431
|
+
|
|
432
|
+}
|