- fixed potential NPE
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / element / UriWithLabelElement.java
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.ui.element;
12
13 import java.net.URI;
14 import java.net.URISyntaxException;
15
16
17
18 /**
19 * @author n.hoffmann
20 * @created Dec 20, 2010
21 * @version 1.0
22 */
23 public class UriWithLabelElement extends TextWithLabelElement {
24
25 /**
26 * @param formFactory
27 * @param parentElement
28 * @param labelString
29 * @param initialText
30 * @param textHeight
31 * @param style
32 */
33 protected UriWithLabelElement(CdmFormFactory formFactory,
34 ICdmFormElement parentElement, String labelString,
35 URI initialUri, Integer textHeight, int style) {
36 super(formFactory, parentElement, labelString, null, textHeight, style);
37 setUri(initialUri);
38 }
39
40 /**
41 *
42 */
43 public void setUri(URI uri) {
44 if(uri != null){
45 super.setText(uri.toString());
46 }
47 }
48
49 public URI getUri() throws URISyntaxException{
50 if(super.getText()!=null){
51 return new URI(super.getText());
52 }
53 return null;
54 }
55
56 }