/** Ensure the use of component is correct. */ private void checkDesktop(Component comp) { final Desktop dt = comp.getDesktop(); if (dt != null && dt != _exec.getDesktop()) throw new IllegalStateException( "Access denied: component, " + comp + ", belongs to another desktop: " + dt); }
public void init(Execution exec, Execution parent) throws Exception { Desktop desktop = exec.getDesktop(); desktop.removeListener(_deferredActivator); BinderImpl.this.didActivate(); } }
/** Constructor. * * @param exec the current execution, never null * @param locator the locator used to locate taglib and other resources. * If null, {@link #getWebApp} is used. */ public RequestInfoImpl(Execution exec, Locator locator) { this(exec.getDesktop(), exec.getNativeRequest(), locator); }
public void close() { _closed = true; final Execution exec = Executions.getCurrent(); if (exec != null) close(exec.getDesktop()); //queues of other desktops will be closed in EQService }
private static WebApp getWebApp() { WebApp app = null; final Execution exec = Executions.getCurrent(); if (exec != null) { final Desktop desktop = exec.getDesktop(); if (desktop != null) { app = desktop.getWebApp(); } } return app; }
public Init() { Execution exec = Executions.getCurrent(); exec.getDesktop().addListener(this); }
private static Desktop getDesktop(Component comp) { final Desktop dt = comp.getDesktop(); if (dt != null) return dt; final Execution exec = Executions.getCurrent(); return exec != null ? exec.getDesktop() : null; }
public ExecutionCarryOver(Desktop desktop) { _exec = Executions.getCurrent(); if (_exec == null || _exec.getDesktop() != desktop) throw new IllegalStateException("Wrong execution: " + _exec); _locale = Locales.getCurrent(); _timeZone = TimeZones.getCurrent(); }
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(); } }
public void preInit() { if (_desktop != null) throw new IllegalStateException("init twice"); final Execution exec = Executions.getCurrent(); _desktop = exec.getDesktop(); if (_desktop == null) throw new IllegalArgumentException("null desktop"); _desktop.getWebApp().getConfiguration().init(this); }
public void notifyAll(Object mutex) { final Execution exec = Executions.getCurrent(); if (exec == null) throw new UiException("resume can be called only in processing a request"); notifyAll(exec.getDesktop(), mutex); }
/** 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; }
/** Checks whether it is OK to detach the specified page. * @param page the page to detach (never null). */ private static void checkDetach(Page page) { final Execution exec = Executions.getCurrent(); if (exec == null) throw new UiException("You cannot access a desktop other than an event listener"); if (page.getDesktop() != exec.getDesktop()) throw new UiException("You cannot access components belong to other desktop"); }
public void execRecover(Execution exec, FailoverManager failover) { final Desktop desktop = exec.getDesktop(); final Session sess = desktop.getSession(); doActivate(exec, false, true, null, -1); //it must not return null try { failover.recover(sess, exec, desktop); } finally { doDeactivate(exec); } }
public HibernateSessionContextListener() { final WebApp app = Executions.getCurrent().getDesktop().getWebApp(); _enabled = app.getConfiguration().isEventThreadEnabled(); }
public SpringTransactionSynchronizationListener() { final WebApp app = Executions.getCurrent().getDesktop().getWebApp(); _enabled = app.getConfiguration().isEventThreadEnabled(); }
public void beginUpdate(Execution exec) { final UiVisualizer uv = doActivate(exec, true, false, null, -1); final Desktop desktop = exec.getDesktop(); desktop.getWebApp().getConfiguration().invokeExecutionInits(exec, null); ((DesktopCtrl) desktop).invokeExecutionInits(exec, null); }
public Object startUpdate(Execution exec) throws IOException { final Desktop desktop = exec.getDesktop(); UiVisualizer uv = doActivate(exec, true, false, null, -1); desktop.getWebApp().getConfiguration().invokeExecutionInits(exec, null); ((DesktopCtrl) desktop).invokeExecutionInits(exec, null); return new UpdateInfo(uv); }
private boolean isEventThreadEnabled(boolean attachedRequired) { Desktop desktop = getDesktop(); if (desktop == null) { if (attachedRequired) throw new SuspendNotAllowedException("Not attached, " + this); final Execution exec = Executions.getCurrent(); if (exec == null || (desktop = exec.getDesktop()) == null) return true; //assume enabled (safer) } return desktop.getWebApp().getConfiguration().isEventThreadEnabled(); }
/** 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 }