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