1
|
package eu.etaxonomy.cdm.remote.editor;
|
2
|
|
3
|
import java.beans.PropertyEditorSupport;
|
4
|
import java.util.ArrayList;
|
5
|
import java.util.List;
|
6
|
import java.util.UUID;
|
7
|
|
8
|
/**
|
9
|
* @author f.revilla
|
10
|
* @date 09.06.2010
|
11
|
*/
|
12
|
|
13
|
public class UUIDListPropertyEditor extends PropertyEditorSupport {
|
14
|
|
15
|
public void setAsText(String text) {
|
16
|
String separator = ",";
|
17
|
List<UUID> uuidList = new ArrayList<UUID>();
|
18
|
if (text.contains(",")){
|
19
|
//set the value for more than one UUID
|
20
|
String[] uuidStringList = text.split(separator);
|
21
|
for (String element : uuidStringList) {
|
22
|
uuidList.add(UUID.fromString(element));
|
23
|
}
|
24
|
} else if(text.length() > 0){
|
25
|
uuidList.add(UUID.fromString(text));
|
26
|
}
|
27
|
setValue(uuidList);
|
28
|
}
|
29
|
|
30
|
}
|