Type module largely complete.
[taxeditor.git] / eclipseprojects / eu.etaxonomy.taxeditor / src / eu / etaxonomy / taxeditor / propertysheet / name / TaxonBasePropertySource.java
index dfe4907a77546ce1d2d51cbd5932a077702c4775..64fc6ebc76229b6db96e493030551965d4817b34 100644 (file)
@@ -11,6 +11,7 @@ package eu.etaxonomy.taxeditor.propertysheet.name;
 \r
 import java.beans.PropertyChangeEvent;\r
 import java.beans.PropertyChangeListener;\r
+import java.util.Set;\r
 import java.util.Vector;\r
 \r
 import org.apache.log4j.Logger;\r
@@ -25,10 +26,11 @@ import eu.etaxonomy.cdm.model.name.TaxonNameBase;
 import eu.etaxonomy.cdm.model.name.ZoologicalName;\r
 import eu.etaxonomy.cdm.model.reference.ReferenceBase;\r
 import eu.etaxonomy.cdm.model.taxon.TaxonBase;\r
-import eu.etaxonomy.taxeditor.controller.GlobalController;\r
 import eu.etaxonomy.taxeditor.propertysheet.reference.IReferenceSearch;\r
 import eu.etaxonomy.taxeditor.propertysheet.reference.ReferencePropertySource;\r
 import eu.etaxonomy.taxeditor.propertysheet.reference.ReferenceSearchDescriptor;\r
+import eu.etaxonomy.taxeditor.propertysheet.type.TypeCollectionPropertySource;\r
+import eu.etaxonomy.taxeditor.propertysheet.type.TypePropertyDescriptor;\r
 \r
 /**\r
  * @author p.ciardelli\r
@@ -44,16 +46,22 @@ public class TaxonBasePropertySource implements IPropertySource {
     // Property unique keys\r
        public static final String P_ID_TAXONNAME = "P_ID_TAXONNAME";\r
        public static final String P_ID_TAXONSEC = "P_ID_TAXONSEC";\r
+       public static final String P_ID_TYPES = "P_ID_TYPES";\r
        \r
     // Property display keys\r
-       public static final String P_TAXONNAME = "00:Misapplied Name";\r
-       public static final String P_TAXONSEC = "01:Sec";\r
+       public String P_TAXONNAME;\r
+       public static final String P_TAXONSEC = "01:Secundum";\r
+       public static final String P_TYPES = "02:Name Types";\r
        \r
-       public TaxonBasePropertySource(TaxonBase taxon) {\r
+       \r
+       public TaxonBasePropertySource(TaxonBase taxon, String nameTitle) {\r
                this.taxon = taxon;\r
                \r
+               this.P_TAXONNAME = "00:" + nameTitle;\r
+               \r
                addDescriptor(P_ID_TAXONNAME);\r
                addDescriptor(P_ID_TAXONSEC);\r
+               addDescriptor(P_ID_TYPES);              \r
        }\r
 \r
        protected Vector<PropertyDescriptor> descriptors = new Vector<PropertyDescriptor>();\r
@@ -70,6 +78,15 @@ public class TaxonBasePropertySource implements IPropertySource {
                                }\r
                        });\r
                }\r
+               if (id.equals(P_ID_TYPES)) {\r
+                       descriptors.addElement(\r
+                               new TypePropertyDescriptor(P_ID_TYPES, P_TYPES, taxon.getName()) {\r
+                                       protected void saveTypes(Set set) {\r
+                                               setPropertyValue(P_ID_TYPES, set);\r
+                                       }\r
+                               }\r
+                       );\r
+               };\r
        }\r
        \r
        /* (non-Javadoc)\r
@@ -141,6 +158,12 @@ public class TaxonBasePropertySource implements IPropertySource {
                        return secPropertySource;\r
                }\r
                \r
+               if (id.equals(P_ID_TYPES)) {\r
+                       if (taxon.getName() != null) {\r
+                               return new TypeCollectionPropertySource(taxon.getName(), taxon.getName().getSpecimenTypeDesignations());\r
+                       }\r
+               }\r
+               \r
                return null;\r
        }\r
 \r