/** Returns the current page. * @since 5.0.10 */ protected Page getPage() { final Execution exec = Executions.getCurrent(); return exec != null ? ((ExecutionCtrl) exec).getCurrentPage() : null; }
private static final Event nextEvent(UiVisualizer uv) { final Event evt = ((ExecutionCtrl) uv.getExecution()).getNextEvent(); return evt != null && !uv.isAborting() ? evt : null; }
final Collection<AuResponse> responses = execCtrl.getResponses(); if (responses == null || responses.isEmpty()) return ""; execCtrl.setResponses(null);
final UiVisualizer olduv = oldexecCtrl != null ? (UiVisualizer) oldexecCtrl.getVisualizer() : null; final Page old = execCtrl.getCurrentPage(); final PageDefinition olddef = execCtrl.getCurrentPageDefinition(); execCtrl.setCurrentPage(page); execCtrl.setCurrentPageDefinition(pagedef); execCtrl.setResponses(responses); execCtrl.setCurrentPage(old); //restore it execCtrl.setCurrentPageDefinition(olddef); //restore it
page = ppg; else if (page == null) page = execCtrl.getCurrentPage(); if (!execCtrl.isActivated()) throw new IllegalStateException("Not activated yet"); final Page prevpg = execCtrl.getCurrentPage(); if (page != null && page != prevpg) execCtrl.setCurrentPage(page); final PageDefinition olddef = execCtrl.getCurrentPageDefinition(); execCtrl.setCurrentPageDefinition(pagedef); exec.pushArg(arg != null ? arg : Collections.EMPTY_MAP); exec.removeVariableResolver(resolver); exec.popArg(); execCtrl.setCurrentPage(prevpg); //restore it execCtrl.setCurrentPageDefinition(olddef); //restore it
public void setDefinition(String name) { final Execution exec = Executions.getCurrent(); if (exec != null) { final ExecutionCtrl execCtrl = (ExecutionCtrl) exec; final PageDefinition pgdef = execCtrl.getCurrentPageDefinition(); final Page page = execCtrl.getCurrentPage(); ComponentDefinition compdef = pgdef != null ? pgdef.getComponentDefinition(name, true) : page != null ? page.getComponentDefinition(name, true) : null; if (compdef == null) compdef = Impls.getDefinitionByDeviceType(this, exec.getDesktop().getDeviceType(), name); if (compdef != null) { setDefinition(compdef); return; } } else { for (String deviceType : LanguageDefinition.getDeviceTypes()) { final ComponentDefinition compdef = Impls.getDefinitionByDeviceType(this, deviceType, name); if (compdef != null) { setDefinition(compdef); return; } } } throw new ComponentNotFoundException(name + " not found"); }
final boolean fakepg = page == null; if (fakepg) { prevPage = execCtrl.getCurrentPage(); page = new VolatilePage(prevPage); ((PageCtrl) page).preInit(); execCtrl.setCurrentPage(page); } finally { if (fakepg) { execCtrl.setCurrentPage(prevPage); try { ((DesktopCtrl) exec.getDesktop()).removePage(page);
if (sid != null) { //Mobile client doesn't have ZK-SID response.setHeader("ZK-SID", sid); ((ExecutionCtrl)exec).setRequestId(sid);
private Object resolveVariable0(Object self, XelContext ctx, Object base, Object onm) { if (base != null) { Object o = ((ExecutionCtrl) _exec).getExtraXelVariable(ctx, base, onm); if (o != null) return o; final Page page = ((ExecutionCtrl) _exec).getCurrentPage(); return page != null ? page.getXelVariable(ctx, base, onm, true) : null; if (self instanceof Page) return ((Page) self).getAttributes(); final Page page = ((ExecutionCtrl) _exec).getCurrentPage(); return page != null ? page.getAttributes() : Collections.EMPTY_MAP; if (self instanceof Page) return self; return ((ExecutionCtrl) _exec).getCurrentPage(); o = ((ExecutionCtrl) _exec).getExtraXelVariable(name); if (o != null) return o; page = (Page) self; } else { page = ((ExecutionCtrl) _exec).getCurrentPage(); o = ((ExecutionCtrl) _exec).getExtraXelVariable(name); if (o != null) return o;
final Session sess = desktop.getSession(); final ExecutionMonitor execmon = desktop.getWebApp().getConfiguration().getExecutionMonitor(); final String seqId = resultOfRepeat != null ? ((ExecutionCtrl) exec).getRequestId() : null; final String oldSeqId = ((ExecutionCtrl) old.getExecution()).getRequestId(); if (oldSeqId != null && !oldSeqId.equals(seqId)) throw new RequestOutOfSequenceException(seqId, oldSeqId); ExecutionsCtrl.setCurrent(exec); try { execCtrl.onActivate(); } catch (Throwable ex) { //just in case ExecutionsCtrl.setCurrent(null);
execCtrl.setCurrentPage(request.getPage()); try { ((DesktopCtrl) desktop).service(request, !errs.isEmpty()); final String seqId = ((ExecutionCtrl) exec).getRequestId(); if (seqId != null) desktopCtrl.responseSent(seqId, out.complete());
private static UiVisualizer getCurrentVisualizer() { final ExecutionCtrl execCtrl = ExecutionsCtrl.getCurrentCtrl(); if (execCtrl == null) throw new IllegalStateException("Components can be accessed only in event listeners"); return (UiVisualizer) execCtrl.getVisualizer(); }
final Execution exec = Executions.getCurrent(); if (exec != null) { Object val = exec instanceof ExecutionCtrl ? ((ExecutionCtrl) exec).getExtraXelVariable(name) : null; if (val != null)
((ExecutionCtrl) execution).addOnDeactivate(new Callback<Object>() { public void call(Object data) { callbackEq.close();
/** Returns the component definition of the specified class, or null * if not found. */ /*package*/ static ComponentDefinition getDefinition(Execution exec, Class<? extends Component> cls) { if (exec != null) { final ExecutionCtrl execCtrl = (ExecutionCtrl) exec; final PageDefinition pgdef = execCtrl.getCurrentPageDefinition(); final Page page = execCtrl.getCurrentPage(); final ComponentDefinition compdef = pgdef != null ? pgdef.getComponentDefinition(cls, true) : page != null ? page.getComponentDefinition(cls, true) : null; if (compdef != null && compdef.getLanguageDefinition() != null) return compdef; //already from langdef (not from pgdef) final ComponentDefinition compdef2 = Components.getDefinitionByDeviceType(exec.getDesktop().getDeviceType(), cls); return compdef != null && (compdef2 == null || !Objects.equals(compdef.getImplementationClass(), compdef2.getImplementationClass())) ? compdef : compdef2; //Feature 2816083: use compdef2 if same class } for (String deviceType : LanguageDefinition.getDeviceTypes()) { final ComponentDefinition compdef = Components.getDefinitionByDeviceType(deviceType, cls); if (compdef != null) return compdef; } return null; }
if (!desktop.getWebApp().getConfiguration().isEventThreadEnabled()) { final ExecutionCtrl execCtrl = (ExecutionCtrl) exec; final Page page = execCtrl.getCurrentPage(); final EventProcessor proc = new EventProcessor(desktop, comp, event); proc.setup(); throw UiException.Aide.wrap(ex); } finally { execCtrl.setCurrentPage(page);
((ExecutionCtrl) exec).setRequestId(sid);
/** Resets the child page of the owner, if any. */ /*package*/ static void resetOwner() { final Execution exec = Executions.getCurrent(); if (exec != null) { final Component comp = ((ExecutionCtrl) exec).getVisualizer().getOwner(); if (comp instanceof Includer) ((Includer) comp).setChildPage(null); } }
final Execution exec = Executions.getCurrent(); if (exec != null && exec != curr) { Object val = exec instanceof ExecutionCtrl ? ((ExecutionCtrl) exec).getExtraXelVariable(name) : null; if (val != null)
/** Returns the current scope. * The current scope is the event target's scope if this thread * is processing an event ({@link org.zkoss.zk.ui.event.Event#getTarget}. * Otherwise, the scope of the page specified is assumed. * * <p>This method is used only to implement {@link org.zkoss.zk.scripting.Interpreter}. * You rarely need to access it other than implementing an interpreter. * * @param page the page. It is used if {@link #beforeInterpret} * is not called before. If null, the current page ({@link ExecutionCtrl#getCurrentPage} * is assumed. */ public static final Scope getCurrent(Page page) { final List<Scope> nss = _scopes.get(); final Scope scope = nss != null && !nss.isEmpty() ? nss.get(0) : null; if (scope != null) return scope; if (page == null) { final Execution exec = Executions.getCurrent(); if (exec != null) page = ((ExecutionCtrl) exec).getCurrentPage(); } return page; }