Project

General

Profile

Download (2.12 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2007 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

    
11
package eu.etaxonomy.taxeditor.singlesource.ui.forms;
12

    
13
import java.net.URI;
14
import java.net.URISyntaxException;
15

    
16
import org.apache.log4j.Logger;
17

    
18
import eu.etaxonomy.taxeditor.singlesource.ImplementationLoader;
19
import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
20
import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
21

    
22
/**
23
 * @author n.hoffmann
24
 * @created Dec 20, 2010
25
 * @version 1.0
26
 */
27
public abstract class UriWithLabelElementFacade extends TextWithLabelElementFacade {
28
	private static final Logger logger = Logger.getLogger(UriWithLabelElementFacade.class);
29
	
30
	private static UriWithLabelElementFacade IMPL;
31
	static{
32
		IMPL = (UriWithLabelElementFacade) ImplementationLoader.newInstance(UriWithLabelElementFacade.class);
33
	}
34

    
35
	protected UriWithLabelElementFacade(){
36
	}
37

    
38
	/**
39
	 * @param formFactory
40
	 * @param parentElement
41
	 * @param labelString
42
	 * @param initialText
43
	 * @param textHeight
44
	 * @param style
45
	 */
46
	protected UriWithLabelElementFacade(CdmFormFactory formFactory,
47
			ICdmFormElement parentElement, String labelString,
48
			URI initialUri, Integer textHeight, int style) {
49
		super(formFactory, parentElement, labelString, null, textHeight, style);
50
		setUri(initialUri);
51
	}
52

    
53
	public static UriWithLabelElementFacade getInstance( CdmFormFactory formFactory,
54
			ICdmFormElement parentElement, String labelString,
55
			URI initialUri, Integer textHeight, int style)
56
	{
57
		return (UriWithLabelElementFacade)IMPL.getInstanceInternal(formFactory, parentElement, labelString, initialUri, textHeight, style);
58
	}
59

    
60
	protected abstract Object getInstanceInternal(CdmFormFactory formFactory,
61
			ICdmFormElement parentElement, String labelString,
62
			URI initialUri, Integer textHeight, int style);
63

    
64
	/**
65
	 * 
66
	 */
67
	public void setUri(URI uri) {
68
		if(uri != null){
69
			super.setText(uri.toString());
70
		}
71
	}
72
	
73
	public URI getUri() throws URISyntaxException{
74
		return new URI(super.getText());
75
	}
76
	
77
}
(4-4/4)