3 * Copyright (C) 2009 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.ui
.selection
;
12 import org
.eclipse
.swt
.events
.SelectionEvent
;
14 import eu
.etaxonomy
.cdm
.api
.conversation
.ConversationHolder
;
15 import eu
.etaxonomy
.cdm
.common
.CdmUtils
;
16 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
17 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
18 import eu
.etaxonomy
.taxeditor
.ui
.dialog
.selection
.TaxonNodeSelectionDialog
;
19 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
20 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
27 public class TaxonNodeSelectionElement
extends EntitySelectionElement
<TaxonNode
> {
29 private Classification classification
;
31 public TaxonNodeSelectionElement(CdmFormFactory formFactory
,
32 ConversationHolder conversation
, ICdmFormElement parentElement
,
33 String labelString
, TaxonNode entity
, int mode
, int style
) {
34 super(formFactory
, conversation
, parentElement
, labelString
, entity
, mode
,
41 public Classification
getClassification() {
42 return classification
;
45 public void setClassification(Classification classification
){
46 this.classification
= classification
;
53 * org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt
54 * .events.SelectionEvent)
58 public void widgetSelected(SelectionEvent e
) {
59 TaxonNode newSelection
= TaxonNodeSelectionDialog
.select(getShell(),
60 getConversationHolder(), "Select parent taxon", null, null, getClassification());
61 setSelectionInternal(newSelection
);
68 * eu.etaxonomy.taxeditor.forms.selection.AbstractSelectionElement#getTitle
73 protected String
getTitle() {
74 if (getEntity() != null && getEntity().getTaxon() != null) {
75 return CdmUtils
.Nz(getEntity().getTaxon().getTitleCache());
77 return super.getTitle();