1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2007 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
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.
|
9
|
*/
|
10
|
|
11
|
package eu.etaxonomy.taxeditor.ui.selection;
|
12
|
|
13
|
import org.eclipse.swt.events.SelectionEvent;
|
14
|
|
15
|
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
|
16
|
import eu.etaxonomy.cdm.common.CdmUtils;
|
17
|
import eu.etaxonomy.cdm.model.taxon.Classification;
|
18
|
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
|
19
|
import eu.etaxonomy.taxeditor.singlesource.ui.forms.CdmFormFactoryFacade;
|
20
|
import eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.TaxonNodeSelectionDialog;
|
21
|
import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
|
22
|
|
23
|
/**
|
24
|
* <p>
|
25
|
* TaxonNodeSelectionElement class.
|
26
|
* </p>
|
27
|
*
|
28
|
* @author n.hoffmann
|
29
|
* @created Sep 27, 2010
|
30
|
* @version 1.0
|
31
|
*/
|
32
|
public class TaxonNodeSelectionElement extends
|
33
|
AbstractSelectionElement<TaxonNode> {
|
34
|
|
35
|
public static final int DEFAULT = DELETABLE;
|
36
|
private Classification classification;
|
37
|
|
38
|
/**
|
39
|
* <p>
|
40
|
* Constructor for TaxonNodeSelectionElement.
|
41
|
* </p>
|
42
|
*
|
43
|
* @param formFactory
|
44
|
* a {@link eu.etaxonomy.taxeditor.singlesource.ui.forms.CdmFormFactoryFacade}
|
45
|
* object.
|
46
|
* @param conversation
|
47
|
* a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
|
48
|
* object.
|
49
|
* @param parentElement
|
50
|
* a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
|
51
|
* object.
|
52
|
* @param labelString
|
53
|
* a {@link java.lang.String} object.
|
54
|
* @param entity
|
55
|
* a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object.
|
56
|
* @param style
|
57
|
* a int.
|
58
|
*/
|
59
|
public TaxonNodeSelectionElement(CdmFormFactoryFacade formFactory,
|
60
|
ConversationHolder conversation, ICdmFormElement parentElement,
|
61
|
String labelString, TaxonNode entity, int mode, int style) {
|
62
|
super(formFactory, conversation, parentElement, labelString, entity,
|
63
|
mode, style);
|
64
|
}
|
65
|
|
66
|
/*
|
67
|
* (non-Javadoc)
|
68
|
*
|
69
|
* @see
|
70
|
* org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt
|
71
|
* .events.SelectionEvent)
|
72
|
*/
|
73
|
/** {@inheritDoc} */
|
74
|
@Override
|
75
|
public void widgetSelected(SelectionEvent e) {
|
76
|
TaxonNode newSelection = TaxonNodeSelectionDialog.select(getShell(),
|
77
|
getConversationHolder(), "Select parent taxon", null, null, getClassification());
|
78
|
setSelectionInternal(newSelection);
|
79
|
}
|
80
|
|
81
|
/**
|
82
|
* @return
|
83
|
*/
|
84
|
public Classification getClassification() {
|
85
|
return classification;
|
86
|
}
|
87
|
|
88
|
public void setClassification(Classification classification){
|
89
|
this.classification = classification;
|
90
|
}
|
91
|
|
92
|
/*
|
93
|
* (non-Javadoc)
|
94
|
*
|
95
|
* @see
|
96
|
* eu.etaxonomy.taxeditor.forms.selection.AbstractSelectionElement#getTitle
|
97
|
* ()
|
98
|
*/
|
99
|
/** {@inheritDoc} */
|
100
|
@Override
|
101
|
protected String getTitle() {
|
102
|
if (getEntity() != null && getEntity().getTaxon() != null) {
|
103
|
return CdmUtils.Nz(getEntity().getTaxon().getTitleCache());
|
104
|
}
|
105
|
return super.getTitle();
|
106
|
}
|
107
|
}
|