Revision f561b00c
Added by Niels Hoffmann about 13 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/TaxonNodeSelectionElement.java | ||
---|---|---|
1 | 1 |
// $Id$ |
2 | 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 |
*/ |
|
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 | 10 |
|
11 | 11 |
package eu.etaxonomy.taxeditor.ui.selection; |
12 | 12 |
|
13 |
import org.apache.log4j.Logger; |
|
14 | 13 |
import org.eclipse.swt.events.SelectionEvent; |
15 | 14 |
|
16 | 15 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
... | ... | |
21 | 20 |
import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement; |
22 | 21 |
|
23 | 22 |
/** |
24 |
* <p>TaxonNodeSelectionElement class.</p> |
|
25 |
* |
|
23 |
* <p> |
|
24 |
* TaxonNodeSelectionElement class. |
|
25 |
* </p> |
|
26 |
* |
|
26 | 27 |
* @author n.hoffmann |
27 | 28 |
* @created Sep 27, 2010 |
28 | 29 |
* @version 1.0 |
29 | 30 |
*/ |
30 |
public class TaxonNodeSelectionElement extends AbstractSelectionElement<TaxonNode> {
|
|
31 |
|
|
32 |
private static final Logger logger = Logger |
|
33 |
.getLogger(TaxonNodeSelectionElement.class);
|
|
34 |
|
|
31 |
public class TaxonNodeSelectionElement extends |
|
32 |
AbstractSelectionElement<TaxonNode> { |
|
33 |
|
|
34 |
public static final int DEFAULT = DELETABLE;
|
|
35 |
|
|
35 | 36 |
/** |
36 |
* <p>Constructor for TaxonNodeSelectionElement.</p> |
|
37 |
* |
|
38 |
* @param formFactory a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory} object. |
|
39 |
* @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. |
|
40 |
* @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object. |
|
41 |
* @param labelString a {@link java.lang.String} object. |
|
42 |
* @param entity a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object. |
|
43 |
* @param style a int. |
|
37 |
* <p> |
|
38 |
* Constructor for TaxonNodeSelectionElement. |
|
39 |
* </p> |
|
40 |
* |
|
41 |
* @param formFactory |
|
42 |
* a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory} |
|
43 |
* object. |
|
44 |
* @param conversation |
|
45 |
* a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} |
|
46 |
* object. |
|
47 |
* @param parentElement |
|
48 |
* a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} |
|
49 |
* object. |
|
50 |
* @param labelString |
|
51 |
* a {@link java.lang.String} object. |
|
52 |
* @param entity |
|
53 |
* a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object. |
|
54 |
* @param style |
|
55 |
* a int. |
|
44 | 56 |
*/ |
45 | 57 |
public TaxonNodeSelectionElement(CdmFormFactory formFactory, |
46 | 58 |
ConversationHolder conversation, ICdmFormElement parentElement, |
47 |
String labelString, TaxonNode entity, int style) { |
|
59 |
String labelString, TaxonNode entity, int mode, int style) {
|
|
48 | 60 |
super(formFactory, conversation, parentElement, labelString, entity, |
49 |
false, false, true, style);
|
|
61 |
mode, style);
|
|
50 | 62 |
} |
51 | 63 |
|
52 |
|
|
53 |
/* (non-Javadoc) |
|
54 |
* @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent) |
|
64 |
/* |
|
65 |
* (non-Javadoc) |
|
66 |
* |
|
67 |
* @see |
|
68 |
* org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt |
|
69 |
* .events.SelectionEvent) |
|
55 | 70 |
*/ |
56 | 71 |
/** {@inheritDoc} */ |
57 | 72 |
@Override |
58 | 73 |
public void widgetSelected(SelectionEvent e) { |
59 |
TaxonNode newSelection = TaxonNodeSelectionDialog.select(getShell(), getConversationHolder(), "Select parent taxon", null, null); |
|
74 |
TaxonNode newSelection = TaxonNodeSelectionDialog.select(getShell(), |
|
75 |
getConversationHolder(), "Select parent taxon", null, null); |
|
60 | 76 |
setSelectionInternal(newSelection); |
61 | 77 |
} |
62 |
|
|
63 |
/* (non-Javadoc) |
|
64 |
* @see eu.etaxonomy.taxeditor.forms.selection.AbstractSelectionElement#getTitle() |
|
78 |
|
|
79 |
/* |
|
80 |
* (non-Javadoc) |
|
81 |
* |
|
82 |
* @see |
|
83 |
* eu.etaxonomy.taxeditor.forms.selection.AbstractSelectionElement#getTitle |
|
84 |
* () |
|
65 | 85 |
*/ |
66 | 86 |
/** {@inheritDoc} */ |
67 | 87 |
@Override |
68 | 88 |
protected String getTitle() { |
69 |
if(getEntity() != null && getEntity().getTaxon() != null){
|
|
89 |
if (getEntity() != null && getEntity().getTaxon() != null) {
|
|
70 | 90 |
return CdmUtils.Nz(getEntity().getTaxon().getTitleCache()); |
71 | 91 |
} |
72 | 92 |
return super.getTitle(); |
Also available in: Unified diff
Refactoring selection elements so they can be configured