Project

General

Profile

Download (2.21 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

    
30

    
31

    
32
	public TaxonNodeSelectionElement(CdmFormFactory formFactory,//ConversationHolder conversation,
33
	        ICdmFormElement parentElement,
34
			String labelString, TaxonNode entity, int mode, int style, Integer limit) {
35
		super(formFactory, //conversation,
36
		        parentElement, TaxonNode.class, labelString, null, mode,
37
				style, limit);
38
		this.text.setTextLimit(limit);
39
		this.setEntity(entity);
40
	}
41

    
42
	/**
43
	 * @return
44
	 */
45
	public Classification getClassification() {
46
		return classification;
47
	}
48

    
49
	public void setClassification(Classification classification){
50
		this.classification = classification;
51
	}
52

    
53
	/*
54
	 * (non-Javadoc)
55
	 *
56
	 * @see
57
	 * org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt
58
	 * .events.SelectionEvent)
59
	 */
60
	/** {@inheritDoc} */
61
	@Override
62
	public void widgetSelected(SelectionEvent e) {
63
		TaxonNode newSelection = TaxonNodeSelectionDialog.select(getShell(),//getConversationHolder(),
64
		        "Select parent taxon", null, null, getClassification().getUuid());
65
		setSelectionInternal(newSelection);
66
	}
67

    
68
	/*
69
	 * (non-Javadoc)
70
	 *
71
	 * @see
72
	 * eu.etaxonomy.taxeditor.forms.selection.AbstractSelectionElement#getTitle
73
	 * ()
74
	 */
75
	/** {@inheritDoc} */
76
	@Override
77
	protected String getTitle() {
78
		if (getEntity() != null && getEntity().getTaxon() != null) {
79
			return CdmUtils.Nz(getEntity().getTaxon().getTitleCache());
80
		}
81
		return super.getTitle();
82
	}
83

    
84
}
(8-8/8)