Project

General

Profile

Download (6.46 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.GridLayout;
19
import org.eclipse.swt.widgets.Button;
20
import org.eclipse.swt.widgets.Composite;
21
import org.eclipse.swt.widgets.TabFolder;
22
import org.eclipse.swt.widgets.TabItem;
23

    
24
import eu.etaxonomy.cdm.io.common.CacheUpdaterConfigurator;
25
import eu.etaxonomy.cdm.io.common.SortIndexUpdaterConfigurator;
26
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
27
import eu.etaxonomy.cdm.model.name.TaxonName;
28
import eu.etaxonomy.cdm.model.reference.Reference;
29
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
30
import eu.etaxonomy.taxeditor.l10n.Messages;
31

    
32
/**
33
 * @author k.luther
34
 * @date 14.12.2016
35
 *
36
 */
37
public class Test extends WizardPage {
38

    
39
    CacheUpdaterConfigurator config;
40
    SortIndexUpdaterConfigurator sortIndexConfig;
41
    public Test(String pageName, CacheUpdaterConfigurator configTitleCache, SortIndexUpdaterConfigurator sortIndexConfig) {
42
        super(pageName);
43
        config = configTitleCache;
44
        this.sortIndexConfig = sortIndexConfig;
45
    }
46

    
47
    /**
48
     * {@inheritDoc}
49
     */
50
    @Override
51
    public void createControl(Composite parent) {
52

    
53

    
54
            Composite container = new Composite(parent, SWT.NULL);
55
            setControl(container);
56
            container.setLayout(new FillLayout(SWT.HORIZONTAL));
57

    
58
            TabFolder tabFolder = new TabFolder(container, SWT.NONE);
59

    
60
            TabItem tbtmSortIndex = new TabItem(tabFolder, SWT.NONE);
61
            tbtmSortIndex.setText("Sort Index");
62

    
63
            Composite composite = new Composite(tabFolder, SWT.NONE);
64
            tbtmSortIndex.setControl(composite);
65
            composite.setLayout(new GridLayout(1, true));
66

    
67
            Button checkBoxTaxonNode = new Button(composite, SWT.CHECK);
68
            checkBoxTaxonNode.setSelection(sortIndexConfig.isDoTaxonNode());
69
            checkBoxTaxonNode.setText(Messages.DatabaseRepairPage_updateTaxonNodes);
70
            checkBoxTaxonNode
71
                    .setToolTipText(Messages.DatabaseRepairPage_toolTip_taxonNode);
72
            checkBoxTaxonNode.addSelectionListener(new SelectionAdapter() {
73
                @Override
74
                public void widgetSelected(SelectionEvent e) {
75
                    sortIndexConfig.setDoTaxonNode(!sortIndexConfig.isDoTaxonNode());
76
                }
77
            });
78

    
79
            Button checkBoxPolytomousKeyNode = new Button(composite, SWT.CHECK);
80
            checkBoxPolytomousKeyNode.setSelection(sortIndexConfig.isDoPolytomousKeyNode());
81
            checkBoxPolytomousKeyNode.setText(Messages.DatabaseRepairPage_PolytomousKeyNode);
82
            checkBoxPolytomousKeyNode
83
            .setToolTipText(Messages.DatabaseRepairPage_toolTip_polytomousKeyNode);
84
            checkBoxPolytomousKeyNode.addSelectionListener(new SelectionAdapter() {
85
                @Override
86
                public void widgetSelected(SelectionEvent e) {
87
                    sortIndexConfig.setDoPolytomousKeyNode(!sortIndexConfig.isDoPolytomousKeyNode());
88
                }
89
            });
90

    
91
            Button checkBoxFeatureNode = new Button(composite, SWT.CHECK);
92
            checkBoxFeatureNode.setSelection(sortIndexConfig.isDoFeatureNode());
93
            checkBoxFeatureNode.setText(Messages.DatabaseRepairPage_featureNodes);
94
            checkBoxFeatureNode
95
            .setToolTipText(Messages.DatabaseRepairPage_toolTipFeatureNodes);
96
            checkBoxFeatureNode.addSelectionListener(new SelectionAdapter() {
97
                @Override
98
                public void widgetSelected(SelectionEvent e) {
99
                    sortIndexConfig.setDoFeatureNode(!sortIndexConfig.isDoFeatureNode());
100
                }
101
            });
102

    
103

    
104
            TabItem tbtmNewItem = new TabItem(tabFolder, SWT.NONE);
105
            tbtmNewItem.setText("Update Caches");
106

    
107
            Composite composite_1 = new Composite(tabFolder, SWT.NONE);
108
            tbtmNewItem.setControl(composite_1);
109
            composite_1.setLayout(new GridLayout(1, false));
110

    
111
            Button checkBoxTaxonName = new Button(composite_1, SWT.CHECK);
112
            checkBoxTaxonName.setSelection(config.getClassList().contains(TaxonName.class));
113
            checkBoxTaxonName.setText(Messages.DatabaseRepairPage_updateTaxonName);
114
            checkBoxTaxonName
115
                    .setToolTipText(Messages.DatabaseRepairPage_toolTip_TaxonName);
116
            checkBoxTaxonName.addSelectionListener(new SelectionAdapter() {
117
                @Override
118
                public void widgetSelected(SelectionEvent e) {
119
                    List<Class<? extends IdentifiableEntity>> classList = config.getClassList();
120
                    classList.add(TaxonName.class);
121
                }
122
            });
123

    
124
            Button checkBoxTaxonBase = new Button(composite_1, SWT.CHECK);
125
            checkBoxTaxonBase.setSelection(config.getClassList().contains(TaxonBase.class));
126
            checkBoxTaxonBase.setText(Messages.DatabaseRepairPage_TaxonBase);
127
            checkBoxTaxonBase
128
            .setToolTipText(Messages.DatabaseRepairPage_toolTip_taxonBase);
129
            checkBoxTaxonBase.addSelectionListener(new SelectionAdapter() {
130
                @Override
131
                public void widgetSelected(SelectionEvent e) {
132
                    List<Class<? extends IdentifiableEntity>> classList  = config.getClassList();
133
                    classList.add(TaxonBase.class);
134
                }
135
            });
136

    
137
            Button checkBoxReference = new Button(composite_1, SWT.CHECK);
138
            checkBoxReference.setSelection(config.getClassList().contains(Reference.class));
139
            checkBoxReference.setText(Messages.DatabaseRepairPage_Reference);
140
            checkBoxReference
141
            .setToolTipText(Messages.DatabaseRepairPage_toolTip_reference);
142
            checkBoxReference.addSelectionListener(new SelectionAdapter() {
143
                @Override
144
                public void widgetSelected(SelectionEvent e) {
145
                    List<Class<? extends IdentifiableEntity>> classList  = config.getClassList();
146
                    classList.add(Reference.class);
147
                }
148
            });
149

    
150

    
151
            tabFolder.pack();
152
    }
153
}
(12-12/12)