1e3b307c887153ef8b07b1251d3368f59bb983f6
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / vocabulary / DefinedTermDetailSection.java
1 // $Id$
2 /**
3 * Copyright (C) 2009 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.section.vocabulary;
11
12 import org.eclipse.jface.viewers.ISelectionProvider;
13 import org.eclipse.ui.forms.widgets.TableWrapLayout;
14
15 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
16 import eu.etaxonomy.cdm.model.common.DefinedTermBase;
17 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
18 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
19 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType;
20 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
21
22 /**
23 * @author l.morris
24 * @date 4 Jan 2012
25 *
26 */
27 public class DefinedTermDetailSection<T extends DefinedTermBase> extends AbstractCdmDetailSection<T> {
28
29 /**
30 * @param formFactory
31 * @param definedTermClass
32 * @param conversation
33 * @param parentElement
34 * @param selectionProvider
35 * @param style
36 */
37 public DefinedTermDetailSection(CdmFormFactory formFactory,
38 Class<T> definedTermClass, ConversationHolder conversation, ICdmFormElement parentElement,
39 ISelectionProvider selectionProvider, int style) {
40 super(formFactory, definedTermClass, conversation, parentElement, selectionProvider, style);
41 }
42
43 /* (non-Javadoc)
44 * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#getDetailType()
45 */
46 @Override
47 protected DetailType getDetailType() {
48 return null;
49 }
50
51 @Override
52 protected void createControlsByType(
53 AbstractCdmDetailSection<T> abstractCdmDetailSection,
54 Class<T> clazz, int style) {
55 TableWrapLayout layout = (TableWrapLayout) getLayoutComposite()
56 .getLayout();
57 layout.topMargin = 10;
58 layout.numColumns = 2;
59
60 getLayoutComposite().setLayout(layout);
61 detailElement = formFactory.createDefinedTermDetailElement(clazz,
62 abstractCdmDetailSection, style);
63 }
64
65 /* (non-Javadoc)
66 * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#getHeading()
67 */
68 @Override
69 public String getHeading() {
70 return "Defined Term: "+ (getEntity() != null ? getEntity().getLabel() : "");
71 }
72
73 }