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.TermVocabulary;
|
10
|
import eu.etaxonomy.cdm.model.location.NamedArea;
|
11
|
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
|
12
|
|
13
|
public class DistributionEditorUtil {
|
14
|
|
15
|
public static final String SEPARATOR = ";;";
|
16
|
|
17
|
public static void openDistributionView(TaxonNode taxonNode, TermVocabulary<NamedArea> term, Set<NamedArea> selectedAreas) {
|
18
|
if(taxonNode==null){
|
19
|
Notification.show("Please choose a classification and/or taxon", Notification.Type.HUMANIZED_MESSAGE);
|
20
|
return;
|
21
|
}
|
22
|
if(term==null){
|
23
|
Notification.show("Please choose a distribution area", Notification.Type.HUMANIZED_MESSAGE);
|
24
|
return;
|
25
|
}
|
26
|
VaadinSession.getCurrent().setAttribute("taxonNodeUUID", taxonNode.getUuid());
|
27
|
VaadinSession.getCurrent().setAttribute("selectedTerm", term.getUuid());
|
28
|
// String selectedAreaUuids = "";
|
29
|
// for (NamedArea namedArea : selectedAreas) {
|
30
|
// selectedAreaUuids += namedArea.getTitleCache()+SEPARATOR;
|
31
|
// }
|
32
|
// selectedAreaUuids = StringUtils.stripEnd(selectedAreaUuids, SEPARATOR);
|
33
|
VaadinSession.getCurrent().setAttribute("selectedAreas", selectedAreas);
|
34
|
|
35
|
//navigate to table view
|
36
|
UI.getCurrent().getNavigator().navigateTo("table");
|
37
|
}
|
38
|
|
39
|
}
|