// $Id$
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
import eu.etaxonomy.cdm.model.name.NonViralName;
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
-import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection;
*
* @author n.hoffmann
* @created Nov 5, 2009
- * @version 1.0
*/
public class ProtologueSection extends AbstractEntityCollectionSection<TaxonNameBase, DescriptionElementBase> implements ITaxonBaseDetailSection{
-
+
private TaxonBase taxonBase;
/**
List<TaxonNameDescription> descriptions = getTaxonNameDescriptions(getEntity());
for (TaxonNameDescription desc : descriptions){
desc.removeElement(element);
- }
+ }
}
/** {@inheritDoc} */
- public void setTaxonBase(TaxonBase entity) {
+ @Override
+ public void setTaxonBase(TaxonBase entity) {
this.taxonBase = entity;
- NonViralName name = (NonViralName) HibernateProxyHelper.deproxy(entity.getName());
+ NonViralName name = HibernateProxyHelper.deproxy(entity.getName(), NonViralName.class);
setEntity(name);
}
-
+
/**
* NOTE: returns first description
* @param name
}
return (TaxonNameDescription) name.getDescriptions().iterator().next();
}
-
+
/**
* Try to fix FIXME in {@link #getTaxonNameDescription(TaxonNameBase)}
* @param name
*/
private List<TaxonNameDescription> getTaxonNameDescriptions(TaxonNameBase<?,?> name){
List<TaxonNameDescription> result = new ArrayList<TaxonNameDescription>();
- if(name.getDescriptions().size() == 0){
- name.addDescription(TaxonNameDescription.NewInstance(name));
+ if (name == null){
+ return result;
}
for (TaxonNameDescription desc : name.getDescriptions()){
result.add(desc);
return result;
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.ITaxonDetailSection#getTaxon(eu.etaxonomy.cdm.model.taxon.TaxonBase)
- */
@Override
public TaxonBase getTaxonBase() {
return taxonBase;