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