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
|
|
14
|
import eu.etaxonomy.cdm.model.name.Rank;
|
15
|
import eu.etaxonomy.cdm.strategy.exceptions.UnknownCdmTypeException;
|
16
|
|
17
|
public class RankPropertyEditor extends PropertyEditorSupport {
|
18
|
|
19
|
public void setAsText(String name) {
|
20
|
try {
|
21
|
setValue(Rank.getRankByName(name));
|
22
|
} catch (UnknownCdmTypeException e) {
|
23
|
throw new IllegalArgumentException("Unknown Rank "+name);
|
24
|
}
|
25
|
}
|
26
|
|
27
|
public String setAsText() {
|
28
|
return ((Rank)getValue()).getLabel();
|
29
|
}
|
30
|
|
31
|
}
|