p2izing the editor
[taxeditor.git] / eclipseprojects / eu.etaxonomy.taxeditor / src / eu / etaxonomy / taxeditor / navigation / QuickNameTaxon.java
1 /**
2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
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.
8 */
9
10 package eu.etaxonomy.taxeditor.navigation;
11
12 import org.apache.log4j.Logger;
13
14 import eu.etaxonomy.cdm.model.name.NonViralName;
15 import eu.etaxonomy.cdm.model.reference.ReferenceBase;
16 import eu.etaxonomy.cdm.model.taxon.Taxon;
17
18 /**
19 * A singleton used as a placeholder in the taxonomic tree when user executes the
20 * action "Add taxon with quick name". When the user enters a valid (i.e. non "")
21 * string, the node is replaced with a taxon. Note that this should not be added to
22 * the session data repository, nor should it be added to its parent taxon's
23 * taxonomic children.
24 *
25 * @see TaxonomicTreeViewer
26 * @see TaxonomicTreeContentProvider
27 *
28 * @author p.ciardelli
29 * @created 03.02.2009
30 * @version 1.0
31 */
32 public class QuickNameTaxon extends Taxon {
33 private static final Logger logger = Logger.getLogger(QuickNameTaxon.class);
34
35 private static QuickNameTaxon instance = null;
36
37 private Taxon parentTaxon;
38
39 private QuickNameTaxon(NonViralName name, ReferenceBase sec) {
40 super(name, sec);
41 }
42
43 public static QuickNameTaxon getInstance() {
44 if (instance == null) {
45 instance = new QuickNameTaxon(null, null);
46 }
47 return instance;
48 }
49
50 public ReferenceBase getSec() {
51 if (parentTaxon == null) {
52 return null;
53 } else {
54 return parentTaxon.getSec();
55 }
56 }
57
58 public void setParent(Taxon parentTaxon) {
59 this.parentTaxon = parentTaxon;
60 }
61
62 public Taxon getTaxonomicParent() {
63 return parentTaxon;
64 }
65 }