Project

General

Profile

« Previous | Next » 

Revision 9e0f8df5

Added by Patrick Plitzner over 8 years ago

Handle ampersand correctly in section titles (#5142)

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/AuthorshipDetailSection.java
23 23
import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection;
24 24

  
25 25
/**
26
 * <p>AuthorshipDetailSection class.</p>
27
 *
28 26
 * @author n.hoffmann
29 27
 * @created 05.06.2009
30 28
 * @version 1.0
......
33 31

  
34 32
	private TaxonBase taxonBase;
35 33

  
36
	/**
37
	 * <p>Constructor for AuthorshipDetailSection.</p>
38
	 *
39
	 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
40
	 * @param style a int.
41
	 * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
42
	 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
43
	 * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
44
	 */
45 34
	public AuthorshipDetailSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement,
46 35
			ISelectionProvider selectionProvider, int style) {
47 36
		super(cdmFormFactory, conversation, parentElement, selectionProvider, style);
48 37
	}
49 38

  
50
	/**
51
	 * {@inheritDoc}
52
	 *
53
	 * Author title is not in titleCache field
54
	 * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#setSectionTitle()
55
	 */
56
	@Override
57
	protected void setSectionTitle() {
58
		if(getEntity() != null){
59
			String title = getHeading() + ": " + getEntity().getAuthorshipCache();
60
	        // we have to duplicate ampersands otherwise they are treated as
61
	        // mnenomic (see Label.setText() documentation)
62
            // see also #4302
63
	        title = title.replace("&", "&&");
64
            this.setText(title);
65
		}
66
	}
67

  
68 39
	/** {@inheritDoc} */
69 40
	@Override
70 41
    public void setTaxonBase(TaxonBase entity) {
......
73 44
		setEntity(name);
74 45
	}
75 46

  
76
	/*
77
	 * (non-Javadoc)
78
	 * @see eu.etaxonomy.taxeditor.forms.section.cdmdetail.AbstractCdmDetailSection#getHeading()
79
	 */
80 47
	/** {@inheritDoc} */
81 48
	@Override
82 49
	public String getHeading() {
83 50
		return "Authorship";
84 51
	}
85 52

  
86
	/* (non-Javadoc)
87
	 * @see eu.etaxonomy.taxeditor.section.ITaxonDetailSection#getTaxon(eu.etaxonomy.cdm.model.taxon.TaxonBase)
88
	 */
89 53
	@Override
90 54
	public TaxonBase getTaxonBase() {
91 55
		return taxonBase;
92 56
	}
93 57

  
94
	/* (non-Javadoc)
95
	 * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
96
	 */
97 58
	@Override
98 59
	protected AbstractCdmDetailElement<NonViralName> createCdmDetailElement(AbstractCdmDetailSection<NonViralName> parentElement, int style) {
99 60
	    return formFactory.createAuthorshipDetailElement(parentElement, style);

Also available in: Unified diff