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 eu
.etaxonomy
.cdm
.hibernate
.HibernateProxyHelper
;
17 import eu
.etaxonomy
.cdm
.model
.name
.HomotypicalGroup
;
18 import eu
.etaxonomy
.cdm
.model
.taxon
.Synonym
;
19 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
20 import eu
.etaxonomy
.taxeditor
.editor
.name
.TaxonNameEditor
;
24 * @created Jan 21, 2011
27 public abstract class AbstractHomotypicalGroupContainer
extends AbstractGroup
{
29 private HomotypicalGroup group
;
34 public AbstractHomotypicalGroupContainer(TaxonNameEditor editor
, HomotypicalGroup group
) {
41 protected abstract void createSynonymContainer();
43 protected List
<Synonym
> getSynonyms(){
44 Taxon taxon
= getEditor().getTaxon();
45 return taxon
.getSynonymsInGroup(getGroup());
49 * @param group the group to set
51 public void setGroup(HomotypicalGroup group
) {
55 public void redraw(HomotypicalGroup homotypicalGroup
){
56 if(redrawNeeded(homotypicalGroup
)){
57 setGroup(homotypicalGroup
);
64 * @param homotypicalGroup
67 protected boolean redrawNeeded(HomotypicalGroup homotypicalGroup
) {
68 Taxon taxon
= getEditor().getTaxon();
69 homotypicalGroup
= HibernateProxyHelper
.deproxy(homotypicalGroup
, HomotypicalGroup
.class);
70 List
<Synonym
> synonyms
= taxon
.getSynonymsInGroup(homotypicalGroup
);
72 List
<Synonym
> presentSynonyms
= new ArrayList
<Synonym
>();
74 for(AbstractGroupedContainer container
: getGroupedContainers()){
75 if(container
.getData() instanceof Synonym
){
76 presentSynonyms
.add((Synonym
) container
.getData());
80 boolean result
= ! (presentSynonyms
.containsAll(synonyms
) && synonyms
.containsAll(presentSynonyms
));
88 public HomotypicalGroup
getGroup() {