1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
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.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.taxeditor.editor.name.e4.container;
|
11
|
|
12
|
import java.util.HashSet;
|
13
|
import java.util.Set;
|
14
|
|
15
|
import eu.etaxonomy.cdm.model.taxon.Taxon;
|
16
|
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
|
17
|
|
18
|
/**
|
19
|
*
|
20
|
* @author pplitzner
|
21
|
* @date Aug 24, 2017
|
22
|
*
|
23
|
*/
|
24
|
public class MisappliedGroupE4 extends AbstractGroupE4{
|
25
|
|
26
|
public MisappliedGroupE4(TaxonNameEditorE4 editor) {
|
27
|
super(editor);
|
28
|
|
29
|
createContent();
|
30
|
}
|
31
|
|
32
|
@Override
|
33
|
protected void createContainers() {
|
34
|
for(Taxon misapplication : getEditor().getTaxon().getMisappliedNames()){
|
35
|
MisapplicationContainerE4 container = new MisapplicationContainerE4(this, misapplication);
|
36
|
this.add(container);
|
37
|
container.createContent();
|
38
|
}
|
39
|
}
|
40
|
|
41
|
@Override
|
42
|
public void redraw() {
|
43
|
if(redrawNeeded()){
|
44
|
super.redraw();
|
45
|
}
|
46
|
}
|
47
|
|
48
|
private boolean redrawNeeded() {
|
49
|
Set<Taxon> misapplications = getEditor().getTaxon().getMisappliedNames();
|
50
|
|
51
|
Set<Taxon> presentMisapplication = new HashSet<Taxon>();
|
52
|
|
53
|
for (AbstractGroupedContainerE4<Taxon> container : getGroupedContainers()){
|
54
|
presentMisapplication.add(container.getData());
|
55
|
}
|
56
|
return ! (presentMisapplication.containsAll(misapplications) && misapplications.containsAll(presentMisapplication));
|
57
|
}
|
58
|
}
|