Project

General

Profile

Download (2.16 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2009 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
package eu.etaxonomy.taxeditor.ui.selection;
11

    
12
import org.eclipse.swt.events.SelectionEvent;
13

    
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;
21

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

    
29
	private Classification classification;
30
	
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,
35
				style);
36
	}
37
	
38
	/**
39
	 * @return
40
	 */
41
	public Classification getClassification() {
42
		return classification;
43
	}
44
	
45
	public void setClassification(Classification classification){
46
		this.classification = classification;
47
	}
48
	
49
	/*
50
	 * (non-Javadoc)
51
	 * 
52
	 * @see
53
	 * org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt
54
	 * .events.SelectionEvent)
55
	 */
56
	/** {@inheritDoc} */
57
	@Override
58
	public void widgetSelected(SelectionEvent e) {
59
		TaxonNode newSelection = TaxonNodeSelectionDialog.select(getShell(),
60
				getConversationHolder(), "Select parent taxon", null, null, getClassification());
61
		setSelectionInternal(newSelection);
62
	}
63
	
64
	/*
65
	 * (non-Javadoc)
66
	 * 
67
	 * @see
68
	 * eu.etaxonomy.taxeditor.forms.selection.AbstractSelectionElement#getTitle
69
	 * ()
70
	 */
71
	/** {@inheritDoc} */
72
	@Override
73
	protected String getTitle() {
74
		if (getEntity() != null && getEntity().getTaxon() != null) {
75
			return CdmUtils.Nz(getEntity().getTaxon().getTitleCache());
76
		}
77
		return super.getTitle();
78
	}
79

    
80
}
(4-4/4)