1
|
// $Id: RankPropertyEditor.java 8450 2010-03-19 15:12:17Z a.kohlbecker $
|
2
|
/**
|
3
|
* Copyright (C) 2009 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.cdm.remote.editor;
|
12
|
|
13
|
import java.beans.PropertyEditorSupport;
|
14
|
|
15
|
import eu.etaxonomy.cdm.model.name.Rank;
|
16
|
import eu.etaxonomy.cdm.strategy.exceptions.UnknownCdmTypeException;
|
17
|
|
18
|
public class RankPropertyEditor extends PropertyEditorSupport {
|
19
|
|
20
|
public void setAsText(String name) {
|
21
|
try {
|
22
|
setValue(Rank.getRankByName(name));
|
23
|
} catch (UnknownCdmTypeException e) {
|
24
|
throw new IllegalArgumentException("Unknown Rank "+name);
|
25
|
}
|
26
|
}
|
27
|
|
28
|
public String setAsText() {
|
29
|
return ((Rank)getValue()).getLabel();
|
30
|
}
|
31
|
|
32
|
}
|