public void log(String msg) { if (_desktop != null) _desktop.getWebApp().log(msg); else _zklog.info(msg); }
private static final UiEngine getUiEngine(Desktop desktop) { if (desktop == null) throw new IllegalArgumentException("desktop cannot be null"); return ((WebAppCtrl) desktop.getWebApp()).getUiEngine(); }
public void log(String msg, Throwable ex) { if (_desktop != null) _desktop.getWebApp().log(msg, ex); else _zklog.error(msg, ex); }
/** 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(); }
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; }
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); }
/** 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; }
public void call(Component host) { host.getDesktop().getWebApp().getConfiguration().afterShadowDetached(se, host); } });
private String getRealUpload() { Desktop desktop = getDesktop(); String upload = getUpload(); if (desktop != null && !Strings.isEmpty(upload) && !upload.contains("maxsize=")) upload = upload.concat(",maxsize=" + desktop.getWebApp().getConfiguration().getMaxUploadSize()); return upload; }
/** Returns the JavaScript codes to disable (a.k.a., stop) the server push. * It is called by {@link #stopClientPush} to prepare the script * of {@link AuScript} that will be sent to the client. */ protected String getStopScript() { final String stop = _desktop.getWebApp().getConfiguration().getPreference("PollingServerPush.stop", null); return stop != null ? stop : "zk.cpsp.stop('" + _desktop.getId() + "');"; }
public void init(Page owner, String zslang) { super.init(owner, zslang); if (System.getProperty("python.home") == null) System.setProperty("python.home", System.getProperty("java.io.tmpdir")); PySystemState.initialize(); PySystemState.add_extdir(owner.getDesktop().getWebApp().getRealPath("/WEB-INF/lib"), true); PySystemState.add_classdir(owner.getDesktop().getWebApp().getRealPath("/WEB-INF/classes")); _ip = new PythonInterpreter(new Variables()); }
public PageDefinition getPageDefinitionDirectly(String content, String ext) { //Note: we have to go thru UiFactory (so user can override it) return ((WebAppCtrl) getDesktop().getWebApp()).getUiFactory().getPageDefinitionDirectly(newRequestInfo(null), content, ext); }
public PageDefinition getPageDefinitionDirectly(Reader reader, String ext) throws IOException { //Note: we have to go thru UiFactory (so user can override it) return ((WebAppCtrl) getDesktop().getWebApp()).getUiFactory().getPageDefinitionDirectly(newRequestInfo(null), reader, ext); }
public HibernateSessionContextListener() { final WebApp app = Executions.getCurrent().getDesktop().getWebApp(); _enabled = app.getConfiguration().isEventThreadEnabled(); }
protected String getSpecialRendererOutput(Component comp) throws IOException { if (_page != null) { final JsContentRenderer renderer = new JsContentRenderer(); PropertiesRenderer[] prs = _page.getDesktop().getWebApp().getConfiguration().getPropertiesRenderers(); for (int j = 0; j < prs.length; j++) prs[j].renderProperties(comp, renderer); return renderer.getBuffer().toString(); } return ""; }
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); }
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(); }
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); }