Revision 4a72ff97
Added by Patrick Plitzner over 7 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/view/dbstatus/DistributionSettingsConfigWindow.java | ||
---|---|---|
10 | 10 |
package eu.etaxonomy.cdm.vaadin.view.dbstatus; |
11 | 11 |
|
12 | 12 |
import java.sql.SQLException; |
13 |
import java.util.Collection; |
|
13 |
import java.util.Collections;
|
|
14 | 14 |
import java.util.Set; |
15 | 15 |
import java.util.UUID; |
16 | 16 |
|
17 |
import com.vaadin.data.Item; |
|
18 | 17 |
import com.vaadin.data.Property; |
19 | 18 |
import com.vaadin.data.Property.ValueChangeEvent; |
20 | 19 |
import com.vaadin.data.Property.ValueChangeListener; |
... | ... | |
96 | 95 |
String titleCache = (String) classificationBox.getContainerProperty(classificationSelection, "titleCache").getValue(); |
97 | 96 |
UUID uuid = UUID.fromString(uuidString); |
98 | 97 |
UuidAndTitleCache<TaxonNode> parent = new UuidAndTitleCache<>(uuid, id, titleCache); |
99 |
taxonTree.setContainerDataSource(new TaxonNodeContainer(parent)); |
|
100 |
addChildItems(parent); |
|
98 |
taxonTree.setContainerDataSource(new TaxonNodeContainer(Collections.singleton(parent))); |
|
101 | 99 |
if(chosenTaxonNode!=null){ |
102 | 100 |
taxonTree.select(new RowId(chosenTaxonNode.getId())); |
103 | 101 |
} |
... | ... | |
212 | 210 |
int id = parentNode.getId(); |
213 | 211 |
String titleCache = parentNode.getClassification().getTitleCache(); |
214 | 212 |
UuidAndTitleCache<TaxonNode> parent = new UuidAndTitleCache<>(uuid, id, titleCache); |
215 |
taxonTree.setContainerDataSource(new TaxonNodeContainer(parent)); |
|
216 |
addChildItems(parent); |
|
213 |
taxonTree.setContainerDataSource(new TaxonNodeContainer(Collections.singleton(parent))); |
|
217 | 214 |
} |
218 | 215 |
} |
219 | 216 |
else if(property==distAreaBox){ |
... | ... | |
257 | 254 |
@Override |
258 | 255 |
public void nodeExpand(ExpandEvent event) { |
259 | 256 |
UuidAndTitleCache<TaxonNode> parent = (UuidAndTitleCache<TaxonNode>) event.getItemId(); |
260 |
addChildItems(parent); |
|
261 |
} |
|
262 |
|
|
263 |
/** |
|
264 |
* @param parent |
|
265 |
*/ |
|
266 |
private void addChildItems(UuidAndTitleCache<TaxonNode> parent) { |
|
267 |
Collection<UuidAndTitleCache<TaxonNode>> children = CdmSpringContextHelper.getTaxonNodeService().listChildNodesAsUuidAndTitleCache(parent); |
|
268 |
taxonTree.setChildrenAllowed(parent, !children.isEmpty()); |
|
269 |
for (UuidAndTitleCache<TaxonNode> child : children) { |
|
270 |
Item childItem = taxonTree.addItem(child); |
|
271 |
if(childItem!=null){ |
|
272 |
taxonTree.setParent(child, parent); |
|
273 |
} |
|
274 |
Collection<UuidAndTitleCache<TaxonNode>> grandChildren = CdmSpringContextHelper.getTaxonNodeService().listChildNodesAsUuidAndTitleCache(child); |
|
275 |
taxonTree.setChildrenAllowed(child, !grandChildren.isEmpty()); |
|
276 |
} |
|
257 |
((TaxonNodeContainer) taxonTree.getContainerDataSource()).addChildItems(parent); |
|
277 | 258 |
} |
278 | 259 |
|
279 | 260 |
} |
Also available in: Unified diff
ref #5458 Improve performance for taxon tree in settings dialog