3 * Copyright (C) 2009 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
;
12 import org
.apache
.commons
.lang
.StringUtils
;
14 import eu
.etaxonomy
.cdm
.model
.common
.DefinedTermBase
;
15 import eu
.etaxonomy
.cdm
.model
.common
.TermVocabulary
;
16 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
17 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
18 import eu
.etaxonomy
.taxeditor
.ui
.element
.TextWithLabelElement
;
25 public class DefinedTermDetailElement
<T
extends DefinedTermBase
> extends AbstractTermBaseDetailElement
<T
> {
27 protected TextWithLabelElement textIdInVocabulary
;
33 public DefinedTermDetailElement(CdmFormFactory formFactory
,
34 ICdmFormElement formElement
) {
35 super(formFactory
, formElement
);
39 protected void createControls(ICdmFormElement formElement
, T entity
, int style
) {
40 super.createControls(formElement
, entity
, style
);
41 textIdInVocabulary
= formFactory
.createTextWithLabelElement(formElement
, "ID in vocabulary", entity
.getIdInVocabulary(), style
);
45 * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#handleEvent(java.lang.Object)
48 public void handleEvent(Object eventSource
) {
49 handleRepresentation(eventSource
);
50 if(eventSource
==textIdInVocabulary
){
51 if (StringUtils
.isBlank(textIdInVocabulary
.getText())){
52 getEntity().setIdInVocabulary(null);
54 getEntity().setIdInVocabulary(textIdInVocabulary
.getText());
61 * @see eu.etaxonomy.taxeditor.ui.section.vocabulary.AbstractTermBaseDetailElement#getVocabularyMarkers()
64 public TermVocabulary
getVocabulary() {
65 return getEntity() != null ?
getEntity().getVocabulary() : null;