1 |
5eece89f
|
Patrick Plitzner
|
// $Id$
|
2 |
|
|
/**
|
3 |
fe7f0131
|
Patrick Plitzner
|
* Copyright (C) 2015 EDIT
|
4 |
|
|
* European Distributed Institute of Taxonomy
|
5 |
|
|
* http://www.e-taxonomy.eu
|
6 |
|
|
*
|
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.
|
9 |
|
|
*/
|
10 |
5eece89f
|
Patrick Plitzner
|
package eu.etaxonomy.cdm.vaadin.view.dbstatus;
|
11 |
|
|
|
12 |
f8b0de79
|
Patrick Plitzner
|
import java.sql.SQLException;
|
13 |
787028b1
|
Patrick Plitzner
|
import java.util.ArrayList;
|
14 |
f9517a12
|
Patrick Plitzner
|
import java.util.Collection;
|
15 |
|
|
import java.util.List;
|
16 |
5eece89f
|
Patrick Plitzner
|
import java.util.Set;
|
17 |
fe7f0131
|
Patrick Plitzner
|
import java.util.UUID;
|
18 |
5eece89f
|
Patrick Plitzner
|
|
19 |
|
|
import com.vaadin.data.Property;
|
20 |
|
|
import com.vaadin.data.Property.ValueChangeEvent;
|
21 |
|
|
import com.vaadin.data.Property.ValueChangeListener;
|
22 |
f9517a12
|
Patrick Plitzner
|
import com.vaadin.data.util.BeanItemContainer;
|
23 |
b8e7047b
|
Patrick Plitzner
|
import com.vaadin.data.util.sqlcontainer.RowId;
|
24 |
ad0d2649
|
Patrick Plitzner
|
import com.vaadin.server.Page;
|
25 |
5eece89f
|
Patrick Plitzner
|
import com.vaadin.server.VaadinSession;
|
26 |
|
|
import com.vaadin.ui.AbstractLayout;
|
27 |
|
|
import com.vaadin.ui.Alignment;
|
28 |
|
|
import com.vaadin.ui.Button.ClickEvent;
|
29 |
|
|
import com.vaadin.ui.Button.ClickListener;
|
30 |
|
|
import com.vaadin.ui.ComboBox;
|
31 |
|
|
import com.vaadin.ui.HorizontalLayout;
|
32 |
|
|
import com.vaadin.ui.ListSelect;
|
33 |
ad0d2649
|
Patrick Plitzner
|
import com.vaadin.ui.Notification;
|
34 |
b8e7047b
|
Patrick Plitzner
|
import com.vaadin.ui.Table.ColumnHeaderMode;
|
35 |
f9517a12
|
Patrick Plitzner
|
import com.vaadin.ui.TextField;
|
36 |
fe7f0131
|
Patrick Plitzner
|
import com.vaadin.ui.Tree.ExpandEvent;
|
37 |
|
|
import com.vaadin.ui.Tree.ExpandListener;
|
38 |
b8e7047b
|
Patrick Plitzner
|
import com.vaadin.ui.TreeTable;
|
39 |
ad0d2649
|
Patrick Plitzner
|
import com.vaadin.ui.UI;
|
40 |
5eece89f
|
Patrick Plitzner
|
import com.vaadin.ui.VerticalLayout;
|
41 |
|
|
|
42 |
f9517a12
|
Patrick Plitzner
|
import eu.etaxonomy.cdm.common.CdmUtils;
|
43 |
5eece89f
|
Patrick Plitzner
|
import eu.etaxonomy.cdm.model.common.TermVocabulary;
|
44 |
|
|
import eu.etaxonomy.cdm.model.location.NamedArea;
|
45 |
787028b1
|
Patrick Plitzner
|
import eu.etaxonomy.cdm.model.taxon.Classification;
|
46 |
5eece89f
|
Patrick Plitzner
|
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
|
47 |
fe7f0131
|
Patrick Plitzner
|
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
|
48 |
f8b0de79
|
Patrick Plitzner
|
import eu.etaxonomy.cdm.vaadin.container.CdmSQLContainer;
|
49 |
5eece89f
|
Patrick Plitzner
|
import eu.etaxonomy.cdm.vaadin.container.NamedAreaContainer;
|
50 |
|
|
import eu.etaxonomy.cdm.vaadin.container.TaxonNodeContainer;
|
51 |
f8b0de79
|
Patrick Plitzner
|
import eu.etaxonomy.cdm.vaadin.util.CdmQueryFactory;
|
52 |
b8e7047b
|
Patrick Plitzner
|
import eu.etaxonomy.cdm.vaadin.util.CdmSpringContextHelper;
|
53 |
5eece89f
|
Patrick Plitzner
|
import eu.etaxonomy.cdm.vaadin.util.DistributionEditorUtil;
|
54 |
|
|
|
55 |
|
|
/**
|
56 |
dc4aa464
|
Patrick Plitzner
|
*
|
57 |
5eece89f
|
Patrick Plitzner
|
* @author pplitzner
|
58 |
|
|
*
|
59 |
|
|
*/
|
60 |
fe7f0131
|
Patrick Plitzner
|
public class DistributionSettingsConfigWindow extends AbstractSettingsDialogWindow implements ValueChangeListener, ClickListener, ExpandListener{
|
61 |
5eece89f
|
Patrick Plitzner
|
|
62 |
fe7f0131
|
Patrick Plitzner
|
private static final long serialVersionUID = 1439411115014088780L;
|
63 |
|
|
private ComboBox classificationBox;
|
64 |
f9517a12
|
Patrick Plitzner
|
private TextField taxonFilter;
|
65 |
5eece89f
|
Patrick Plitzner
|
private ComboBox distAreaBox;
|
66 |
|
|
private ListSelect namedAreaList;
|
67 |
b8e7047b
|
Patrick Plitzner
|
private TreeTable taxonTree;
|
68 |
4b321494
|
Patrick Plitzner
|
|
69 |
5eece89f
|
Patrick Plitzner
|
/**
|
70 |
|
|
* The constructor should first build the main layout, set the
|
71 |
|
|
* composition root and then do any custom initialization.
|
72 |
|
|
*
|
73 |
|
|
* The constructor will not be automatically regenerated by the
|
74 |
|
|
* visual editor.
|
75 |
dc4aa464
|
Patrick Plitzner
|
* @param distributionTableView
|
76 |
5eece89f
|
Patrick Plitzner
|
*/
|
77 |
|
|
public DistributionSettingsConfigWindow(DistributionTableView distributionTableView) {
|
78 |
fe7f0131
|
Patrick Plitzner
|
super();
|
79 |
5eece89f
|
Patrick Plitzner
|
}
|
80 |
|
|
|
81 |
fe7f0131
|
Patrick Plitzner
|
@Override
|
82 |
58dba687
|
Patrick Plitzner
|
protected void init() {
|
83 |
787028b1
|
Patrick Plitzner
|
//init classification
|
84 |
|
|
Classification classification = presenter.getChosenClassification();
|
85 |
f8b0de79
|
Patrick Plitzner
|
try {
|
86 |
|
|
classificationBox.setContainerDataSource(new CdmSQLContainer(CdmQueryFactory.generateTableQuery("Classification")));
|
87 |
|
|
} catch (SQLException e) {
|
88 |
|
|
DistributionEditorUtil.showSqlError(e);
|
89 |
|
|
}
|
90 |
787028b1
|
Patrick Plitzner
|
RowId parent = null;
|
91 |
|
|
if(classification!=null){
|
92 |
|
|
parent = new RowId(classification.getRootNode().getId());
|
93 |
|
|
}
|
94 |
|
|
else if(classificationBox.getItemIds().size()==1){
|
95 |
fe7f0131
|
Patrick Plitzner
|
//only one classification exists
|
96 |
787028b1
|
Patrick Plitzner
|
parent = (RowId) classificationBox.getItemIds().iterator().next();
|
97 |
fe7f0131
|
Patrick Plitzner
|
}
|
98 |
787028b1
|
Patrick Plitzner
|
if(parent!=null){
|
99 |
|
|
classificationBox.setValue(new RowId(parent.getId()));
|
100 |
|
|
showClassificationTaxa(getUuidAndTitleCacheFromRowId(parent));
|
101 |
5eece89f
|
Patrick Plitzner
|
}
|
102 |
4b321494
|
Patrick Plitzner
|
|
103 |
d196eb4d
|
Patrick Plitzner
|
classificationBox.addValueChangeListener(this);
|
104 |
f9517a12
|
Patrick Plitzner
|
taxonFilter.addValueChangeListener(this);
|
105 |
787028b1
|
Patrick Plitzner
|
taxonTree.addExpandListener(this);
|
106 |
fe7f0131
|
Patrick Plitzner
|
|
107 |
58dba687
|
Patrick Plitzner
|
TermVocabulary<NamedArea> chosenArea = presenter.getChosenArea();
|
108 |
|
|
distAreaBox.setContainerDataSource(presenter.getDistributionContainer());
|
109 |
5eece89f
|
Patrick Plitzner
|
distAreaBox.setValue(chosenArea);
|
110 |
|
|
distAreaBox.addValueChangeListener(this);
|
111 |
dc4aa464
|
Patrick Plitzner
|
|
112 |
5eece89f
|
Patrick Plitzner
|
if(chosenArea!=null){
|
113 |
fe7f0131
|
Patrick Plitzner
|
NamedAreaContainer container = new NamedAreaContainer(chosenArea);
|
114 |
|
|
namedAreaList.setContainerDataSource(container);
|
115 |
5eece89f
|
Patrick Plitzner
|
}
|
116 |
|
|
Object selectedAreas = VaadinSession.getCurrent().getAttribute(DistributionEditorUtil.SATTR_SELECTED_AREAS);
|
117 |
|
|
namedAreaList.setValue(selectedAreas);
|
118 |
dc4aa464
|
Patrick Plitzner
|
|
119 |
5eece89f
|
Patrick Plitzner
|
okButton.addClickListener(this);
|
120 |
|
|
cancelButton.addClickListener(this);
|
121 |
41f187f1
|
Patrick Plitzner
|
updateButtons();
|
122 |
5eece89f
|
Patrick Plitzner
|
}
|
123 |
|
|
|
124 |
fe7f0131
|
Patrick Plitzner
|
@Override
|
125 |
58dba687
|
Patrick Plitzner
|
protected AbstractLayout buildMainLayout() {
|
126 |
5eece89f
|
Patrick Plitzner
|
|
127 |
d196eb4d
|
Patrick Plitzner
|
mainLayout = new VerticalLayout();
|
128 |
5eece89f
|
Patrick Plitzner
|
mainLayout.setSizeFull();
|
129 |
d196eb4d
|
Patrick Plitzner
|
|
130 |
fe7f0131
|
Patrick Plitzner
|
HorizontalLayout leftAndRightContainer = new HorizontalLayout();
|
131 |
d196eb4d
|
Patrick Plitzner
|
leftAndRightContainer.setImmediate(false);
|
132 |
|
|
leftAndRightContainer.setSizeFull();
|
133 |
|
|
leftAndRightContainer.setMargin(true);
|
134 |
|
|
leftAndRightContainer.setSpacing(true);
|
135 |
5eece89f
|
Patrick Plitzner
|
|
136 |
|
|
VerticalLayout leftContainer = new VerticalLayout();
|
137 |
|
|
leftContainer.setImmediate(false);
|
138 |
|
|
leftContainer.setSpacing(true);
|
139 |
b8e7047b
|
Patrick Plitzner
|
leftContainer.setSizeFull();
|
140 |
5eece89f
|
Patrick Plitzner
|
|
141 |
|
|
VerticalLayout rightContainer = new VerticalLayout();
|
142 |
|
|
rightContainer.setImmediate(false);
|
143 |
|
|
rightContainer.setSpacing(true);
|
144 |
b8e7047b
|
Patrick Plitzner
|
rightContainer.setSizeFull();
|
145 |
5eece89f
|
Patrick Plitzner
|
|
146 |
f9517a12
|
Patrick Plitzner
|
//classification
|
147 |
5eece89f
|
Patrick Plitzner
|
classificationBox = new ComboBox("Classification");
|
148 |
d196eb4d
|
Patrick Plitzner
|
classificationBox.setItemCaptionPropertyId(TaxonNodeContainer.LABEL);
|
149 |
|
|
classificationBox.setInputPrompt("Please select a classification...");
|
150 |
5eece89f
|
Patrick Plitzner
|
classificationBox.setImmediate(true);
|
151 |
d196eb4d
|
Patrick Plitzner
|
classificationBox.setNewItemsAllowed(false);
|
152 |
|
|
classificationBox.setNullSelectionAllowed(false);
|
153 |
e11ccba6
|
Patrick Plitzner
|
classificationBox.setSizeFull();
|
154 |
5eece89f
|
Patrick Plitzner
|
classificationBox.setWidth("100%");
|
155 |
|
|
|
156 |
f9517a12
|
Patrick Plitzner
|
//taxonFilter
|
157 |
|
|
taxonFilter = new TextField("Filter");
|
158 |
|
|
taxonFilter.setInputPrompt("Filter taxa by name...");
|
159 |
|
|
taxonFilter.setSizeFull();
|
160 |
|
|
taxonFilter.setImmediate(true);
|
161 |
|
|
|
162 |
5eece89f
|
Patrick Plitzner
|
//distribution area box
|
163 |
|
|
distAreaBox = new ComboBox("Distribution Area:");
|
164 |
d196eb4d
|
Patrick Plitzner
|
distAreaBox.setInputPrompt("Please select a distribution area...");
|
165 |
5eece89f
|
Patrick Plitzner
|
distAreaBox.setImmediate(true);
|
166 |
d196eb4d
|
Patrick Plitzner
|
distAreaBox.setNullSelectionAllowed(false);
|
167 |
|
|
distAreaBox.setNewItemsAllowed(false);
|
168 |
|
|
distAreaBox.setSizeFull();
|
169 |
5eece89f
|
Patrick Plitzner
|
distAreaBox.setWidth("100%");
|
170 |
|
|
|
171 |
|
|
// named areas
|
172 |
|
|
namedAreaList = new ListSelect();
|
173 |
|
|
namedAreaList.setCaption("Areas");
|
174 |
dc4aa464
|
Patrick Plitzner
|
namedAreaList.setSizeFull();
|
175 |
5eece89f
|
Patrick Plitzner
|
namedAreaList.setMultiSelect(true);
|
176 |
|
|
|
177 |
|
|
//taxonomy
|
178 |
b8e7047b
|
Patrick Plitzner
|
taxonTree = new TreeTable("Taxonomy");
|
179 |
|
|
taxonTree.setSelectable(true);
|
180 |
|
|
taxonTree.setSizeFull();
|
181 |
|
|
taxonTree.setImmediate(true);
|
182 |
|
|
taxonTree.setCacheRate(20);
|
183 |
|
|
taxonTree.setColumnHeaderMode(ColumnHeaderMode.HIDDEN);
|
184 |
787028b1
|
Patrick Plitzner
|
taxonTree.setMultiSelect(true);
|
185 |
5eece89f
|
Patrick Plitzner
|
|
186 |
|
|
leftContainer.addComponent(distAreaBox);
|
187 |
|
|
leftContainer.addComponent(namedAreaList);
|
188 |
d196eb4d
|
Patrick Plitzner
|
leftContainer.setExpandRatio(distAreaBox, 0.1f);
|
189 |
e11ccba6
|
Patrick Plitzner
|
leftContainer.setExpandRatio(namedAreaList, 0.9f);
|
190 |
5eece89f
|
Patrick Plitzner
|
leftContainer.setSizeFull();
|
191 |
dc4aa464
|
Patrick Plitzner
|
|
192 |
e11ccba6
|
Patrick Plitzner
|
rightContainer.addComponent(classificationBox);
|
193 |
f9517a12
|
Patrick Plitzner
|
rightContainer.addComponent(taxonFilter);
|
194 |
5eece89f
|
Patrick Plitzner
|
rightContainer.addComponent(taxonTree);
|
195 |
d196eb4d
|
Patrick Plitzner
|
rightContainer.setExpandRatio(classificationBox, 0.1f);
|
196 |
f9517a12
|
Patrick Plitzner
|
rightContainer.setExpandRatio(taxonFilter, 0.1f);
|
197 |
|
|
rightContainer.setExpandRatio(taxonTree, 0.8f);
|
198 |
5eece89f
|
Patrick Plitzner
|
|
199 |
d196eb4d
|
Patrick Plitzner
|
leftAndRightContainer.addComponent(leftContainer);
|
200 |
|
|
leftAndRightContainer.addComponent(rightContainer);
|
201 |
5eece89f
|
Patrick Plitzner
|
|
202 |
|
|
//button toolbar
|
203 |
58dba687
|
Patrick Plitzner
|
HorizontalLayout buttonToolBar = createOkCancelButtons();
|
204 |
5eece89f
|
Patrick Plitzner
|
|
205 |
d196eb4d
|
Patrick Plitzner
|
mainLayout.addComponent(leftAndRightContainer);
|
206 |
5eece89f
|
Patrick Plitzner
|
mainLayout.addComponent(buttonToolBar);
|
207 |
d196eb4d
|
Patrick Plitzner
|
mainLayout.setExpandRatio(leftAndRightContainer, 0.9f);
|
208 |
|
|
mainLayout.setExpandRatio(buttonToolBar, 0.1f);
|
209 |
5eece89f
|
Patrick Plitzner
|
mainLayout.setComponentAlignment(buttonToolBar, Alignment.BOTTOM_RIGHT);
|
210 |
|
|
|
211 |
d196eb4d
|
Patrick Plitzner
|
return leftAndRightContainer;
|
212 |
5eece89f
|
Patrick Plitzner
|
}
|
213 |
|
|
|
214 |
fe7f0131
|
Patrick Plitzner
|
@Override
|
215 |
|
|
public void valueChange(ValueChangeEvent event) {
|
216 |
|
|
Property property = event.getProperty();
|
217 |
|
|
if(property==classificationBox){
|
218 |
787028b1
|
Patrick Plitzner
|
UuidAndTitleCache<TaxonNode> parent = getUuidAndTitleCacheFromRowId(classificationBox.getValue());
|
219 |
f9517a12
|
Patrick Plitzner
|
showClassificationTaxa(parent);
|
220 |
|
|
}
|
221 |
|
|
else if(property==taxonFilter){
|
222 |
|
|
String filterText = taxonFilter.getValue();
|
223 |
ad0d2649
|
Patrick Plitzner
|
Property uuidProperty = classificationBox.getContainerProperty(classificationBox.getValue(),"uuid");
|
224 |
|
|
if(uuidProperty==null){
|
225 |
|
|
Notification.show("Please select a classification");
|
226 |
f9517a12
|
Patrick Plitzner
|
}
|
227 |
|
|
else{
|
228 |
ad0d2649
|
Patrick Plitzner
|
if(CdmUtils.isNotBlank(filterText)){
|
229 |
|
|
UUID classificationUuid = UUID.fromString((String) uuidProperty.getValue());
|
230 |
|
|
List<UuidAndTitleCache<TaxonNode>> taxa = CdmSpringContextHelper.getTaxonNodeService().getUuidAndTitleCache(null, filterText, classificationUuid);
|
231 |
|
|
BeanItemContainer<UuidAndTitleCache<TaxonNode>> container = new BeanItemContainer<>(UuidAndTitleCache.class);
|
232 |
|
|
taxonTree.setContainerDataSource(container);
|
233 |
|
|
for (UuidAndTitleCache<TaxonNode> taxon : taxa) {
|
234 |
|
|
container.addItem(taxon);
|
235 |
|
|
taxonTree.setChildrenAllowed(taxon, false);
|
236 |
|
|
}
|
237 |
|
|
taxonTree.setVisibleColumns("titleCache");
|
238 |
|
|
}
|
239 |
|
|
else{
|
240 |
|
|
UuidAndTitleCache<TaxonNode> parent = getUuidAndTitleCacheFromRowId(classificationBox.getValue());
|
241 |
|
|
showClassificationTaxa(parent);
|
242 |
|
|
}
|
243 |
fe7f0131
|
Patrick Plitzner
|
}
|
244 |
|
|
}
|
245 |
|
|
else if(property==distAreaBox){
|
246 |
|
|
TermVocabulary<NamedArea> vocabulary = (TermVocabulary<NamedArea>) event.getProperty().getValue();
|
247 |
|
|
NamedAreaContainer container = new NamedAreaContainer(vocabulary);
|
248 |
|
|
namedAreaList.setContainerDataSource(container);
|
249 |
|
|
}
|
250 |
|
|
updateButtons();
|
251 |
|
|
}
|
252 |
|
|
|
253 |
|
|
@Override
|
254 |
|
|
protected boolean isValid() {
|
255 |
|
|
return classificationBox.getValue()!=null && distAreaBox.getValue()!=null;
|
256 |
|
|
}
|
257 |
|
|
|
258 |
|
|
@Override
|
259 |
|
|
public void buttonClick(ClickEvent event) {
|
260 |
|
|
Object source = event.getSource();
|
261 |
|
|
if(source==okButton){
|
262 |
787028b1
|
Patrick Plitzner
|
List<UUID> taxonNodes = new ArrayList<>();
|
263 |
fe7f0131
|
Patrick Plitzner
|
TermVocabulary<NamedArea> term = null;
|
264 |
787028b1
|
Patrick Plitzner
|
String uuidString = (String) classificationBox.getContainerProperty(classificationBox.getValue(),"uuid").getValue();
|
265 |
|
|
UUID classificationUuid = UUID.fromString(uuidString);
|
266 |
|
|
Set<UuidAndTitleCache<TaxonNode>> treeSelection = (Set<UuidAndTitleCache<TaxonNode>>) taxonTree.getValue();
|
267 |
|
|
if(!treeSelection.isEmpty()){
|
268 |
|
|
for (UuidAndTitleCache<TaxonNode> uuidAndTitleCache : treeSelection) {
|
269 |
|
|
taxonNodes.add(uuidAndTitleCache.getUuid());
|
270 |
|
|
}
|
271 |
fe7f0131
|
Patrick Plitzner
|
}
|
272 |
|
|
term = (TermVocabulary<NamedArea>) distAreaBox.getValue();
|
273 |
|
|
Set<NamedArea> selectedAreas = (Set<NamedArea>) namedAreaList.getValue();
|
274 |
787028b1
|
Patrick Plitzner
|
DistributionEditorUtil.openDistributionView(taxonNodes, term, selectedAreas, classificationUuid);
|
275 |
fe7f0131
|
Patrick Plitzner
|
window.close();
|
276 |
|
|
}
|
277 |
|
|
else if(source==cancelButton){
|
278 |
|
|
window.close();
|
279 |
|
|
}
|
280 |
|
|
}
|
281 |
|
|
|
282 |
|
|
@Override
|
283 |
|
|
public void nodeExpand(ExpandEvent event) {
|
284 |
|
|
UuidAndTitleCache<TaxonNode> parent = (UuidAndTitleCache<TaxonNode>) event.getItemId();
|
285 |
4a72ff97
|
Patrick Plitzner
|
((TaxonNodeContainer) taxonTree.getContainerDataSource()).addChildItems(parent);
|
286 |
fe7f0131
|
Patrick Plitzner
|
}
|
287 |
5eece89f
|
Patrick Plitzner
|
|
288 |
f9517a12
|
Patrick Plitzner
|
private void showClassificationTaxa(UuidAndTitleCache<TaxonNode> parent) {
|
289 |
ad0d2649
|
Patrick Plitzner
|
final Collection<UuidAndTitleCache<TaxonNode>> children = CdmSpringContextHelper.getTaxonNodeService().listChildNodesAsUuidAndTitleCache(parent);
|
290 |
|
|
// Enable polling and set frequency to 0.5 seconds
|
291 |
|
|
UI.getCurrent().setPollInterval(500);
|
292 |
|
|
taxonTree.setEnabled(false);
|
293 |
4b321494
|
Patrick Plitzner
|
taxonTree.removeAllItems();
|
294 |
ad0d2649
|
Patrick Plitzner
|
Notification.show("Loading taxa...");
|
295 |
|
|
|
296 |
|
|
new TreeUpdater(children).start();
|
297 |
f9517a12
|
Patrick Plitzner
|
}
|
298 |
|
|
|
299 |
|
|
private UuidAndTitleCache<TaxonNode> getUuidAndTitleCacheFromRowId(Object classificationSelection) {
|
300 |
|
|
String uuidString = (String) classificationBox.getContainerProperty(classificationSelection, "uuid").getValue();
|
301 |
4b321494
|
Patrick Plitzner
|
int id = (int) classificationBox.getContainerProperty(classificationSelection, "rootNode_id").getValue();
|
302 |
f9517a12
|
Patrick Plitzner
|
String titleCache = (String) classificationBox.getContainerProperty(classificationSelection, "titleCache").getValue();
|
303 |
|
|
UUID uuid = UUID.fromString(uuidString);
|
304 |
|
|
UuidAndTitleCache<TaxonNode> parent = new UuidAndTitleCache<>(uuid, id, titleCache);
|
305 |
|
|
return parent;
|
306 |
|
|
}
|
307 |
4b321494
|
Patrick Plitzner
|
|
308 |
ad0d2649
|
Patrick Plitzner
|
private class TreeUpdater extends Thread{
|
309 |
4b321494
|
Patrick Plitzner
|
|
310 |
ad0d2649
|
Patrick Plitzner
|
private Collection<UuidAndTitleCache<TaxonNode>> children;
|
311 |
|
|
|
312 |
4b321494
|
Patrick Plitzner
|
|
313 |
ad0d2649
|
Patrick Plitzner
|
public TreeUpdater(Collection<UuidAndTitleCache<TaxonNode>> children) {
|
314 |
|
|
this.children = children;
|
315 |
|
|
}
|
316 |
|
|
|
317 |
|
|
@Override
|
318 |
|
|
public void run() {
|
319 |
|
|
UI.getCurrent().access(new Runnable() {
|
320 |
|
|
@Override
|
321 |
|
|
public void run() {
|
322 |
|
|
taxonTree.setContainerDataSource(new TaxonNodeContainer(children));
|
323 |
|
|
|
324 |
|
|
Notification notification = new Notification("Loading complete");
|
325 |
|
|
notification.setDelayMsec(500);
|
326 |
|
|
notification.show(Page.getCurrent());
|
327 |
|
|
taxonTree.setEnabled(true);
|
328 |
|
|
|
329 |
|
|
//disable polling when all taxa are loaded
|
330 |
|
|
UI.getCurrent().setPollInterval(-1);
|
331 |
|
|
}
|
332 |
|
|
});
|
333 |
|
|
}
|
334 |
|
|
}
|
335 |
5eece89f
|
Patrick Plitzner
|
}
|