Project

General

Profile

Download (2.13 KB) Statistics
| Branch: | Tag: | Revision:
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.common.CdmUtils;
14
import eu.etaxonomy.cdm.model.taxon.Classification;
15
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
16
import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
17
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
18
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
19

    
20
/**
21
 * @author n.hoffmann
22
 * @date Jan 26, 2012
23
 *
24
 */
25
public class TaxonNodeSelectionElement extends EntitySelectionElement<TaxonNode> {
26

    
27
	private Classification classification;
28

    
29
	public TaxonNodeSelectionElement(CdmFormFactory formFactory,//ConversationHolder conversation,
30
	        ICdmFormElement parentElement,
31
			String labelString, TaxonNode entity, int mode, int style) {
32
		super(formFactory, //conversation,
33
		        parentElement, TaxonNode.class, 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(),//getConversationHolder(),
59
		        "Select parent taxon", null, null, getClassification().getUuid());
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
}
(7-7/7)