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 java.net.URISyntaxException;
|
13
|
import java.util.HashSet;
|
14
|
import java.util.Set;
|
15
|
|
16
|
import eu.etaxonomy.cdm.model.common.Language;
|
17
|
import eu.etaxonomy.cdm.model.common.Marker;
|
18
|
import eu.etaxonomy.cdm.model.common.Representation;
|
19
|
import eu.etaxonomy.cdm.model.common.TermVocabulary;
|
20
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
21
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
22
|
import eu.etaxonomy.taxeditor.ui.element.UriWithLabelElement;
|
23
|
|
24
|
/**
|
25
|
* @author l.morris
|
26
|
* @date 20 Dec 2011
|
27
|
*
|
28
|
*/
|
29
|
public class TermVocabularyDetailElement extends AbstractTermBaseDetailElement<TermVocabulary> {
|
30
|
|
31
|
private UriWithLabelElement uri_uriTermSource;
|
32
|
/**
|
33
|
* @param formFactory
|
34
|
* @param formElement
|
35
|
*/
|
36
|
public TermVocabularyDetailElement(CdmFormFactory formFactory,
|
37
|
ICdmFormElement formElement) {
|
38
|
super(formFactory, formElement);
|
39
|
}
|
40
|
|
41
|
/* (non-Javadoc)
|
42
|
* @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#createControls(eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement, java.lang.Object, int)
|
43
|
*/
|
44
|
@Override
|
45
|
protected void createControls(ICdmFormElement formElement,
|
46
|
TermVocabulary entity, int style) {
|
47
|
|
48
|
super.createControls(formElement, entity, style);
|
49
|
uri_uriTermSource = formFactory.createUriWithLabelElement(formElement, "URI Term Source", getEntity().getTermSourceUri(), style);
|
50
|
}
|
51
|
|
52
|
/* (non-Javadoc)
|
53
|
* @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#handleEvent(java.lang.Object)
|
54
|
*/
|
55
|
@Override
|
56
|
public void handleEvent(Object eventSource) {
|
57
|
|
58
|
if (eventSource == text_label) {
|
59
|
getEntity().setLabel(text_label.getText());
|
60
|
getEntity().setTitleCache(null);
|
61
|
} else if (eventSource == text_description) {
|
62
|
|
63
|
Representation representation = getEntity().getRepresentation(Language.DEFAULT());
|
64
|
representation.setText(text_description.getText());
|
65
|
} else if (eventSource == uri_uri) {
|
66
|
|
67
|
try {
|
68
|
getEntity().setUri(uri_uri.getUri());
|
69
|
} catch (URISyntaxException e) {
|
70
|
|
71
|
e.printStackTrace();
|
72
|
}
|
73
|
} else if (eventSource == uri_uriTermSource) {
|
74
|
try {
|
75
|
getEntity().setTermSourceUri(uri_uriTermSource.getUri());
|
76
|
} catch (URISyntaxException e) {
|
77
|
// TODO Auto-generated catch block
|
78
|
e.printStackTrace();
|
79
|
}
|
80
|
}
|
81
|
}
|
82
|
|
83
|
/* (non-Javadoc)
|
84
|
* @see eu.etaxonomy.taxeditor.ui.section.vocabulary.AbstractTermBaseDetailElement#getVocabularyMarkers()
|
85
|
*/
|
86
|
@Override
|
87
|
public TermVocabulary getVocabulary() {
|
88
|
return getEntity();
|
89
|
}
|
90
|
|
91
|
}
|