Merge branch 'release/4.7.0'
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / databaseAdmin / wizard / AbstractPreferenceWizard.java
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.layout.GridData;
14 import org.eclipse.swt.layout.GridLayout;
15 import org.eclipse.swt.widgets.Composite;
16 import org.eclipse.swt.widgets.TabFolder;
17 import org.eclipse.swt.widgets.TabItem;
18
19 /**
20 * @author k.luther
21 * @date 26.04.2017
22 *
23 */
24 public abstract class AbstractPreferenceWizard extends WizardPage {
25 /**
26 * @param pageName
27 */
28 protected AbstractPreferenceWizard(String pageName) {
29 super(pageName);
30
31 }
32 protected TabFolder tabFolder;
33 protected Composite composite;
34 /***
35 * Adds a tab to the page.
36 * @param text the tab label
37 */
38 public Composite addTab(String text) {
39 if (tabFolder == null){
40 // initialize tab folder
41 if (composite == null) {
42 composite = new Composite(getShell(), SWT.NONE);
43 }
44 tabFolder = new TabFolder(composite, SWT.NONE);
45 tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
46 }
47
48 TabItem item = new TabItem(tabFolder, SWT.NONE);
49 item.setText(text);
50
51 Composite currentTab = new Composite(tabFolder, SWT.NULL);
52 GridLayout layout = new GridLayout();
53 currentTab.setLayout(layout);
54 currentTab.setFont(composite.getFont());
55 // currentTab.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
56
57 item.setControl(currentTab);
58 return currentTab;
59
60 }
61
62 }