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.ICdmFormElement;
|
20
|
|
21
|
/**
|
22
|
* @author n.hoffmann
|
23
|
* @created Dec 20, 2010
|
24
|
* @version 1.0
|
25
|
*/
|
26
|
public abstract class UriWithLabelElementFacade extends TextWithLabelElementFacade {
|
27
|
private static final Logger logger = Logger.getLogger(UriWithLabelElementFacade.class);
|
28
|
|
29
|
private static UriWithLabelElementFacade IMPL;
|
30
|
static{
|
31
|
IMPL = (UriWithLabelElementFacade) ImplementationLoader.newInstance(UriWithLabelElementFacade.class);
|
32
|
}
|
33
|
|
34
|
protected UriWithLabelElementFacade(){
|
35
|
}
|
36
|
|
37
|
/**
|
38
|
* @param formFactory
|
39
|
* @param parentElement
|
40
|
* @param labelString
|
41
|
* @param initialText
|
42
|
* @param textHeight
|
43
|
* @param style
|
44
|
*/
|
45
|
protected UriWithLabelElementFacade(CdmFormFactoryFacade formFactory,
|
46
|
ICdmFormElement parentElement, String labelString,
|
47
|
URI initialUri, Integer textHeight, int style) {
|
48
|
super(formFactory, parentElement, labelString, null, textHeight, style);
|
49
|
setUri(initialUri);
|
50
|
}
|
51
|
|
52
|
public static UriWithLabelElementFacade getInstance( CdmFormFactoryFacade formFactory,
|
53
|
ICdmFormElement parentElement, String labelString,
|
54
|
URI initialUri, Integer textHeight, int style)
|
55
|
{
|
56
|
return (UriWithLabelElementFacade)IMPL.getInstanceInternal(formFactory, parentElement, labelString, initialUri, textHeight, style);
|
57
|
}
|
58
|
|
59
|
protected abstract Object getInstanceInternal(CdmFormFactoryFacade formFactory,
|
60
|
ICdmFormElement parentElement, String labelString,
|
61
|
URI initialUri, Integer textHeight, int style);
|
62
|
|
63
|
/**
|
64
|
*
|
65
|
*/
|
66
|
public void setUri(URI uri) {
|
67
|
if(uri != null){
|
68
|
super.setText(uri.toString());
|
69
|
}
|
70
|
}
|
71
|
|
72
|
public URI getUri() throws URISyntaxException{
|
73
|
return new URI(super.getText());
|
74
|
}
|
75
|
|
76
|
}
|