From f0e3e0ff9c5aa3159f80a1d47f75d2de2c4a9563 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andreas=20M=C3=BCller?= Date: Fri, 8 May 2015 13:06:59 +0000 Subject: [PATCH] fix remaining issues for taxon field prefill #4860 --- .../TaxonNodeDetailElement.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/TaxonNodeDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/TaxonNodeDetailElement.java index 79ec3ffe4..fde5720fc 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/TaxonNodeDetailElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/TaxonNodeDetailElement.java @@ -10,6 +10,7 @@ package eu.etaxonomy.taxeditor.ui.section.classification; +import org.apache.commons.lang.StringUtils; import org.eclipse.swt.widgets.Text; import eu.etaxonomy.cdm.common.CdmUtils; @@ -130,18 +131,20 @@ public class TaxonNodeDetailElement extends AbstractCdmDetailElement name = HibernateProxyHelper.deproxy(node.getTaxon().getName(), NonViralName.class); - if(!name.getRank().isHigher(Rank.GENUS())){ + if( ! name.isSupraGeneric() && name.getRank() != null){ String taxonName = ""; - if(name.isGenus() || name.isInfraGeneric()){ + if(name.isGenus() || name.isInfraGeneric()|| name.isSpeciesAggregate() ){ taxonName = name.getGenusOrUninomial(); } - else if(name.isSpecies() || name.isInfraSpecific()){ - taxonName = name.getGenusOrUninomial() +" "+ name.getSpecificEpithet(); + else if(name.isSpecies() || name.isInfraSpecific() ){ + taxonName = CdmUtils.concat(" ", name.getGenusOrUninomial(),name.getSpecificEpithet()); } - text_newTaxonName.setText(taxonName+" "); - if(text_newTaxonName.getMainControl() instanceof Text){ - Text text = (Text)text_newTaxonName.getMainControl(); - text.setSelection(text_newTaxonName.getText().length()); + if (StringUtils.isNotBlank(taxonName)){ + text_newTaxonName.setText(taxonName + " "); + if(text_newTaxonName.getMainControl() instanceof Text){ + Text text = (Text)text_newTaxonName.getMainControl(); + text.setSelection(text_newTaxonName.getText().length()); + } } } } -- 2.34.1