1
|
/**
|
2
|
* Copyright (C) 2017 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.databaseAdmin.wizard;
|
10
|
|
11
|
import org.eclipse.jface.preference.IPreferenceStore;
|
12
|
import org.eclipse.swt.SWT;
|
13
|
import org.eclipse.swt.events.SelectionAdapter;
|
14
|
import org.eclipse.swt.events.SelectionEvent;
|
15
|
import org.eclipse.swt.layout.GridData;
|
16
|
import org.eclipse.swt.layout.GridLayout;
|
17
|
import org.eclipse.swt.widgets.Button;
|
18
|
import org.eclipse.swt.widgets.Composite;
|
19
|
|
20
|
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
|
21
|
import eu.etaxonomy.taxeditor.preference.NameDetailsConfigurator;
|
22
|
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
|
23
|
|
24
|
/**
|
25
|
* @author k.luther
|
26
|
* @date 22.02.2017
|
27
|
*
|
28
|
*/
|
29
|
public class NameDetailsViewComposite extends Composite {
|
30
|
|
31
|
NameDetailsConfigurator config;
|
32
|
boolean isSimpleDetailsViewActivated;
|
33
|
boolean isShowTaxon;
|
34
|
boolean isShowLSID;
|
35
|
boolean isShowNomenclaturalCode;
|
36
|
boolean isShowNameCache;
|
37
|
boolean isShowAppendedPhrase;
|
38
|
boolean isShowRank;
|
39
|
boolean isShowEpithets;
|
40
|
boolean isShowAuthorshipCache;
|
41
|
boolean isShowAuthorship;
|
42
|
boolean isShowNomenclaturalRef;
|
43
|
boolean isShowNomenclaturalStatus;
|
44
|
boolean isShowProtologue;
|
45
|
boolean isShowTypeDesignation;
|
46
|
boolean isShowNameRelationship;
|
47
|
boolean isShowHybrid;
|
48
|
Composite child;
|
49
|
|
50
|
public NameDetailsViewComposite(Composite parent, int style, NameDetailsConfigurator config){
|
51
|
|
52
|
super(parent, SWT.NONE);
|
53
|
// TabItem tbtmNameDetailsConfiguration = new TabItem(tabFolder, SWT.NONE);
|
54
|
// Composite c2 = new Composite(tabFolder, SWT.BORDER);
|
55
|
// c2.setLayout(new GridLayout(1, true));
|
56
|
// tbtmNameDetailsConfiguration.setControl(c2);
|
57
|
// composite.setLayout(new GridLayout(1, true));
|
58
|
this.config = config;
|
59
|
|
60
|
// Composite composite = new Composite(parent, SWT.NULL);
|
61
|
|
62
|
this.setLayout(new GridLayout());
|
63
|
isSimpleDetailsViewActivated= PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION);
|
64
|
final Button activateCheckButton = new Button(this, SWT.CHECK);
|
65
|
activateCheckButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, true, 1, 1));
|
66
|
activateCheckButton.setText("Show only a simple name details view");
|
67
|
activateCheckButton.setSelection(isSimpleDetailsViewActivated);
|
68
|
activateCheckButton.addSelectionListener(new SelectionAdapter(){
|
69
|
@Override
|
70
|
public void widgetSelected(SelectionEvent e) {
|
71
|
isSimpleDetailsViewActivated = activateCheckButton.getSelection();
|
72
|
//
|
73
|
if(isSimpleDetailsViewActivated){
|
74
|
child.setVisible(true);
|
75
|
child.setEnabled(true);
|
76
|
}else{
|
77
|
child.setVisible(false);
|
78
|
child.setEnabled(false);
|
79
|
}
|
80
|
}
|
81
|
});
|
82
|
|
83
|
child = new Composite(this, SWT.NULL);
|
84
|
|
85
|
child.setLayout(new GridLayout());
|
86
|
child.setVisible(isSimpleDetailsViewActivated);
|
87
|
|
88
|
final Button showTaxon = new Button(child, SWT.CHECK);
|
89
|
isShowTaxon = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON);
|
90
|
showTaxon.setText("Show taxon of the name");
|
91
|
showTaxon.setSelection(isShowTaxon);
|
92
|
showTaxon.addSelectionListener(new SelectionAdapter(){
|
93
|
@Override
|
94
|
public void widgetSelected(SelectionEvent e) {
|
95
|
isShowTaxon = showTaxon.getSelection();
|
96
|
|
97
|
}
|
98
|
});
|
99
|
|
100
|
final Button showLsid = new Button(child, SWT.CHECK);
|
101
|
isShowLSID = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID);
|
102
|
showLsid.setText("Show Lsid of the name");
|
103
|
showLsid.setSelection(isShowLSID);
|
104
|
showLsid.addSelectionListener(new SelectionAdapter(){
|
105
|
@Override
|
106
|
public void widgetSelected(SelectionEvent e) {
|
107
|
isShowLSID = showLsid.getSelection();
|
108
|
|
109
|
}
|
110
|
});
|
111
|
|
112
|
final Button showNomenclaturalCode = new Button(child, SWT.CHECK);
|
113
|
isShowNomenclaturalCode = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE);
|
114
|
showNomenclaturalCode.setText("Show the nomenclatural code");
|
115
|
showNomenclaturalCode.setSelection(isShowNomenclaturalCode);
|
116
|
showNomenclaturalCode.addSelectionListener(new SelectionAdapter(){
|
117
|
@Override
|
118
|
public void widgetSelected(SelectionEvent e) {
|
119
|
isShowNomenclaturalCode = showNomenclaturalCode.getSelection();
|
120
|
|
121
|
}
|
122
|
});
|
123
|
|
124
|
final Button showNameCache = new Button(child, SWT.CHECK);
|
125
|
isShowNameCache= PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE);
|
126
|
showNameCache.setText("Show nameCache of the name (only the scientific name without the author and year)");
|
127
|
showNameCache.setSelection(isShowNomenclaturalCode);
|
128
|
showNameCache.addSelectionListener(new SelectionAdapter(){
|
129
|
@Override
|
130
|
public void widgetSelected(SelectionEvent e) {
|
131
|
isShowNameCache = showNameCache.getSelection();
|
132
|
|
133
|
}
|
134
|
});
|
135
|
final Button showAppendedPhrase = new Button(child, SWT.CHECK);
|
136
|
isShowAppendedPhrase= PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE);
|
137
|
showAppendedPhrase.setText("Show appended phrase");
|
138
|
showAppendedPhrase.setSelection(isShowAppendedPhrase);
|
139
|
showAppendedPhrase.addSelectionListener(new SelectionAdapter(){
|
140
|
@Override
|
141
|
public void widgetSelected(SelectionEvent e) {
|
142
|
isShowAppendedPhrase = showAppendedPhrase.getSelection();
|
143
|
|
144
|
}
|
145
|
});
|
146
|
|
147
|
final Button showRank = new Button(child, SWT.CHECK);
|
148
|
isShowRank = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK);
|
149
|
showRank.setText("Show rank of the name");
|
150
|
showRank.setSelection(isShowRank);
|
151
|
showRank.addSelectionListener(new SelectionAdapter(){
|
152
|
@Override
|
153
|
public void widgetSelected(SelectionEvent e) {
|
154
|
isShowRank = showRank.getSelection();
|
155
|
|
156
|
}
|
157
|
});
|
158
|
final Button showEpithets = new Button(child, SWT.CHECK);
|
159
|
isShowEpithets = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS);
|
160
|
showEpithets.setText("Show atomised epithets");
|
161
|
showEpithets.setSelection(isShowEpithets);
|
162
|
showEpithets.addSelectionListener(new SelectionAdapter(){
|
163
|
@Override
|
164
|
public void widgetSelected(SelectionEvent e) {
|
165
|
isShowEpithets = showEpithets.getSelection();
|
166
|
|
167
|
}
|
168
|
});
|
169
|
final Button showAuthorshipCache = new Button(child, SWT.CHECK);
|
170
|
isShowAuthorshipCache= PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP_CACHE);
|
171
|
showAuthorshipCache.setText("Show authorship cache");
|
172
|
showAuthorshipCache.setSelection(isShowAuthorshipCache);
|
173
|
showAuthorshipCache.addSelectionListener(new SelectionAdapter(){
|
174
|
@Override
|
175
|
public void widgetSelected(SelectionEvent e) {
|
176
|
isShowAuthorshipCache = showAuthorshipCache.getSelection();
|
177
|
|
178
|
}
|
179
|
});
|
180
|
|
181
|
final Button showAuthorship = new Button(child, SWT.CHECK);
|
182
|
isShowAuthorship = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP);
|
183
|
showAuthorship.setText("Show authorship section");
|
184
|
showAuthorship.setSelection(isShowAuthorship);
|
185
|
showAuthorship.addSelectionListener(new SelectionAdapter(){
|
186
|
@Override
|
187
|
public void widgetSelected(SelectionEvent e) {
|
188
|
isShowAuthorship = showAuthorship.getSelection();
|
189
|
|
190
|
}
|
191
|
});
|
192
|
|
193
|
final Button showNomenclaturalRef = new Button(child, SWT.CHECK);
|
194
|
isShowNomenclaturalRef = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE);
|
195
|
showNomenclaturalRef.setText("Show nomenclatural reference section");
|
196
|
showNomenclaturalRef.setSelection(isShowNomenclaturalRef);
|
197
|
showNomenclaturalRef.addSelectionListener(new SelectionAdapter(){
|
198
|
@Override
|
199
|
public void widgetSelected(SelectionEvent e) {
|
200
|
isShowNomenclaturalRef = showNomenclaturalRef.getSelection();
|
201
|
|
202
|
}
|
203
|
});
|
204
|
|
205
|
final Button showNomenclaturalStatus = new Button(child, SWT.CHECK);
|
206
|
isShowNomenclaturalStatus = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS);
|
207
|
showNomenclaturalStatus.setText("Show nomenclatural status section");
|
208
|
showNomenclaturalStatus.setSelection(isShowNomenclaturalStatus);
|
209
|
showNomenclaturalStatus.addSelectionListener(new SelectionAdapter(){
|
210
|
@Override
|
211
|
public void widgetSelected(SelectionEvent e) {
|
212
|
isShowNomenclaturalStatus = showNomenclaturalStatus.getSelection();
|
213
|
|
214
|
}
|
215
|
});
|
216
|
|
217
|
final Button showProtologue = new Button(child, SWT.CHECK);
|
218
|
isShowProtologue = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE);
|
219
|
showProtologue.setText("Show protologue section");
|
220
|
showProtologue.setSelection(isShowProtologue);
|
221
|
showProtologue.addSelectionListener(new SelectionAdapter(){
|
222
|
@Override
|
223
|
public void widgetSelected(SelectionEvent e) {
|
224
|
isShowProtologue = showProtologue.getSelection();
|
225
|
|
226
|
}
|
227
|
});
|
228
|
|
229
|
final Button showTypeDesignation = new Button(child, SWT.CHECK);
|
230
|
isShowTypeDesignation = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION);
|
231
|
showTypeDesignation.setText("Show name type designation section");
|
232
|
showTypeDesignation.setSelection(isShowTypeDesignation);
|
233
|
showTypeDesignation.addSelectionListener(new SelectionAdapter(){
|
234
|
@Override
|
235
|
public void widgetSelected(SelectionEvent e) {
|
236
|
isShowTypeDesignation = showTypeDesignation.getSelection();
|
237
|
|
238
|
}
|
239
|
});
|
240
|
|
241
|
|
242
|
final Button showNameRelationship = new Button(child, SWT.CHECK);
|
243
|
isShowNameRelationship = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP);
|
244
|
showNameRelationship.setText("Show name relationship section");
|
245
|
showNameRelationship.setSelection(isShowNameRelationship);
|
246
|
showNameRelationship.addSelectionListener(new SelectionAdapter(){
|
247
|
@Override
|
248
|
public void widgetSelected(SelectionEvent e) {
|
249
|
isShowNameRelationship = showNameRelationship.getSelection();
|
250
|
|
251
|
}
|
252
|
});
|
253
|
|
254
|
final Button showHybrid = new Button(child, SWT.CHECK);
|
255
|
isShowHybrid = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_HYBRID);
|
256
|
showHybrid.setText("Show hybrid section");
|
257
|
showHybrid.setSelection(isShowHybrid);
|
258
|
showHybrid.addSelectionListener(new SelectionAdapter(){
|
259
|
@Override
|
260
|
public void widgetSelected(SelectionEvent e) {
|
261
|
isShowHybrid = showHybrid.getSelection();
|
262
|
|
263
|
}
|
264
|
});
|
265
|
this.redraw();
|
266
|
|
267
|
if(isSimpleDetailsViewActivated){
|
268
|
child.setEnabled(true);
|
269
|
}else{
|
270
|
child.setEnabled(false);
|
271
|
}
|
272
|
|
273
|
}
|
274
|
|
275
|
/**
|
276
|
*
|
277
|
*/
|
278
|
protected NameDetailsConfigurator createNameDetailsViewConfig() {
|
279
|
saveConfigToPrefernceStore();
|
280
|
|
281
|
config.setSimpleDetailsViewActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION));
|
282
|
config.setAppendedPhraseActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE));
|
283
|
config.setAtomisedEpithetsActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS));
|
284
|
config.setAuthorshipSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP));
|
285
|
config.setLSIDActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID));
|
286
|
config.setNameCacheActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_CACHE));
|
287
|
config.setNameRelationsSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP));
|
288
|
config.setNomenclaturalCodeActived(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE));
|
289
|
config.setNomenclaturalStatusSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS));
|
290
|
config.setNomenclaturalReferenceSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE));
|
291
|
config.setProtologueActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE));
|
292
|
config.setRankActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK));
|
293
|
config.setTaxonSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON));
|
294
|
config.setTypeDesignationSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION));
|
295
|
config.setHybridActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_HYBRID));
|
296
|
return config;
|
297
|
}
|
298
|
|
299
|
/**
|
300
|
*
|
301
|
*/
|
302
|
private void saveConfigToPrefernceStore() {
|
303
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION,
|
304
|
isSimpleDetailsViewActivated);
|
305
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON, isShowTaxon);
|
306
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID, isShowLSID);
|
307
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE,
|
308
|
isShowNomenclaturalCode);
|
309
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE,
|
310
|
isShowNameCache);
|
311
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE,
|
312
|
isShowAppendedPhrase);
|
313
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK, isShowRank);
|
314
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS,
|
315
|
isShowEpithets);
|
316
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP_CACHE,
|
317
|
isShowAuthorshipCache);
|
318
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP,
|
319
|
isShowAuthorship);
|
320
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE,
|
321
|
isShowNomenclaturalRef);
|
322
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS,
|
323
|
isShowNomenclaturalStatus);
|
324
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE,
|
325
|
isShowProtologue);
|
326
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION,
|
327
|
isShowTypeDesignation);
|
328
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP,
|
329
|
isShowNameRelationship);
|
330
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_HYBRID,
|
331
|
isShowHybrid);
|
332
|
|
333
|
}
|
334
|
|
335
|
protected IPreferenceStore doGetPreferenceStore() {
|
336
|
return PreferencesUtil.getPreferenceStore();
|
337
|
}
|
338
|
|
339
|
}
|