2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.editor
.name
.e4
.container
;
12 import java
.util
.ArrayList
;
13 import java
.util
.List
;
15 import org
.eclipse
.swt
.graphics
.Color
;
17 import eu
.etaxonomy
.cdm
.model
.name
.HomotypicalGroup
;
18 import eu
.etaxonomy
.cdm
.model
.taxon
.Synonym
;
19 import eu
.etaxonomy
.taxeditor
.editor
.name
.e4
.TaxonNameEditorE4
;
20 import eu
.etaxonomy
.taxeditor
.model
.AbstractUtility
;
21 import eu
.etaxonomy
.taxeditor
.preference
.Resources
;
29 public class AcceptedGroupE4
extends AbstractHomotypicalGroupContainerE4
{
31 private AcceptedNameContainerE4 acceptedContainer
;
33 public AcceptedGroupE4(TaxonNameEditorE4 editor
, HomotypicalGroup group
) {
38 public void dragEntered() {
39 Color color
= AbstractUtility
.getColor(Resources
.COLOR_DRAG_ENTER
);
40 acceptedContainer
.setBackground(color
);
45 public void dragLeft() {
46 acceptedContainer
.restoreColor();
51 public List
<AbstractGroupedContainerE4
> getGroupedContainers() {
52 List
<AbstractGroupedContainerE4
> containers
= new ArrayList
<>();
53 containers
.add(getAcceptedNameContainer());
54 containers
.addAll(super.getGroupedContainers());
59 protected void createContainers() {
60 this.acceptedContainer
= new AcceptedNameContainerE4(getEditor().getTaxon());
61 acceptedContainer
.setGroup(this);
63 acceptedContainer
.createContent();
65 createSynonymContainer();
69 protected void createSynonymContainer(){
70 for(Synonym synonym
: getSynonyms()){
71 SynonymContainerE4 container
= new SynonymContainerE4(this, synonym
);
73 container
.createContent();
77 public void setAcceptedNameContainer(AcceptedNameContainerE4 acceptedNameContainer
) {
78 this.acceptedContainer
= acceptedNameContainer
;
79 acceptedContainer
.setGroup(this);
82 public AcceptedNameContainerE4
getAcceptedNameContainer(){
83 return acceptedContainer
;
87 protected void emptyGroup() {
88 acceptedContainer
.dispose();
89 acceptedContainer
= null;
94 protected boolean redrawNeeded(HomotypicalGroup homotypicalGroup
) {
95 if(! acceptedContainer
.getData().equals(getEditor().getTaxon())){
98 return super.redrawNeeded(homotypicalGroup
);