Revision 96783004
Added by Andreas Kohlbecker almost 7 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/view/reference/ReferenceEditorPresenter.java | ||
---|---|---|
15 | 15 |
import org.springframework.context.event.EventListener; |
16 | 16 |
import org.springframework.transaction.TransactionStatus; |
17 | 17 |
|
18 |
import com.vaadin.data.Item; |
|
19 | 18 |
import com.vaadin.data.util.BeanItemContainer; |
20 | 19 |
import com.vaadin.ui.ListSelect; |
21 | 20 |
|
... | ... | |
65 | 64 |
* |
66 | 65 |
* @param editorAction |
67 | 66 |
*/ |
68 |
@EventListener(condition = "#editorAction.source != null") |
|
67 |
@EventListener(condition = "#editorAction.sourceComponent != null")
|
|
69 | 68 |
public void onReferenceEditorAction(ReferenceEditorAction editorAction){ |
70 |
if(ToOneRelatedEntityField.class.isAssignableFrom(editorAction.getSource().getClass())){ |
|
69 |
if(!isFromOwnView(editorAction)){ |
|
70 |
return; |
|
71 |
} |
|
72 |
if(ToOneRelatedEntityField.class.isAssignableFrom(editorAction.getSourceComponent().getClass())){ |
|
71 | 73 |
if(editorAction.isAddAction()){ |
72 | 74 |
Reference reference = ReferenceFactory.newGeneric(); |
73 | 75 |
getView().getTypeSelect().getValue(); |
... | ... | |
91 | 93 |
if(event.getReason().equals(Reason.SAVE)){ |
92 | 94 |
Reference bean = inReferencePopup.getBean(); |
93 | 95 |
// TODO update items from db instead of just adding the new item |
94 |
Item selectItem = getView().getInReferenceSelect().getSelect().addItem(bean);
|
|
95 |
getView().getInReferenceSelect().getSelect().select(selectItem);
|
|
96 |
getView().getInReferenceSelect().getSelect().markAsDirty();
|
|
96 |
ListSelect localInReferenceSelectSelect = getView().getInReferenceSelect().getSelect();
|
|
97 |
localInReferenceSelectSelect.addItem(bean);
|
|
98 |
localInReferenceSelectSelect.select(bean);
|
|
97 | 99 |
} |
98 | 100 |
inReferencePopup = null; |
99 | 101 |
} |
Also available in: Unified diff
ref #6562 presenters can handle events from own view & solving listSelect update problem