E4 DI: Accessing the MPart from an EventObjectSupplier [message #1713191] |
Mon, 02 November 2015 08:50 |
Alexander Bunkowski Messages: 29 Registered: February 2014 |
Junior Member |
|
|
Hey Community!
Inspired from the UIEventTopic/UIEventObjectSupplier I implemented my own Annotation/Supplier called VisibleUIEventTopic and VisibleUIEventObjectSupplier.
The event is only handled if the belonging part is visible.
The usage of the annotation looks like:
@Inject
@Optional
private void handleEvent(@VisibleUIEventTopic(value = Topic.MY_EVENT_TOPIC, partId = THIS_PARTS_ID) String analysisId) {
//code here
}
And the VisibleEventObjectSupplier makes a VisibleUIEventHandler for it that gets the part via "requestorMPart = partService.findPart(partId)" on construction and checks on every handleEvent() "partService.isPartVisible(requestorMPart)"
Works perfectly as long as I have each part only once.
PROBLEM:
If I put a part more than once in my Application Model it does not work correctly because the implementing part pojo class needs to have a hard static final declaration of the THIS_PARTS_ID which is equal for all part instances.
QUESTION:
How can I get the link from an IRequestor inside an EventObjectSupplier to the belonging MPart. I now that the Requestor always is an MPart.
[Updated on: Mon, 02 November 2015 08:53] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.02523 seconds