1
|
/**
|
2
|
* Copyright (C) 2016 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.wizard.WizardPage;
|
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.FillLayout;
|
16
|
import org.eclipse.swt.layout.GridLayout;
|
17
|
import org.eclipse.swt.widgets.Button;
|
18
|
import org.eclipse.swt.widgets.Composite;
|
19
|
import org.eclipse.swt.widgets.TabFolder;
|
20
|
import org.eclipse.swt.widgets.TabItem;
|
21
|
|
22
|
import eu.etaxonomy.cdm.io.operation.config.CacheUpdaterConfigurator;
|
23
|
import eu.etaxonomy.cdm.io.operation.config.SortIndexUpdaterConfigurator;
|
24
|
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
|
25
|
import eu.etaxonomy.cdm.model.name.TaxonName;
|
26
|
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
|
27
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
28
|
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
|
29
|
import eu.etaxonomy.taxeditor.l10n.Messages;
|
30
|
|
31
|
/**
|
32
|
* @author k.luther
|
33
|
* @date 14.12.2016
|
34
|
*
|
35
|
*/
|
36
|
public class Test extends WizardPage {
|
37
|
|
38
|
CacheUpdaterConfigurator config;
|
39
|
SortIndexUpdaterConfigurator sortIndexConfig;
|
40
|
boolean updateAgentBase = false;
|
41
|
boolean updateReference = false;
|
42
|
boolean updateTaxonBase = false;
|
43
|
boolean updateName = false;
|
44
|
boolean updateSpecimen = false;
|
45
|
|
46
|
public Test(String pageName, CacheUpdaterConfigurator configTitleCache, SortIndexUpdaterConfigurator sortIndexConfig) {
|
47
|
super(pageName);
|
48
|
config = configTitleCache;
|
49
|
this.sortIndexConfig = sortIndexConfig;
|
50
|
}
|
51
|
|
52
|
/**
|
53
|
* {@inheritDoc}
|
54
|
*/
|
55
|
@Override
|
56
|
public void createControl(Composite parent) {
|
57
|
|
58
|
|
59
|
Composite container = new Composite(parent, SWT.NULL);
|
60
|
setControl(container);
|
61
|
container.setLayout(new FillLayout(SWT.HORIZONTAL));
|
62
|
|
63
|
TabFolder tabFolder = new TabFolder(container, SWT.NONE);
|
64
|
|
65
|
TabItem tbtmSortIndex = new TabItem(tabFolder, SWT.NONE);
|
66
|
tbtmSortIndex.setText("Sort Index");
|
67
|
|
68
|
Composite composite = new Composite(tabFolder, SWT.NONE);
|
69
|
tbtmSortIndex.setControl(composite);
|
70
|
composite.setLayout(new GridLayout(1, true));
|
71
|
|
72
|
|
73
|
Button checkBoxTaxonNode = new Button(composite, SWT.CHECK);
|
74
|
checkBoxTaxonNode.setSelection(sortIndexConfig.isDoTaxonNode());
|
75
|
checkBoxTaxonNode.setText(Messages.DatabaseRepairPage_updateTaxonNodes);
|
76
|
checkBoxTaxonNode
|
77
|
.setToolTipText(Messages.DatabaseRepairPage_toolTip_taxonNode);
|
78
|
checkBoxTaxonNode.addSelectionListener(new SelectionAdapter() {
|
79
|
@Override
|
80
|
public void widgetSelected(SelectionEvent e) {
|
81
|
sortIndexConfig.setDoTaxonNode(!sortIndexConfig.isDoTaxonNode());
|
82
|
}
|
83
|
});
|
84
|
|
85
|
Button checkBoxPolytomousKeyNode = new Button(composite, SWT.CHECK);
|
86
|
checkBoxPolytomousKeyNode.setSelection(sortIndexConfig.isDoPolytomousKeyNode());
|
87
|
checkBoxPolytomousKeyNode.setText(Messages.DatabaseRepairPage_PolytomousKeyNode);
|
88
|
checkBoxPolytomousKeyNode
|
89
|
.setToolTipText(Messages.DatabaseRepairPage_toolTip_polytomousKeyNode);
|
90
|
checkBoxPolytomousKeyNode.addSelectionListener(new SelectionAdapter() {
|
91
|
@Override
|
92
|
public void widgetSelected(SelectionEvent e) {
|
93
|
sortIndexConfig.setDoPolytomousKeyNode(!sortIndexConfig.isDoPolytomousKeyNode());
|
94
|
}
|
95
|
});
|
96
|
|
97
|
Button checkBoxFeatureNode = new Button(composite, SWT.CHECK);
|
98
|
checkBoxFeatureNode.setSelection(sortIndexConfig.isDoFeatureNode());
|
99
|
checkBoxFeatureNode.setText(Messages.DatabaseRepairPage_featureNodes);
|
100
|
checkBoxFeatureNode
|
101
|
.setToolTipText(Messages.DatabaseRepairPage_toolTipFeatureNodes);
|
102
|
checkBoxFeatureNode.addSelectionListener(new SelectionAdapter() {
|
103
|
@Override
|
104
|
public void widgetSelected(SelectionEvent e) {
|
105
|
sortIndexConfig.setDoFeatureNode(!sortIndexConfig.isDoFeatureNode());
|
106
|
}
|
107
|
});
|
108
|
|
109
|
|
110
|
TabItem tbtmNewItem = new TabItem(tabFolder, SWT.NONE);
|
111
|
tbtmNewItem.setText("Update Caches");
|
112
|
|
113
|
Composite composite_1 = new Composite(tabFolder, SWT.NONE);
|
114
|
tbtmNewItem.setControl(composite_1);
|
115
|
composite_1.setLayout(new GridLayout(1, false));
|
116
|
|
117
|
Button checkBoxTeamOrPerson = new Button(composite_1, SWT.CHECK);
|
118
|
checkBoxTeamOrPerson.setSelection(config.getClassList().contains(TeamOrPersonBase.class));
|
119
|
checkBoxTeamOrPerson.setText(Messages.DatabaseRepairPage_TeamOrPerson);
|
120
|
checkBoxTeamOrPerson
|
121
|
.setToolTipText(Messages.DatabaseRepairPage_toolTip_teamOrPerson);
|
122
|
checkBoxTeamOrPerson.addSelectionListener(new SelectionAdapter() {
|
123
|
@Override
|
124
|
public void widgetSelected(SelectionEvent e) {
|
125
|
Button b = (Button) e.widget;
|
126
|
updateAgentBase = b.getSelection();
|
127
|
|
128
|
}
|
129
|
});
|
130
|
|
131
|
Button checkBoxReference = new Button(composite_1, SWT.CHECK);
|
132
|
checkBoxReference.setSelection(config.getClassList().contains(Reference.class));
|
133
|
checkBoxReference.setText(Messages.DatabaseRepairPage_Reference);
|
134
|
checkBoxReference
|
135
|
.setToolTipText(Messages.DatabaseRepairPage_toolTip_reference);
|
136
|
checkBoxReference.addSelectionListener(new SelectionAdapter() {
|
137
|
@Override
|
138
|
public void widgetSelected(SelectionEvent e) {
|
139
|
Button b = (Button) e.widget;
|
140
|
updateReference= b.getSelection();
|
141
|
}
|
142
|
});
|
143
|
|
144
|
Button checkBoxTaxonName = new Button(composite_1, SWT.CHECK);
|
145
|
checkBoxTaxonName.setSelection(config.getClassList().contains(TaxonName.class));
|
146
|
checkBoxTaxonName.setText(Messages.DatabaseRepairPage_updateTaxonName);
|
147
|
checkBoxTaxonName
|
148
|
.setToolTipText(Messages.DatabaseRepairPage_toolTip_TaxonName);
|
149
|
checkBoxTaxonName.addSelectionListener(new SelectionAdapter() {
|
150
|
@Override
|
151
|
public void widgetSelected(SelectionEvent e) {
|
152
|
Button b = (Button) e.widget;
|
153
|
updateName = b.getSelection();
|
154
|
|
155
|
}
|
156
|
});
|
157
|
|
158
|
Button checkBoxTaxonBase = new Button(composite_1, SWT.CHECK);
|
159
|
checkBoxTaxonBase.setSelection(config.getClassList().contains(TaxonBase.class));
|
160
|
checkBoxTaxonBase.setText(Messages.DatabaseRepairPage_TaxonBase);
|
161
|
checkBoxTaxonBase
|
162
|
.setToolTipText(Messages.DatabaseRepairPage_toolTip_taxonBase);
|
163
|
checkBoxTaxonBase.addSelectionListener(new SelectionAdapter() {
|
164
|
@Override
|
165
|
public void widgetSelected(SelectionEvent e) {
|
166
|
Button b = (Button) e.widget;
|
167
|
updateTaxonBase = b.getSelection();
|
168
|
|
169
|
}
|
170
|
});
|
171
|
|
172
|
|
173
|
Button checkBoxSpecimen = new Button(composite_1, SWT.CHECK);
|
174
|
checkBoxSpecimen.setSelection(config.getClassList().contains(SpecimenOrObservationBase.class));
|
175
|
checkBoxSpecimen.setText(Messages.DatabaseRepairPage_Specimen);
|
176
|
checkBoxSpecimen
|
177
|
.setToolTipText(Messages.DatabaseRepairPage_toolTip_specimen);
|
178
|
checkBoxSpecimen.addSelectionListener(new SelectionAdapter() {
|
179
|
@Override
|
180
|
public void widgetSelected(SelectionEvent e) {
|
181
|
Button b = (Button) e.widget;
|
182
|
updateSpecimen = b.getSelection();
|
183
|
|
184
|
}
|
185
|
});
|
186
|
|
187
|
tabFolder.pack();
|
188
|
}
|
189
|
}
|