Revision 558d5bd1
Added by Patrick Plitzner over 7 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/presenter/dbstatus/DistributionTablePresenter.java | ||
---|---|---|
35 | 35 |
import eu.etaxonomy.cdm.vaadin.container.CdmSQLContainer; |
36 | 36 |
import eu.etaxonomy.cdm.vaadin.util.CdmQueryFactory; |
37 | 37 |
import eu.etaxonomy.cdm.vaadin.util.CdmSpringContextHelper; |
38 |
import eu.etaxonomy.cdm.vaadin.util.DistributionEditorUtil; |
|
38 | 39 |
import eu.etaxonomy.cdm.vaadin.view.dbstatus.DistributionTableView; |
39 | 40 |
|
40 | 41 |
|
... | ... | |
132 | 133 |
} |
133 | 134 |
|
134 | 135 |
public Set<NamedArea> getNamedAreas(){ |
135 |
Set<NamedArea> namedAreas = (Set<NamedArea>) VaadinSession.getCurrent().getAttribute("selectedAreas");
|
|
136 |
Set<NamedArea> namedAreas = (Set<NamedArea>) VaadinSession.getCurrent().getAttribute(DistributionEditorUtil.SATTR_SELECTED_AREAS);
|
|
136 | 137 |
if(namedAreas.isEmpty()){ |
137 | 138 |
return getTermSet(); |
138 | 139 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/presenter/dbstatus/settings/SettingsPresenter.java | ||
---|---|---|
25 | 25 |
import eu.etaxonomy.cdm.model.common.TermVocabulary; |
26 | 26 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
27 | 27 |
import eu.etaxonomy.cdm.vaadin.util.CdmSpringContextHelper; |
28 |
import eu.etaxonomy.cdm.vaadin.util.DistributionEditorUtil; |
|
28 | 29 |
|
29 | 30 |
/** |
30 | 31 |
* @author alex |
... | ... | |
50 | 51 |
|
51 | 52 |
private void init() { |
52 | 53 |
taxonNodeService = CdmSpringContextHelper.getTaxonNodeService(); |
53 |
taxonNodeUuid = UUID.fromString(VaadinSession.getCurrent().getAttribute("taxonNodeUUID").toString());
|
|
54 |
termUUID = UUID.fromString(VaadinSession.getCurrent().getAttribute("selectedTerm").toString());
|
|
54 |
taxonNodeUuid = UUID.fromString(VaadinSession.getCurrent().getAttribute(DistributionEditorUtil.SATTR_TAXON_NODE_UUID).toString());
|
|
55 |
termUUID = UUID.fromString(VaadinSession.getCurrent().getAttribute(DistributionEditorUtil.SATTR_SELECTED_VOCABULARY_UUID).toString());
|
|
55 | 56 |
distributionContainer = new IndexedContainer(getNamedAreaList()); |
56 | 57 |
distributionStatusContainer = new IndexedContainer(getPresenceAbsenceVocabulary()); |
57 | 58 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/servlet/CdmVaadinConversationalServlet.java | ||
---|---|---|
16 | 16 |
|
17 | 17 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
18 | 18 |
import eu.etaxonomy.cdm.vaadin.util.CdmSpringContextHelper; |
19 |
import eu.etaxonomy.cdm.vaadin.util.DistributionEditorUtil; |
|
19 | 20 |
|
20 | 21 |
|
21 | 22 |
public class CdmVaadinConversationalServlet extends VaadinServlet implements SessionInitListener, SessionDestroyListener { |
22 | 23 |
|
23 | 24 |
private static final Logger logger = Logger.getLogger(CdmVaadinConversationalServlet.class); |
24 | 25 |
|
25 |
/** |
|
26 |
* |
|
27 |
*/ |
|
28 | 26 |
private static final long serialVersionUID = -2973231251266766766L; |
29 | 27 |
|
30 | 28 |
private ConversationHolder conversation; |
... | ... | |
42 | 40 |
throws ServiceException { |
43 | 41 |
conversation = (ConversationHolder) CdmSpringContextHelper.getCurrent().getBean("conversationHolder"); |
44 | 42 |
conversation.bind(); |
45 |
VaadinSession.getCurrent().setAttribute("conversation", conversation);
|
|
43 |
VaadinSession.getCurrent().setAttribute(DistributionEditorUtil.SATTR_CONVERSATION, conversation);
|
|
46 | 44 |
} |
47 | 45 |
|
48 | 46 |
@Override |
src/main/java/eu/etaxonomy/cdm/vaadin/util/DistributionEditorUtil.java | ||
---|---|---|
12 | 12 |
|
13 | 13 |
public class DistributionEditorUtil { |
14 | 14 |
|
15 |
public static final String SEPARATOR = ";;"; |
|
15 |
public static final String VIEW_TABLE = "table"; |
|
16 |
|
|
17 |
public static final String SATTR_SELECTED_AREAS = "selectedAreas"; |
|
18 |
|
|
19 |
public static final String SATTR_SELECTED_VOCABULARY_UUID = "selectedVocabularyUuid"; |
|
20 |
|
|
21 |
public static final String SATTR_TAXON_NODE_UUID = "taxonNodeUUID"; |
|
16 | 22 |
|
17 |
public static final String SESSION_ABBREVIATED_LABELS = "abbreviatedLabels"; |
|
23 |
public static final String SATTR_ABBREVIATED_LABELS = "abbreviatedLabels"; |
|
24 |
|
|
25 |
public static final String SEPARATOR = ";;"; |
|
18 | 26 |
|
19 | 27 |
public static void openDistributionView(TaxonNode taxonNode, TermVocabulary<NamedArea> term, Set<NamedArea> selectedAreas) { |
20 | 28 |
if(taxonNode==null){ |
... | ... | |
25 | 33 |
Notification.show("Please choose a distribution area", Notification.Type.HUMANIZED_MESSAGE); |
26 | 34 |
return; |
27 | 35 |
} |
28 |
VaadinSession.getCurrent().setAttribute("taxonNodeUUID", taxonNode.getUuid());
|
|
29 |
VaadinSession.getCurrent().setAttribute("selectedTerm", term.getUuid());
|
|
30 |
VaadinSession.getCurrent().setAttribute("selectedAreas", selectedAreas);
|
|
36 |
VaadinSession.getCurrent().setAttribute(SATTR_TAXON_NODE_UUID, taxonNode.getUuid());
|
|
37 |
VaadinSession.getCurrent().setAttribute(SATTR_SELECTED_VOCABULARY_UUID, term.getUuid());
|
|
38 |
VaadinSession.getCurrent().setAttribute(SATTR_SELECTED_AREAS, selectedAreas);
|
|
31 | 39 |
|
32 | 40 |
//navigate to table view |
33 |
UI.getCurrent().getNavigator().navigateTo("table");
|
|
41 |
UI.getCurrent().getNavigator().navigateTo(VIEW_TABLE);
|
|
34 | 42 |
} |
35 | 43 |
|
44 |
public static final String SATTR_CONVERSATION = "conversation"; |
|
45 |
|
|
36 | 46 |
|
37 | 47 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/view/dbstatus/DistributionTableView.java | ||
---|---|---|
183 | 183 |
private static final long serialVersionUID = 1L; |
184 | 184 |
@Override |
185 | 185 |
public void buttonClick(ClickEvent event) { |
186 |
ConversationHolder conversationHolder = (ConversationHolder) VaadinSession.getCurrent().getAttribute("conversation");
|
|
186 |
ConversationHolder conversationHolder = (ConversationHolder) VaadinSession.getCurrent().getAttribute(DistributionEditorUtil.SATTR_CONVERSATION);
|
|
187 | 187 |
try{ |
188 | 188 |
conversationHolder.commit(); |
189 | 189 |
}catch(Exception stateException){ |
... | ... | |
217 | 217 |
String itemCaption = null; |
218 | 218 |
Representation representation = presenceAbsenceTerm.getRepresentation(Language.DEFAULT()); |
219 | 219 |
if(representation!=null){ |
220 |
if((Boolean)VaadinSession.getCurrent().getAttribute(DistributionEditorUtil.SESSION_ABBREVIATED_LABELS)){
|
|
220 |
if((Boolean)VaadinSession.getCurrent().getAttribute(DistributionEditorUtil.SATTR_ABBREVIATED_LABELS)){
|
|
221 | 221 |
itemCaption = representation.getAbbreviatedLabel(); |
222 | 222 |
} |
223 | 223 |
else{ |
Also available in: Unified diff
ref #5458 extract constants for session attributes