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
.name
.container
;
13 import java
.util
.ArrayList
;
14 import java
.util
.List
;
16 import org
.eclipse
.swt
.graphics
.Color
;
18 import eu
.etaxonomy
.cdm
.model
.name
.HomotypicalGroup
;
19 import eu
.etaxonomy
.cdm
.model
.taxon
.Synonym
;
20 import eu
.etaxonomy
.taxeditor
.editor
.EditorUtil
;
21 import eu
.etaxonomy
.taxeditor
.editor
.name
.TaxonNameEditor
;
22 import eu
.etaxonomy
.taxeditor
.preference
.Resources
;
26 * @created Jan 20, 2011
29 public class AcceptedGroup
extends AbstractHomotypicalGroupContainer
{
31 private AcceptedNameContainer acceptedContainer
;
37 public AcceptedGroup(TaxonNameEditor editor
, HomotypicalGroup group
) {
42 * @see eu.etaxonomy.taxeditor.editor.name.AbstractGroup#dragEntered()
45 public void dragEntered() {
46 Color color
= EditorUtil
.getColor(Resources
.COLOR_DRAG_ENTER
);
47 acceptedContainer
.setBackground(color
);
52 * @see eu.etaxonomy.taxeditor.editor.name.AbstractGroup#dragLeft()
55 public void dragLeft() {
56 acceptedContainer
.restoreColor();
61 * @see eu.etaxonomy.taxeditor.editor.name.container.AbstractGroup#getGroupedContainers()
64 public List
<AbstractGroupedContainer
> getGroupedContainers() {
65 List
<AbstractGroupedContainer
> containers
= new ArrayList
<AbstractGroupedContainer
>();
66 containers
.add(getAcceptedNameContainer());
67 containers
.addAll(super.getGroupedContainers());
74 protected void createContainers() {
75 this.acceptedContainer
= new AcceptedNameContainer(getEditor().getTaxon());
76 acceptedContainer
.setGroup(this);
78 acceptedContainer
.createContent();
80 createSynonymContainer();
83 protected void createSynonymContainer(){
84 for(Synonym synonym
: getSynonyms()){
85 SynonymContainer container
= new SynonymContainer(this, synonym
);
87 container
.createContent();
92 * @param acceptedNameContainer
94 public void setAcceptedNameContainer(AcceptedNameContainer acceptedNameContainer
) {
95 this.acceptedContainer
= acceptedNameContainer
;
96 acceptedContainer
.setGroup(this);
99 public AcceptedNameContainer
getAcceptedNameContainer(){
100 return acceptedContainer
;
104 * @see eu.etaxonomy.taxeditor.editor.name.AbstractGroup#emptyGroup()
107 protected void emptyGroup() {
108 acceptedContainer
.dispose();
109 acceptedContainer
= null;
114 * @see eu.etaxonomy.taxeditor.editor.name.AbstractHomotypicalGroupContainer#redrawNeeded(eu.etaxonomy.cdm.model.name.HomotypicalGroup)
117 protected boolean redrawNeeded(HomotypicalGroup homotypicalGroup
) {
118 if(! acceptedContainer
.getData().equals(getEditor().getTaxon())){
121 return super.redrawNeeded(homotypicalGroup
);