2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.editor
.name
.container
;
12 import org
.eclipse
.swt
.graphics
.Font
;
14 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
15 import eu
.etaxonomy
.taxeditor
.editor
.EditorUtil
;
16 import eu
.etaxonomy
.taxeditor
.editor
.Messages
;
17 import eu
.etaxonomy
.taxeditor
.preference
.Resources
;
20 * <p>MisapplicationContainer class.</p>
26 public class MisapplicationContainer
extends AbstractGroupedContainer
<Taxon
> {
29 * <p>Constructor for MisapplicationContainer.</p>
31 * @param editor a {@link eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor} object.
32 * @param group a {@link eu.etaxonomy.taxeditor.editor.name.container.AbstractGroup} object.
33 * @param misappliedName a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
35 public MisapplicationContainer(AbstractGroup group
, Taxon misappliedName
) {
36 super(misappliedName
);
41 * @see eu.etaxonomy.taxeditor.editor.name.NameComposite#initializeComposite()
45 protected void initializeComposite() {
47 setFont(getViewerFont());
55 protected void updateIcon() {
56 setIcon(MISAPPLIEDNAME_ICON
);
59 private void showSec() {
60 if (getMisappliedName() == null) {
64 if (getMisappliedName().getSec() == null) {
65 if (getMisappliedName().getAppendedPhrase() != null ){
66 setNonEditableInfo(getMisappliedName().getAppendedPhrase(), false);
68 setNonEditableInfo("sec. ???", false); //$NON-NLS-1$
71 String title
= getMisappliedName().getSec().getTitleCache();
72 title
= title
.replace("&", "&&"); //$NON-NLS-1$ //$NON-NLS-2$
73 String sec
= "sec. "; //$NON-NLS-1$
74 if (getMisappliedName().getAppendedPhrase() != null ){
75 sec
= getMisappliedName().getAppendedPhrase() + " "+sec
; //$NON-NLS-1$
77 setNonEditableInfo(sec
+ title
, false);
82 * <p>getMisappliedName</p>
84 * @return a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
86 public Taxon
getMisappliedName() {
87 return getTaxonBase();
92 protected Font
getViewerFont() {
93 return EditorUtil
.getFont(Resources
.MISAPPLIEDNAME_FONT
);
97 * @see eu.etaxonomy.taxeditor.editor.name.container.AbstractGroupedContainer#showAnnotations()
100 public void showAnnotations() {
101 if(getData().getSec() == null){
102 getNameViewer().addAnnotation(
103 new EditorAnnotation(0, Messages
.MisapplicationContainer_SEC_REF_REQUIRED
));
105 super.showAnnotations();
111 protected void updateNonEditableInfo() {
117 * @see eu.etaxonomy.taxeditor.editor.name.AbstractGroupedContainer#updateIndent()
120 protected void updateIndent() {
121 setIndent(MISAPPLIEDNAME_INDENT
);