Project

General

Profile

Download (2.43 KB) Statistics
| Branch: | Tag: | Revision:
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

    
14
import eu.etaxonomy.cdm.model.common.TermVocabulary;
15
import eu.etaxonomy.taxeditor.store.StoreUtil;
16
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
17
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
18
import eu.etaxonomy.taxeditor.ui.element.UriWithLabelElement;
19

    
20
/**
21
 * @author l.morris
22
 * @date 20 Dec 2011
23
 *
24
 */
25
public class TermVocabularyDetailElement extends AbstractTermBaseDetailElement<TermVocabulary> {
26

    
27
	private UriWithLabelElement uri_uriTermSource;
28
	/**
29
	 * @param formFactory
30
	 * @param formElement
31
	 */
32
	public TermVocabularyDetailElement(CdmFormFactory formFactory,
33
			ICdmFormElement formElement) {
34
		super(formFactory, formElement);
35
	}
36

    
37
	/* (non-Javadoc)
38
	 * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#createControls(eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement, java.lang.Object, int)
39
	 */
40
	@Override
41
	protected void createControls(ICdmFormElement formElement,
42
			TermVocabulary entity, int style) {
43
		
44
		super.createControls(formElement, entity, style);
45
		uri_uriTermSource = formFactory.createUriWithLabelElement(formElement, "Term Source URI", getEntity().getTermSourceUri(), style);
46
	}
47

    
48
	/* (non-Javadoc)
49
	 * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#handleEvent(java.lang.Object)
50
	 */
51
	@Override
52
	public void handleEvent(Object eventSource) {
53
		
54
		handleRepresentation(eventSource);
55
		
56
		if (eventSource == uri_uri) {
57
			try {
58
				getEntity().setUri(uri_uri.getUri());
59
			} catch (URISyntaxException e) {
60
				StoreUtil.errorDialog("Not a URI", getClass(), "You have to provide a valid URI");
61
			}
62
		} else if (eventSource == uri_uriTermSource) {
63
			try {
64
				getEntity().setTermSourceUri(uri_uriTermSource.getUri());
65
			} catch (URISyntaxException e) {
66
				StoreUtil.errorDialog("Not a URI", getClass(), "You have to provide a valid URI");
67
			}
68
		}
69
	}
70

    
71
	/* (non-Javadoc)
72
	 * @see eu.etaxonomy.taxeditor.ui.section.vocabulary.AbstractTermBaseDetailElement#getVocabularyMarkers()
73
	 */
74
	@Override
75
	public TermVocabulary getVocabulary() {
76
		return getEntity();
77
	}
78

    
79
}
(8-8/9)