Revision 1746c51d
Added by Alexander Oppermann over 9 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/presenter/dbstatus/DistributionTablePresenter.java | ||
---|---|---|
14 | 14 |
import eu.etaxonomy.cdm.api.service.IClassificationService; |
15 | 15 |
import eu.etaxonomy.cdm.api.service.IDescriptionService; |
16 | 16 |
import eu.etaxonomy.cdm.api.service.ITaxonNodeService; |
17 |
import eu.etaxonomy.cdm.api.service.ITaxonService; |
|
17 | 18 |
import eu.etaxonomy.cdm.api.service.ITermService; |
18 | 19 |
import eu.etaxonomy.cdm.api.service.IVocabularyService; |
19 | 20 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
... | ... | |
26 | 27 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
27 | 28 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
28 | 29 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
30 |
import eu.etaxonomy.cdm.vaadin.model.CdmTaxonTableCollection; |
|
29 | 31 |
import eu.etaxonomy.cdm.vaadin.model.DbTableDTO; |
30 | 32 |
import eu.etaxonomy.cdm.vaadin.model.DbTableDTOS; |
31 |
import eu.etaxonomy.cdm.vaadin.model.DistributionDTO; |
|
32 | 33 |
import eu.etaxonomy.cdm.vaadin.model.LazyLoadedContainer; |
33 | 34 |
import eu.etaxonomy.cdm.vaadin.util.CdmSpringContextHelper; |
34 | 35 |
import eu.etaxonomy.cdm.vaadin.view.dbstatus.DistributionTableView; |
... | ... | |
37 | 38 |
|
38 | 39 |
public class DistributionTablePresenter implements IDistributionTableComponent.DistributionTableComponentListener{ |
39 | 40 |
|
41 |
|
|
40 | 42 |
private final IClassificationService classificationService; |
41 | 43 |
private final IVocabularyService vocabularyService; |
42 | 44 |
private final IDescriptionService descriptionService; |
43 | 45 |
private final ITaxonNodeService taxonNodeService; |
44 | 46 |
private final ITermService termService; |
45 | 47 |
private final DistributionTableView view; |
48 |
private ITaxonService taxonService; |
|
46 | 49 |
|
47 | 50 |
public DistributionTablePresenter(DistributionTableView dtv){ |
48 | 51 |
this.view = dtv; |
49 | 52 |
view.addListener(this); |
50 |
view.dataBinding();
|
|
53 |
taxonService = (ITaxonService)CdmSpringContextHelper.newInstance().getBean("taxonServiceImpl");
|
|
51 | 54 |
classificationService = (IClassificationService)CdmSpringContextHelper.newInstance().getBean("classificationServiceImpl"); |
52 | 55 |
taxonNodeService = (ITaxonNodeService)CdmSpringContextHelper.newInstance().getBean("taxonNodeServiceImpl"); |
53 | 56 |
vocabularyService = (IVocabularyService)CdmSpringContextHelper.newInstance().getBean("vocabularyServiceImpl"); |
54 | 57 |
descriptionService = (IDescriptionService)CdmSpringContextHelper.newInstance().getBean("descriptionServiceImpl"); |
55 | 58 |
termService = (ITermService)CdmSpringContextHelper.newInstance().getBean("termServiceImpl"); |
59 |
view.dataBinding(); |
|
56 | 60 |
} |
57 | 61 |
|
58 | 62 |
|
... | ... | |
91 | 95 |
} |
92 | 96 |
return map; |
93 | 97 |
} |
94 |
|
|
98 |
@Override |
|
99 |
public List<DescriptionElementBase> listDescriptionElementsForTaxon(Taxon taxon, Set<Feature> setFeature){ |
|
100 |
return descriptionService.listDescriptionElementsForTaxon(taxon, setFeature, null, null, null, DESCRIPTION_INIT_STRATEGY); |
|
101 |
} |
|
95 | 102 |
|
96 | 103 |
@Override |
97 | 104 |
public List<Distribution> getDistribution(Taxon taxon) { |
... | ... | |
101 | 108 |
|
102 | 109 |
} |
103 | 110 |
|
104 |
|
|
111 |
@Override |
|
105 | 112 |
public List<TaxonNode> getAllNodes(int start, int end){ |
106 |
Classification classification = loadClassification();
|
|
113 |
Classification classification = getChosenClassification();
|
|
107 | 114 |
List<TaxonNode> nodesForClassification = taxonNodeService.listAllNodesForClassification(classification, start, end); |
108 | 115 |
return nodesForClassification; |
109 | 116 |
} |
110 | 117 |
|
111 | 118 |
|
112 |
|
|
113 |
private Classification loadClassification() {
|
|
119 |
@Override |
|
120 |
public Classification getChosenClassification() {
|
|
114 | 121 |
VaadinSession session = VaadinSession.getCurrent(); |
115 | 122 |
UUID classificationUUID = (UUID) session.getAttribute("classificationUUID"); |
116 | 123 |
Classification classification = classificationService.load(classificationUUID); |
... | ... | |
119 | 126 |
|
120 | 127 |
@Override |
121 | 128 |
public int getSizeOfClassification(){ |
122 |
Classification classification = loadClassification();
|
|
129 |
Classification classification = getChosenClassification();
|
|
123 | 130 |
return taxonNodeService.countAllNodesForClassification(classification); |
124 | 131 |
} |
125 | 132 |
|
... | ... | |
147 | 154 |
return items; |
148 | 155 |
} |
149 | 156 |
|
150 |
void nestedContainer(){ |
|
151 |
BeanItemContainer<DbTableDTO> container = new BeanItemContainer<DbTableDTO>(DbTableDTO.class); |
|
157 |
|
|
158 |
|
|
159 |
@Override |
|
160 |
public LazyLoadedContainer getLazyLoadedContainer(){ |
|
161 |
LazyLoadedContainer lz = new LazyLoadedContainer(CdmTaxonTableCollection.class); |
|
162 |
lz.addListener(this); |
|
163 |
return lz; |
|
152 | 164 |
|
153 | 165 |
} |
154 | 166 |
|
... | ... | |
173 | 185 |
}); |
174 | 186 |
|
175 | 187 |
|
188 |
@Override |
|
189 |
public IClassificationService getClassificationService() { |
|
190 |
return classificationService; |
|
191 |
} |
|
192 |
|
|
193 |
|
|
194 |
@Override |
|
195 |
public IVocabularyService getVocabularyService() { |
|
196 |
return vocabularyService; |
|
197 |
} |
|
198 |
|
|
199 |
|
|
200 |
@Override |
|
201 |
public IDescriptionService getDescriptionService() { |
|
202 |
return descriptionService; |
|
203 |
} |
|
204 |
|
|
205 |
|
|
206 |
@Override |
|
207 |
public ITaxonNodeService getTaxonNodeService() { |
|
208 |
return taxonNodeService; |
|
209 |
} |
|
210 |
|
|
211 |
|
|
212 |
@Override |
|
213 |
public ITermService getTermService() { |
|
214 |
return termService; |
|
215 |
} |
|
216 |
|
|
176 | 217 |
@Override |
177 | 218 |
public LazyLoadedContainer getTableContainer() { |
178 | 219 |
// TODO Auto-generated method stub |
... | ... | |
181 | 222 |
|
182 | 223 |
|
183 | 224 |
|
225 |
@Override |
|
226 |
public ITaxonService getTaxonService() { |
|
227 |
return taxonService; |
|
228 |
} |
|
229 |
|
|
230 |
|
|
184 | 231 |
} |
Also available in: Unified diff
finalize vaadin app to seperate to prepare the next step for separating vaadin from cdmlib-remote