Basically fixes #2282. I will create new tickets for still open issues.
[taxeditor.git] / taxeditor-store / src / main / java / eu / etaxonomy / taxeditor / ui / selection / NamedAreaSelectionElement.java
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.apache.log4j.Logger;
14 import org.eclipse.swt.events.SelectionEvent;
15
16 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
17 import eu.etaxonomy.cdm.model.location.NamedArea;
18 import eu.etaxonomy.taxeditor.store.CdmStore;
19 import eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.NamedAreaSelectionDialog;
20 import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
21 import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
22
23 /**
24 * <p>NamedAreaSelectionElement class.</p>
25 *
26 * @author n.hoffmann
27 * @created May 11, 2010
28 * @version 1.0
29 */
30 public class NamedAreaSelectionElement extends AbstractSelectionElement<NamedArea> {
31
32 /**
33 * <p>Constructor for NamedAreaSelectionElement.</p>
34 *
35 * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory} object.
36 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
37 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
38 * @param labelString a {@link java.lang.String} object.
39 * @param entity a {@link eu.etaxonomy.cdm.model.location.NamedArea} object.
40 * @param style a int.
41 */
42 public NamedAreaSelectionElement(CdmFormFactory formFactory, ConversationHolder conversation,
43 ICdmFormElement parentElement, String labelString,
44 NamedArea entity, int style) {
45 super(formFactory, conversation, parentElement, labelString, entity,
46 false, false, false, style);
47 }
48
49 /** {@inheritDoc} */
50 public void widgetSelected(SelectionEvent e) {
51 NamedArea newSelection = NamedAreaSelectionDialog.select(getLayoutComposite().getShell(), getConversationHolder(), entity);
52 setSelectionInternal(newSelection);
53 }
54
55 /** {@inheritDoc} */
56 @Override
57 protected String getTitle() {
58 return (entity != null) ? NamedArea.labelWithLevel(entity, CdmStore.getDefaultLanguage()) : "";
59 }
60 }