1
|
package eu.etaxonomy.cdm.vaadin.model;
|
2
|
|
3
|
import java.io.Serializable;
|
4
|
import java.util.List;
|
5
|
|
6
|
import com.vaadin.data.util.BeanContainer;
|
7
|
import com.vaadin.data.util.BeanItem;
|
8
|
|
9
|
import eu.etaxonomy.cdm.model.common.CdmBase;
|
10
|
import eu.etaxonomy.cdm.model.taxon.Taxon;
|
11
|
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
|
12
|
import eu.etaxonomy.cdm.vaadin.view.dbstatus.IDistributionTableComponent;
|
13
|
|
14
|
public class LazyLoadedContainer extends BeanContainer implements Serializable, IDistributionTableComponent {
|
15
|
|
16
|
/** autogenerated **/
|
17
|
private static final long serialVersionUID = 1L;
|
18
|
|
19
|
DistributionTableComponentListener listener;
|
20
|
|
21
|
|
22
|
public LazyLoadedContainer(Class type) throws IllegalArgumentException {
|
23
|
super(type);
|
24
|
}
|
25
|
//
|
26
|
// public LazyLoadedContainer(Class type, IClassificationService classificationService, ITaxonNodeService taxonNodeService, IDescriptionService descriptionService) throws IllegalArgumentException {
|
27
|
// super(type);
|
28
|
// this.classificationService = classificationService;
|
29
|
// this.taxonNodeService = taxonNodeService;
|
30
|
// this.descriptionService = descriptionService;
|
31
|
//
|
32
|
// }
|
33
|
|
34
|
@Override
|
35
|
public int size(){
|
36
|
return listener.getSizeOfTaxonNode();
|
37
|
}
|
38
|
|
39
|
@Override
|
40
|
public BeanItem getItem(Object itemId){
|
41
|
TaxonNode taxonNode = ((TaxonNode) itemId);
|
42
|
CdmBase.deproxy(taxonNode, TaxonNode.class);
|
43
|
Taxon taxon = (Taxon)taxonNode.getTaxon();
|
44
|
CdmBase.deproxy(taxon, Taxon.class);
|
45
|
CdmTaxonTableCollection cttc = new CdmTaxonTableCollection(taxon);
|
46
|
return new BeanItem(cttc);
|
47
|
}
|
48
|
|
49
|
@Override
|
50
|
public List getItemIds(int startIndex, int numberOfIds){
|
51
|
int endIndex = startIndex + numberOfIds;
|
52
|
List<TaxonNode> listAllNodesForClassification = listener.getAllNodes(startIndex, endIndex);
|
53
|
return listAllNodesForClassification;
|
54
|
}
|
55
|
|
56
|
|
57
|
|
58
|
@Override
|
59
|
public void addListener(DistributionTableComponentListener listener) {
|
60
|
this.listener = listener;
|
61
|
}
|
62
|
|
63
|
|
64
|
|
65
|
}
|