Revision fe785c1e
Added by Andreas Kohlbecker almost 7 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/view/reference/ReferenceEditorPresenter.java | ||
---|---|---|
13 | 13 |
|
14 | 14 |
import org.apache.log4j.Logger; |
15 | 15 |
import org.springframework.context.event.EventListener; |
16 |
import org.springframework.transaction.TransactionStatus; |
|
17 | 16 |
import org.vaadin.viritin.fields.CaptionGenerator; |
18 | 17 |
import org.vaadin.viritin.fields.LazyComboBox.FilterableCountProvider; |
19 | 18 |
import org.vaadin.viritin.fields.LazyComboBox.FilterablePagingProvider; |
... | ... | |
44 | 43 |
ReferencePopupEditor inReferencePopup = null; |
45 | 44 |
|
46 | 45 |
public ReferenceEditorPresenter() { |
47 |
logger.trace("CONTRUCTOR"); |
|
46 |
|
|
48 | 47 |
} |
49 | 48 |
|
50 | 49 |
/** |
... | ... | |
96 | 95 |
, 20); |
97 | 96 |
} |
98 | 97 |
|
98 |
/** |
|
99 |
* {@inheritDoc} |
|
100 |
*/ |
|
101 |
@Override |
|
102 |
protected Reference loadBeanById(Object identifier) { |
|
103 |
Reference reference; |
|
104 |
if(identifier != null){ |
|
105 |
reference = getRepo().getReferenceService().find((Integer)identifier); |
|
106 |
} else { |
|
107 |
reference = ReferenceFactory.newGeneric(); |
|
108 |
} |
|
109 |
return reference; |
|
110 |
} |
|
111 |
|
|
99 | 112 |
/** |
100 | 113 |
* |
101 | 114 |
* @param editorAction |
... | ... | |
108 | 121 |
} |
109 | 122 |
if(ToOneRelatedEntityField.class.isAssignableFrom(editorAction.getSourceComponent().getClass())){ |
110 | 123 |
if(editorAction.isAddAction()){ |
111 |
Reference reference = ReferenceFactory.newGeneric(); |
|
112 | 124 |
inReferencePopup = getNavigationManager().showInPopup(ReferencePopupEditor.class); |
113 |
inReferencePopup.showInEditor(reference);
|
|
125 |
inReferencePopup.loadInEditor(null);
|
|
114 | 126 |
} |
115 | 127 |
if(editorAction.isEditAction()){ |
116 |
TransactionStatus tx = getRepo().startTransaction(false); |
|
117 |
Reference reference = getRepo().getReferenceService().find(editorAction.getEntityId()); |
|
118 | 128 |
ReferencePopupEditor popup = getNavigationManager().showInPopup(ReferencePopupEditor.class); |
119 | 129 |
popup.withDeleteButton(true); |
120 |
popup.showInEditor(reference); |
|
121 |
getRepo().commitTransaction(tx); |
|
130 |
popup.loadInEditor(editorAction.getEntityId()); |
|
122 | 131 |
} |
123 | 132 |
} |
124 | 133 |
} |
Also available in: Unified diff
fix #6687 per view implementation of the 'session-per-conversation' pattern