3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
11 package eu
.etaxonomy
.taxeditor
.editor
.description
;
13 import java
.util
.HashSet
;
16 import org
.apache
.log4j
.Logger
;
17 import org
.eclipse
.swt
.SWT
;
18 import org
.eclipse
.swt
.events
.MouseAdapter
;
19 import org
.eclipse
.swt
.events
.MouseEvent
;
20 import org
.eclipse
.swt
.events
.MouseListener
;
21 import org
.eclipse
.swt
.widgets
.Button
;
22 import org
.eclipse
.swt
.widgets
.Composite
;
23 import org
.eclipse
.swt
.widgets
.Event
;
25 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionElementBase
;
26 import eu
.etaxonomy
.cdm
.model
.description
.Distribution
;
27 import eu
.etaxonomy
.cdm
.model
.description
.Feature
;
28 import eu
.etaxonomy
.cdm
.model
.description
.TaxonDescription
;
35 public class DistributionFeatureGroupComposite
extends DescriptionFeatureGroupComposite
implements MouseListener
{
36 private static final Logger logger
= Logger
37 .getLogger(DistributionFeatureGroupComposite
.class);
39 private Set
<Distribution
> distributions
;
41 private Button showMapButton
;
43 public DistributionFeatureGroupComposite(TaxonDescriptionEditor editor
, Composite parent
,
44 TaxonDescription description
, Feature feature
) {
45 super(editor
, parent
, description
, feature
);
47 distributions
= new HashSet
<Distribution
>();
49 for(DescriptionElementBase descriptionElement
: description
.getElements()){
50 if(descriptionElement
.getFeature().equals(Feature
.DISTRIBUTION())){
51 distributions
.add((Distribution
) descriptionElement
);
55 showMapButton
= new Button(parent
, SWT
.PUSH
);
56 showMapButton
.setText("Show Map");
57 showMapButton
.addMouseListener(this);
61 * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
63 public void mouseUp(MouseEvent event
) {
64 if(event
.widget
== showMapButton
){
66 DistributionMapDialog dialog
= new DistributionMapDialog(editor
, this.getShell(), distributions
);
72 public void mouseDoubleClick(MouseEvent e
) {}
74 public void mouseDown(MouseEvent e
) {}