import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailElement;
import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailSection;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
+import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElementWithAbbreviatedTitle;
import eu.etaxonomy.taxeditor.ui.selection.NomenclaturalAuthorTeamSelectionElement;
import eu.etaxonomy.taxeditor.ui.selection.TaxonNodeSelectionElement;
return element;
}
+ /**
+ * <p>
+ * Creates a selection element for the given type T which shows only the <b>abbreviated</b> title as the label.
+ * </p>
+ * <p>
+ * <strong>Selection elements not handled by this method:</strong>
+ * <ul>
+ * <li>{@link TaxonNodeSelectionElement} see
+ * {@link #createTaxonNodeSelectionElement(ConversationHolder, ICdmFormElement, String, TaxonNode, int, int)}
+ * </li>
+ * <li>{@link NomenclaturalAuthorTeamSelectionElement} see
+ * {@link #createNomenclaturalAuthorTeamSelectionElement(ConversationHolder, ICdmFormElement, String, Team, int, int)}
+ * </li>
+ * </ul>
+ * </p>
+ *
+ * @param clazz
+ * a {@link Class} object of the type that you want the selection
+ * element to handle
+ * @param parentElement
+ * a {@link ICdmFormElement} object.
+ * @param labelString
+ * a {@link String} object.
+ * @param selectionType
+ * @param selection
+ * a {@link ICdmBase} object.
+ * @param style
+ * a int.
+ * @param conversation
+ * a {@link ConversationHolder} object.
+ * @return a {@link EntitySelectionElement} object.
+ */
+ public <T extends ICdmBase> EntitySelectionElementWithAbbreviatedTitle<T> createSelectionElementWithAbbreviatedTitle(
+ Class<T> clazz, ConversationHolder conversation, ICdmFormElement parentElement, String labelString,
+ T selection, int mode, int style) {
+ EntitySelectionElementWithAbbreviatedTitle<T> element = new EntitySelectionElementWithAbbreviatedTitle<T>(this, conversation, parentElement, clazz,
+ labelString, selection, mode, style);
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
+
public TaxonNodeSelectionElement createTaxonNodeSelectionElement(ConversationHolder conversation,
ICdmFormElement parentElement, String labelString, TaxonNode selection, int mode, int style) {
TaxonNodeSelectionElement element = new TaxonNodeSelectionElement(this, conversation, parentElement,
if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
toggleable_cache.setVisible(false);
}
- selectionCombinationAuthor = formFactory.createSelectionElement(TeamOrPersonBase.class,
+ selectionCombinationAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class,
getConversationHolder(),
formElement, "Author",
entity.getCombinationAuthorship(),
EntitySelectionElement.ALL, style);
addElement(selectionCombinationAuthor);
- selectionExCombinationAuthor = formFactory.createSelectionElement(TeamOrPersonBase.class,
+ selectionExCombinationAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class,
getConversationHolder(),
formElement, "Ex Author",
entity.getExCombinationAuthorship(),
EntitySelectionElement.ALL, style);
addElement(selectionExCombinationAuthor);
- selectionBasionymAuthor = formFactory.createSelectionElement(TeamOrPersonBase.class, getConversationHolder(),
+ selectionBasionymAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class, getConversationHolder(),
formElement, "Basionym Author", entity.getBasionymAuthorship(),
EntitySelectionElement.ALL, style);
addElement(selectionBasionymAuthor);
- selectionExBasionymAuthor = formFactory.createSelectionElement(TeamOrPersonBase.class, getConversationHolder(),
+ selectionExBasionymAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class, getConversationHolder(),
formElement, "Ex Basionym Author", entity.getExBasionymAuthorship(),
EntitySelectionElement.ALL, style);
// $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.
*/
* <p>
* NomenclaturalReferenceDetailElement class.
* </p>
- *
+ *
* @author n.hoffmann
* @created Mar 12, 2010
* @version 1.0
* <p>
* Constructor for NomenclaturalReferenceDetailElement.
* </p>
- *
+ *
* @param cdmFormFactory
* a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
* object.
protected void createControls(ICdmFormElement formElement,
TaxonNameBase entity, int style) {
selection_nomenclaturalReference = formFactory
- .createSelectionElement(Reference.class,
+ .createSelectionElementWithAbbreviatedTitle(Reference.class,
getConversationHolder(), formElement, "Reference",
(Reference) entity.getNomenclaturalReference(),
EntitySelectionElement.ALL, style);
--- /dev/null
+/**
+ *
+ */
+package eu.etaxonomy.taxeditor.ui.selection;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
+import eu.etaxonomy.cdm.model.common.ICdmBase;
+import eu.etaxonomy.cdm.model.reference.Reference;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+
+public class EntitySelectionElementWithAbbreviatedTitle<T extends ICdmBase> extends EntitySelectionElement<T> {
+
+ /**
+ * @param formFactory
+ * @param conversation
+ * @param parentElement
+ * @param clazz
+ * @param labelString
+ * @param entity
+ * @param mode
+ * @param style
+ */
+ public EntitySelectionElementWithAbbreviatedTitle(CdmFormFactory formFactory, ConversationHolder conversation,
+ ICdmFormElement parentElement, Class<T> clazz, String labelString, T entity, int mode, int style) {
+ super(formFactory, conversation, parentElement, clazz, labelString, entity, mode, style);
+ }
+
+ @Override
+ protected String getTitle() {
+ if (entity != null){
+ if(entity instanceof TeamOrPersonBase) {
+ return ((TeamOrPersonBase) entity).getNomenclaturalTitle();
+ } else if(entity instanceof Reference){
+ return ((Reference) entity).getAbbrevTitleCache();
+ } else{
+ return super.getTitle();
+ }
+ }
+ return "";
+ }
+}