ref #8677: layout and labeling in aggregation config wizard
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / supplemental / AbstractOriginalSourceElement.java
1 /**
2 * Copyright (C) 2007 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
10 package eu.etaxonomy.taxeditor.ui.section.supplemental;
11
12 import org.eclipse.swt.SWT;
13 import org.eclipse.swt.events.SelectionListener;
14
15 import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
16 import eu.etaxonomy.cdm.model.reference.OriginalSourceBase;
17 import eu.etaxonomy.cdm.model.reference.OriginalSourceType;
18 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
19 import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
20 import eu.etaxonomy.taxeditor.ui.combo.OriginalSourceTypeComparator;
21 import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
22 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
23 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
24 import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
25 import eu.etaxonomy.taxeditor.ui.section.common.ExternalLinksSection;
26
27 /**
28 * @author n.hoffmann
29 * @created Mar 16, 2010
30 * @version 1.0
31 */
32 public abstract class AbstractOriginalSourceElement<T extends OriginalSourceBase> extends AbstractReferencedEntityElement<T> {
33 protected EnumComboElement<OriginalSourceType> combo_origsourcetype;
34 protected TextWithLabelElement text_idInSource;
35 protected TextWithLabelElement text_idNamespace;
36 protected TextWithLabelElement text_originaleNameString;
37
38 protected ExternalLinksSection externalLinks;
39
40 public AbstractOriginalSourceElement(CdmFormFactory formFactory,
41 AbstractFormSection section,
42 T element, SelectionListener removeListener,
43 int style, boolean isCommonNameReference) {
44 super(formFactory, section, element, removeListener, style, isCommonNameReference);
45 }
46
47 public AbstractOriginalSourceElement(CdmFormFactory formFactory,
48 AbstractFormSection section,
49 T element, SelectionListener removeListener,
50 int style) {
51 super(formFactory, section, element, removeListener, style);
52 }
53
54 /**
55 * {@inheritDoc}
56 */
57 @Override
58 public void setEntity(T entity) {
59 super.setEntity(entity);
60 text_originaleNameString.setText(entity.getOriginalNameString());
61 externalLinks.setEntity(entity);
62 }
63
64 /** {@inheritDoc}
65 * @wbp.parser.entryPoint*/
66 @Override
67 public void createControls(ICdmFormElement formElement, int style) {
68 combo_origsourcetype = formFactory
69 .createEnumComboElement(OriginalSourceType.class,
70 formElement, new OriginalSourceTypeComparator(getEntity()), style);
71 super.createControls(formElement, style);
72 if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowIdInSource.getKey())){
73 text_idInSource = formFactory.createTextWithLabelElement(formElement, "ID in Source", null, style);
74 }
75 if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowNamespaceInSource.getKey())){
76 text_idNamespace = formFactory.createTextWithLabelElement(formElement, "ID Namespace", null, style);
77 }
78 text_originaleNameString = formFactory.createTextWithLabelElement(
79 formElement, "Original Information", null, SWT.NULL);
80
81
82
83 }
84
85
86 }