1
|
/**
|
2
|
* Copyright (C) 2009 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
|
package eu.etaxonomy.taxeditor.ui.selection;
|
10
|
|
11
|
import org.eclipse.swt.events.SelectionEvent;
|
12
|
|
13
|
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
|
14
|
import eu.etaxonomy.cdm.common.CdmUtils;
|
15
|
import eu.etaxonomy.cdm.model.taxon.Classification;
|
16
|
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
|
17
|
import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
|
18
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
19
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
20
|
|
21
|
/**
|
22
|
* @author n.hoffmann
|
23
|
* @date Jan 26, 2012
|
24
|
*
|
25
|
*/
|
26
|
public class TaxonNodeSelectionElement extends EntitySelectionElement<TaxonNode> {
|
27
|
|
28
|
private Classification classification;
|
29
|
|
30
|
public TaxonNodeSelectionElement(CdmFormFactory formFactory,
|
31
|
ConversationHolder conversation, ICdmFormElement parentElement,
|
32
|
String labelString, TaxonNode entity, int mode, int style) {
|
33
|
super(formFactory, conversation, parentElement, labelString, entity, mode,
|
34
|
style);
|
35
|
}
|
36
|
|
37
|
/**
|
38
|
* @return
|
39
|
*/
|
40
|
public Classification getClassification() {
|
41
|
return classification;
|
42
|
}
|
43
|
|
44
|
public void setClassification(Classification classification){
|
45
|
this.classification = classification;
|
46
|
}
|
47
|
|
48
|
/*
|
49
|
* (non-Javadoc)
|
50
|
*
|
51
|
* @see
|
52
|
* org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt
|
53
|
* .events.SelectionEvent)
|
54
|
*/
|
55
|
/** {@inheritDoc} */
|
56
|
@Override
|
57
|
public void widgetSelected(SelectionEvent e) {
|
58
|
TaxonNode newSelection = TaxonNodeSelectionDialog.select(getShell(),
|
59
|
getConversationHolder(), "Select parent taxon", null, null, getClassification());
|
60
|
setSelectionInternal(newSelection);
|
61
|
}
|
62
|
|
63
|
/*
|
64
|
* (non-Javadoc)
|
65
|
*
|
66
|
* @see
|
67
|
* eu.etaxonomy.taxeditor.forms.selection.AbstractSelectionElement#getTitle
|
68
|
* ()
|
69
|
*/
|
70
|
/** {@inheritDoc} */
|
71
|
@Override
|
72
|
protected String getTitle() {
|
73
|
if (getEntity() != null && getEntity().getTaxon() != null) {
|
74
|
return CdmUtils.Nz(getEntity().getTaxon().getTitleCache());
|
75
|
}
|
76
|
return super.getTitle();
|
77
|
}
|
78
|
|
79
|
}
|