/** * Finds a component with the current address using the given RequestCycle. * * @param cycle * the RequestCycle to use to locate the component * @return IComponent a component that has been initialized for the given RequestCycle */ public IComponent findComponent(IRequestCycle cycle) { IPage objPage = cycle.getPage(_pageName); return objPage.getNestedComponent(_idPath); }
/** * Finds a component with the current address using the given RequestCycle. * * @param cycle * the RequestCycle to use to locate the component * @return IComponent a component that has been initialized for the given RequestCycle */ public IComponent findComponent(IRequestCycle cycle) { IPage objPage = cycle.getPage(_pageName); return objPage.getNestedComponent(_idPath); }
/** * Returns true if the active page name matches the page for this property. This means that * <em>after a new page has been activated</em>, the state is discarded. */ public boolean shouldEncodeState(ServiceEncoding encoding, String pageName, PersistentPropertyData data) { IPage page = _requestCycle.getPage(); // TAPESTRY-701: if you try to generate a link using, say, page or external service, // from inside PageValidateListener.pageValidate(), then there may not be an active // page yet. Seems like the right thing to do is hold onto any properties until // we know what the active page is. I know this one is going to cause a fight // since its not clear whether keeping or discarding is the right way to go. if (page == null) return true; return pageName.equals(page.getPageName()); }
/** * Returns true if the active page name matches the page for this property. This means that * <em>after a new page has been activated</em>, the state is discarded. */ public boolean shouldEncodeState(ServiceEncoding encoding, String pageName, PersistentPropertyData data) { IPage page = _requestCycle.getPage(); // TAPESTRY-701: if you try to generate a link using, say, page or external service, // from inside PageValidateListener.pageValidate(), then there may not be an active // page yet. Seems like the right thing to do is hold onto any properties until // we know what the active page is. I know this one is going to cause a fight // since its not clear whether keeping or discarding is the right way to go. if (page == null) return true; return pageName.equals(page.getPageName()); }
public ILink getLink(boolean post, Object parameter) { if (parameter != null) throw new IllegalArgumentException(EngineMessages .serviceNoParameter(this)); Map parameters = new HashMap(); parameters.put(ServiceConstants.PAGE, _requestCycle.getPage() .getPageName()); return _linkFactory.constructLink(this, post, parameters, true); }
public ILink getLink(boolean post, Object parameter) { if (parameter != null) throw new IllegalArgumentException(EngineMessages .serviceNoParameter(this)); Map parameters = new HashMap(); parameters.put(ServiceConstants.PAGE, _requestCycle.getPage() .getPageName()); return _linkFactory.constructLink(this, post, parameters, true); }
/** * Invoked, typically, when an exception occurs while servicing the request. This method resets * the output, sets the new page and renders it. */ protected void redirect(String pageName, IRequestCycle cycle, ApplicationRuntimeException exception) throws IOException { IPage page = cycle.getPage(pageName); cycle.activate(page); renderResponse(cycle); }
public void presentStaleSessionException(IRequestCycle cycle, StaleSessionException cause) throws IOException { IPage exceptionPage = cycle.getPage(_pageName); cycle.activate(exceptionPage); _responseRenderer.renderResponse(cycle); }
/** * Invoked, typically, when an exception occurs while servicing the request. This method resets * the output, sets the new page and renders it. */ protected void redirect(String pageName, IRequestCycle cycle, ApplicationRuntimeException exception) throws IOException { IPage page = cycle.getPage(pageName); cycle.activate(page); renderResponse(cycle); }
public void presentStaleSessionException(IRequestCycle cycle, StaleSessionException cause) throws IOException { IPage exceptionPage = cycle.getPage(_pageName); cycle.activate(exceptionPage); _responseRenderer.renderResponse(cycle); }
/** * Returns the {@link IPage} currently inspected by the Inspector, as determined * from the inspectedPageName property. * **/ public IPage getInspectedPage() { return getRequestCycle().getPage(getInspectedPageName()); }
public void render(IMarkupWriter writer, IRequestCycle cycle) { IPage page = cycle.getPage(); StringBuffer sb = new StringBuffer(); sb.append("/"); if (page.getNamespace().getId() == null) { String name = page.getPageName(); int slashx = name.lastIndexOf('/'); // Include the directory and trailing slash. if (slashx > 0) sb.append(name.substring(0, slashx + 1)); } String url = cycle.getAbsoluteURL(sb.toString()); writer.beginEmpty("base"); writer.attribute("href", url); writer.printRaw("<!--[if IE]></base><![endif]-->"); writer.println(); }
public void presentStaleLinkException(IRequestCycle cycle, StaleLinkException cause) throws IOException { IPage exceptionPage = cycle.getPage(_pageName); PropertyUtils.write(exceptionPage, "message", cause.getMessage()); cycle.activate(exceptionPage); _responseRenderer.renderResponse(cycle); }
public void presentStaleLinkException(IRequestCycle cycle, StaleLinkException cause) throws IOException { IPage exceptionPage = cycle.getPage(_pageName); PropertyUtils.write(exceptionPage, "message", cause.getMessage()); cycle.activate(exceptionPage); _responseRenderer.renderResponse(cycle); }
/** * Gets the listener for the link component. * * @since 1.0.5 */ public void trigger(IRequestCycle cycle) { String name = getNamespace().constructQualifiedName("Inspector"); Inspector inspector = (Inspector) cycle.getPage(name); inspector.inspect(getPage().getPageName(), cycle); }
/** * Invokes {@link IRequestCycle#activate(org.apache.tapestry.IPage)} to select the previously identified * <tt>IExternalPage</tt> as the response page and activates the page by invoking * <tt>activateExternalPage()</tt> with the callback parameters and request cycle. */ public void performCallback(IRequestCycle cycle) { Defense.notNull(cycle, "cycle"); try { IExternalPage page = (IExternalPage) cycle.getPage(_pageName); cycle.activate(page); page.activateExternalPage(_parameters, cycle); } catch (ClassCastException ex) { throw new ApplicationRuntimeException(CallbackMessages.pageNotExternal(_pageName), ex); } }
/** * Invokes {@link IRequestCycle#activate(org.apache.tapestry.IPage)} to select the previously identified * <tt>IExternalPage</tt> as the response page and activates the page by invoking * <tt>activateExternalPage()</tt> with the callback parameters and request cycle. */ public void performCallback(IRequestCycle cycle) { Defense.notNull(cycle, "cycle"); try { IExternalPage page = (IExternalPage) cycle.getPage(_pageName); cycle.activate(page); page.activateExternalPage(_parameters, cycle); } catch (ClassCastException ex) { throw new ApplicationRuntimeException(CallbackMessages.pageNotExternal(_pageName), ex); } }
/** * {@inheritDoc} */ public void render(IMarkupWriter writer, IRequestCycle cycle) { IPage page = cycle.getPage(); processPath(writer, cycle, _javascriptManager.getPath()); _javascriptManager.renderLibraryResources(writer, cycle, page.hasFormComponents(), page.hasWidgets()); processTapestryPath(writer, cycle, _javascriptManager.getTapestryPath()); _javascriptManager.renderLibraryAdaptor(writer, cycle); }
public void service(IRequestCycle cycle) throws IOException { String pageName = cycle.getParameter(ServiceConstants.PAGE); IPage rawPage = cycle.getPage(pageName); IExternalPage page = null; try { page = (IExternalPage) rawPage; } catch (ClassCastException ex) { throw new ApplicationRuntimeException(EngineMessages.pageNotCompatible(rawPage,IExternalPage.class), rawPage, null, ex); } Object[] parameters = _linkFactory.extractListenerParameters(cycle); cycle.setListenerParameters(parameters); cycle.activate(page); page.activateExternalPage(parameters, cycle); _responseRenderer.renderResponse(cycle); }
public void service(IRequestCycle cycle) throws IOException { String pageName = cycle.getParameter(ServiceConstants.PAGE); IPage rawPage = cycle.getPage(pageName); IExternalPage page = null; try { page = (IExternalPage) rawPage; } catch (ClassCastException ex) { throw new ApplicationRuntimeException(EngineMessages.pageNotCompatible(rawPage,IExternalPage.class), rawPage, null, ex); } Object[] parameters = _linkFactory.extractListenerParameters(cycle); cycle.setListenerParameters(parameters); cycle.activate(page); page.activateExternalPage(parameters, cycle); _responseRenderer.renderResponse(cycle); }