Implemented distinction between basionym (ICBN) and original combination (ICZN),...
[taxeditor.git] / eclipseprojects / eu.etaxonomy.taxeditor / src / eu / etaxonomy / taxeditor / propertysheet / name / BotanicalNamePropertySource.java
1 /**
2 * Copyright (C) 2007 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.taxeditor.propertysheet.name;
11
12 import org.apache.log4j.Logger;
13 import org.eclipse.ui.views.properties.TextPropertyDescriptor;
14
15 import eu.etaxonomy.cdm.model.name.BotanicalName;
16
17 /**
18 * Property source for BotanicalName entries.
19 *
20 * @author p.ciardelli
21 * @created 21.05.2008
22 * @version 1.0
23 */
24 public class BotanicalNamePropertySource extends NonViralNamePropertySource {
25 private static final Logger logger = Logger
26 .getLogger(BotanicalNamePropertySource.class);
27
28 // Property unique keys
29 public static final String P_ID_REFERENCEYEAR = "referenceyear";
30 // Property display keys
31 public static final String P_REFERENCEYEAR = "099:Reference Year";
32
33 public BotanicalNamePropertySource(BotanicalName name) {
34 super(name);
35 // addDescriptor(P_ID_REFERENCEYEAR);
36 }
37
38 protected void addDescriptor(String id) {
39 if (id.equals(P_ID_REFERENCEYEAR)) {
40 descriptors.addElement(
41 new TextPropertyDescriptor(P_ID_REFERENCEYEAR, P_REFERENCEYEAR));
42 }
43 super.addDescriptor(id);
44 }
45
46 @Override
47 public Object getPropertyValue(Object id) {
48 if (id.equals(P_ID_NOMENCLATURAL_CODE)) {
49 return "ICBN";
50 }
51 if (id.equals(P_ID_REFERENCEYEAR)) {
52 return subEmptyForNull(name.getReferenceYear());
53 }
54 return super.getPropertyValue(id);
55 }
56 }