private static final UiEngine getUiEngine(Desktop desktop) { if (desktop == null) throw new IllegalArgumentException("desktop cannot be null"); return ((WebAppCtrl) desktop.getWebApp()).getUiEngine(); }
/** Returns the UI engine. */ private final UiEngine getUiEngine() { return ((WebAppCtrl) _desktop.getWebApp()).getUiEngine(); }
public Collection<EventProcessingThread> getSuspendedThreads() { return ((WebAppCtrl) _wapp).getUiEngine().getSuspendedThreads(this); }
private final UiEngine getUiEngine() { return ((WebAppCtrl) _desktop.getWebApp()).getUiEngine(); }
private void addResponse(AuResponse response) { ((WebAppCtrl) _wapp).getUiEngine().addResponse(response); }
public boolean ceaseSuspendedThread(EventProcessingThread evtthd, String cause) { return ((WebAppCtrl) _wapp).getUiEngine().ceaseSuspendedThread(this, evtthd, cause); }
/** Sets whether to use the event processing thread. * * <p>Default: false (disabled). * * @exception IllegalStateException if there is suspended thread * and use is false. */ public void enableEventThread(boolean enable) { if (!enable && _wapp != null) { final UiEngine engine = ((WebAppCtrl) _wapp).getUiEngine(); if (engine != null) { if (engine.hasSuspendedThread()) throw new IllegalStateException("Unable to disable due to suspended threads"); } } if (enable) log.warn("Enable event thread has deprecated!"); _evtThdEnabled = enable; }
/** Returns the UI engine based on {@link #_page}'s getDesktop(). * Don't call this method when _page is null. */ private UiEngine getAttachedUiEngine() { return ((WebAppCtrl) _page.getDesktop().getWebApp()).getUiEngine(); }
/** Safe to be called even if the Web application has been destroyed */ private void safeActivate(Execution exec) { final UiEngine uieng = ((WebAppCtrl) _wapp).getUiEngine(); if (uieng != null) { uieng.activate(exec); } else { _exec = exec; ExecutionsCtrl.setCurrent(exec); } }
/** Safe to be called even if the Web application has been destroyed */ private void safeDeactivate(Execution exec) { final UiEngine uieng = ((WebAppCtrl) _wapp).getUiEngine(); if (uieng != null) { uieng.deactivate(exec); } else { _exec = null; ExecutionsCtrl.setCurrent(null); } }
private static final UiEngine getUiEngine() { final Execution exec = getCurrent(); if (exec == null) throw new IllegalStateException("This method can be called only under an event listener"); return ((WebAppCtrl) exec.getDesktop().getWebApp()).getUiEngine(); } }
/** Returns the result in the JavaScript. * The caller shall send it back and evaluate it at the client (<code>eval(jscode);</code>). * <p>After calling this method, the caller shall not modify the component's state any more. */ public String getResult() { final Desktop desktop = _exec.getDesktop(); try { JSONArray result = ((WebAppCtrl) desktop.getWebApp()).getUiEngine().finishUpdate(_updctx); return new StringBuffer(512).append("zAu.doCmds('").append(desktop.getId()).append("',") .append(result.toString()).append(");").toString(); } catch (Exception ex) { //not possible throw UiException.Aide.wrap(ex); } }
/** Returns the UI engine of the current execution, or null * if no current execution. */ private UiEngine getCurrentUiEngine() { final Execution exec = Executions.getCurrent(); return exec != null ? ((WebAppCtrl) exec.getDesktop().getWebApp()).getUiEngine() : null; }
/** Constructor. * Don't invoke this directly. Rather, use {@link #start} instead. */ protected Bridge(ServletContext svlctx, HttpServletRequest request, HttpServletResponse response, Desktop desktop, Object locale) throws Exception { _exec = new ExecutionImpl(svlctx, request, response, desktop, null); _updctx = ((WebAppCtrl) desktop.getWebApp()).getUiEngine().startUpdate(_exec); _locale = locale; }
private static final void afterCC(CCInfo cci) { if (cci.created) { try { ((WebAppCtrl) cci.exec.getDesktop().getWebApp()).getUiEngine().deactivate(cci.exec); } catch (Throwable ex) { } } }
private static void afterCreate(Execution exec, Extension ext, Component[] comps) { if (ext == null) ext = ((UiEngineImpl) ((WebAppCtrl) exec.getDesktop().getWebApp()).getUiEngine()).getExtension(); ext.afterCreate(comps); }
private static final CCInfo beforeCC(WebApp wapp) { Execution exec = Executions.getCurrent(); if (exec != null) return new CCInfo(exec, false); ((WebAppCtrl) wapp).getUiEngine().activate(exec = CCExecution.newInstance(wapp)); return new CCInfo(exec, true); }
private static void saveResumable0(DownloadURL downloadURL) { ((WebAppCtrl)Executions.getCurrent().getDesktop().getWebApp()) .getUiEngine().addResponse(null, new AuDownload(downloadURL)); }
/** Open a download dialog to save the specified content at the client * with the suggested file name. * * @param media the media to download * @param flnm the suggested file name, e.g., myfile.pdf. * If null, {@link Media#getName} is assumed. */ public static void save(Media media, String flnm) { final Desktop desktop = Executions.getCurrent().getDesktop(); ((WebAppCtrl) desktop.getWebApp()).getUiEngine().addResponse(new AuDownload(new DownloadURL(media, flnm))); //Bug 2114380 }
/** Closes the execution such that other requests targeting * the same desktop can be processed. * It must be called. Otherwise, the whole desktop might not be able * to be accessed any more. */ public void close() { final HttpServletRequest request = (HttpServletRequest) _exec.getNativeRequest(); try { ((WebAppCtrl) _exec.getDesktop().getWebApp()).getUiEngine().closeUpdate(_updctx); _updctx = null; _exec = null; } catch (Exception ex) { //not possible throw UiException.Aide.wrap(ex); } finally { Charsets.cleanup(request, _locale); _locale = null; } } }