1
|
/**
|
2
|
* Copyright (C) 2014 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.preference;
|
10
|
|
11
|
import org.eclipse.swt.SWT;
|
12
|
import org.eclipse.swt.custom.CLabel;
|
13
|
import org.eclipse.swt.events.SelectionAdapter;
|
14
|
import org.eclipse.swt.events.SelectionEvent;
|
15
|
import org.eclipse.swt.layout.GridLayout;
|
16
|
import org.eclipse.swt.widgets.Button;
|
17
|
import org.eclipse.swt.widgets.Composite;
|
18
|
import org.eclipse.swt.widgets.Control;
|
19
|
|
20
|
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
|
21
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
22
|
import eu.etaxonomy.taxeditor.ui.element.CommandHandlerButton;
|
23
|
|
24
|
/**
|
25
|
* @author a.oppermann
|
26
|
* @date 21.07.2014
|
27
|
*
|
28
|
*/
|
29
|
public class ChecklistEditorGeneralPreference extends CdmPreferencePage {
|
30
|
|
31
|
boolean isEditorActivated;
|
32
|
Composite child ;
|
33
|
|
34
|
@Override
|
35
|
protected Control createContents(Composite parent) {
|
36
|
|
37
|
Composite composite = new Composite(parent, SWT.NULL);
|
38
|
composite.setLayout(new GridLayout());
|
39
|
isEditorActivated = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE);
|
40
|
final Button activateCheckButton = new Button(composite, SWT.CHECK);
|
41
|
activateCheckButton.setText("Enable Distribution Editor");
|
42
|
activateCheckButton.setSelection(isEditorActivated);
|
43
|
activateCheckButton.addSelectionListener(new SelectionAdapter(){
|
44
|
@Override
|
45
|
public void widgetSelected(SelectionEvent e) {
|
46
|
isEditorActivated = activateCheckButton.getSelection();
|
47
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE, isEditorActivated);
|
48
|
if(isEditorActivated){
|
49
|
child.setVisible(true);
|
50
|
child.setEnabled(true);
|
51
|
}else{
|
52
|
child.setVisible(false);
|
53
|
child.setEnabled(false);
|
54
|
}
|
55
|
|
56
|
}
|
57
|
});
|
58
|
|
59
|
child = new Composite(composite, SWT.NULL);
|
60
|
child.setLayout(new GridLayout());
|
61
|
child.setVisible(isEditorActivated);
|
62
|
final CLabel label = new CLabel(child, SWT.NULL);
|
63
|
label.setText("Please open the wizard below, in order to \n" + "choose the areas for the Distribution Editor");
|
64
|
final CommandHandlerButton button_openFeatureTree = new CommandHandlerButton(child, SWT.PUSH,
|
65
|
"eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardHandler");
|
66
|
|
67
|
button_openFeatureTree.setText("Open Distribution Selection Wizard");
|
68
|
final Button showIdInVocabulary = new Button(child, SWT.CHECK);
|
69
|
boolean isShowIdInVocabulary = PreferencesUtil.isShowIdInVocabularyInChecklistEditor();
|
70
|
showIdInVocabulary.setText("Show Id in Vocabulary instead of full title of the areas");
|
71
|
showIdInVocabulary.setSelection(isShowIdInVocabulary);
|
72
|
showIdInVocabulary.addSelectionListener(new SelectionAdapter(){
|
73
|
@Override
|
74
|
public void widgetSelected(SelectionEvent e) {
|
75
|
boolean isShowIdInVocabulary = showIdInVocabulary.getSelection();
|
76
|
PreferencesUtil.setShowIdInVocabularyInChecklistEditor(isShowIdInVocabulary);
|
77
|
}
|
78
|
});
|
79
|
|
80
|
final Button showSymbol = new Button(child, SWT.CHECK);
|
81
|
boolean isShowSymbol = PreferencesUtil.isShowSymbolInChecklistEditor();
|
82
|
showSymbol.setText("Show Symbol of the Status, if existing");
|
83
|
showSymbol.setSelection(isShowSymbol);
|
84
|
showSymbol.addSelectionListener(new SelectionAdapter(){
|
85
|
@Override
|
86
|
public void widgetSelected(SelectionEvent e) {
|
87
|
boolean isShowSymbol = showSymbol.getSelection();
|
88
|
PreferencesUtil.setShowSymbolInChecklistEditor(isShowSymbol);
|
89
|
}
|
90
|
});
|
91
|
PreferencesUtil.recursiveSetEnabled(button_openFeatureTree, CdmStore.isActive());
|
92
|
boolean isShowRank = PreferencesUtil.isShowRankInChecklistEditor();
|
93
|
final Button activateRankButton = new Button(child, SWT.CHECK);
|
94
|
activateRankButton.setText("Show Rank in Distribution Editor");
|
95
|
activateRankButton.setSelection(isShowRank);
|
96
|
activateRankButton.addSelectionListener(new SelectionAdapter(){
|
97
|
@Override
|
98
|
public void widgetSelected(SelectionEvent e) {
|
99
|
boolean isShowRank = activateRankButton.getSelection();
|
100
|
PreferencesUtil.setShowRankInChecklistEditor(isShowRank);
|
101
|
}
|
102
|
});
|
103
|
final Button sortNamedAreaByVocabularyOrder = new Button(child, SWT.CHECK);
|
104
|
boolean isSortByVocabularyOrder = PreferencesUtil.isSortNamedAreaByOrderInVocabulary();
|
105
|
sortNamedAreaByVocabularyOrder.setText("Sort Areas by Order in Vocabulary");
|
106
|
sortNamedAreaByVocabularyOrder.setSelection(isSortByVocabularyOrder);
|
107
|
sortNamedAreaByVocabularyOrder.addSelectionListener(new SelectionAdapter(){
|
108
|
@Override
|
109
|
public void widgetSelected(SelectionEvent e) {
|
110
|
boolean isSortByVocabularyOrder = sortNamedAreaByVocabularyOrder.getSelection();
|
111
|
PreferencesUtil.setSortNamedAreasByOrderInVocabulary(isSortByVocabularyOrder);
|
112
|
}
|
113
|
});
|
114
|
|
115
|
if(isEditorActivated){
|
116
|
child.setEnabled(true);
|
117
|
}else{
|
118
|
child.setEnabled(false);
|
119
|
}
|
120
|
|
121
|
return composite;
|
122
|
}
|
123
|
|
124
|
}
|