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
;
13 import java
.util
.ArrayList
;
14 import java
.util
.Collection
;
15 import java
.util
.HashMap
;
16 import java
.util
.HashSet
;
17 import java
.util
.List
;
18 import java
.util
.Locale
;
20 import java
.util
.ResourceBundle
;
22 import java
.util
.UUID
;
24 import org
.apache
.log4j
.Logger
;
25 import org
.eclipse
.core
.databinding
.observable
.Realm
;
26 import org
.eclipse
.core
.databinding
.observable
.list
.WritableList
;
27 import org
.eclipse
.core
.databinding
.observable
.set
.IObservableSet
;
28 import org
.eclipse
.core
.databinding
.observable
.set
.WritableSet
;
29 import org
.eclipse
.core
.runtime
.FileLocator
;
30 import org
.eclipse
.core
.runtime
.IPath
;
31 import org
.eclipse
.core
.runtime
.Path
;
32 import org
.eclipse
.jface
.databinding
.swt
.SWTObservables
;
33 import org
.eclipse
.jface
.resource
.FontRegistry
;
34 import org
.eclipse
.jface
.resource
.ImageDescriptor
;
35 import org
.eclipse
.jface
.resource
.ImageRegistry
;
36 import org
.eclipse
.swt
.SWT
;
37 import org
.eclipse
.swt
.graphics
.Color
;
38 import org
.eclipse
.swt
.graphics
.Font
;
39 import org
.eclipse
.swt
.graphics
.FontData
;
40 import org
.eclipse
.swt
.graphics
.Image
;
41 import org
.eclipse
.swt
.widgets
.Display
;
42 import org
.eclipse
.swt
.widgets
.Tree
;
43 import org
.eclipse
.ui
.forms
.FormColors
;
44 import org
.eclipse
.ui
.plugin
.AbstractUIPlugin
;
45 import org
.eclipse
.ui
.views
.properties
.PropertySheetPage
;
46 import org
.osgi
.framework
.BundleContext
;
47 import org
.springframework
.transaction
.TransactionStatus
;
49 import eu
.etaxonomy
.cdm
.api
.application
.CdmApplicationController
;
50 import eu
.etaxonomy
.cdm
.api
.service
.IDescriptionService
;
51 import eu
.etaxonomy
.cdm
.api
.service
.INameService
;
52 import eu
.etaxonomy
.cdm
.api
.service
.IReferenceService
;
53 import eu
.etaxonomy
.cdm
.api
.service
.ITaxonService
;
54 import eu
.etaxonomy
.cdm
.database
.CdmDataSource
;
55 import eu
.etaxonomy
.cdm
.database
.DataSourceNotFoundException
;
56 import eu
.etaxonomy
.cdm
.database
.DbSchemaValidation
;
57 import eu
.etaxonomy
.cdm
.database
.ICdmDataSource
;
58 import eu
.etaxonomy
.cdm
.model
.agent
.Person
;
59 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
60 import eu
.etaxonomy
.cdm
.model
.common
.OrderedTermVocabulary
;
61 import eu
.etaxonomy
.cdm
.model
.common
.TermVocabulary
;
62 import eu
.etaxonomy
.cdm
.model
.common
.init
.TermNotFoundException
;
63 import eu
.etaxonomy
.cdm
.model
.name
.BotanicalName
;
64 import eu
.etaxonomy
.cdm
.model
.name
.NameRelationshipType
;
65 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalStatus
;
66 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalStatusType
;
67 import eu
.etaxonomy
.cdm
.model
.name
.Rank
;
68 import eu
.etaxonomy
.cdm
.model
.reference
.ReferenceBase
;
69 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
70 import eu
.etaxonomy
.taxeditor
.model
.CdmUtil
;
71 import eu
.etaxonomy
.taxeditor
.navigation
.TaxonomicTreeViewer
;
74 * The class controlling the plug-in life cycle.
77 * <li>Initializes datastore as necessary.</li>
78 * <li>Initializes default preferences.</li>
79 * <li>Gateway to CDM service layer.</li>
80 * <li>Stores taxa for application session.</li>
81 * <li>Stores registries for colors, fonts, images.</li>
88 public class TaxEditorPlugin
extends AbstractUIPlugin
{
89 private static final Logger logger
= Logger
90 .getLogger(TaxEditorPlugin
.class);
95 public static final String PLUGIN_ID
= "eu.etaxonomy.taxeditor.plugin";
99 private static TaxEditorPlugin plugin
;
101 // private DbSchemaValidation dbSchemaValidation = DbSchemaValidation.VALIDATE;
102 private DbSchemaValidation dbSchemaValidation
= DbSchemaValidation
.UPDATE
;
107 public TaxEditorPlugin() {
108 // logger.fatal("Fatal");
109 // logger.error("Error");
110 // logger.debug("Debug");
111 // logger.info("Info");
112 // logger.warn("Warn");
113 // logger.trace("Trace");
119 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
121 public void start(BundleContext context
) throws Exception
{
122 super.start(context
);
125 // If the preferences INITIALIZED has not been set, the IF clause
126 // will return false, i.e. datastore will be initialized first
127 // time the application is run after being installed.
128 boolean initialized
= false;
129 if (getPreferenceStore()
130 .contains(ITaxEditorConstants
.INITIALIZED
)) {
131 initialized
= getPreferenceStore().getBoolean(
132 ITaxEditorConstants
.INITIALIZED
);
137 logger
.warn("Initializing datastore");
139 dbSchemaValidation
= DbSchemaValidation
.CREATE
;
141 if (getPreferenceStore().getBoolean(
142 ITaxEditorConstants
.INITIALIZE_W_TESTDATA
)) {
144 getPreferenceStore().setValue(
145 ITaxEditorConstants
.INITIALIZE_W_TESTDATA
, false);
149 .setValue(ITaxEditorConstants
.INITIALIZED
, true);
152 cdmApp
= getCdmApp();
154 Locale locale
= new Locale("en", "", "icbn");
155 Locale
.setDefault(locale
);
161 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
163 public void stop(BundleContext context
) throws Exception
{
171 void initDatastore() {
173 boolean useSoraya
= true;
174 // useSoraya = false;
177 genusTaxon
= getSorayasGenusTaxon();
180 BotanicalName botanicalName
= BotanicalName
.NewInstance(Rank
182 botanicalName
.setTitleCache("Hieracium L.");
183 botanicalName
.setGenusOrUninomial("Hieracium");
184 botanicalName
.setCombinationAuthorTeam(Person
.NewInstance());
185 botanicalName
.getCombinationAuthorTeam()
186 .setNomenclaturalTitle("L.");
187 genusTaxon
= Taxon
.NewInstance(botanicalName
, CdmUtil
188 .getSessionDefaultSec());
190 BotanicalName botSpecies
= BotanicalName
191 .NewInstance(Rank
.SPECIES());
192 botSpecies
.setTitleCache("Hieracium asturianum Pau");
193 botSpecies
.setGenusOrUninomial("Hieracium");
194 botSpecies
.setSpecificEpithet("asturianum");
195 botSpecies
.setCombinationAuthorTeam(Person
.NewInstance());
196 botSpecies
.getCombinationAuthorTeam().setNomenclaturalTitle("Pau");
197 Taxon childTaxon
= Taxon
.NewInstance(botSpecies
, null);
198 childTaxon
.setTaxonomicParent(genusTaxon
, null, null);
200 BotanicalName botSpecies2
= BotanicalName
.NewInstance(Rank
202 botSpecies2
.setTitleCache("Hieracium wolffii Zahn");
203 botSpecies2
.setGenusOrUninomial("Hieracium");
204 botSpecies2
.setSpecificEpithet("wolffii");
205 botSpecies2
.setCombinationAuthorTeam(Person
.NewInstance());
206 botSpecies2
.getCombinationAuthorTeam()
207 .setNomenclaturalTitle("Zahn");
208 Taxon childTaxon2
= Taxon
.NewInstance(botSpecies2
, CdmUtil
209 .getSessionDefaultSec());
210 // childTaxon2.setName(botSpecies2);
211 // childTaxon2.setSec(null);
212 childTaxon2
.setTaxonomicParent(genusTaxon
, null, null);
214 // Add some name relations to botSpecies2
215 botSpecies2
.addRelationshipFromName(botSpecies
,
216 NameRelationshipType
.BASIONYM(), null);
217 botSpecies2
.addRelationshipToName(botSpecies
, NameRelationshipType
218 .REPLACED_SYNONYM(), null);
219 logger
.warn("Name relations created");
221 // Add name status to botSpecies2
222 botSpecies2
.addStatus(NomenclaturalStatus
223 .NewInstance(NomenclaturalStatusType
.NOVUM()));
224 logger
.warn("Nom. status created");
227 getCdmApp().getTaxonService().saveTaxon(genusTaxon
);
233 * Returns the shared instance
235 * @return the shared instance
237 public static TaxEditorPlugin
getDefault() {
241 /***************************************************************************
243 **************************************************************************/
245 * All CDM services are called via the application controller
247 private CdmApplicationController cdmApp
;
248 private TransactionStatus txStatus
;
250 public CdmApplicationController
getCdmApp() {
251 if (cdmApp
== null) {
253 // cdmApp.getDatabaseService().getDatabaseEnum();
254 // cdmApp.getDatabaseService().saveDataSource(strDataSourceName, databaseTypeEnum, server, database, username, password)
256 // // Open ds by string
257 // CdmPersistentDataSource ds = CdmPersistentDataSource.NewInstance(dataSourceName)
259 // // Open default instance
260 // CdmPersistentDataSource ds = CdmPersistentDataSource.NewDefaultInstance();
262 // CdmPersistentDataSource.getAllDataSources();
264 // // Open CdmApp w default DB
265 // CdmApplicationController.NewInstance(dbSchemaValidation);
270 CdmDataSource
.NewH2EmbeddedInstance("cdm", "sa", "");
271 //// CdmDataSource.NewMySqlInstance("192.168.2.10", "cdm_editor_test1", "edit", "wp5");
272 //// CdmPersistentDataSource.NewLocalHsqlInstance();
273 cdmApp
= CdmApplicationController
274 .NewInstance(cdmDatasource
, dbSchemaValidation
);
276 // cdmApp = CdmApplicationController.NewInstance(dbSchemaValidation);
280 // cdmApp.commitTransaction((TransactionStatus) txStatus);
282 } catch (DataSourceNotFoundException e
) {
283 // TODO Auto-generated catch block
285 } catch (TermNotFoundException e
) {
286 // TODO Auto-generated catch block
293 public void startTransaction() {
294 if (cdmApp
!= null) {
295 txStatus
= cdmApp
.startTransaction();
299 public void commitTransaction() {
300 if (txStatus
!= null) {
301 cdmApp
.commitTransaction(txStatus
);
306 private ITaxonService taxonService
;
308 public ITaxonService
getTaxonService() {
309 if (taxonService
== null) {
310 taxonService
= getCdmApp().getTaxonService();
315 private INameService nameService
;
317 public INameService
getNameService() {
318 if (nameService
== null) {
319 nameService
= getCdmApp().getNameService();
324 private IDescriptionService descriptionService
;
326 public IDescriptionService
getDescriptionService() {
327 if (descriptionService
== null) {
328 descriptionService
= getCdmApp().getDescriptionService();
330 return descriptionService
;
333 private IReferenceService referenceService
;
335 public IReferenceService
getReferenceService() {
336 if (referenceService
== null) {
337 referenceService
= getCdmApp().getReferenceService();
339 return referenceService
;
342 private List
<ICdmDataSource
> dataSources
;
344 public List
<ICdmDataSource
> getDataSources() {
345 if (dataSources
== null) {
346 dataSources
= new ArrayList
<ICdmDataSource
>();
347 dataSources
.add(CdmDataSource
.
348 NewH2EmbeddedInstance("cdm", "sa", ""));
349 dataSources
.add(CdmDataSource
.
350 NewMySqlInstance("192.168.2.10", "cdm_editor_test1",
356 private ICdmDataSource cdmDatasource
;
358 public ICdmDataSource
getCdmDataSource() {
359 return cdmDatasource
;
362 /***************************************************************************
364 **************************************************************************/
366 private WritableList observableRecentNamesList
= null;
367 private WritableList observableFavoritesList
= null;
369 public WritableList
getObservableRecentNamesList() {
370 if (observableRecentNamesList
== null) {
371 observableRecentNamesList
= new WritableList();
373 return observableRecentNamesList
;
376 public WritableList
getObservableFavoritesList() {
377 if (observableFavoritesList
== null) {
378 observableFavoritesList
= new WritableList();
380 return observableFavoritesList
;
383 /***************************************************************************
385 **************************************************************************/
386 public ImageDescriptor
getImageDescriptor(String key
) {
387 return getImageRegistry().getDescriptor(key
);
390 public Image
getImage(String key
) {
391 return getImageRegistry().get(key
);
395 private ResourceBundle resourceBundle
;
396 private FormColors formColors
;
398 protected void initializeImageRegistry(ImageRegistry registry
) {
399 registerImage(registry
, ITaxEditorConstants
.EDIT_ICON
, "edit_16x16.ico");
400 registerImage(registry
, ITaxEditorConstants
.WARNING_ICON
,
402 registerImage(registry
, ITaxEditorConstants
.BLACK_SQUARE_ICON
,
403 "accepted_small.gif");
404 registerImage(registry
, ITaxEditorConstants
.HOMOTYPIC_SYN_ICON
,
405 "homosyn_no_bg.gif");
406 registerImage(registry
,
407 ITaxEditorConstants
.HOMOTYPIC_SYN_ORIGINAL_ICON
,
408 "homosyn_original_no_bg.gif");
409 registerImage(registry
, ITaxEditorConstants
.HETEROTYPIC_SYN_ICON
,
410 "heterosyn_no_bg.gif");
411 registerImage(registry
,
412 ITaxEditorConstants
.HETEROTYPIC_SYN_ORIGINAL_ICON
,
413 "heterosyn_original_no_bg.gif");
414 registerImage(registry
, ITaxEditorConstants
.MISAPPLIED_NAME_ICON
,
415 "misapplied_no_bg.gif");
416 registerImage(registry
, ITaxEditorConstants
.AUTONYM_ICON
,
417 "autonym_no_bg.gif");
418 registerImage(registry
, ITaxEditorConstants
.BASIONYM_ICON
,
419 "basionym_no_bg.gif");
420 registerImage(registry
, ITaxEditorConstants
.ORTHOGRAPHIC_VARIANT_ICON
,
421 "orthovariant_no_bg.gif");
422 registerImage(registry
, ITaxEditorConstants
.DB_ICON
, "db.gif");
423 registerImage(registry
, ITaxEditorConstants
.MOVE_ICON
,
424 "correction_change.gif");
425 registerImage(registry
, ITaxEditorConstants
.ACTIVE_DELETE_ICON
,
427 registerImage(registry
, ITaxEditorConstants
.SYNONYM_TO_TAXON_ICON
,
429 registerImage(registry
, ITaxEditorConstants
.OPEN_TAXON_ICON
, "open.gif");
430 registerImage(registry
, ITaxEditorConstants
.ADD_CHILD_TAXON_ICON
,
432 registerImage(registry
,
433 ITaxEditorConstants
.SWAP_SYNONYM_AND_TAXON_ICON
, "swap2.gif");
434 registerImage(registry
, ITaxEditorConstants
.QUICK_ADD_ICON
,
436 registerImage(registry
, ITaxEditorConstants
.TAXON_TO_SYNONYM_ICON
,
440 private void registerImage(ImageRegistry registry
, String key
,
443 IPath path
= new Path("icons/" + fileName
); //$NON-NLS-1$
444 URL url
= FileLocator
.find(getBundle(), path
, null);
446 ImageDescriptor desc
= ImageDescriptor
.createFromURL(url
);
447 registry
.put(key
, desc
);
449 } catch (Exception e
) {
453 /***************************************************************************
455 **************************************************************************/
456 private FontRegistry fontRegistry
;
458 private FontRegistry
getFontRegistry() {
459 if (fontRegistry
== null) {
460 fontRegistry
= new FontRegistry(Display
.getCurrent());
462 fontRegistry
.put(ITaxEditorConstants
.DATASOURCE_FONT
,
463 new FontData
[] { new FontData("Arial", 8, SWT
.NONE
) });
464 fontRegistry
.put(ITaxEditorConstants
.MENU_ITEM_ITALICS_FONT
,
465 new FontData
[] { new FontData("Arial", 9, SWT
.ITALIC
) });
466 fontRegistry
.put(ITaxEditorConstants
.ACCEPTED_TAXON_FONT
,
467 new FontData
[] { new FontData("Georgia", 12, SWT
.NONE
) });
468 fontRegistry
.put(ITaxEditorConstants
.SYNONYM_FONT
,
469 new FontData
[] { new FontData("Georgia", 10, SWT
.NONE
) });
470 fontRegistry
.put(ITaxEditorConstants
.MISAPPLIEDNAME_FONT
,
471 new FontData
[] { new FontData("Georgia", 10, SWT
.NONE
) });
472 fontRegistry
.put(ITaxEditorConstants
.CHOOSE_NAME_TEXT_FONT
,
473 new FontData
[] { new FontData("Arial", 12, SWT
.BOLD
) });
474 fontRegistry
.put(ITaxEditorConstants
.DEFAULT_PROMPT_FONT
,
475 new FontData
[] { new FontData("Georgia", 10, SWT
.ITALIC
) });
480 public Font
getFont(String key
) {
481 return getFontRegistry().get(key
);
484 /***************************************************************************
486 **************************************************************************/
487 private static HashMap
<String
, Color
> colorMap
;
489 public Color
getColor(String key
) {
490 return getColorMap().get(key
);
493 private HashMap
<String
, Color
> getColorMap() {
494 if (colorMap
== null) {
495 colorMap
= new HashMap
<String
, Color
>();
497 colorMap
.put(ITaxEditorConstants
.GROUP_GRAY_BKG_COLOR
,
498 new Color(null, 240, 240, 240));
503 private void disposeColors() {
504 if (colorMap
== null) {
507 for (Color color
: colorMap
.values()) {
513 /***************************************************************************
515 **************************************************************************/
517 public ReferenceBase
getSec() {
518 return getCdmApp().getReferenceService().getReferenceByUuid(
519 UUID
.fromString("f3593c18-a8d2-4e51-bdad-0befbf8fb2d1"));
522 private Set
<Taxon
> sessionRootTaxa
;
524 * The taxonomic tree content provider observes this set for changes, and
525 * makes the appropriate changes to the tree.
527 private IObservableSet observableSessionTaxonSet
;
529 * This map of taxa to their taxonomic children is used by
530 * NameTreeContentProvider's getChildren method.
532 * key = taxon, value = key's child taxa Note that a map can have a key ==
533 * null, i.e. no parent taxon
535 private HashMap
<Taxon
, Set
<Taxon
>> sessionTaxonomicChildrenMap
;
537 public Set
<Taxon
> getSessionRootTaxa() {
538 if (sessionRootTaxa
== null) {
540 sessionRootTaxa
= new HashSet
<Taxon
>();
541 // sessionRootTaxa.addAll(getCdmApp().getTaxonService().getRootTaxa(
542 // getSec(), null, false));
543 sessionRootTaxa
.addAll(getCdmApp().getTaxonService().getRootTaxa(
544 getSec(), null, true));
545 addSessionTaxa(sessionRootTaxa
);
548 return sessionRootTaxa
;
551 private Map
<Taxon
, Set
<Taxon
>> getTaxonomicChildrenMap() {
552 if (sessionTaxonomicChildrenMap
== null) {
553 sessionTaxonomicChildrenMap
= new HashMap
<Taxon
, Set
<Taxon
>>();
555 return sessionTaxonomicChildrenMap
;
559 * Returns a set of any child taxa for this taxon that have already been
560 * requested during this session.
565 public Set
<Taxon
> getSessionTaxonomicChildren(Taxon parentTaxon
) {
566 if (!getTaxonomicChildrenMap().containsKey(parentTaxon
)) {
567 if (parentTaxon
== null) {
568 getTaxonomicChildrenMap().put(parentTaxon
, getSessionRootTaxa());
571 // BUG deleted taxon were re-appearing as NULL children
572 Set
<Taxon
> childTaxa
= new HashSet
<Taxon
>();
574 // TransactionStatus tx = getCdmApp().startTransaction();
575 // getCdmApp().getTaxonService().saveTaxon(parentTaxon);
576 for (Taxon taxon
: parentTaxon
.getTaxonomicChildren()) {
578 childTaxa
.add(taxon
);
581 // getCdmApp().commitTransaction(tx);
583 getTaxonomicChildrenMap().put(parentTaxon
, childTaxa
);
586 return getTaxonomicChildrenMap().get(parentTaxon
);
592 public IObservableSet
getObservableSessionTaxa() {
593 if (observableSessionTaxonSet
== null) {
594 Realm realm
= SWTObservables
.getRealm(Display
.getDefault());
595 observableSessionTaxonSet
= new WritableSet(realm
);
597 return observableSessionTaxonSet
;
601 * Recursive function to clear the hashmap of a taxon's children used in
602 * this session, and the childrens' children, etc.
606 private void clearTaxonomicChildren(Taxon taxon
) {
607 Set
<Taxon
> children
= getSessionTaxonomicChildren(taxon
);
608 if (children
!= null) {
609 for (Taxon child
: children
) {
610 clearTaxonomicChildren(child
);
612 getTaxonomicChildrenMap().remove(taxon
);
613 getObservableSessionTaxa().removeAll(children
);
618 * Remove taxon from all session collections
622 public void removeSessionTaxon(Taxon taxon
) {
624 // Recursively remove all children, children's children, etc.
625 clearTaxonomicChildren(taxon
);
627 Taxon parentTaxon
= taxon
.getTaxonomicParent();
629 // Remove from parent's child map, or from root taxa
630 if (parentTaxon
== null) {
631 getSessionRootTaxa().remove(taxon
);
633 getSessionTaxonomicChildren(parentTaxon
).remove(taxon
);
636 // Remove from session taxa
637 getObservableSessionTaxa().remove(taxon
);
639 UiUtil
.getTreeViewer().remove(taxon
);
642 public void addSessionTaxa(Collection
<Taxon
> taxa
) {
643 for (Taxon taxon
: taxa
) {
644 addSessionTaxon(taxon
);
649 * Whenever a taxon is opened, either for editing or for display in the
650 * taxonomic tree, it should be added to the collections of taxa used during
655 public void addSessionTaxon(Taxon taxon
) {
657 // Add taxon to session taxa if not already there
658 if (!(getObservableSessionTaxa().contains(taxon
))) {
659 getObservableSessionTaxa().add(taxon
);
662 Taxon parentTaxon
= taxon
.getTaxonomicParent();
664 // If taxon has no parent, add it to root taxa
665 if (parentTaxon
== null) {
666 if (!(getSessionRootTaxa().contains(taxon
))) {
667 getSessionRootTaxa().add(taxon
);
671 // Add taxon to its parent's child map
672 getSessionTaxonomicChildren(parentTaxon
).add(taxon
);
674 TaxonomicTreeViewer viewer
= UiUtil
.getTreeViewer();
676 if (viewer
!= null) {
678 if (parentTaxon
== null) {
679 viewer
.setInput(getSessionRootTaxa());
681 viewer
.add(parentTaxon
, taxon
);
688 // private TaxonomicTreeView taxonomicTreeView;
690 // public void setTaxonomicTree(TaxonomicTreeView taxonomicTreeView) {
691 // this.taxonomicTreeView = taxonomicTreeView;
694 /***************************************************************************
696 **************************************************************************/
697 OrderedTermVocabulary
<Rank
> rankVocabulary
= null;
699 public OrderedTermVocabulary
<Rank
> getRankVocabulary() {
700 if (rankVocabulary
== null) {
701 rankVocabulary
= getCdmApp().getNameService().getRankVocabulary();
703 return rankVocabulary
;
706 /***************************************************************************
707 * NOMENCLATURAL STATUS
708 **************************************************************************/
709 TermVocabulary
<NomenclaturalStatusType
> nomStatusVocabulary
= null;
711 public TermVocabulary
<NomenclaturalStatusType
> getNomStatusVocabulary() {
712 if (nomStatusVocabulary
== null) {
713 nomStatusVocabulary
= getCdmApp().getNameService()
714 .getStatusTypeVocabulary();
716 return nomStatusVocabulary
;
719 /***************************************************************************
721 **************************************************************************/
722 TermVocabulary
<NameRelationshipType
> nameRelationshipTypeVocabulary
= null;
724 public TermVocabulary
<NameRelationshipType
> getNameRelationshipTypeVocabulary() {
725 if (nameRelationshipTypeVocabulary
== null) {
726 nameRelationshipTypeVocabulary
= getCdmApp().getNameService()
727 .getNameRelationshipTypeVocabulary();
729 return nameRelationshipTypeVocabulary
;
732 public Set
<NameRelationshipType
> getSortedNameRelationshipTypes() {
733 return getNameRelationshipTypeVocabulary().getTermsOrderedByLabels(
737 /***************************************************************************
739 **************************************************************************/
740 private Taxon
getSorayasGenusTaxon() {
742 String
[] children
= new String
[] {
743 "Heterospathe annectens H.E.Moore",
744 "Heterospathe arfakiana (Becc.) H.E.Moore",
745 "Heterospathe brevicaulis Fernando",
746 "Heterospathe cagayanensis Becc.",
747 "Heterospathe califrons Fernando, Palms 45: 118 (2001).",
748 "Heterospathe clemensiae (Burret) H.E.Moore",
749 "Heterospathe delicatula H.E.Moore",
750 "Heterospathe dransfieldii Fernando",
751 "Heterospathe elata Scheff.",
752 "Heterospathe elata var. elata.",
753 "Heterospathe elata var. guamensis Becc.",
754 "Heterospathe elata var. palauensis (Becc.) Becc.",
755 "Heterospathe elegans (Becc.) Becc.",
756 "Heterospathe elmeri Becc.",
757 "Heterospathe glabra (Burret) H.E.Moore",
758 "Heterospathe glauca (Scheff.) H.E.Moore",
759 "Heterospathe humilis Becc.",
760 "Heterospathe intermedia (Becc.) Fernando",
761 "Heterospathe kajewskii Burret",
762 "Heterospathe ledermanniana Becc.",
763 "Heterospathe lepidota H.E.Moore",
764 "Heterospathe longipes (H.E.Moore) Norup",
765 "Heterospathe macgregorii (Becc.) H.E.Moore",
766 "Heterospathe micrantha (Becc.) H.E.Moore",
767 "Heterospathe minor Burret",
768 "Heterospathe muelleriana (Becc.) Becc.",
769 "Heterospathe negrosensis Becc.",
770 "Heterospathe obriensis (Becc.) H.E.Moore",
771 "Heterospathe palauensis Becc.",
772 "Heterospathe parviflora Essig",
773 "Heterospathe philippinensis (Becc.) Becc.",
774 // "Heterospathe phillipsii D.Fuller & Dowe", // <--------------
775 "Heterospathe pilosa (Burret) Burret",
776 "Heterospathe pisifera (Gaertn.) Burret",
777 "Heterospathe pulchra H.E.Moore",
778 "Heterospathe ramulosa Burret",
779 "Heterospathe salomonensis Becc.",
780 "Heterospathe scitula Fernando", "Heterospathe sensisi Becc.",
781 "Heterospathe sibuyanensis Becc.",
782 "Heterospathe sphaerocarpa Burret",
783 "Heterospathe trispatha Fernando",
784 "Heterospathe uniformis Dowe",
785 "Heterospathe versteegiana Becc.",
786 "Heterospathe woodfordiana Becc." };
788 BotanicalName genusName
= BotanicalName
789 .PARSED_NAME("Heterospathe Scheff.");
791 Taxon genusTaxon
= Taxon
.NewInstance(genusName
, CdmUtil
792 .getSessionDefaultSec());
794 for (String child
: children
) {
795 BotanicalName speciesName
= BotanicalName
.PARSED_NAME(child
);
797 Taxon childTaxon
= Taxon
.NewInstance(speciesName
, CdmUtil
798 .getSessionDefaultSec());
799 childTaxon
.setTaxonomicParent(genusTaxon
, null, null);
801 if (child
.equals("Heterospathe elegans (Becc.) Becc.")) {
802 BotanicalName basionym
= BotanicalName
803 .PARSED_NAME("Barkerwebbia elegans Becc.");
804 speciesName
.addRelationshipFromName(basionym
,
805 NameRelationshipType
.BASIONYM(), null);
806 childTaxon
.addHomotypicSynonymName(basionym
, null, null);
809 if (child
.equals("Heterospathe humilis Becc.")) {
810 BotanicalName synonymName
= BotanicalName
811 .PARSED_NAME("Barkerwebbia humilis (Becc.) Becc. ex Martelli");
812 childTaxon
.addHomotypicSynonymName(synonymName
, null, null);
819 /***************************************************************************
821 **************************************************************************/
823 private Tree propertySheetTree
;
825 public void setPropertySheetTree(Tree tree
) {
826 this.propertySheetTree
= tree
;
829 public Tree
getPropertySheetTree() {
830 return propertySheetTree
;
833 private PropertySheetPage propertySheetPage
;
835 public void setPropertySheetPage(PropertySheetPage page
) {
836 this.propertySheetPage
= page
;
839 public PropertySheetPage
getPropertySheetPage() {
840 return propertySheetPage
;