1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.taxeditor.ui.section.reference;
|
10
|
|
11
|
import java.util.ArrayList;
|
12
|
import java.util.Arrays;
|
13
|
import java.util.List;
|
14
|
|
15
|
import org.eclipse.swt.SWT;
|
16
|
import org.joda.time.DateTime;
|
17
|
|
18
|
import eu.etaxonomy.cdm.model.agent.Institution;
|
19
|
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
|
20
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
21
|
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
|
22
|
import eu.etaxonomy.cdm.model.reference.ReferenceType;
|
23
|
import eu.etaxonomy.taxeditor.store.StoreUtil;
|
24
|
import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
|
25
|
import eu.etaxonomy.taxeditor.ui.element.CacheRelevance;
|
26
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
27
|
import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent;
|
28
|
import eu.etaxonomy.taxeditor.ui.element.DoiWithLabelElement;
|
29
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
30
|
import eu.etaxonomy.taxeditor.ui.element.IErrorIntolerableElement;
|
31
|
import eu.etaxonomy.taxeditor.ui.element.IExceptionHandler;
|
32
|
import eu.etaxonomy.taxeditor.ui.element.LsidWithExceptionLabelElement;
|
33
|
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
|
34
|
import eu.etaxonomy.taxeditor.ui.element.ToggleableTextElement;
|
35
|
import eu.etaxonomy.taxeditor.ui.element.UriWithLabelElement;
|
36
|
import eu.etaxonomy.taxeditor.ui.element.VerbatimTimePeriodElement;
|
37
|
import eu.etaxonomy.taxeditor.ui.mvc.element.DateElement;
|
38
|
import eu.etaxonomy.taxeditor.ui.section.AbstractIdentifiableEntityDetailElement;
|
39
|
import eu.etaxonomy.taxeditor.ui.section.common.ExternalLinksSection;
|
40
|
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
|
41
|
|
42
|
/**
|
43
|
* ReferenceBaseDetailElement class.
|
44
|
*
|
45
|
* @author n.hoffmann
|
46
|
* @created Mar 2, 2010
|
47
|
*/
|
48
|
public class ReferenceDetailElement extends AbstractIdentifiableEntityDetailElement<Reference>
|
49
|
implements IErrorIntolerableElement, IExceptionHandler {
|
50
|
|
51
|
private ToggleableTextElement toggleableAbbrevCache;
|
52
|
|
53
|
private TextWithLabelElement text_edition;
|
54
|
private TextWithLabelElement text_editor;
|
55
|
private TextWithLabelElement text_isbn;
|
56
|
private TextWithLabelElement text_issn;
|
57
|
private TextWithLabelElement text_organisation;
|
58
|
private TextWithLabelElement text_pages;
|
59
|
private TextWithLabelElement text_placePublished;
|
60
|
private TextWithLabelElement text_publisher;
|
61
|
private TextWithLabelElement text_referenceAbstract;
|
62
|
private TextWithLabelElement text_series;
|
63
|
// private TextWithLabelElement text_seriesPart;
|
64
|
private TextWithLabelElement text_volume;
|
65
|
private TextWithLabelElement text_abbrevTitle;
|
66
|
private TextWithLabelElement text_title;
|
67
|
private DoiWithLabelElement text_doi;
|
68
|
private UriWithLabelElement text_uri;
|
69
|
private LsidWithExceptionLabelElement text_lsid;
|
70
|
private DateElement text_accessed;
|
71
|
private EntitySelectionElement<TeamOrPersonBase> selection_authorTeam;
|
72
|
private VerbatimTimePeriodElement element_timePeriod;
|
73
|
private EntitySelectionElement<Reference> selection_inReference;
|
74
|
private EntitySelectionElement<Institution> selection_institution;
|
75
|
private EnumComboElement<ReferenceType> combo_referenceType;
|
76
|
private ExternalLinksSection externalLinks;
|
77
|
private EntitySelectionElement<Reference> selection_inSeries;
|
78
|
|
79
|
private void registerCacheElements() {
|
80
|
registerCacheRelevance(text_edition, toggleable_cache, toggleableAbbrevCache);
|
81
|
registerCacheRelevance(text_pages, toggleable_cache);
|
82
|
registerCacheRelevance(text_series, toggleable_cache, toggleableAbbrevCache);
|
83
|
registerCacheRelevance(text_volume, toggleable_cache, toggleableAbbrevCache);
|
84
|
registerCacheRelevance(text_abbrevTitle, toggleableAbbrevCache);
|
85
|
registerCacheRelevance(text_title, toggleable_cache);
|
86
|
registerCacheRelevance(text_accessed, toggleable_cache, toggleableAbbrevCache);
|
87
|
registerCacheRelevance(selection_authorTeam, toggleable_cache, toggleableAbbrevCache);
|
88
|
registerCacheRelevance(element_timePeriod, toggleable_cache, toggleableAbbrevCache);
|
89
|
registerCacheRelevance(selection_inReference, toggleable_cache, toggleableAbbrevCache);
|
90
|
registerCacheRelevance(combo_referenceType, toggleable_cache, toggleableAbbrevCache);
|
91
|
}
|
92
|
|
93
|
/**
|
94
|
* Constructor for ReferenceBaseDetailElement.
|
95
|
*/
|
96
|
public ReferenceDetailElement(CdmFormFactory cdmFormFactory,
|
97
|
ICdmFormElement formElement, int style) {
|
98
|
super(cdmFormFactory, formElement);
|
99
|
}
|
100
|
|
101
|
@Override
|
102
|
protected void createControls(ICdmFormElement formElement,
|
103
|
Reference entity, int style) {
|
104
|
setWarnForReferencingObjects(formElement);
|
105
|
toggleable_cache = formFactory.createToggleableTextField(formElement,
|
106
|
"Reference Cache", entity.getTitleCache(),
|
107
|
entity.isProtectedTitleCache(), style);
|
108
|
|
109
|
toggleableAbbrevCache = formFactory.createToggleableTextField(formElement,
|
110
|
"Nomencl. Cache", entity.getAbbrevTitleCache(),
|
111
|
entity.isProtectedAbbrevTitleCache(), CacheRelevance.CACHE2, style);
|
112
|
|
113
|
combo_referenceType = formFactory.createEnumComboElement(ReferenceType.class,
|
114
|
formElement, style);
|
115
|
|
116
|
combo_referenceType.setSelection(entity.getType());
|
117
|
|
118
|
// title
|
119
|
text_title = formFactory.createMultiLineTextWithLabel(formElement,
|
120
|
"Title", 60, style);
|
121
|
text_title.setText(entity.getTitle());
|
122
|
// abbreviated title
|
123
|
text_abbrevTitle = formFactory.createTextWithLabelElement(formElement,
|
124
|
"Nomencl. Title", entity.getAbbrevTitle(), style);
|
125
|
ReferenceType referenceType = entity.getType();
|
126
|
// author team
|
127
|
if(referenceType != null && !referenceType.equals(ReferenceType.Journal) && !referenceType.equals(ReferenceType.PrintSeries) ) {
|
128
|
selection_authorTeam = formFactory
|
129
|
.createSelectionElement(TeamOrPersonBase.class,
|
130
|
formElement, "Author",
|
131
|
entity.getAuthorship(),
|
132
|
EntitySelectionElement.ALL, style);
|
133
|
}
|
134
|
|
135
|
if (referenceType != null) {
|
136
|
|
137
|
createInReferenceByType(this, referenceType, entity, SWT.NULL);
|
138
|
|
139
|
if (referenceType.equals(ReferenceType.Generic)) {
|
140
|
createGenericControls(this, entity, SWT.NULL);
|
141
|
createPublicationControls(this, referenceType, entity, SWT.NULL);
|
142
|
|
143
|
} else {
|
144
|
if (referenceType.isPrintedUnit()) {
|
145
|
createPrintedUnitControls(this, referenceType, entity,
|
146
|
SWT.NULL);
|
147
|
}
|
148
|
// if (referenceType.equals(ReferenceType.Proceedings)) {
|
149
|
// text_isbn = formFactory.createTextWithLabelElement(this, "ISBN",
|
150
|
// entity.getIsbn(), style);
|
151
|
// }
|
152
|
if (referenceType.isPublication()) {
|
153
|
createPublicationControls(this, referenceType, entity,
|
154
|
SWT.NULL);
|
155
|
}
|
156
|
if (referenceType.isVolumeReference()) {
|
157
|
createVolumeControls(this, entity, SWT.NULL);
|
158
|
}
|
159
|
if (referenceType.isSection()) {
|
160
|
createSectionControls(this, entity, SWT.NULL);
|
161
|
}
|
162
|
}
|
163
|
}
|
164
|
|
165
|
// date published
|
166
|
if(referenceType != null && !referenceType.equals(ReferenceType.Journal) && !referenceType.equals(ReferenceType.PrintSeries)){
|
167
|
element_timePeriod = formFactory.createVerbatimTimePeriodElement(formElement,
|
168
|
"Date Published", entity.getDatePublished(), style);
|
169
|
}
|
170
|
|
171
|
createUri(this, entity, SWT.NULL);
|
172
|
|
173
|
// externalLinks = formFactory.createExternalLinksSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(ExternalLinksSection.class, DescriptionElementSource.class.getCanonicalName()));
|
174
|
// externalLinks.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 3));
|
175
|
// externalLinks.setEntity(entity);
|
176
|
// externalLinks.setFont(AbstractUtility.getFont(Resources.COLOR_FONT_DEFAULT));
|
177
|
// externalLinks.setEmptySectionString("No links yet.");
|
178
|
|
179
|
if(referenceType != null && (!referenceType.equals(ReferenceType.Journal) && !referenceType.equals(ReferenceType.PrintSeries) && !referenceType.equals(ReferenceType.PersonalCommunication))) {
|
180
|
text_doi = formFactory.createDoiWithLabelElement(formElement, "DOI", entity.getDoi(), style);
|
181
|
}
|
182
|
|
183
|
createLsid(this, entity, SWT.NULL);
|
184
|
createAbstract(this, entity, SWT.NULL);
|
185
|
|
186
|
registerCacheElements();
|
187
|
|
188
|
handleToggleableAbbrevTitleField();
|
189
|
handleToggleableCacheField();
|
190
|
|
191
|
}
|
192
|
|
193
|
private void createWebPageControls(ReferenceDetailElement referenceDetailElement, Reference reference, int style) {
|
194
|
DateTime accessed = reference.getAccessed();
|
195
|
|
196
|
text_accessed = formFactory.createDateElement(referenceDetailElement, "Accessed", accessed, style, false);
|
197
|
}
|
198
|
|
199
|
@Override
|
200
|
protected void updateContent() {
|
201
|
if (getEntity() == null) {
|
202
|
setEntity(ReferenceFactory.newGeneric());
|
203
|
}
|
204
|
|
205
|
super.updateContent();
|
206
|
|
207
|
// enable elements according to state of cache protection
|
208
|
toggleable_cache.setCacheEnabled(getEntity().isProtectedTitleCache());
|
209
|
toggleableAbbrevCache.setCacheEnabled(getEntity().isProtectedAbbrevTitleCache());
|
210
|
}
|
211
|
|
212
|
/**
|
213
|
* Creates an in reference for reference types that do hav this.
|
214
|
*/
|
215
|
private void createInReferenceByType(ICdmFormElement element,
|
216
|
ReferenceType referenceType, Reference reference, int style) {
|
217
|
|
218
|
String label;
|
219
|
|
220
|
switch (referenceType) {
|
221
|
case Book:
|
222
|
case Proceedings:
|
223
|
label = "In Series";
|
224
|
break;
|
225
|
case BookSection:
|
226
|
label = "Book";
|
227
|
break;
|
228
|
case InProceedings:
|
229
|
label = "Proceedings";
|
230
|
break;
|
231
|
case Article:
|
232
|
label = "Journal";
|
233
|
break;
|
234
|
default:
|
235
|
label = "In Reference";
|
236
|
}
|
237
|
|
238
|
boolean createInReferenceWidget = !ReferenceType.inReferenceContraints(referenceType).isEmpty();
|
239
|
|
240
|
if (createInReferenceWidget) {
|
241
|
selection_inReference = formFactory
|
242
|
.createSelectionElement(Reference.class,
|
243
|
element, label,
|
244
|
reference.getInReference(),
|
245
|
EntitySelectionElement.ALL, style);
|
246
|
}
|
247
|
}
|
248
|
|
249
|
/**
|
250
|
* Creates additional controls to edit a generic reference
|
251
|
*/
|
252
|
private void createGenericControls(ICdmFormElement element,
|
253
|
Reference reference, int style) {
|
254
|
|
255
|
// editor
|
256
|
text_editor = formFactory.createTextWithLabelElement(element, "Editor",
|
257
|
reference.getEditor(), style);
|
258
|
|
259
|
// series
|
260
|
text_series = formFactory.createTextWithLabelElement(element, "Series",
|
261
|
reference.getSeriesPart(), style);
|
262
|
|
263
|
// volume
|
264
|
text_volume = formFactory.createTextWithLabelElement(element, "Volume",
|
265
|
reference.getVolume(), style);
|
266
|
|
267
|
// pages
|
268
|
text_pages = formFactory.createTextWithLabelElement(element, "Pages",
|
269
|
reference.getPages(), style);
|
270
|
}
|
271
|
|
272
|
/**
|
273
|
* Creates additional controls to edit a publication
|
274
|
*/
|
275
|
private void createPublicationControls(ICdmFormElement element,
|
276
|
ReferenceType referenceType, Reference reference, int style) {
|
277
|
|
278
|
// placePublished
|
279
|
text_placePublished = formFactory.createTextWithLabelElement(element,
|
280
|
"Place Published", reference.getPlacePublished(), style);
|
281
|
|
282
|
// publisher
|
283
|
text_publisher = formFactory.createTextWithLabelElement(element,
|
284
|
"Publisher", reference.getPublisher(), style);
|
285
|
|
286
|
if (referenceType.equals(ReferenceType.Journal)) {
|
287
|
// issn
|
288
|
text_issn = formFactory.createTextWithLabelElement(element, "ISSN",
|
289
|
reference.getIssn(), style);
|
290
|
}
|
291
|
|
292
|
if (referenceType.equals(ReferenceType.Report)) {
|
293
|
// institution
|
294
|
selection_institution = formFactory
|
295
|
.createSelectionElement(Institution.class,//getConversationHolder(),
|
296
|
element, "Institution",
|
297
|
reference.getInstitution(),
|
298
|
EntitySelectionElement.ALL, style);
|
299
|
}
|
300
|
|
301
|
if (referenceType.equals(ReferenceType.Thesis)) {
|
302
|
// school
|
303
|
selection_institution = formFactory
|
304
|
.createSelectionElement(Institution.class,
|
305
|
element, "School",
|
306
|
reference.getSchool(),
|
307
|
EntitySelectionElement.ALL, style);
|
308
|
}
|
309
|
|
310
|
if (referenceType.equals(ReferenceType.Proceedings)) {
|
311
|
// organization
|
312
|
text_organisation = formFactory.createTextWithLabelElement(element,
|
313
|
"Organisation", reference.getOrganization(), style);
|
314
|
}
|
315
|
}
|
316
|
|
317
|
/**
|
318
|
* Creates additional controls to edit a section
|
319
|
*/
|
320
|
private void createSectionControls(ICdmFormElement element,
|
321
|
Reference reference, int style) {
|
322
|
// pages
|
323
|
text_pages = formFactory.createTextWithLabelElement(element, "Pages",
|
324
|
reference.getPages(), style);
|
325
|
}
|
326
|
|
327
|
/**
|
328
|
* Creates additional controls to edit a volume
|
329
|
*/
|
330
|
private void createVolumeControls(ICdmFormElement element,
|
331
|
Reference reference, int style) {
|
332
|
|
333
|
text_volume = formFactory.createTextWithLabelElement(element, "Volume",
|
334
|
reference.getVolume(), style);
|
335
|
|
336
|
text_series = formFactory.createTextWithLabelElement(element, "Series",
|
337
|
reference.getSeriesPart(), style);
|
338
|
}
|
339
|
|
340
|
private void createPrintedUnitControls(ICdmFormElement element,
|
341
|
ReferenceType referenceType, Reference reference, int style) {
|
342
|
// in series
|
343
|
//handled in generic in-Reference part
|
344
|
|
345
|
// editor
|
346
|
text_editor = formFactory.createTextWithLabelElement(element, "Editor",
|
347
|
reference.getEditor(), style);
|
348
|
|
349
|
/* series part
|
350
|
text_seriesPart = formFactory.createTextWithLabelElement(element,
|
351
|
"Series", reference.getSeriesPart(), style);
|
352
|
*/
|
353
|
if (referenceType.equals(ReferenceType.Book)) {
|
354
|
// edition
|
355
|
text_edition = formFactory.createTextWithLabelElement(element,
|
356
|
"Edition", reference.getEdition(), style);
|
357
|
}
|
358
|
|
359
|
// isbn
|
360
|
text_isbn = formFactory.createTextWithLabelElement(element, "ISBN",
|
361
|
reference.getIsbn(), style);
|
362
|
}
|
363
|
|
364
|
private void createAbstract(ICdmFormElement element,
|
365
|
Reference reference, int style) {
|
366
|
|
367
|
text_referenceAbstract = formFactory.createMultiLineTextWithLabel(
|
368
|
element, "Reference Abstract", 100, style);
|
369
|
text_referenceAbstract.setText(reference.getReferenceAbstract());
|
370
|
}
|
371
|
|
372
|
private void createLsid(ICdmFormElement element,
|
373
|
Reference reference, int style) {
|
374
|
text_lsid = formFactory.createLsidWithExceptionLabelElement(element, "LSID",
|
375
|
reference.getLsid(), style);
|
376
|
}
|
377
|
|
378
|
private void createUri(ICdmFormElement element,
|
379
|
Reference reference, int style) {
|
380
|
|
381
|
text_uri = formFactory.createUriWithLabelElement(element, "URI",
|
382
|
reference.getUri(), style);
|
383
|
if (reference.getType().equals(ReferenceType.WebPage)){
|
384
|
createWebPageControls(this, reference, style);
|
385
|
}
|
386
|
}
|
387
|
|
388
|
@Override
|
389
|
public void handleEvent(Object eventSource) {
|
390
|
if (eventSource == combo_referenceType) {
|
391
|
getEntity().setType(combo_referenceType.getSelection());
|
392
|
updateContent();
|
393
|
//this is needed for the "new" wizards in order to redraw correctly
|
394
|
StoreUtil.reflowParentScrolledForm(getLayoutComposite(), true);
|
395
|
} else if (eventSource == element_timePeriod) {
|
396
|
getEntity().setDatePublished(element_timePeriod.getTimePeriod());
|
397
|
clearException();
|
398
|
}
|
399
|
// selections
|
400
|
else if (eventSource == selection_authorTeam) {
|
401
|
getEntity().setAuthorship(
|
402
|
selection_authorTeam.getEntity());
|
403
|
} else if (eventSource == selection_inReference) {
|
404
|
getEntity().setInReference(selection_inReference.getSelection());
|
405
|
} else if (eventSource == selection_inSeries) {
|
406
|
getEntity().setInReference(selection_inSeries.getSelection());
|
407
|
} else if (eventSource == selection_institution) {
|
408
|
getEntity().setInstitution(selection_institution.getSelection());
|
409
|
}
|
410
|
|
411
|
// textfields
|
412
|
else if (eventSource == toggleable_cache) {
|
413
|
handleToggleableCacheField();
|
414
|
}
|
415
|
else if (eventSource == toggleableAbbrevCache) {
|
416
|
handleToggleableAbbrevTitleField();
|
417
|
} else if (eventSource == text_edition) {
|
418
|
getEntity().setEdition(text_edition.getText());
|
419
|
} else if (eventSource == text_editor) {
|
420
|
getEntity().setEditor(text_editor.getText());
|
421
|
} else if (eventSource == text_isbn) {
|
422
|
getEntity().setIsbn(text_isbn.getText());
|
423
|
} else if (eventSource == text_issn) {
|
424
|
getEntity().setIssn(text_issn.getText());
|
425
|
} else if (eventSource == text_organisation) {
|
426
|
getEntity().setOrganization(text_organisation.getText());
|
427
|
} else if (eventSource == text_pages) {
|
428
|
getEntity().setPages(text_pages.getText());
|
429
|
} else if (eventSource == text_placePublished) {
|
430
|
getEntity().setPlacePublished(text_placePublished.getText());
|
431
|
} else if (eventSource == text_publisher) {
|
432
|
getEntity().setPublisher(text_publisher.getText());
|
433
|
} else if (eventSource == text_referenceAbstract) {
|
434
|
getEntity().setReferenceAbstract(text_referenceAbstract.getText());
|
435
|
} else if (eventSource == text_series) {
|
436
|
getEntity().setSeriesPart(text_series.getText());
|
437
|
} else if (eventSource == text_title ) {
|
438
|
getEntity().setTitle(text_title.getText());
|
439
|
if (!toggleable_cache.isCacheEnabled()){
|
440
|
toggleable_cache.setText(getEntity().generateTitle());
|
441
|
}
|
442
|
} else if (eventSource == text_abbrevTitle ) {
|
443
|
getEntity().setAbbrevTitle(text_abbrevTitle.getText());
|
444
|
if (!toggleableAbbrevCache.isCacheEnabled()){
|
445
|
toggleableAbbrevCache.setText(getEntity().generateAbbrevTitle());
|
446
|
}
|
447
|
} else if (eventSource == text_uri) {
|
448
|
getEntity().setUri(text_uri.parseText());
|
449
|
} else if (eventSource == text_lsid) {
|
450
|
getEntity().setLsid(text_lsid.parseText());
|
451
|
} else if (eventSource == text_volume) {
|
452
|
getEntity().setVolume(text_volume.getText());
|
453
|
}else if (eventSource == text_doi) {
|
454
|
getEntity().setDoi(text_doi.parseText());
|
455
|
}else if (text_accessed != null && eventSource == text_accessed.getController()) {
|
456
|
getEntity().setAccessed(text_accessed.getController().getDateTime());
|
457
|
}
|
458
|
|
459
|
if (eventSource != text_title && eventSource != text_abbrevTitle) {
|
460
|
// set abbrev title cache to null to force new generation
|
461
|
// for the standard title cache this is done by a PropertyChangeListener registered
|
462
|
// in IdentifiableEntity.initListeners()
|
463
|
if(!getEntity().isProtectedAbbrevTitleCache()){
|
464
|
getEntity().setAbbrevTitleCache(null, getEntity().isProtectedAbbrevTitleCache());
|
465
|
}
|
466
|
if(!getEntity().isProtectedTitleCache()){
|
467
|
getEntity().setTitleCache(null, getEntity().isProtectedTitleCache());
|
468
|
}
|
469
|
|
470
|
toggleable_cache.setText(getEntity().getTitleCache());
|
471
|
toggleableAbbrevCache.setText(getEntity().getAbbrevTitleCache());
|
472
|
}
|
473
|
|
474
|
firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
|
475
|
}
|
476
|
|
477
|
@Override
|
478
|
public void updateToggleableCacheField() {
|
479
|
if (!getEntity().isProtectedTitleCache()) {
|
480
|
toggleable_cache.setText(getEntity().generateTitle());
|
481
|
}
|
482
|
if (!getEntity().isProtectedAbbrevTitleCache()) {
|
483
|
toggleableAbbrevCache.setText(getEntity().generateAbbrevTitle());
|
484
|
}
|
485
|
}
|
486
|
|
487
|
protected void handleToggleableAbbrevTitleField() {
|
488
|
getEntity().setAbbrevTitleCache(
|
489
|
toggleableAbbrevCache.getText(), toggleableAbbrevCache.getState());
|
490
|
updateToggleableCacheField();
|
491
|
updateCacheRelevance();
|
492
|
}
|
493
|
|
494
|
@Override
|
495
|
public void handleException(CdmPropertyChangeEvent event) {
|
496
|
exceptionOccurred(event);
|
497
|
}
|
498
|
|
499
|
@Override
|
500
|
public void clearException() {
|
501
|
exceptionOccurred(null);
|
502
|
}
|
503
|
|
504
|
private final List<IExceptionHandler> exceptionHandlers = new ArrayList<>();
|
505
|
|
506
|
@Override
|
507
|
public void addExceptionHandler(IExceptionHandler handler) {
|
508
|
exceptionHandlers.add(handler);
|
509
|
}
|
510
|
|
511
|
@Override
|
512
|
public void removeExceptionHandler(IExceptionHandler handler) {
|
513
|
exceptionHandlers.remove(handler);
|
514
|
}
|
515
|
|
516
|
@Override
|
517
|
public void exceptionOccurred(CdmPropertyChangeEvent event) {
|
518
|
for (IExceptionHandler handler : exceptionHandlers) {
|
519
|
if (event == null) {
|
520
|
handler.clearException();
|
521
|
} else {
|
522
|
handler.handleException(event);
|
523
|
}
|
524
|
}
|
525
|
}
|
526
|
|
527
|
@Override
|
528
|
protected void handleToggleableCacheField() {
|
529
|
getEntity().setTitleCache(toggleable_cache.getText(), toggleable_cache.getState());
|
530
|
updateToggleableCacheField();
|
531
|
updateCacheRelevance();
|
532
|
}
|
533
|
|
534
|
protected void setIrrelevantReferenceDetail(boolean abbrev){
|
535
|
|
536
|
List<Object> except = new ArrayList<>();
|
537
|
|
538
|
except.addAll( Arrays.asList(new Object[] { toggleable_cache, toggleableAbbrevCache, text_editor, text_isbn, text_issn, text_organisation, text_pages, text_placePublished, text_publisher, text_referenceAbstract, text_uri, selection_institution}));
|
539
|
|
540
|
if (abbrev){
|
541
|
except.add(text_title);
|
542
|
} else{
|
543
|
except.add(text_abbrevTitle);
|
544
|
}
|
545
|
|
546
|
switch( getEntity().getType()){
|
547
|
case Journal:
|
548
|
except.add(element_timePeriod);
|
549
|
break;
|
550
|
case Book:
|
551
|
except.remove(text_series);
|
552
|
except.remove(text_edition);
|
553
|
break;
|
554
|
default:
|
555
|
break;
|
556
|
}
|
557
|
|
558
|
updateCacheRelevance();
|
559
|
}
|
560
|
}
|