Trying to asychronously load UI component using Event Queues properly?

asked 2018-05-16 05:20:59 +0800

tonys03 gravatar image tonys03

updated 2018-05-16 05:30:27 +0800

I currently have a custom composer/controller class that extends GenericForwardComposer. Inside this class I have some methods that are being used to initialize components with data. This initialization process is a very long operation and takes time to complete. Due to performance issues I am trying to asynchronously load this data using Event Queues. This way it will not block users from accessing other functions while the process runs in the background.

In my custom class there is an init method that starts the processing. This method invokes several other methods that handle the majority of the processing.

My thinking was that I can use Event Queues something as such:

public class MyWidgetController extends GenericForwardComposer

    public void init(final Component comp)
        //other logic
     final EventQueue evtQ = EventQueues.lookup("eventQ", EventQueues.SESSION, true); 
        evtQ.subscribe(this); //not sure
        evtQ.publish(new Event("onInitPrimaryLoad", componentA, ""));
        evtQ.publish(new Event("onInitSecondaryLoad", componentB, ""));
    // other class logic
    @ViewEvent(componentID = "componentA", eventName = "onInitPrimaryLoad")
    public void onInitPrimary( final Event event)

    @ViewEvent(componentID = "componentB", eventName = "onInitSecondaryLoad")
    public void onInitSecondary( final Event event)

But wasn't sure as my class is not explicitly defining a onEvent() which is being inherited. Not sure if this is all correct. Don't really need a callback method as the Events (publish) themselves are loading the UI components with data. The application runs with no issue but I'm not sure if I'm implementing this correctly.

Any advice or corrections are appreciated :) Thanks

delete flag offensive retag edit
Be the first one to answer this question!
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2018-05-16 05:20:59 +0800

Seen: 0 times

Last updated: May 16