Project

General

Profile

« Previous | Next » 

Revision 72060b99

Added by Patrick Plitzner over 8 years ago

Show abbreviated title cache for authors and refernce in taxon details
view

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java
323 323
import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailElement;
324 324
import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailSection;
325 325
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
326
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElementWithAbbreviatedTitle;
326 327
import eu.etaxonomy.taxeditor.ui.selection.NomenclaturalAuthorTeamSelectionElement;
327 328
import eu.etaxonomy.taxeditor.ui.selection.TaxonNodeSelectionElement;
328 329

  
......
2616 2617
        return element;
2617 2618
    }
2618 2619

  
2620
    /**
2621
     * <p>
2622
     * Creates a selection element for the given type T which shows only the <b>abbreviated</b> title as the label.
2623
     * </p>
2624
     * <p>
2625
     * <strong>Selection elements not handled by this method:</strong>
2626
     * <ul>
2627
     * <li>{@link TaxonNodeSelectionElement} see
2628
     * {@link #createTaxonNodeSelectionElement(ConversationHolder, ICdmFormElement, String, TaxonNode, int, int)}
2629
     * </li>
2630
     * <li>{@link NomenclaturalAuthorTeamSelectionElement} see
2631
     * {@link #createNomenclaturalAuthorTeamSelectionElement(ConversationHolder, ICdmFormElement, String, Team, int, int)}
2632
     * </li>
2633
     * </ul>
2634
     * </p>
2635
     *
2636
     * @param clazz
2637
     *            a {@link Class} object of the type that you want the selection
2638
     *            element to handle
2639
     * @param parentElement
2640
     *            a {@link ICdmFormElement} object.
2641
     * @param labelString
2642
     *            a {@link String} object.
2643
     * @param selectionType
2644
     * @param selection
2645
     *            a {@link ICdmBase} object.
2646
     * @param style
2647
     *            a int.
2648
     * @param conversation
2649
     *            a {@link ConversationHolder} object.
2650
     * @return a {@link EntitySelectionElement} object.
2651
     */
2652
    public <T extends ICdmBase> EntitySelectionElementWithAbbreviatedTitle<T> createSelectionElementWithAbbreviatedTitle(
2653
            Class<T> clazz, ConversationHolder conversation, ICdmFormElement parentElement, String labelString,
2654
            T selection, int mode, int style) {
2655
        EntitySelectionElementWithAbbreviatedTitle<T> element = new EntitySelectionElementWithAbbreviatedTitle<T>(this, conversation, parentElement, clazz,
2656
                labelString, selection, mode, style);
2657
        adapt(element);
2658
        parentElement.addElement(element);
2659
        return element;
2660
    }
2661

  
2619 2662
    public TaxonNodeSelectionElement createTaxonNodeSelectionElement(ConversationHolder conversation,
2620 2663
            ICdmFormElement parentElement, String labelString, TaxonNode selection, int mode, int style) {
2621 2664
        TaxonNodeSelectionElement element = new TaxonNodeSelectionElement(this, conversation, parentElement,
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/AuthorshipDetailElement.java
69 69
		if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
70 70
			toggleable_cache.setVisible(false);
71 71
		}
72
		selectionCombinationAuthor = formFactory.createSelectionElement(TeamOrPersonBase.class,
72
		selectionCombinationAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class,
73 73
				getConversationHolder(),
74 74
				formElement, "Author",
75 75
				entity.getCombinationAuthorship(),
76 76
				EntitySelectionElement.ALL, style);
77 77
		addElement(selectionCombinationAuthor);
78
		selectionExCombinationAuthor = formFactory.createSelectionElement(TeamOrPersonBase.class,
78
		selectionExCombinationAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class,
79 79
				getConversationHolder(),
80 80
				formElement, "Ex Author",
81 81
				entity.getExCombinationAuthorship(),
82 82
				EntitySelectionElement.ALL, style);
83 83
		addElement(selectionExCombinationAuthor);
84
		selectionBasionymAuthor = formFactory.createSelectionElement(TeamOrPersonBase.class, getConversationHolder(),
84
		selectionBasionymAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class, getConversationHolder(),
85 85
                formElement, "Basionym Author", entity.getBasionymAuthorship(),
86 86
                EntitySelectionElement.ALL, style);
87 87
		addElement(selectionBasionymAuthor);
88
		selectionExBasionymAuthor = formFactory.createSelectionElement(TeamOrPersonBase.class, getConversationHolder(),
88
		selectionExBasionymAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class, getConversationHolder(),
89 89
		        formElement, "Ex Basionym Author", entity.getExBasionymAuthorship(),
90 90
		        EntitySelectionElement.ALL, style);
91 91

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/NomenclaturalReferenceDetailElement.java
1 1
// $Id$
2 2
/**
3 3
 * Copyright (C) 2007 EDIT
4
 * European Distributed Institute of Taxonomy 
4
 * European Distributed Institute of Taxonomy
5 5
 * http://www.e-taxonomy.eu
6
 * 
6
 *
7 7
 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 8
 * See LICENSE.TXT at the top of this package for the full license terms.
9 9
 */
......
22 22
 * <p>
23 23
 * NomenclaturalReferenceDetailElement class.
24 24
 * </p>
25
 * 
25
 *
26 26
 * @author n.hoffmann
27 27
 * @created Mar 12, 2010
28 28
 * @version 1.0
......
37 37
	 * <p>
38 38
	 * Constructor for NomenclaturalReferenceDetailElement.
39 39
	 * </p>
40
	 * 
40
	 *
41 41
	 * @param cdmFormFactory
42 42
	 *            a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
43 43
	 *            object.
......
57 57
	protected void createControls(ICdmFormElement formElement,
58 58
			TaxonNameBase entity, int style) {
59 59
		selection_nomenclaturalReference = formFactory
60
				.createSelectionElement(Reference.class,
60
				.createSelectionElementWithAbbreviatedTitle(Reference.class,
61 61
						getConversationHolder(), formElement, "Reference",
62 62
						(Reference) entity.getNomenclaturalReference(),
63 63
						EntitySelectionElement.ALL, style);
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/EntitySelectionElementWithAbbreviatedTitle.java
1
/**
2
 *
3
 */
4
package eu.etaxonomy.taxeditor.ui.selection;
5

  
6
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
7
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
8
import eu.etaxonomy.cdm.model.common.ICdmBase;
9
import eu.etaxonomy.cdm.model.reference.Reference;
10
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
11
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
12

  
13
public class EntitySelectionElementWithAbbreviatedTitle<T extends ICdmBase> extends EntitySelectionElement<T> {
14

  
15
	/**
16
     * @param formFactory
17
     * @param conversation
18
     * @param parentElement
19
     * @param clazz
20
     * @param labelString
21
     * @param entity
22
     * @param mode
23
     * @param style
24
     */
25
    public EntitySelectionElementWithAbbreviatedTitle(CdmFormFactory formFactory, ConversationHolder conversation,
26
            ICdmFormElement parentElement, Class<T> clazz, String labelString, T entity, int mode, int style) {
27
        super(formFactory, conversation, parentElement, clazz, labelString, entity, mode, style);
28
    }
29

  
30
    @Override
31
    protected String getTitle() {
32
		if (entity != null){
33
		    if(entity instanceof TeamOrPersonBase) {
34
		        return ((TeamOrPersonBase) entity).getNomenclaturalTitle();
35
		    } else if(entity instanceof Reference){
36
		        return ((Reference) entity).getAbbrevTitleCache();
37
		    } else{
38
		        return super.getTitle();
39
		    }
40
		}
41
		return "";
42
	}
43
}

Also available in: Unified diff