Project

General

Profile

Download (2.5 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.model.MessagingUtils;
16
import eu.etaxonomy.taxeditor.store.StoreUtil;
17
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
18
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
19
import eu.etaxonomy.taxeditor.ui.element.UriWithLabelElement;
20

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

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

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

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

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

    
80
}
(8-8/9)