Merge branch 'release/4.0.0'
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / AbstractEntityCollectionElementWizardPage.java
1 // $Id$
2 /**
3 * Copyright (C) 2016 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
9 */
10 package eu.etaxonomy.taxeditor.ui;
11
12 import org.eclipse.jface.util.IPropertyChangeListener;
13 import org.eclipse.jface.wizard.WizardPage;
14 import org.eclipse.swt.widgets.Composite;
15 import org.eclipse.ui.forms.widgets.TableWrapLayout;
16
17 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
18 import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
19 import eu.etaxonomy.taxeditor.ui.element.RootElement;
20
21 /**
22 * @author pplitzner
23 * @date Mar 30, 2016
24 *
25 */
26 public abstract class AbstractEntityCollectionElementWizardPage extends WizardPage implements
27 IPropertyChangeListener {
28
29 protected CdmFormFactory formFactory;
30
31 protected RootElement rootElement;
32
33 protected AbstractEntityCollectionElementWizardPage(String pageName) {
34 super(pageName);
35 }
36
37 /**
38 * {@inheritDoc}
39 */
40 @Override
41 public void createControl(Composite parent) {
42 this.setPageComplete(false);
43
44 Composite control = formFactory.createComposite(parent);
45
46 TableWrapLayout layout = LayoutConstants.LAYOUT(2, false);
47 layout.horizontalSpacing = 5;
48 control.setLayout(layout);
49
50 rootElement = new RootElement(formFactory, control);
51
52
53 setControl(control);
54
55 }
56
57 /** {@inheritDoc} */
58 @Override
59 public void dispose() {
60 rootElement.removeElements();
61 formFactory.removePropertyChangeListener(this);
62 super.dispose();
63 }
64
65 }