1
|
/**
|
2
|
* Copyright (C) 2009 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.cdm.remote.editor;
|
11
|
|
12
|
import java.beans.PropertyEditorSupport;
|
13
|
import java.util.UUID;
|
14
|
|
15
|
public class UUIDPropertyEditor extends PropertyEditorSupport {
|
16
|
|
17
|
private String nullRepresentation;
|
18
|
|
19
|
public UUIDPropertyEditor() {
|
20
|
super();
|
21
|
}
|
22
|
|
23
|
public UUIDPropertyEditor(String nullRepresentation){
|
24
|
super();
|
25
|
this.nullRepresentation = nullRepresentation;
|
26
|
}
|
27
|
|
28
|
@Override
|
29
|
public void setAsText(String text) {
|
30
|
if(nullRepresentation != null && nullRepresentation.equals(text)){
|
31
|
setValue(null);
|
32
|
} else {
|
33
|
setValue(UUID.fromString(text));
|
34
|
}
|
35
|
}
|
36
|
}
|