editor now updatable via updateSite
[taxeditor.git] / taxeditor-editor / src / main / java / eu / etaxonomy / taxeditor / propertysheet / reference / NomenclaturalReferencePropertySource.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.propertysheet.reference;
11
12 import java.util.HashMap;
13 import java.util.LinkedHashMap;
14 import java.util.Set;
15
16 import eu.etaxonomy.cdm.model.reference.Article;
17 import eu.etaxonomy.cdm.model.reference.Book;
18 import eu.etaxonomy.cdm.model.reference.BookSection;
19 import eu.etaxonomy.cdm.model.reference.Generic;
20 import eu.etaxonomy.cdm.model.reference.ReferenceBase;
21
22 /**
23 * Subclass of <code>ReferencePropertySource</code> which restricts reference type menu
24 * to "Article", "Generic", "Book", "Book Section".
25 *
26 * @author p.ciardelli
27 * @created 12.11.2008
28 * @version 1.0
29 */
30 public class NomenclaturalReferencePropertySource extends
31 ReferencePropertySource {
32
33 public NomenclaturalReferencePropertySource(ReferenceBase<?> reference) {
34 super(reference);
35 }
36
37 protected static HashMap<Class<?>, String> nomReferenceTypeMap = null;
38
39 protected void populateReferenceTypes() {
40
41 // LinkedHashMap maintains insertion order
42 nomReferenceTypeMap = new LinkedHashMap<Class<?>, String>();
43
44 nomReferenceTypeMap.put(ReferenceBase.class, "");
45 // referenceTypeMap.put(BibtexReference.class, "BibTeX Reference");
46 nomReferenceTypeMap.put(Article.class, "Article");
47 nomReferenceTypeMap.put(Generic.class, "Generic");
48 nomReferenceTypeMap.put(Book.class, "Book");
49 nomReferenceTypeMap.put(BookSection.class, "Book Section");
50 }
51
52 protected String[] getReferenceTypeArray() {
53 if (nomReferenceTypeMap == null) {
54 populateReferenceTypes();
55 }
56 return nomReferenceTypeMap.values().toArray(new String[] {});
57 }
58
59 protected Set<Class<?>> getReferenceClassSet() {
60 return nomReferenceTypeMap.keySet();
61 }
62
63 protected int getSearchType() {
64 return IReferenceSearch.NOMREF;
65 }
66 }