1
|
package eu.etaxonomy.taxeditor.preference;
|
2
|
|
3
|
|
4
|
import org.eclipse.jface.layout.GridLayoutFactory;
|
5
|
import org.eclipse.swt.SWT;
|
6
|
import org.eclipse.swt.custom.CLabel;
|
7
|
import org.eclipse.swt.events.SelectionAdapter;
|
8
|
import org.eclipse.swt.events.SelectionEvent;
|
9
|
import org.eclipse.swt.events.SelectionListener;
|
10
|
import org.eclipse.swt.layout.GridData;
|
11
|
import org.eclipse.swt.layout.GridLayout;
|
12
|
import org.eclipse.swt.widgets.Button;
|
13
|
import org.eclipse.swt.widgets.Composite;
|
14
|
import org.eclipse.swt.widgets.Control;
|
15
|
import org.eclipse.swt.widgets.Label;
|
16
|
|
17
|
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
|
18
|
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
|
19
|
import eu.etaxonomy.taxeditor.l10n.Messages;
|
20
|
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
|
21
|
|
22
|
|
23
|
public class NameDetailsViewConfiguration extends CdmPreferencePage implements SelectionListener{
|
24
|
|
25
|
boolean isUseLocalSettings;
|
26
|
protected NameDetailsConfigurator nameDetailsConfig;
|
27
|
Composite localSettings ;
|
28
|
|
29
|
protected CdmPreference nameDetailsPref;
|
30
|
|
31
|
protected boolean isShowTaxon;
|
32
|
protected boolean isShowNameApprobiation ;
|
33
|
protected boolean isShowHybrid;
|
34
|
protected boolean isShowNameRelationship;
|
35
|
protected boolean isShowNameRelationshipRuleConsidered;
|
36
|
protected boolean isShowNameRelationshipRuleConsideredCodeEdition;
|
37
|
protected boolean isShowTypeDesignation;
|
38
|
protected boolean isShowProtologue;
|
39
|
protected boolean isShowNomenclaturalStatus;
|
40
|
protected boolean isShowNomenclaturalStatusRuleConsidered;
|
41
|
protected boolean isShowNomenclaturalStatusRuleConsideredCodeEdition;
|
42
|
protected boolean isShowNomenclaturalRef;
|
43
|
protected boolean isShowAuthorship;
|
44
|
protected boolean isShowAuthorCache;
|
45
|
protected boolean isShowEpithets;
|
46
|
protected boolean isShowRank;
|
47
|
protected boolean isShowAppendedPhrase;
|
48
|
protected boolean isShowNameCache;
|
49
|
protected boolean isShowNomenclaturalCode;
|
50
|
protected boolean isShowLSID;
|
51
|
protected boolean isSecEnabled;
|
52
|
protected boolean isSecDetailsActivated;
|
53
|
|
54
|
protected boolean isAllowOverride;
|
55
|
private boolean isOverride = true;
|
56
|
private Button showSecDetail;
|
57
|
private Button secEnabled;
|
58
|
|
59
|
// protected Combo activateCheckButton;
|
60
|
protected Button allowLocalPreference;
|
61
|
protected Button showTaxon;
|
62
|
protected Button showLsid;
|
63
|
protected Button showNomenclaturalCode;
|
64
|
protected Button showNameCache;
|
65
|
protected Button showAppendedPhrase;
|
66
|
protected Button showRank;
|
67
|
protected Button showEpithets;
|
68
|
protected Button showAuthorCache;
|
69
|
protected Button showAuthorship;
|
70
|
protected Button showNomenclaturalRef;
|
71
|
protected Button showNomenclaturalStatus;
|
72
|
protected Button showNomenclaturalStatusRuleConsidered;
|
73
|
protected Button showNomenclaturalStatusRuleConsideredCodeEdition;
|
74
|
protected Button showProtologue;
|
75
|
protected Button showTypeDesignation;
|
76
|
protected Button showNameRelationship;
|
77
|
protected Button showNameRelationshipRuleConsidered;
|
78
|
protected Button showNameRelationshipRuleConsideredCodeEdition;
|
79
|
protected Button showHybrid;
|
80
|
protected Button showNameApprobiation;
|
81
|
|
82
|
Composite dbSettings;
|
83
|
|
84
|
@Override
|
85
|
protected Control createContents(Composite parent) {
|
86
|
getValues();
|
87
|
if (isAllowOverride || isAdminPreference ){
|
88
|
|
89
|
final CLabel description = new CLabel(parent, SWT.NULL);
|
90
|
description.setText(Messages.NameDetailsViewConfiguration_description);
|
91
|
|
92
|
Composite title = createComposite(parent);
|
93
|
if (isAdminPreference){
|
94
|
allowLocalPreference = createAllowOverrideButton(title);
|
95
|
|
96
|
allowLocalPreference.addSelectionListener(new SelectionAdapter(){
|
97
|
@Override
|
98
|
public void widgetSelected(SelectionEvent e) {
|
99
|
setApply(true);
|
100
|
isAllowOverride = allowLocalPreference.getSelection();
|
101
|
}
|
102
|
});
|
103
|
|
104
|
}
|
105
|
dbSettings = new Composite(parent, SWT.NONE);
|
106
|
dbSettings.setLayout(new GridLayout());
|
107
|
|
108
|
Label separator= new Label(dbSettings, SWT.HORIZONTAL | SWT.SEPARATOR);
|
109
|
separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
110
|
showTaxon = new Button(dbSettings, SWT.CHECK);
|
111
|
showTaxon.setText(Messages.NameDetailsViewComposite_Show_Taxon);
|
112
|
showTaxon.addSelectionListener(this);
|
113
|
isShowTaxon = nameDetailsConfig.isTaxonSectionActivated();
|
114
|
|
115
|
showTaxon.addSelectionListener(new SelectionAdapter(){
|
116
|
@Override
|
117
|
public void widgetSelected(SelectionEvent e) {
|
118
|
setApply(true);
|
119
|
isShowTaxon = showTaxon.getSelection();
|
120
|
nameDetailsConfig.setTaxonSectionActivated(isShowTaxon);
|
121
|
showSecDetail.setEnabled(isShowTaxon);
|
122
|
secEnabled.setEnabled(isShowTaxon);
|
123
|
}
|
124
|
});
|
125
|
|
126
|
Composite taxonComp = new Composite(dbSettings, SWT.NULL);
|
127
|
|
128
|
GridLayoutFactory.fillDefaults().applyTo(taxonComp);
|
129
|
|
130
|
GridData data = new GridData();
|
131
|
data.horizontalIndent = 10;
|
132
|
data.horizontalAlignment = SWT.FILL;
|
133
|
taxonComp.setLayoutData(data);
|
134
|
GridLayoutFactory.fillDefaults().applyTo(taxonComp);
|
135
|
secEnabled = new Button(taxonComp, SWT.CHECK);
|
136
|
secEnabled.setText(Messages.NameDetailsViewComposite_SecEnabled);
|
137
|
secEnabled.addSelectionListener(this);
|
138
|
isSecEnabled = nameDetailsConfig.isSecEnabled();
|
139
|
|
140
|
secEnabled.addSelectionListener(new SelectionAdapter(){
|
141
|
@Override
|
142
|
public void widgetSelected(SelectionEvent e) {
|
143
|
setApply(true);
|
144
|
isSecEnabled = secEnabled.getSelection();
|
145
|
nameDetailsConfig.setSecEnabled(isSecEnabled);
|
146
|
}
|
147
|
});
|
148
|
showSecDetail = new Button(taxonComp, SWT.CHECK);
|
149
|
showSecDetail.setText(Messages.NameDetailsViewComposite_Show_SecDetail);
|
150
|
showSecDetail.addSelectionListener(this);
|
151
|
isSecDetailsActivated = nameDetailsConfig.isSecDetailsActivated();
|
152
|
|
153
|
showSecDetail.addSelectionListener(new SelectionAdapter(){
|
154
|
@Override
|
155
|
public void widgetSelected(SelectionEvent e) {
|
156
|
setApply(true);
|
157
|
isSecDetailsActivated = showSecDetail.getSelection();
|
158
|
nameDetailsConfig.setSecDetailsActivated(isSecDetailsActivated);
|
159
|
}
|
160
|
});
|
161
|
|
162
|
showLsid = new Button(dbSettings, SWT.CHECK);
|
163
|
showLsid.setText(Messages.NameDetailsViewComposite_Show_LSID);
|
164
|
isShowLSID = nameDetailsConfig.isLSIDActivated();
|
165
|
showLsid.addSelectionListener(this);
|
166
|
showLsid.addSelectionListener(new SelectionAdapter(){
|
167
|
@Override
|
168
|
public void widgetSelected(SelectionEvent e) {
|
169
|
setApply(true);
|
170
|
isShowLSID = showLsid.getSelection();
|
171
|
nameDetailsConfig.setLSIDActivated(isShowLSID);
|
172
|
}
|
173
|
});
|
174
|
|
175
|
showNomenclaturalCode = new Button(dbSettings, SWT.CHECK);
|
176
|
showNomenclaturalCode.setText(Messages.NameDetailsViewComposite_Show_NomenclaturalCode);
|
177
|
isShowNomenclaturalCode = nameDetailsConfig.isNomenclaturalCodeActived();
|
178
|
showNomenclaturalCode.addSelectionListener(this);
|
179
|
showNomenclaturalCode.addSelectionListener(new SelectionAdapter(){
|
180
|
@Override
|
181
|
public void widgetSelected(SelectionEvent e) {
|
182
|
setApply(true);
|
183
|
isShowNomenclaturalCode = showNomenclaturalCode.getSelection();
|
184
|
nameDetailsConfig.setNomenclaturalCodeActived(isShowNomenclaturalCode);
|
185
|
}
|
186
|
});
|
187
|
|
188
|
showNameCache = new Button(dbSettings, SWT.CHECK);
|
189
|
showNameCache.setText(Messages.NameDetailsViewComposite_Show_NameCache);
|
190
|
isShowNameCache = nameDetailsConfig.isNameCacheActivated();
|
191
|
showNameCache.addSelectionListener(this);
|
192
|
showNameCache.addSelectionListener(new SelectionAdapter(){
|
193
|
@Override
|
194
|
public void widgetSelected(SelectionEvent e) {
|
195
|
setApply(true);
|
196
|
isShowNameCache = showNameCache.getSelection();
|
197
|
nameDetailsConfig.setNameCacheActivated(isShowNameCache);
|
198
|
}
|
199
|
});
|
200
|
showAppendedPhrase = new Button(dbSettings, SWT.CHECK);
|
201
|
isShowAppendedPhrase= nameDetailsConfig.isAppendedPhraseActivated();
|
202
|
showAppendedPhrase.setText(Messages.NameDetailsViewComposite_Show_AppendedPhrase);
|
203
|
showAppendedPhrase.addSelectionListener(this);
|
204
|
showAppendedPhrase.addSelectionListener(new SelectionAdapter(){
|
205
|
@Override
|
206
|
public void widgetSelected(SelectionEvent e) {
|
207
|
setApply(true);
|
208
|
isShowAppendedPhrase = showAppendedPhrase.getSelection();
|
209
|
nameDetailsConfig.setAppendedPhraseActivated(isShowAppendedPhrase);
|
210
|
}
|
211
|
});
|
212
|
|
213
|
showRank = new Button(dbSettings, SWT.CHECK);
|
214
|
isShowRank = nameDetailsConfig.isRankActivated();
|
215
|
showRank.setText(Messages.NameDetailsViewComposite_Show_Rank);
|
216
|
showRank.addSelectionListener(this);
|
217
|
showRank.addSelectionListener(new SelectionAdapter(){
|
218
|
@Override
|
219
|
public void widgetSelected(SelectionEvent e) {
|
220
|
setApply(true);
|
221
|
isShowRank = showRank.getSelection();
|
222
|
nameDetailsConfig.setRankActivated(isShowRank);
|
223
|
}
|
224
|
});
|
225
|
showEpithets = new Button(dbSettings, SWT.CHECK);
|
226
|
isShowEpithets = nameDetailsConfig.isAtomisedEpithetsActivated();
|
227
|
showEpithets.setText(Messages.NameDetailsViewComposite_Show_AtomisedEpithets);
|
228
|
showEpithets.addSelectionListener(this);
|
229
|
showEpithets.addSelectionListener(new SelectionAdapter(){
|
230
|
@Override
|
231
|
public void widgetSelected(SelectionEvent e) {
|
232
|
setApply(true);
|
233
|
isShowEpithets = showEpithets.getSelection();
|
234
|
nameDetailsConfig.setAtomisedEpithetsActivated(isShowEpithets);
|
235
|
}
|
236
|
});
|
237
|
|
238
|
showAuthorCache = new Button(dbSettings, SWT.CHECK);
|
239
|
isShowAuthorCache = nameDetailsConfig.isAuthorCacheActivated();
|
240
|
showAuthorCache.setText(Messages.NameDetailsViewComposite_Show_AuthorCache);
|
241
|
showAuthorCache.addSelectionListener(this);
|
242
|
showAuthorCache.addSelectionListener(new SelectionAdapter(){
|
243
|
@Override
|
244
|
public void widgetSelected(SelectionEvent e) {
|
245
|
setApply(true);
|
246
|
isShowAuthorCache = showAuthorCache.getSelection();
|
247
|
nameDetailsConfig.setAuthorCacheActivated(isShowAuthorCache);
|
248
|
}
|
249
|
});
|
250
|
|
251
|
showAuthorship = new Button(dbSettings, SWT.CHECK);
|
252
|
isShowAuthorship = nameDetailsConfig.isAuthorshipSectionActivated();
|
253
|
showAuthorship.setText(Messages.NameDetailsViewComposite_Show_Author);
|
254
|
showAuthorship.addSelectionListener(this);
|
255
|
showAuthorship.addSelectionListener(new SelectionAdapter(){
|
256
|
@Override
|
257
|
public void widgetSelected(SelectionEvent e) {
|
258
|
setApply(true);
|
259
|
isShowAuthorship = showAuthorship.getSelection();
|
260
|
nameDetailsConfig.setAuthorshipSectionActivated(isShowAuthorship);
|
261
|
}
|
262
|
});
|
263
|
|
264
|
showNomenclaturalRef = new Button(dbSettings, SWT.CHECK);
|
265
|
isShowNomenclaturalRef = nameDetailsConfig.isNomenclaturalReferenceSectionActivated();
|
266
|
showNomenclaturalRef.setText(Messages.NameDetailsViewComposite_Show_NomenclaturalReference);
|
267
|
showNomenclaturalRef.addSelectionListener(this);
|
268
|
showNomenclaturalRef.addSelectionListener(new SelectionAdapter(){
|
269
|
@Override
|
270
|
public void widgetSelected(SelectionEvent e) {
|
271
|
setApply(true);
|
272
|
isShowNomenclaturalRef = showNomenclaturalRef.getSelection();
|
273
|
nameDetailsConfig.setNomenclaturalReferenceSectionActivated(isShowNomenclaturalRef);
|
274
|
}
|
275
|
});
|
276
|
|
277
|
showNomenclaturalStatus = new Button(dbSettings, SWT.CHECK);
|
278
|
isShowNomenclaturalStatus = nameDetailsConfig.isNomenclaturalStatusSectionActivated();
|
279
|
showNomenclaturalStatus.setText(Messages.NameDetailsViewComposite_Show_NomenclaturalStatus);
|
280
|
showNomenclaturalStatus.addSelectionListener(this);
|
281
|
showNomenclaturalStatus.addSelectionListener(new SelectionAdapter(){
|
282
|
@Override
|
283
|
public void widgetSelected(SelectionEvent e) {
|
284
|
setApply(true);
|
285
|
isShowNomenclaturalStatus = showNomenclaturalStatus.getSelection();
|
286
|
nameDetailsConfig.setNomenclaturalStatusSectionActivated(isShowNomenclaturalStatus);
|
287
|
|
288
|
showNomenclaturalStatusRuleConsidered.setEnabled(isShowNomenclaturalStatus);
|
289
|
if (isShowNomenclaturalStatus){
|
290
|
showNomenclaturalStatusRuleConsideredCodeEdition.setEnabled(isShowNomenclaturalStatusRuleConsidered);
|
291
|
}else{
|
292
|
showNomenclaturalStatusRuleConsideredCodeEdition.setEnabled(isShowNomenclaturalStatus);
|
293
|
}
|
294
|
}
|
295
|
});
|
296
|
|
297
|
|
298
|
Composite nomenlaturalStatusComp = new Composite(dbSettings, SWT.NULL);
|
299
|
|
300
|
GridLayoutFactory.fillDefaults().applyTo(nomenlaturalStatusComp);
|
301
|
|
302
|
nomenlaturalStatusComp.setLayoutData(data);
|
303
|
|
304
|
showNomenclaturalStatusRuleConsidered = new Button(nomenlaturalStatusComp, SWT.CHECK);
|
305
|
isShowNomenclaturalStatusRuleConsidered = nameDetailsConfig.isNomenclaturalStatusRuleConsideredActivated();
|
306
|
showNomenclaturalStatusRuleConsidered.setText(Messages.NameDetailsViewComposite_Show_NomenclaturalStatus_RuleConsidered);
|
307
|
showNomenclaturalStatusRuleConsidered.addSelectionListener(this);
|
308
|
showNomenclaturalStatusRuleConsidered.addSelectionListener(new SelectionAdapter(){
|
309
|
@Override
|
310
|
public void widgetSelected(SelectionEvent e) {
|
311
|
setApply(true);
|
312
|
isShowNomenclaturalStatusRuleConsidered = showNomenclaturalStatusRuleConsidered.getSelection();
|
313
|
nameDetailsConfig.setNomenclaturalStatusRuleConsideredActivated(isShowNomenclaturalStatusRuleConsidered);
|
314
|
showNomenclaturalStatusRuleConsideredCodeEdition.setEnabled(isShowNomenclaturalStatusRuleConsidered);
|
315
|
}
|
316
|
});
|
317
|
|
318
|
showNomenclaturalStatusRuleConsideredCodeEdition = new Button(nomenlaturalStatusComp, SWT.CHECK);
|
319
|
isShowNomenclaturalStatusRuleConsideredCodeEdition = nameDetailsConfig.isNomenclaturalStatusRuleConsideredCodeEditionActivated();
|
320
|
showNomenclaturalStatusRuleConsideredCodeEdition.setText(Messages.NameDetailsViewComposite_Show_NomenclaturalStatus_RuleConsideredCodeEdition);
|
321
|
showNomenclaturalStatusRuleConsideredCodeEdition.addSelectionListener(this);
|
322
|
showNomenclaturalStatusRuleConsideredCodeEdition.addSelectionListener(new SelectionAdapter(){
|
323
|
@Override
|
324
|
public void widgetSelected(SelectionEvent e) {
|
325
|
setApply(true);
|
326
|
isShowNomenclaturalStatusRuleConsideredCodeEdition = showNomenclaturalStatusRuleConsideredCodeEdition.getSelection();
|
327
|
nameDetailsConfig.setNomenclaturalStatusRuleConsideredCodeEditionActivated(isShowNomenclaturalStatusRuleConsideredCodeEdition);
|
328
|
}
|
329
|
});
|
330
|
|
331
|
showProtologue = new Button(dbSettings, SWT.CHECK);
|
332
|
isShowProtologue = nameDetailsConfig.isProtologueActivated();
|
333
|
showProtologue.setText(Messages.NameDetailsViewComposite_Show_Protologue);
|
334
|
showProtologue.addSelectionListener(this);
|
335
|
showProtologue.addSelectionListener(new SelectionAdapter(){
|
336
|
@Override
|
337
|
public void widgetSelected(SelectionEvent e) {
|
338
|
setApply(true);
|
339
|
isShowProtologue = showProtologue.getSelection();
|
340
|
nameDetailsConfig.setProtologueActivated(isShowProtologue);
|
341
|
}
|
342
|
});
|
343
|
|
344
|
showTypeDesignation = new Button(dbSettings, SWT.CHECK);
|
345
|
isShowTypeDesignation = nameDetailsConfig.isTypeDesignationSectionActivated();
|
346
|
showTypeDesignation.setText(Messages.NameDetailsViewComposite_Show_TypeDesignation);
|
347
|
showTypeDesignation.addSelectionListener(this);
|
348
|
showTypeDesignation.addSelectionListener(new SelectionAdapter(){
|
349
|
@Override
|
350
|
public void widgetSelected(SelectionEvent e) {
|
351
|
setApply(true);
|
352
|
isShowTypeDesignation = showTypeDesignation.getSelection();
|
353
|
nameDetailsConfig.setTypeDesignationSectionActivated(isShowTypeDesignation);
|
354
|
}
|
355
|
});
|
356
|
|
357
|
|
358
|
showNameRelationship = new Button(dbSettings, SWT.CHECK);
|
359
|
isShowNameRelationship = nameDetailsConfig.isNameRelationsSectionActivated();
|
360
|
showNameRelationship.setText(Messages.NameDetailsViewComposite_Show_Namerelationships);
|
361
|
showNameRelationship.addSelectionListener(this);
|
362
|
showNameRelationship.addSelectionListener(new SelectionAdapter(){
|
363
|
@Override
|
364
|
public void widgetSelected(SelectionEvent e) {
|
365
|
setApply(true);
|
366
|
isShowNameRelationship = showNameRelationship.getSelection();
|
367
|
nameDetailsConfig.setNameRelationsSectionActivated(isShowNameRelationship);
|
368
|
showNameRelationshipRuleConsidered.setEnabled(isShowNameRelationship);
|
369
|
if (isShowNameRelationship){
|
370
|
showNameRelationshipRuleConsideredCodeEdition.setEnabled(isShowNameRelationshipRuleConsidered);
|
371
|
}else {
|
372
|
showNameRelationshipRuleConsideredCodeEdition.setEnabled(isShowNameRelationship);
|
373
|
}
|
374
|
|
375
|
}
|
376
|
});
|
377
|
|
378
|
Composite nameRelationComp = new Composite(dbSettings, SWT.NULL);
|
379
|
GridLayoutFactory.fillDefaults().applyTo(nameRelationComp);
|
380
|
nameRelationComp.setLayoutData(data);
|
381
|
|
382
|
showNameRelationshipRuleConsidered = new Button(nameRelationComp, SWT.CHECK);
|
383
|
isShowNameRelationshipRuleConsidered = nameDetailsConfig.isNameRelationsRuleConsideredActivated();
|
384
|
showNameRelationshipRuleConsidered.setText(Messages.NameDetailsViewComposite_Show_Namerelationships_RuleConsidered);
|
385
|
showNameRelationshipRuleConsidered.addSelectionListener(this);
|
386
|
showNameRelationshipRuleConsidered.addSelectionListener(new SelectionAdapter(){
|
387
|
@Override
|
388
|
public void widgetSelected(SelectionEvent e) {
|
389
|
setApply(true);
|
390
|
isShowNameRelationshipRuleConsidered = showNameRelationshipRuleConsidered.getSelection();
|
391
|
nameDetailsConfig.setNameRelationsRuleConsideredActivated(isShowNameRelationshipRuleConsidered);
|
392
|
showNameRelationshipRuleConsideredCodeEdition.setEnabled(isShowNameRelationshipRuleConsidered);
|
393
|
|
394
|
}
|
395
|
});
|
396
|
|
397
|
showNameRelationshipRuleConsideredCodeEdition = new Button(nameRelationComp, SWT.CHECK);
|
398
|
isShowNameRelationshipRuleConsideredCodeEdition = nameDetailsConfig.isNameRelationsRuleConsideredCodeEditionActivated();
|
399
|
showNameRelationshipRuleConsideredCodeEdition.setText(Messages.NameDetailsViewComposite_Show_Namerelationships_RuleConsideredCodeEdition);
|
400
|
showNameRelationshipRuleConsideredCodeEdition.addSelectionListener(this);
|
401
|
showNameRelationshipRuleConsideredCodeEdition.addSelectionListener(new SelectionAdapter(){
|
402
|
@Override
|
403
|
public void widgetSelected(SelectionEvent e) {
|
404
|
setApply(true);
|
405
|
isShowNameRelationshipRuleConsideredCodeEdition = showNameRelationshipRuleConsideredCodeEdition.getSelection();
|
406
|
nameDetailsConfig.setNameRelationsRuleConsideredCodeEditionActivated(isShowNameRelationshipRuleConsideredCodeEdition);
|
407
|
}
|
408
|
});
|
409
|
|
410
|
showHybrid = new Button(dbSettings, SWT.CHECK);
|
411
|
isShowHybrid = nameDetailsConfig.isHybridActivated();
|
412
|
showHybrid.setText(Messages.NameDetailsViewComposite_Show_Hybrid);
|
413
|
showHybrid.addSelectionListener(this);
|
414
|
showHybrid.addSelectionListener(new SelectionAdapter(){
|
415
|
@Override
|
416
|
public void widgetSelected(SelectionEvent e) {
|
417
|
setApply(true);
|
418
|
isShowHybrid = showHybrid.getSelection();
|
419
|
nameDetailsConfig.setHybridActivated(isShowHybrid);
|
420
|
}
|
421
|
});
|
422
|
showNameApprobiation = new Button(dbSettings, SWT.CHECK);
|
423
|
isShowNameApprobiation = nameDetailsConfig.isNameApprobiationActivated();
|
424
|
showNameApprobiation.setText(Messages.NameDetailsViewComposite_Show_NameApprobiation);
|
425
|
showNameApprobiation.addSelectionListener(this);
|
426
|
showNameApprobiation.addSelectionListener(new SelectionAdapter(){
|
427
|
@Override
|
428
|
public void widgetSelected(SelectionEvent e) {
|
429
|
setApply(true);
|
430
|
isShowNameApprobiation = showNameApprobiation.getSelection();
|
431
|
nameDetailsConfig.setNameApprobiationActivated(isShowNameApprobiation);
|
432
|
}
|
433
|
});
|
434
|
showSecDetail.setEnabled(isShowTaxon);
|
435
|
secEnabled.setEnabled(isShowTaxon);
|
436
|
|
437
|
setButtonSelections();
|
438
|
|
439
|
}else{
|
440
|
final CLabel description = new CLabel(parent, SWT.NULL);
|
441
|
description.setText(Messages.NameDetailsViewConfiguration_description_not_available);
|
442
|
this.setDefaultButtonActivated(false);
|
443
|
}
|
444
|
|
445
|
|
446
|
|
447
|
|
448
|
return parent;
|
449
|
}
|
450
|
|
451
|
@Override
|
452
|
public boolean performOk() {
|
453
|
if (isApply()){
|
454
|
if (isOverride){
|
455
|
PreferencesUtil.setStringValue(PreferencePredicate.NameDetailsView.getKey(), nameDetailsConfig.toString());
|
456
|
if (nameDetailsPref == null || !nameDetailsConfig.toString().equals(nameDetailsPref.getValue())) {
|
457
|
PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.NameDetailsView.getKey()), true);
|
458
|
}
|
459
|
}else {
|
460
|
PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.NameDetailsView.getKey()), false);
|
461
|
}
|
462
|
|
463
|
}
|
464
|
PreferencesUtil.firePreferencesChanged(this.getClass());
|
465
|
return true;
|
466
|
|
467
|
}
|
468
|
|
469
|
@Override
|
470
|
public void getValues(){
|
471
|
if (nameDetailsConfig == null){
|
472
|
nameDetailsPref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.NameDetailsView);
|
473
|
isAdminPreference = false;
|
474
|
isAllowOverride = true;
|
475
|
if (nameDetailsPref != null){
|
476
|
isAllowOverride = nameDetailsPref.isAllowOverride();
|
477
|
|
478
|
}
|
479
|
isOverride = PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.NameDetailsView.getKey()), true) != null? PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.NameDetailsView.getKey()), true): false;
|
480
|
if (isOverride){
|
481
|
nameDetailsConfig = PreferencesUtil.getPreferredNameDetailsConfiguration(true);
|
482
|
}else{
|
483
|
nameDetailsConfig = PreferencesUtil.getPreferredNameDetailsConfiguration(false);
|
484
|
}
|
485
|
if (nameDetailsConfig == null){
|
486
|
nameDetailsConfig = new NameDetailsConfigurator();
|
487
|
}
|
488
|
}
|
489
|
}
|
490
|
|
491
|
protected void setButtonSelections(){
|
492
|
if (isAdminPreference){
|
493
|
allowLocalPreference.setSelection(isAllowOverride);
|
494
|
}
|
495
|
showTaxon.setSelection(isShowTaxon);
|
496
|
showLsid.setSelection(isShowLSID);
|
497
|
showNomenclaturalCode.setSelection(isShowNomenclaturalCode);
|
498
|
showNameCache.setSelection(isShowNameCache);
|
499
|
showAppendedPhrase.setSelection(isShowAppendedPhrase);
|
500
|
showRank.setSelection(isShowRank);
|
501
|
showEpithets.setSelection(isShowEpithets);
|
502
|
showAuthorCache.setSelection(isShowAuthorCache);
|
503
|
showAuthorship.setSelection(isShowAuthorship);
|
504
|
showNomenclaturalRef.setSelection(isShowNomenclaturalRef);
|
505
|
showNomenclaturalStatus.setSelection(isShowNomenclaturalStatus);
|
506
|
|
507
|
showNomenclaturalStatusRuleConsidered.setSelection(isShowNomenclaturalStatusRuleConsidered);
|
508
|
showNomenclaturalStatusRuleConsidered.setEnabled(isShowNomenclaturalStatus);
|
509
|
showNomenclaturalStatusRuleConsideredCodeEdition.setSelection(isShowNomenclaturalStatusRuleConsideredCodeEdition);
|
510
|
if (isShowNomenclaturalStatus){
|
511
|
showNomenclaturalStatusRuleConsideredCodeEdition.setEnabled(isShowNomenclaturalStatusRuleConsidered);
|
512
|
}else{
|
513
|
showNomenclaturalStatusRuleConsideredCodeEdition.setEnabled(isShowNomenclaturalStatus);
|
514
|
}
|
515
|
|
516
|
showProtologue.setSelection(isShowProtologue);
|
517
|
showTypeDesignation.setSelection(isShowTypeDesignation);
|
518
|
showNameRelationship.setSelection(isShowNameRelationship);
|
519
|
showNameRelationshipRuleConsidered.setSelection(isShowNameRelationshipRuleConsidered);
|
520
|
showNameRelationshipRuleConsideredCodeEdition.setSelection(isShowNameRelationshipRuleConsideredCodeEdition);
|
521
|
showNameRelationshipRuleConsidered.setEnabled(isShowNameRelationship);
|
522
|
if (isShowNameRelationship){
|
523
|
showNameRelationshipRuleConsideredCodeEdition.setEnabled(isShowNameRelationshipRuleConsidered);
|
524
|
}else{
|
525
|
showNameRelationshipRuleConsideredCodeEdition.setEnabled(isShowNameRelationship);
|
526
|
}
|
527
|
showHybrid.setSelection(isShowHybrid);
|
528
|
showNameApprobiation.setSelection(isShowNameApprobiation);
|
529
|
secEnabled.setSelection(isSecEnabled);
|
530
|
//secEnabled.setEnabled(isShowTaxon);
|
531
|
showSecDetail.setSelection(isSecDetailsActivated);
|
532
|
//showSecDetail.setEnabled(isShowTaxon);
|
533
|
|
534
|
}
|
535
|
|
536
|
@Override
|
537
|
protected void performDefaults() {
|
538
|
if (isAdminPreference){
|
539
|
nameDetailsConfig = new NameDetailsConfigurator();
|
540
|
}else{
|
541
|
nameDetailsConfig = PreferencesUtil.getPreferredNameDetailsConfiguration(false);
|
542
|
}
|
543
|
|
544
|
isShowAppendedPhrase = nameDetailsConfig.isAppendedPhraseActivated();
|
545
|
isShowEpithets = nameDetailsConfig.isAtomisedEpithetsActivated();
|
546
|
isShowAuthorship = nameDetailsConfig.isAuthorshipSectionActivated();
|
547
|
isShowAuthorCache = nameDetailsConfig.isAuthorCacheActivated();
|
548
|
isShowLSID = nameDetailsConfig.isLSIDActivated();
|
549
|
isShowNameApprobiation = nameDetailsConfig.isNameApprobiationActivated();
|
550
|
isShowNameCache = nameDetailsConfig.isNameCacheActivated();
|
551
|
isShowNameRelationship = nameDetailsConfig.isNameRelationsSectionActivated();
|
552
|
isShowNameRelationshipRuleConsidered = nameDetailsConfig.isNameRelationsRuleConsideredActivated();
|
553
|
isShowNameRelationshipRuleConsideredCodeEdition = nameDetailsConfig.isNameRelationsRuleConsideredCodeEditionActivated();
|
554
|
isShowNomenclaturalCode = nameDetailsConfig.isNomenclaturalCodeActived();
|
555
|
isShowNomenclaturalStatus = nameDetailsConfig.isNomenclaturalStatusSectionActivated();
|
556
|
isShowNomenclaturalStatusRuleConsidered = nameDetailsConfig.isNomenclaturalStatusRuleConsideredActivated();
|
557
|
isShowNomenclaturalStatusRuleConsideredCodeEdition = nameDetailsConfig.isNomenclaturalStatusRuleConsideredCodeEditionActivated();
|
558
|
isShowNomenclaturalRef = nameDetailsConfig.isNomenclaturalReferenceSectionActivated();
|
559
|
isShowProtologue = nameDetailsConfig.isProtologueActivated();
|
560
|
isShowRank = nameDetailsConfig.isRankActivated();
|
561
|
isShowTaxon = nameDetailsConfig.isTaxonSectionActivated();
|
562
|
isSecDetailsActivated = nameDetailsConfig.isSecDetailsActivated();
|
563
|
isSecEnabled = nameDetailsConfig.isSecEnabled();
|
564
|
isShowTypeDesignation = nameDetailsConfig.isTypeDesignationSectionActivated();
|
565
|
isShowHybrid = nameDetailsConfig.isHybridActivated();
|
566
|
// isSimpleDetailsViewActivated = null;
|
567
|
isAllowOverride = true;
|
568
|
isOverride = false;
|
569
|
this.setButtonSelections();
|
570
|
// PreferencesUtil.recursiveSetEnabled(dbSettings, isSimpleDetailsViewActivated!= null? isSimpleDetailsViewActivated:false);
|
571
|
// activateCheckButton.select(0);
|
572
|
setApply(true);
|
573
|
super.performDefaults();
|
574
|
}
|
575
|
|
576
|
@Override
|
577
|
public void widgetSelected(SelectionEvent e) {
|
578
|
if (e.getSource() != getApplyButton() || e.getSource() != getDefaultsButton()){
|
579
|
isOverride = true;
|
580
|
}
|
581
|
|
582
|
}
|
583
|
|
584
|
@Override
|
585
|
public void widgetDefaultSelected(SelectionEvent e) {
|
586
|
// TODO Auto-generated method stub
|
587
|
|
588
|
}
|
589
|
|
590
|
|
591
|
|
592
|
}
|