2 * Copyright (C) 2016 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.taxeditor
.databaseAdmin
.wizard
;
11 import java
.util
.List
;
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
;
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
.TaxonNameBase
;
28 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
29 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
30 import eu
.etaxonomy
.taxeditor
.Messages
;
37 public class Test
extends WizardPage
{
39 CacheUpdaterConfigurator config
;
40 SortIndexUpdaterConfigurator sortIndexConfig
;
41 public Test(String pageName
, CacheUpdaterConfigurator configTitleCache
, SortIndexUpdaterConfigurator sortIndexConfig
) {
43 config
= configTitleCache
;
44 this.sortIndexConfig
= sortIndexConfig
;
51 public void createControl(Composite parent
) {
54 Composite container
= new Composite(parent
, SWT
.NULL
);
55 setControl(container
);
56 container
.setLayout(new FillLayout(SWT
.HORIZONTAL
));
58 TabFolder tabFolder
= new TabFolder(container
, SWT
.NONE
);
60 TabItem tbtmSortIndex
= new TabItem(tabFolder
, SWT
.NONE
);
61 tbtmSortIndex
.setText("Sort Index");
63 Composite composite
= new Composite(tabFolder
, SWT
.NONE
);
64 tbtmSortIndex
.setControl(composite
);
65 composite
.setLayout(new GridLayout(1, true));
67 Button checkBoxTaxonNode
= new Button(composite
, SWT
.CHECK
);
68 checkBoxTaxonNode
.setSelection(sortIndexConfig
.isDoTaxonNode());
69 checkBoxTaxonNode
.setText(Messages
.DatabaseRepairPage_updateTaxonNodes
);
71 .setToolTipText(Messages
.DatabaseRepairPage_toolTip_taxonNode
);
72 checkBoxTaxonNode
.addSelectionListener(new SelectionAdapter() {
74 public void widgetSelected(SelectionEvent e
) {
75 sortIndexConfig
.setDoTaxonNode(!sortIndexConfig
.isDoTaxonNode());
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() {
86 public void widgetSelected(SelectionEvent e
) {
87 sortIndexConfig
.setDoPolytomousKeyNode(!sortIndexConfig
.isDoPolytomousKeyNode());
91 Button checkBoxFeatureNode
= new Button(composite
, SWT
.CHECK
);
92 checkBoxFeatureNode
.setSelection(sortIndexConfig
.isDoFeatureNode());
93 checkBoxFeatureNode
.setText(Messages
.DatabaseRepairPage_featureNodes
);
95 .setToolTipText(Messages
.DatabaseRepairPage_toolTipFeatureNodes
);
96 checkBoxFeatureNode
.addSelectionListener(new SelectionAdapter() {
98 public void widgetSelected(SelectionEvent e
) {
99 sortIndexConfig
.setDoFeatureNode(!sortIndexConfig
.isDoFeatureNode());
104 TabItem tbtmNewItem
= new TabItem(tabFolder
, SWT
.NONE
);
105 tbtmNewItem
.setText("Update Caches");
107 Composite composite_1
= new Composite(tabFolder
, SWT
.NONE
);
108 tbtmNewItem
.setControl(composite_1
);
109 composite_1
.setLayout(new GridLayout(1, false));
111 Button checkBoxTaxonName
= new Button(composite_1
, SWT
.CHECK
);
112 checkBoxTaxonName
.setSelection(config
.getClassList().contains(TaxonNameBase
.class));
113 checkBoxTaxonName
.setText(Messages
.DatabaseRepairPage_updateTaxonName
);
115 .setToolTipText(Messages
.DatabaseRepairPage_toolTip_TaxonName
);
116 checkBoxTaxonName
.addSelectionListener(new SelectionAdapter() {
118 public void widgetSelected(SelectionEvent e
) {
119 List
<Class
<?
extends IdentifiableEntity
>> classList
= config
.getClassList();
120 classList
.add(TaxonNameBase
.class);
124 Button checkBoxTaxonBase
= new Button(composite_1
, SWT
.CHECK
);
125 checkBoxTaxonBase
.setSelection(config
.getClassList().contains(TaxonBase
.class));
126 checkBoxTaxonBase
.setText(Messages
.DatabaseRepairPage_TaxonBase
);
128 .setToolTipText(Messages
.DatabaseRepairPage_toolTip_taxonBase
);
129 checkBoxTaxonBase
.addSelectionListener(new SelectionAdapter() {
131 public void widgetSelected(SelectionEvent e
) {
132 List
<Class
<?
extends IdentifiableEntity
>> classList
= config
.getClassList();
133 classList
.add(TaxonBase
.class);
137 Button checkBoxReference
= new Button(composite_1
, SWT
.CHECK
);
138 checkBoxReference
.setSelection(config
.getClassList().contains(Reference
.class));
139 checkBoxReference
.setText(Messages
.DatabaseRepairPage_Reference
);
141 .setToolTipText(Messages
.DatabaseRepairPage_toolTip_reference
);
142 checkBoxReference
.addSelectionListener(new SelectionAdapter() {
144 public void widgetSelected(SelectionEvent e
) {
145 List
<Class
<?
extends IdentifiableEntity
>> classList
= config
.getClassList();
146 classList
.add(Reference
.class);