1
|
package eu.etaxonomy.cdm.vaadin.util;
|
2
|
|
3
|
import java.util.Set;
|
4
|
|
5
|
import com.vaadin.server.VaadinSession;
|
6
|
import com.vaadin.ui.Notification;
|
7
|
import com.vaadin.ui.UI;
|
8
|
|
9
|
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
|
10
|
import eu.etaxonomy.cdm.model.common.TermVocabulary;
|
11
|
import eu.etaxonomy.cdm.model.location.NamedArea;
|
12
|
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
|
13
|
|
14
|
public class DistributionEditorUtil {
|
15
|
|
16
|
public static void openDistributionView(TaxonNode taxonNode, TermVocabulary<DefinedTermBase> term, Set<NamedArea> selectedAreas) {
|
17
|
if(taxonNode==null){
|
18
|
Notification.show("Please choose a classification and/or taxon", Notification.Type.HUMANIZED_MESSAGE);
|
19
|
return;
|
20
|
}
|
21
|
if(term==null){
|
22
|
Notification.show("Please choose a distribution area", Notification.Type.HUMANIZED_MESSAGE);
|
23
|
return;
|
24
|
}
|
25
|
VaadinSession.getCurrent().setAttribute("taxonNodeUUID", taxonNode.getUuid());
|
26
|
VaadinSession.getCurrent().setAttribute("selectedTerm", term.getUuid());
|
27
|
String selectedAreaUuids = "";
|
28
|
for (NamedArea namedArea : selectedAreas) {
|
29
|
selectedAreaUuids += namedArea.getUuid().toString()+",";
|
30
|
}
|
31
|
VaadinSession.getCurrent().setAttribute("selectedAreas", selectedAreaUuids);
|
32
|
|
33
|
//navigate to table view
|
34
|
UI.getCurrent().getNavigator().navigateTo("table");
|
35
|
}
|
36
|
|
37
|
}
|