Search in sources :

Example 1 with IEventDispatcher

use of org.sablo.eventthread.IEventDispatcher in project servoy-client by Servoy.

the class NGRuntimeWindow method hideUI.

@Override
public void hideUI() {
    visible = false;
    getApplication().getWebsocketSession().getClientService(NGRuntimeWindowManager.WINDOW_SERVICE).executeAsyncServiceCall("hide", new Object[] { getName() });
    // assume that just after hiding the window, currentController in js is the main window controller
    JSWindow parent = getParent();
    IFormController formController = null;
    if (parent != null) {
        formController = parent.getImpl().getController();
        getApplication().getRuntimeWindowManager().setCurrentWindowName(parent.getImpl().getName());
    } else if (getApplication().getRuntimeWindowManager().getMainApplicationWindow() != null) {
        if (getApplication().getRuntimeWindowManager().getMainApplicationWindow() != null)
            formController = getApplication().getRuntimeWindowManager().getMainApplicationWindow().getController();
    }
    if (formController instanceof IWebFormController)
        getApplication().getFormManager().setCurrentControllerJS((IWebFormController) formController);
    // resume
    if (windowType == JSWindow.MODAL_DIALOG && getApplication().getWebsocketSession().getEventDispatcher() != null) {
        final IEventDispatcher eventDispatcher = getApplication().getWebsocketSession().getEventDispatcher();
        if (eventDispatcher.isEventDispatchThread()) {
            eventDispatcher.resume(this);
        } else {
            eventDispatcher.addEvent(new Runnable() {

                @Override
                public void run() {
                    eventDispatcher.resume(NGRuntimeWindow.this);
                }
            });
        }
    }
}
Also used : IEventDispatcher(org.sablo.eventthread.IEventDispatcher) JSWindow(com.servoy.j2db.scripting.JSWindow) IFormController(com.servoy.j2db.IFormController)

Aggregations

IFormController (com.servoy.j2db.IFormController)1 JSWindow (com.servoy.j2db.scripting.JSWindow)1 IEventDispatcher (org.sablo.eventthread.IEventDispatcher)1