merged campanula branch to trunk. Main features are: BioCase Query via Imports, Deriv...
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / vocabulary / DefinedTermDetailElement.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 eu.etaxonomy.cdm.model.common.DefinedTermBase;
13 import eu.etaxonomy.cdm.model.common.TermVocabulary;
14 import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
15 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
16 import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
17
18 /**
19 * @author l.morris
20 * @date 20 Dec 2011
21 *
22 */
23 public class DefinedTermDetailElement<T extends DefinedTermBase> extends AbstractTermBaseDetailElement<T> {
24
25 protected TextWithLabelElement textIdInVocabulary;
26
27 /**
28 * @param formFactory
29 * @param formElement
30 */
31 public DefinedTermDetailElement(CdmFormFactory formFactory,
32 ICdmFormElement formElement) {
33 super(formFactory, formElement);
34 }
35
36 @Override
37 protected void createControls(ICdmFormElement formElement, T entity, int style) {
38 super.createControls(formElement, entity, style);
39 textIdInVocabulary = formFactory.createTextWithLabelElement(formElement, "ID in vocabulary", entity.getIdInVocabulary(), style);
40 };
41
42 /* (non-Javadoc)
43 * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#handleEvent(java.lang.Object)
44 */
45 @Override
46 public void handleEvent(Object eventSource) {
47 handleRepresentation(eventSource);
48 if(eventSource==textIdInVocabulary){
49 getEntity().setIdInVocabulary(textIdInVocabulary.getText());
50 }
51 }
52
53 /* (non-Javadoc)
54 * @see eu.etaxonomy.taxeditor.ui.section.vocabulary.AbstractTermBaseDetailElement#getVocabularyMarkers()
55 */
56 @Override
57 public TermVocabulary getVocabulary() {
58 return getEntity() != null ? getEntity().getVocabulary() : null;
59 }
60
61 }