minor
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / AbstractEntityCollectionElementWizardPage.java
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.ui;
10
11 import org.eclipse.jface.util.IPropertyChangeListener;
12 import org.eclipse.jface.wizard.WizardPage;
13 import org.eclipse.swt.widgets.Composite;
14 import org.eclipse.ui.forms.widgets.TableWrapLayout;
15
16 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
17 import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
18 import eu.etaxonomy.taxeditor.ui.element.RootElement;
19
20 /**
21 * @author pplitzner
22 * @date Mar 30, 2016
23 *
24 */
25 public abstract class AbstractEntityCollectionElementWizardPage extends WizardPage implements
26 IPropertyChangeListener {
27
28 protected CdmFormFactory formFactory;
29
30
31 protected RootElement rootElement;
32
33 protected AbstractEntityCollectionElementWizardPage(String pageName, CdmFormFactory formFactory) {
34 super(pageName);
35 this.formFactory = formFactory;
36 }
37
38 /**
39 * {@inheritDoc}
40 */
41 @Override
42 public void createControl(Composite parent) {
43 this.setPageComplete(false);
44
45 Composite control = formFactory.createComposite(parent);
46
47 TableWrapLayout layout = LayoutConstants.LAYOUT(2, false);
48 layout.horizontalSpacing = 5;
49 control.setLayout(layout);
50
51 rootElement = new RootElement(formFactory, control);
52
53
54 setControl(control);
55
56 }
57
58 /** {@inheritDoc} */
59 @Override
60 public void dispose() {
61 rootElement.removeElements();
62 formFactory.removePropertyChangeListener(this);
63
64 super.dispose();
65 }
66
67 }