Mate How to inject UI component
-
14-11-2019 - |
题
In the Mate framework for flex. I'm trying to inject a UIComponent into a non UIComponent.
The reason is the UI component is a library component and it has methods that need to be invoked on it. I'm not able to remove the requirement to invoke the methods.
I've got something like this currently
<ObjectBuilder cache="global" generator="{DashboardController}" registerTarget="true"/>
<EventHandlers type="{DashboardEvent.DASHBOARD_CREATION_COMPLETE}">
<PropertySetter generator="{DashboardController}"
targetKey="dashboard"
source="{lastReturn}"
sourceKey="target" />
</EventHandlers>
And I'm receiving an error like this.
--------------------------------------------------------- MATE Error: Property type mismatch, turn on the debugger for more information EventType:test.example.events.creationComplete. Error was found in a EventHandlers list in file DashboardEventMap ---------------------------------------------------------
I've also tried using an object builder to set the property.
解决方案
I suppose the problem is your lastReturn
type isn't compatible with DashboardController.dashboard
field. Please recheck it.
其他提示
Got it working. lastReturn was sometimes returning null even though it was in an eventHandling block.
I didn't realise that the event object was in scope here.
<EventHandlers type="{DashboardEvent.DASHBOARD_CREATION_COMPLETE}" debug="true">
<PropertySetter generator="{DashboardController}"
targetKey="dashboard"
source="{event.target}" />
</EventHandlers>
不隶属于 StackOverflow