1c2fdc951249648e8224c8a6fe27679c42708d51
[taxeditor.git] / taxeditor-editor / src / main / java / eu / etaxonomy / taxeditor / editor / description / DistributionComposite.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.editor.description;
12
13 import org.apache.log4j.Logger;
14 import org.eclipse.swt.widgets.Composite;
15 import org.eclipse.ui.views.properties.IPropertySource;
16
17 import eu.etaxonomy.cdm.model.description.Distribution;
18 import eu.etaxonomy.cdm.model.description.PresenceAbsenceTermBase;
19 import eu.etaxonomy.cdm.model.location.NamedArea;
20 import eu.etaxonomy.taxeditor.propertysheet.description.DistributionPropertySource;
21
22 /**
23 * @author p.ciardelli
24 * @created 02.04.2009
25 * @version 1.0
26 */
27 public class DistributionComposite extends DescriptionElementComposite {
28 private static final Logger logger = Logger
29 .getLogger(DistributionComposite.class);
30
31 /**
32 * @param groupComposite
33 * @param groupComposite
34 * @param element
35 */
36 public DistributionComposite(TaxonDescriptionEditor editor, Composite groupComposite,
37 Distribution element) {
38 super(editor, groupComposite, element);
39 }
40
41
42
43 public IPropertySource getPropertySource() {
44 return new DistributionPropertySource((Distribution) getElement());
45 }
46
47
48
49 /* (non-Javadoc)
50 * @see eu.etaxonomy.taxeditor.editor.description.DescriptionElementComposite#initTextViewer()
51 */
52 @Override
53 protected void initTextViewer() {
54
55 Distribution distribution = (Distribution) getElement();
56
57 NamedArea area = distribution.getArea();
58 PresenceAbsenceTermBase<?> status = distribution.getStatus();
59
60 if (status != null) {
61 String text = area.getLabel() + ", " + status.getLabel();
62 textViewer.getTextWidget().setText(text);
63 }
64
65
66 textViewer.getTextWidget().setEditable(false);
67 }
68 }