Project

General

Profile

Download (8.13 KB) Statistics
| Branch: | Tag: | Revision:
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 java.util.List;
12

    
13
import org.eclipse.jface.wizard.WizardPage;
14
import org.eclipse.swt.SWT;
15
import org.eclipse.swt.events.SelectionAdapter;
16
import org.eclipse.swt.events.SelectionEvent;
17
import org.eclipse.swt.layout.FillLayout;
18
import org.eclipse.swt.layout.GridData;
19
import org.eclipse.swt.layout.GridLayout;
20
import org.eclipse.swt.widgets.Button;
21
import org.eclipse.swt.widgets.Composite;
22
import org.eclipse.swt.widgets.TabFolder;
23
import org.eclipse.swt.widgets.TabItem;
24

    
25
import eu.etaxonomy.cdm.io.operation.config.CacheUpdaterConfigurator;
26
import eu.etaxonomy.cdm.io.operation.config.SortIndexUpdaterConfigurator;
27
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
28
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
29
import eu.etaxonomy.cdm.model.name.TaxonName;
30
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
31
import eu.etaxonomy.cdm.model.reference.Reference;
32
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
33
import eu.etaxonomy.taxeditor.l10n.Messages;
34

    
35
/**
36
 * @author k.luther
37
 * @date 14.12.2016
38
 *
39
 */
40
public class Test extends WizardPage {
41

    
42
    CacheUpdaterConfigurator config;
43
    SortIndexUpdaterConfigurator sortIndexConfig;
44
    boolean updateAgentBase = false;
45
    boolean updateReference = false;
46
    boolean updateTaxonBase = false;
47
    boolean updateName = false;
48
    boolean updateSpecimen = false;
49
        
50
    public Test(String pageName, CacheUpdaterConfigurator configTitleCache, SortIndexUpdaterConfigurator sortIndexConfig) {
51
        super(pageName);
52
        config = configTitleCache;
53
        this.sortIndexConfig = sortIndexConfig;
54
    }
55

    
56
    /**
57
     * {@inheritDoc}
58
     */
59
    @Override
60
    public void createControl(Composite parent) {
61

    
62

    
63
            Composite container = new Composite(parent, SWT.NULL);
64
            setControl(container);
65
            container.setLayout(new FillLayout(SWT.HORIZONTAL));
66

    
67
            TabFolder tabFolder = new TabFolder(container, SWT.NONE);
68

    
69
            TabItem tbtmSortIndex = new TabItem(tabFolder, SWT.NONE);
70
            tbtmSortIndex.setText("Sort Index");
71

    
72
            Composite composite = new Composite(tabFolder, SWT.NONE);
73
            tbtmSortIndex.setControl(composite);
74
            composite.setLayout(new GridLayout(1, true));
75

    
76
           
77
            Button checkBoxTaxonNode = new Button(composite, SWT.CHECK);
78
            checkBoxTaxonNode.setSelection(sortIndexConfig.isDoTaxonNode());
79
            checkBoxTaxonNode.setText(Messages.DatabaseRepairPage_updateTaxonNodes);
80
            checkBoxTaxonNode
81
                    .setToolTipText(Messages.DatabaseRepairPage_toolTip_taxonNode);
82
            checkBoxTaxonNode.addSelectionListener(new SelectionAdapter() {
83
                @Override
84
                public void widgetSelected(SelectionEvent e) {
85
                    sortIndexConfig.setDoTaxonNode(!sortIndexConfig.isDoTaxonNode());
86
                }
87
            });
88

    
89
            Button checkBoxPolytomousKeyNode = new Button(composite, SWT.CHECK);
90
            checkBoxPolytomousKeyNode.setSelection(sortIndexConfig.isDoPolytomousKeyNode());
91
            checkBoxPolytomousKeyNode.setText(Messages.DatabaseRepairPage_PolytomousKeyNode);
92
            checkBoxPolytomousKeyNode
93
            .setToolTipText(Messages.DatabaseRepairPage_toolTip_polytomousKeyNode);
94
            checkBoxPolytomousKeyNode.addSelectionListener(new SelectionAdapter() {
95
                @Override
96
                public void widgetSelected(SelectionEvent e) {
97
                    sortIndexConfig.setDoPolytomousKeyNode(!sortIndexConfig.isDoPolytomousKeyNode());
98
                }
99
            });
100

    
101
            Button checkBoxFeatureNode = new Button(composite, SWT.CHECK);
102
            checkBoxFeatureNode.setSelection(sortIndexConfig.isDoFeatureNode());
103
            checkBoxFeatureNode.setText(Messages.DatabaseRepairPage_featureNodes);
104
            checkBoxFeatureNode
105
            .setToolTipText(Messages.DatabaseRepairPage_toolTipFeatureNodes);
106
            checkBoxFeatureNode.addSelectionListener(new SelectionAdapter() {
107
                @Override
108
                public void widgetSelected(SelectionEvent e) {
109
                    sortIndexConfig.setDoFeatureNode(!sortIndexConfig.isDoFeatureNode());
110
                }
111
            });
112

    
113

    
114
            TabItem tbtmNewItem = new TabItem(tabFolder, SWT.NONE);
115
            tbtmNewItem.setText("Update Caches");
116

    
117
            Composite composite_1 = new Composite(tabFolder, SWT.NONE);
118
            tbtmNewItem.setControl(composite_1);
119
            composite_1.setLayout(new GridLayout(1, false));
120
            
121
            Button checkBoxTeamOrPerson = new Button(composite_1, SWT.CHECK);
122
            checkBoxTeamOrPerson.setSelection(config.getClassList().contains(TeamOrPersonBase.class));
123
            checkBoxTeamOrPerson.setText(Messages.DatabaseRepairPage_TeamOrPerson);
124
            checkBoxTeamOrPerson
125
            .setToolTipText(Messages.DatabaseRepairPage_toolTip_teamOrPerson);
126
            checkBoxTeamOrPerson.addSelectionListener(new SelectionAdapter() {
127
                @Override
128
                public void widgetSelected(SelectionEvent e) {
129
                	Button b = (Button) e.widget;
130
                	updateAgentBase =  b.getSelection();
131
                   
132
                }
133
            });
134
            
135
            Button checkBoxReference = new Button(composite_1, SWT.CHECK);
136
            checkBoxReference.setSelection(config.getClassList().contains(Reference.class));
137
            checkBoxReference.setText(Messages.DatabaseRepairPage_Reference);
138
            checkBoxReference
139
            .setToolTipText(Messages.DatabaseRepairPage_toolTip_reference);
140
            checkBoxReference.addSelectionListener(new SelectionAdapter() {
141
                @Override
142
                public void widgetSelected(SelectionEvent e) {
143
                	Button b = (Button) e.widget;
144
                	updateReference= b.getSelection();
145
                }
146
            });
147
            
148
            Button checkBoxTaxonName = new Button(composite_1, SWT.CHECK);
149
            checkBoxTaxonName.setSelection(config.getClassList().contains(TaxonName.class));
150
            checkBoxTaxonName.setText(Messages.DatabaseRepairPage_updateTaxonName);
151
            checkBoxTaxonName
152
                    .setToolTipText(Messages.DatabaseRepairPage_toolTip_TaxonName);
153
            checkBoxTaxonName.addSelectionListener(new SelectionAdapter() {
154
                @Override
155
                public void widgetSelected(SelectionEvent e) {
156
                	Button b = (Button) e.widget;
157
                	updateName = b.getSelection();
158
                   
159
                }
160
            });
161

    
162
            Button checkBoxTaxonBase = new Button(composite_1, SWT.CHECK);
163
            checkBoxTaxonBase.setSelection(config.getClassList().contains(TaxonBase.class));
164
            checkBoxTaxonBase.setText(Messages.DatabaseRepairPage_TaxonBase);
165
            checkBoxTaxonBase
166
            .setToolTipText(Messages.DatabaseRepairPage_toolTip_taxonBase);
167
            checkBoxTaxonBase.addSelectionListener(new SelectionAdapter() {
168
                @Override
169
                public void widgetSelected(SelectionEvent e) {
170
                	Button b = (Button) e.widget;
171
                	updateTaxonBase = b.getSelection();
172
                   
173
                }
174
            });
175

    
176
           
177
            Button checkBoxSpecimen = new Button(composite_1, SWT.CHECK);
178
            checkBoxSpecimen.setSelection(config.getClassList().contains(SpecimenOrObservationBase.class));
179
            checkBoxSpecimen.setText(Messages.DatabaseRepairPage_Specimen);
180
            checkBoxSpecimen
181
            .setToolTipText(Messages.DatabaseRepairPage_toolTip_specimen);
182
            checkBoxSpecimen.addSelectionListener(new SelectionAdapter() {
183
                @Override
184
                public void widgetSelected(SelectionEvent e) {
185
                	Button b = (Button) e.widget;
186
                	updateSpecimen = b.getSelection();
187
                   
188
                }
189
            });
190
          
191
            tabFolder.pack();
192
    }
193
}
(12-12/12)