public int compare (final @Nonnull Taxon taxon1, final @Nonnull Taxon taxon2) { return collator.compare(taxon1.getScientificName(), taxon2.getScientificName()); } };
/******************************************************************************************************************* * * ******************************************************************************************************************/ private boolean matchesScientificName (final @Nonnull Taxon taxon, final @Nonnull CharSequence match, final @Nonnull NameMatcher nameMatcher) { return nameMatcher.matches(taxon.getScientificName(), match, Locale.ENGLISH); } }
public CommonNamesPresentationModel (final @Nonnull Taxon taxon, final @Nonnull Locale locale) throws NotFoundException { super(new Object[] { taxon }); language = getMessage(_, "lang_" + locale.getLanguage()); name = taxon.getDisplayName(locale); scientificName = taxon.getScientificName(); } }
/******************************************************************************************************************* * * ******************************************************************************************************************/ @Nonnull private String renderHierarchy() { final StringBuilder buffer = new StringBuilder(); for (final Taxon taxon : getPath()) { buffer.append(String.format("%s<br>", taxon.getScientificName())); } return buffer.toString(); }
@Nonnull private String getDisplayName (final @Nonnull Taxon taxon) { try { return taxon.getDisplayName(primaryTaxonLocale); } catch (NotFoundException e) { // We prepend some zeds to scientific names, so if they are compared against common names, // they go to the bottom of the list. // FIXME: in some locales, Z is not the last letter! return "ZZZZZZZ" + taxon.getScientificName(); } } };
buffer.append(String.format("<small><i>%s</i></small>", taxon.getScientificName()));
@Nonnull public String render (final @Nonnull Object... args) { final StringBuilder buffer = new StringBuilder(); String separator = ""; final List<Locale> taxonLocales = preferences.get().getTaxonomyLocales(); for (final Locale locale : taxonLocales) { try { buffer.append(separator).append(taxon.getDisplayName(locale)); separator = ", "; } catch (NotFoundException e) { // a localized name not available, just ignore it } } if (preferences.get().isScientificNamesRenderingEnabled()) { buffer.append(" (").append(taxon.getScientificName()).append(")"); } return buffer.toString(); } }
buffer.append(String.format("<small><i>%s</i></small>", taxon.getScientificName()));
taxonNames.add(taxon.getScientificName());
buffer.append(taxon.getScientificName()).append(separator);