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
.preference
.Resources
;
19 * <p>MisapplicationContainer class.</p>
25 public class MisapplicationContainer
extends AbstractGroupedContainer
<Taxon
> {
28 * <p>Constructor for MisapplicationContainer.</p>
30 * @param editor a {@link eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor} object.
31 * @param group a {@link eu.etaxonomy.taxeditor.editor.name.container.AbstractGroup} object.
32 * @param misappliedName a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
34 public MisapplicationContainer(AbstractGroup group
, Taxon misappliedName
) {
35 super(misappliedName
);
40 * @see eu.etaxonomy.taxeditor.editor.name.NameComposite#initializeComposite()
44 protected void initializeComposite() {
46 setFont(getViewerFont());
54 protected void updateIcon() {
55 setIcon(MISAPPLIEDNAME_ICON
);
58 private void showSec() {
59 if (getMisappliedName() == null) {
63 if (getMisappliedName().getSec() == null) {
64 if (getMisappliedName().getAppendedPhrase() != null ){
65 setNonEditableInfo(getMisappliedName().getAppendedPhrase(), false);
67 setNonEditableInfo("sec. ???", false);
70 String title
= getMisappliedName().getSec().getTitleCache();
71 title
= title
.replace("&", "&&");
73 if (getMisappliedName().getAppendedPhrase() != null ){
74 sec
= getMisappliedName().getAppendedPhrase() + " "+sec
;
76 setNonEditableInfo(sec
+ title
, false);
81 * <p>getMisappliedName</p>
83 * @return a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
85 public Taxon
getMisappliedName() {
86 return getTaxonBase();
91 protected Font
getViewerFont() {
92 return EditorUtil
.getFont(Resources
.MISAPPLIEDNAME_FONT
);
96 * @see eu.etaxonomy.taxeditor.editor.name.container.AbstractGroupedContainer#showAnnotations()
99 public void showAnnotations() {
100 if(getData().getSec() == null){
101 getNameViewer().addAnnotation(
102 new EditorAnnotation(0, "This misapplication requires a sec. reference."));
104 super.showAnnotations();
110 protected void updateNonEditableInfo() {
116 * @see eu.etaxonomy.taxeditor.editor.name.AbstractGroupedContainer#updateIndent()
119 protected void updateIndent() {
120 setIndent(MISAPPLIEDNAME_INDENT
);