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
.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
.EditorUtil
;
20 import eu
.etaxonomy
.taxeditor
.editor
.name
.TaxonNameEditor
;
21 import eu
.etaxonomy
.taxeditor
.preference
.Resources
;
25 * @created Jan 20, 2011
28 public class AcceptedGroup
extends AbstractHomotypicalGroupContainer
{
30 private AcceptedNameContainer acceptedContainer
;
36 public AcceptedGroup(TaxonNameEditor editor
, HomotypicalGroup group
) {
41 * @see eu.etaxonomy.taxeditor.editor.name.AbstractGroup#dragEntered()
44 public void dragEntered() {
45 Color color
= EditorUtil
.getColor(Resources
.COLOR_DRAG_ENTER
);
46 acceptedContainer
.setBackground(color
);
51 * @see eu.etaxonomy.taxeditor.editor.name.AbstractGroup#dragLeft()
54 public void dragLeft() {
55 acceptedContainer
.restoreColor();
60 * @see eu.etaxonomy.taxeditor.editor.name.container.AbstractGroup#getGroupedContainers()
63 public List
<AbstractGroupedContainer
> getGroupedContainers() {
64 List
<AbstractGroupedContainer
> containers
= new ArrayList
<AbstractGroupedContainer
>();
65 containers
.add(getAcceptedNameContainer());
66 containers
.addAll(super.getGroupedContainers());
73 protected void createContainers() {
74 this.acceptedContainer
= new AcceptedNameContainer(getEditor().getTaxon());
75 acceptedContainer
.setGroup(this);
77 acceptedContainer
.createContent();
79 createSynonymContainer();
82 protected void createSynonymContainer(){
83 for(Synonym synonym
: getSynonyms()){
84 SynonymContainer container
= new SynonymContainer(this, synonym
);
86 container
.createContent();
91 * @param acceptedNameContainer
93 public void setAcceptedNameContainer(AcceptedNameContainer acceptedNameContainer
) {
94 this.acceptedContainer
= acceptedNameContainer
;
95 acceptedContainer
.setGroup(this);
98 public AcceptedNameContainer
getAcceptedNameContainer(){
99 return acceptedContainer
;
103 * @see eu.etaxonomy.taxeditor.editor.name.AbstractGroup#emptyGroup()
106 protected void emptyGroup() {
107 acceptedContainer
.dispose();
108 acceptedContainer
= null;
113 * @see eu.etaxonomy.taxeditor.editor.name.AbstractHomotypicalGroupContainer#redrawNeeded(eu.etaxonomy.cdm.model.name.HomotypicalGroup)
116 protected boolean redrawNeeded(HomotypicalGroup homotypicalGroup
) {
117 if(! acceptedContainer
.getData().equals(getEditor().getTaxon())){
120 return super.redrawNeeded(homotypicalGroup
);