1
|
/**
|
2
|
* Copyright (C) 2017 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.custom.ScrolledComposite;
|
14
|
import org.eclipse.swt.layout.GridData;
|
15
|
import org.eclipse.swt.layout.GridLayout;
|
16
|
import org.eclipse.swt.widgets.Composite;
|
17
|
import org.eclipse.swt.widgets.TabFolder;
|
18
|
import org.eclipse.swt.widgets.TabItem;
|
19
|
|
20
|
/**
|
21
|
* @author k.luther
|
22
|
* @date 26.04.2017
|
23
|
*
|
24
|
*/
|
25
|
public abstract class AbstractPreferenceWizard extends WizardPage {
|
26
|
/**
|
27
|
* @param pageName
|
28
|
*/
|
29
|
protected AbstractPreferenceWizard(String pageName) {
|
30
|
super(pageName);
|
31
|
|
32
|
}
|
33
|
protected TabFolder tabFolder;
|
34
|
protected Composite composite;
|
35
|
/***
|
36
|
* Adds a tab to the page.
|
37
|
* @param text the tab label
|
38
|
*/
|
39
|
public Composite addTab(String text) {
|
40
|
if (tabFolder == null){
|
41
|
// initialize tab folder
|
42
|
if (composite == null) {
|
43
|
// composite = new ScrolledComposite(getShell(), SWT.BORDER | SWT.V_SCROLL);
|
44
|
|
45
|
// Composite tabArea = new Composite(scroller, SWT.NONE);
|
46
|
composite = new Composite(getShell(), SWT.NONE);
|
47
|
}
|
48
|
tabFolder = new TabFolder(composite, SWT.NULL);
|
49
|
tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
|
50
|
}
|
51
|
|
52
|
TabItem item = new TabItem(tabFolder, SWT.NONE);
|
53
|
item.setText(text);
|
54
|
|
55
|
Composite currentTab = new Composite(tabFolder, SWT.NONE);
|
56
|
GridLayout layout = new GridLayout();
|
57
|
currentTab.setLayout(layout);
|
58
|
currentTab.setFont(composite.getFont());
|
59
|
// currentTab.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
60
|
|
61
|
item.setControl(currentTab);
|
62
|
return currentTab;
|
63
|
|
64
|
}
|
65
|
|
66
|
}
|