Search in sources :

Example 1 with IPerformanceRegistry

use of com.servoy.j2db.server.shared.IPerformanceRegistry in project servoy-client by Servoy.

the class NGRuntimeWindow method doOldShow.

@Override
protected void doOldShow(String formName, boolean closeAll, boolean legacyV3Behavior) {
    String currentWindowName = getApplication().getRuntimeWindowManager().getCurrentWindowName();
    IWebFormController controller = getApplication().getFormManager().getForm(formName);
    if (controller != null) {
        getApplication().getFormManager().showFormInContainer(formName, this, getTitle(), true, windowName);
        this.formName = formName;
        controller.getFormUI().setParentWindowName(getName());
        // show panel as main
        switchForm(controller);
    }
    String titleArg = getTitle();
    if (titleArg == null && controller != null) {
        titleArg = controller.getForm().getTitleText();
    }
    if (titleArg == null) {
        titleArg = formName;
    }
    titleArg = getApplication().getI18NMessageIfPrefixed(titleArg);
    getApplication().getWebsocketSession().getClientService(NGRuntimeWindowManager.WINDOW_SERVICE).executeAsyncServiceCall("show", new Object[] { getName(), formName, titleArg });
    if (windowType == JSWindow.MODAL_DIALOG && getApplication().getWebsocketSession().getEventDispatcher() != null) {
        try {
            try {
                CurrentWindow.get().sendChanges();
            } catch (IOException e) {
                Debug.log(e);
            }
            IPerformanceRegistry perfRegistry = null;
            try {
                perfRegistry = (getApplication().getApplicationServerAccess() != null ? getApplication().getApplicationServerAccess().getFunctionPerfomanceRegistry() : null);
            } catch (RemoteException e) {
                Debug.error(e);
            }
            Pair<Integer, Integer> perfId = null;
            PerformanceData performanceData = null;
            String clientID = getApplication().getClientID();
            if (perfRegistry != null) {
                performanceData = perfRegistry.getPerformanceData(getApplication().getSolutionName());
                perfId = performanceData != null ? // $NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
                performanceData.startSubAction(// $NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
                "showDialog(" + windowName + "->" + formName + ")", // $NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
                System.currentTimeMillis(), IDataServer.METHOD_CALL_WAITING_FOR_USER_INPUT, clientID) : null;
            }
            try {
                getApplication().getWebsocketSession().getEventDispatcher().suspend(this, IEventDispatcher.EVENT_LEVEL_DEFAULT, IEventDispatcher.NO_TIMEOUT);
            } finally {
                if (perfId != null)
                    performanceData.endSubAction(perfId, clientID);
            }
            // this is now a hide of this window, set back the window name just before this show.
            getApplication().getRuntimeWindowManager().setCurrentWindowName(currentWindowName);
        } catch (CancellationException e) {
            // full browser refresh while waiting for modal to close?
            throw e;
        } catch (TimeoutException e) {
            Debug.error("Modal dialog suspend timed out. This should never happen");
        }
    }
}
Also used : CancellationException(java.util.concurrent.CancellationException) PerformanceData(com.servoy.j2db.server.shared.PerformanceData) IOException(java.io.IOException) IPerformanceRegistry(com.servoy.j2db.server.shared.IPerformanceRegistry) RemoteException(java.rmi.RemoteException) TimeoutException(java.util.concurrent.TimeoutException)

Aggregations

IPerformanceRegistry (com.servoy.j2db.server.shared.IPerformanceRegistry)1 PerformanceData (com.servoy.j2db.server.shared.PerformanceData)1 IOException (java.io.IOException)1 RemoteException (java.rmi.RemoteException)1 CancellationException (java.util.concurrent.CancellationException)1 TimeoutException (java.util.concurrent.TimeoutException)1